LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-30-2011, 11:25 PM   #1
needsleep
Member
 
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?

Thanks,
 
Old 10-31-2011, 12:38 AM   #2
macemoneta
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:
127.0.0.1       localhost.localdomain   localhost
::1             localhost6.localdomain6 localhost6
 
  


Reply


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 03:08 AM
script to update /etc/hosts on dhcp obtained ip change. juanctes Linux - General 1 02-02-2008 10:17 AM
Camserv disconnects remote hosts automatically Adrohak Linux - Software 0 07-17-2004 03:04 PM
IP Address for /etc/hosts when using DHCP jimbo Linux - Networking 5 03-27-2004 07:59 PM
automatically updating the hosts file sal_paradise42 Linux - Networking 3 12-31-2003 11:58 AM


All times are GMT -5. The time now is 04:28 AM.

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