[Dnsmasq-discuss] using --dhcp-fqdn without setting domain based on IP

Simon Kelley simon at thekelleys.org.uk
Wed Sep 22 16:45:46 BST 2010


Tom Fernandes wrote:
> Hi,
> 
> I have my systems send their hostname and domain-name with the DHCP request. 
> Based on that I want to add the machines to the DNS without configuring IPs or 
> MAC-adresses though. All the machines are on the same subnets. I have 3 
> different domains.
> 
> Is this possible?

No, sorry. This all arises because there's no "slot" in the lease
database to record the domain - only the hostname. When the facility for
multiple domains was retro-fitted, the workaround was to be able to
derive the domain associated with a host from its IP address. That
allows dnsmasq to populate the DNS with fully qualified domain names
given only the information on the leases file.
> 
> The only way I see at the moment is to use the "dhcp-host=" to give a host a 
> certain IP-Address and - based on that - have it in a different "domain=" 
> section. But then I have to maintain additional configuration - which I don't 
> see necessary (I may be missing something) and would try to omit.
> Configuring the domains once via "domain=" options is fine of cause. But 
> having to enter new settings for each machine (via "dhcp-host=") is what I 
> would like to avoid.

The IP  ranges associated with domain names don't have to be complete
subnets, so you could do something like this (assuming that your one
subnet is 192.168.0.x)

dhcp-range=tag:domain1,tag:!domain2,tag:!domain3,192.168.0.2,192.168.0.80
dhcp-range=tag:!domain1,tag:domain2,tag:!domain3,192.168.0.81,192.168.0.150
dhcp-range=tag:!domain1,tag:!domain2,tag:domain3,192.168.0.151,192.168.0.254

Thus splitting your subnet into three address ranges. Then associate
domains with each range.

domain=domain1.mydomain.org,192.168.0.2,192.168.0.80
domain=domain2.mydomain.org,192.168.0.81,192.168.150
domain=domain3.mydomain.org,192.168.0.151,192.168.0.254

Finally, set the correct tag based on the domain
      supplied by the machine,

dhcp-match=set:domain1:option:domain-name,domain1.mydomain.org
dhcp-match=set:domain2:option:domain-name,domain2.mydomain.org
dhcp-match=set:domain3:option:domain-name,domain3.mydomain.org


I've not tried this, and there could be complications which stop it
working, but it's worth a go.

Cheers,

Simon.





More information about the Dnsmasq-discuss mailing list