[Dnsmasq-discuss] Setting dns domain name through dhcpv6

Roy Marples roy at marples.name
Sat Mar 8 14:10:56 UTC 2014

On 08/03/2014 12:07, Tom Hendrikx wrote:
> I was already using the search option, but it was giving me some
> headaches, mainly because what I actually was trying to get to work
> was that 'hostname --fqdn' on the client would actually return the
> correct fqdn from the dhcp network.

AFAIK that has nothing todo with either search or domain options in 
hostname --fqdn queries the nameservers to work out what the FQDN is 
based on your IP address.
This is also quite erroneous. Here's the Linux man page section:


the Fqdn
You can't change the FQDN (as returned by hostname --fqdn) or the DNS 
domain name (as returned by dnsdomainname) with this command. The FQDN 
of the system is the name that the resolver(3) returns for the host 

Technically: The FQDN is the name gethostbyname(2) returns for the host 
name returned by gethostname(2). The DNS domain name is the part after 
the first dot.

Therefore it depends on the configuration (usually in /etc/host.conf) 
how you can change it. Usually (if the hosts file is parsed before DNS 
or NIS) you can change it in /etc/hosts.

If a machine has multiple network interfaces/addresses or is used in a 
mobile environment, then it may either have multiple FQDNs/domain names 
or none at all. Therefore avoid using hostname --fqdn, hostname --domain 
and dnsdomainname. hostname --ip-address is subject to the same 
limitations so it should be avoided as well.


As such, hostname should either be a single name (foo) or a FQDN 
(foo.bar.com) and the hostname program shouldn't do any DNS lookups at 
That is what we have tools such as host(1) and dig(1) for.


More information about the Dnsmasq-discuss mailing list