[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Computer host name



Steve wrote:
---- Rick Stevens <ricks nerd com> wrote:
James Allsopp wrote:
Hi,
I've deactivated NetworkManager as it was interfering with my wireless
networking, but since then my computer has been renamed to
<ip-address>-bethere.co.uk, instead of localhost.localdomain. I've
looked at /etc/hosts
/etc/sysconfig/network
and these are all set up as localhost.localdomain and the network card
facing the internet is set up statically.

Anyone have any ideas how to stop this happening?
If you are running a DHCP client (and it looks like you are), the DHCP
server you're using gave your machine a host name.  That's pretty
normal.

I don't think that this is true. At least not if you're running dhcp-4.0.0 as I am on my F9 system.
$ rpm -qa | grep dhclient
dhclient-4.0.0-22.fc9.x86_64

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.

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

My guess is that your ISP is "bethere.co.uk", therefore they gave you
a hostname that reflects the IP address they gave you.  That's good,
generally, because that means they're probably maintaining a reverse DNS
entry for your IP address that points at you.

You can ignore the host name the DHCP server gives you by editing the
DHCP client config on your machine and adding

	supercede host-name localhost.localdomain;

to the lease clause.  See "man dhclient.conf" and "man dhcp-options".

You can also put

send host-name "my_host_name";

in the dhclient.conf file or add

DHCP_HOSTNAME="my_host_name"

to /etc/sysconfig/network

I put this entry in my /etc/sysconfig/network-scripts/ifcfg-eth0 (or eth1 or whatever) that also has the line:

NM-CONTROLLED=no



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]