Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-30-2011, 10:25 PM   #1
Registered: Apr 2011
Location: Minneapolis
Distribution: CentOS 7
Posts: 80

Rep: Reputation: 0
CentOS 5.7: How can DHCP automatically update /etc/hosts?

The current ip address, as defined in /etc/hosts file, is no longer current with the DHCP clients table from the router. How can I tell Linux to update it? How can this be configured so that whenever DHCP renews the address, it will update /etc/hosts and any other file that has an address so affected?

Old 10-30-2011, 11:38 PM   #2
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
If you're using DHCP, your /etc/hosts should just contain:
Code:       localhost.localdomain   localhost
::1             localhost6.localdomain6 localhost6


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCP on CentOS 4.7 - /var/lib/dhcp/dhcpd.leases: Permission denied Latitude Linux - Networking 1 06-05-2009 02:08 AM
script to update /etc/hosts on dhcp obtained ip change. juanctes Linux - General 1 02-02-2008 09:17 AM
Camserv disconnects remote hosts automatically Adrohak Linux - Software 0 07-17-2004 02:04 PM
IP Address for /etc/hosts when using DHCP jimbo Linux - Networking 5 03-27-2004 06:59 PM
automatically updating the hosts file sal_paradise42 Linux - Networking 3 12-31-2003 10:58 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration