We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Can we set hostname using the DHCP ?

beer9 asked
Medium Priority
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' ??
Watch Question

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

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
Principle Software Engineer
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Top Expert 2007

please see the file /etc/default/dhcpagent which contains some info in this regard and a parameter


Thanks blu!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.