[Dnsmasq-discuss] --dhcp-fqdn example?

Simon Kelley simon at thekelleys.org.uk
Wed Aug 13 16:05:11 BST 2008


B. Cook wrote:
> Hello All,
> 
> trying to figure out how to use the new option..
> 
> I have things like this:
> 
> dnsmasq.cli.dhcp:dhcp-option=cli,option:domain-name,cli.pcsd         #
> Domain
> dnsmasq.kri.dhcp:dhcp-option=kri,option:domain-name,kri.pcsd     # Domain
> dnsmasq.phs.dhcp:dhcp-option=net:phs,option:domain-name,phs.pcsd       
> # Domain
> dnsmasq.smi.dhcp:dhcp-option=smi,option:domain-name,smi.pcsd     # Domain
> dnsmasq.war.dhcp:dhcp-option=war,option:domain-name,war.pcsd     # Domain
> 
> and in my global dnsmasq.conf
> 
> I have domain=phs.pcsd
> 
> everyone still gets phs.pcsd as their domain name..
> 
> root at core [/usr/local/etc/dnsmasq]# 84 > ping 10126kribarclay
> PING 10126kribarclay.phs.pcsd (10.20.4.125): 56 data bytes
> 64 bytes from 10.20.4.125: icmp_seq=0 ttl=126 time=163.191 ms
> 64 bytes from 10.20.4.125: icmp_seq=1 ttl=126 time=75.766 ms
> ^C
> --- 10126kribarclay.phs.pcsd ping statistics ---
> 2 packets transmitted, 2 packets received, 0% packet loss
> round-trip min/avg/max/stddev = 75.766/119.478/163.191/43.713 ms
> 
> root at core [/usr/local/etc/dnsmasq]# 85 > grep 10.20.4 *
> dnsmasq.kri.dhcp:dhcp-option=kri,option:router,10.20.4.1
> dnsmasq.kri.dhcp:dhcp-range=kri,10.20.4.2,10.20.5.254,255.255.254.0,4h
> dnsmasq.kri.dhcp:dhcp-option=kri,option:domain-name,kri.pcsd     # Domain
> 
> dnsmasq.kri.dhcp:dhcp-host=00:1c:23:1f:59:35,net:kri # 10126kribarclay
> 
> 
> what am I missing?

It doesn't work the way you think it does, even though the way you think
it works is quite sensible.

I've decided to try and answer this by giving a comprehensive
explanation of the way names and domains are generated for hosts, and
what that data is used for. I hope that this will be generally useful
information.

So, for each DHCP client, we generate a name, which is unqualified (ie
no period.) and a domain.

First the name. If there is a matching dhcp-host which includes a name,
we use that, if the name in the dhcp-host part is qualified (ie it has a
domain part) that is stripped off. If there's no dhcp-host with a name,
use a hostname provided by the client as part of the DHCP request.

Second, the domain. This is always generated from a "domain=" line, so
it depends only on the IP address of the DHCP client. If the client
supplies a domain, that is _not_ used. Once the domain is determined,
it's compared against any domain from a dhcp-host line or from the
client. If they don't match, a warning is logged.


Now, we have a name and a domain, what happens to them? They are used to
 create DNS entries, and they are sent back to the client as part of the
DHCP protocol.

First DNS. The default behaviour as the DNS entries are created for both
<name> and <name>.<domain>. If --dhcp-fqdn is set, then only
<name>.<domain> is put into the DNS.

Second DHCP. The name and the domain are sent as DHCP options back to
the host, unless there are dhcp-option lines which tell dnsmasq to do
something else. Note that sending a different domain as a DHCP option
doesn't affect the DNS stuff in the paragraph before this one.


So: you probably need to ditch the

dhcp-option=kri,option:domain-name,kri.pcsd

lines, and replace them with something like

domain=kri.pcsd,10.20.4.0/25

to set the domain for a particular subnet to the correct value.

HTH.

Simon.



More information about the Dnsmasq-discuss mailing list