Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Can we set hostname using the DHCP ?

Posted on 2009-02-15
5
Medium Priority
?
808 Views
Last Modified: 2013-12-27
Suppose I have modified my /etc/hosts and /etc/nodename as 'foo'
and at DHCP server my IP address bound to my MAC address and associated hostname is 'bar'


so when I request from DHCP for auto host configuration, will my hostname would be changed from 'foo' to 'bar' ??
0
Comment
Question by:beer9
5 Comments
 
LVL 10

Expert Comment

by:kyleb84
ID: 23647247
No, dhclient (The DHCP Client daemon) does not set your hostname to what it receives in a lease (by default).

0
 
LVL 10

Expert Comment

by:kyleb84
ID: 23647249
If you want custom host names bound to specific IP's use an internal DNS server...
- add that server into the DHCP lease
- add the hosts into the DNS records
0
 
LVL 22

Accepted Solution

by:
Brian Utterback earned 500 total points
ID: 23649356
Actually, Solaris does set the hostname of the system from what it receives in the DHCP
request, if the DHCP server supplies one. In some of the initial releases of Solaris this was
a problem, because many DHCP servers do not supply one, and the /etc/nodename file was
only used if DHCP was not. As a result, the hostname became set to "unknown", which was
the default hostname used when DHCP did not supply a hostname.  It took awhile before
Solaris was modified to use what was in /etc/nodename as a default instead of "unknown".
Since many people wanted the /etc/nodename to override what it got from DHCP, different
versions of Solaris have used different algorithms to ultimately set the hostname.

However, you may find that in many cases Solaris (10 and before at least, not sure about
OpenSolaris) may not pick up a host name when other systems do. While DHCP can
supply a hostname, in many Windows networks it does not, relying on the Windows naming
service to provide the hostname. If that is the case, Solaris will not pick up the hostname and
will end up using the default.
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 23651839
please see the file /etc/default/dhcpagent which contains some info in this regard and a parameter
0
 

Author Closing Comment

by:beer9
ID: 31547201
Thanks blu!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question