[GLLUG] hostname with DHCP
Matt Graham
danceswithcrows at usa.net
Thu Sep 4 14:35:14 EDT 2003
On Thursday 04 September 2003 13:13, after a long battle with
technology, Benjamin Minshall wrote:
> Todd Torrey wrote:
>> Thanks to everybody for the help! Now I have another question. How
>> do I set the hostname if I'm getting an IP addrress via DHCP. The
>> examples of /etc/hosts that I'm seeing are for static IP addresses.
> That depends on the DHCP client program that you're using. If it's
> dhclient, then look in the configuration file /etc/dhclient.conf. If
> it's pump, then I believe the config file is /etc/pump/pump.conf;
> although I haven't used pump in a while, so I can't be sure.
...and you use -H to make dhcpcd set the hostname of the machine to the
hostname received from the DHCP server. This does not, AFAICT, update
/etc/hosts , but you can fiddle that with a small script. -H is not
that useful in the real world--who wants to have their machine's
hostname be "uselessgabble-1.2.3.4-somewhere.myisp.org" instead of
"usefulname"? Also note that if you switch your machine's hostname
while an X server is running, you may not be able to start any more X
clients without restarting the X server. (Also, I thought that
dhclient and pump were deprecated.)
I don't think you *have* to use -H when you're obtaining your IP via
DHCP, though. All my machines use DHCP, and I use "dhcpcd -d eth0" on
all of them. All my machines have an entry of the form
127.0.0.1 MACHINENAME
...in /etc/hosts, and that prevents DNS-related slowdowns when starting
X clients, and since the machine's hostname never changes, my
.Xauthority is always valid. MACHINENAME is simply the name in
/etc/hostname .
--
Something unpleasant is coming when men are anxious to tell the
truth. --Benjamin Disraeli
There is no Darkness in Eternity/But only Light too dim for us to see
More information about the linux-user
mailing list