Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 02-14-2008, 06:27 PM   #1
LQ Newbie
Registered: Feb 2008
Posts: 1

Rep: Reputation: 0
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: 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.
Old 02-16-2008, 09:00 AM   #2
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 97
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.
Old 02-16-2008, 10:08 AM   #3
Registered: Oct 2006
Location: Porsgrunn, Norway
Distribution: CentOS 5 / 6 / 7
Posts: 104

Rep: Reputation: 16
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 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.

Old 02-17-2008, 05:49 AM   #4
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 97
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.


dhcp, hostname

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
eth0 ip assigned by dhcp , how would i know the ip address of the dhcp server where.. kublador Linux - Networking 14 05-16-2006 06:33 AM
How do I keep the local name for the computer from being dynamically assigned by DHCP slickrcbd Linux - Networking 3 03-04-2004 12:11 AM
What's my DHCP assigned IP and where is it? Buckyjunior Linux - Networking 7 02-27-2004 01:29 PM
dhcp assigned address nilbog Linux - Networking 4 04-02-2003 11:17 AM
How to find out my IP address on a DHCP IP Assigned machine? simonh Linux - Networking 2 12-10-2002 05:49 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:41 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration