LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Host name assigned by DHCP incorrectly (http://www.linuxquestions.org/questions/linux-networking-3/host-name-assigned-by-dhcp-incorrectly-621196/)

potus83 02-14-2008 07:27 PM

Host name assigned by DHCP incorrectly
 
I have a dhcp server setup to hand out ips and such bases on MAC addresses. I also for most machines have a hostname option specified. I also have my /etc/hosts file setup so I only have to change ips in one file. Within the hosts file there are two aliases, a longer complicated alias used for technical purposes and a shorter more user friendly alias. The file looks something like this:

1.1.1.1 tek3739283 bingo

When my clients request DHCP they receive the correct IP address but receive the incorrect host name. My clients are receiving the tek... name instead of the bingo, which is listed in the /etc/hosts file and the dhcpd.conf file, "option hostname bingo". I finally switched the order of the two names in the /etc/hosts file and the clients began receiving the correct name. Any ideas on why this is happening and how to make it stop? Thanks for your help in advance.

carltm 02-16-2008 10:00 AM

Double check your dhcpd.conf file to make sure you don't
have a second entry and that the syntax is right.

Also, take a look at the configuration of the clients.
It's possible to have the client accept or reject the
hostname which is offered by dhcp.

daveginorge 02-16-2008 11:08 AM

It has always been my belief the the first entry in the "hosts" after the IP address is the hostname and all other entries would become an alias

10.0.0.20 mail smtp

The above will give th hostname "mail" to the client and also allow it to answer "smtp".

The lookup priority for dns is always local "host file" first.

HTH

carltm 02-17-2008 06:49 AM

Actually the entries in the /etc/hosts file are used
to resolve names to IP addresses and IP addresses to
names, but it can't set the hostname of a system.

It's the hostname command that manages the hostname.
Typically this is assigned early in the boot process,
so using it on a running system will only change it
until the next boot. To permanently change it, you'll
need to find the procedure for your particular distro.


All times are GMT -5. The time now is 03:24 PM.