Computer host name

Tim ignored_mailbox at yahoo.com.au
Thu Mar 5 19:53:52 UTC 2009


On Thu, 2009-03-05 at 14:22 -0500, Steve wrote:
> I had thought the same thing but I recently spent some time sifting
> through the code to try to find where the host name is set. What I
> found is that it's not set by dhclient at all. It is set in the
> script /etc/sysconfig/network-scripts/ifup-post by the ipcalc command
> which is passed the IP address that the DHCP server gives your
> machine. Essentially this is a DNS lookup.

In both directions...  DHCP server says here's your IP, or the box has a
static IP set into it.  That IP resolves to this name.  Checking that
name resolves to the same IP.  I am /that/ name.  That's how Linux (and
some services running on the box) works out what its name is, in the
absence of it being fixed some other way (e.g. the user setting a
hostname in a configuration file, regardless of what IP address it gets,
even if that causes problems by using something that doesn't resolve, or
resolves wrongly).

> If you know otherwise or if this is not always true, I'd be interested
> to hear about it.

DHCP clients can tell the DCHP server the name it wants, and DHCP
servers can tell the clients what name it wants them to use.  Neither of
them has to obey.

If you want to fix a name to a box that travels, it's a good idea to
configure the DHCP client to ask for it.  It might help.  But no well
set up server is going to let a client name itself in a manner would
harm a network - such as a rogue box being attached that insists it's
the name server (this being a good admin issue versus bad admin,
people-wise).

On a dynamically configured network, the best approach is centrally
control names and addresses via your DHCP and DNS servers, and have your
clients obey.  You only have one thing to adjust - your server.

-- 
[tim at localhost ~]$ uname -r
2.6.27.15-78.2.23.fc9.i686

Don't send private replies to my address, the mailbox is ignored.  I
read messages from the public lists.






More information about the users mailing list