[lfs-support] Network card configuring

Ken Moffat zarniwhoop at ntlworld.com
Sun Mar 25 12:24:03 PDT 2012


On Sun, Mar 25, 2012 at 01:11:49PM -0500, Eleanore Boyd wrote:
> How exactly does one configure the /etc/hosts for using DHCP? I can't 
> really tell at all.....
> 
> Elly

 AFAIK there is nothing different *required*.  For my machines using
dhclient I have an /etc/hosts.orig which only contains entries for
localhost and the machines on my network which have fixed addresses.

 I then use /etc/dhclient-exit-hooks to add the current address to
/etc/hosts.  So, on my machine 'bluesbreaker' I have:

ken at bluesbreaker ~ $cat /etc/dhclient-exit-hooks
if [ -f /etc/hosts.orig ]; then
  cp /etc/hosts.orig /etc/hosts
  echo "$new_ip_address bluesbreaker bluesbreaker.mydomain" >>etc/hosts
else
  echo "127.0.0.1 localhost.localdomain localhost" >>/etc/hosts
fi

(perms 644 for the exit-hooks).  Obviously, it works without the
.orig file, but for varying definitions of 'works'. ;-)

ĸen
-- 
das eine Mal als Tragödie, das andere Mal als Farce



More information about the lfs-support mailing list