LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 10: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-30-2011, 11:38 PM   #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: 344Reputation: 344Reputation: 344Reputation: 344
If you're using DHCP, your /etc/hosts should just contain:
Code:
127.0.0.1       localhost.localdomain   localhost
::1             localhost6.localdomain6 localhost6
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:05 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
Open Source Consulting | Domain Registration