[Dnsmasq-discuss] dnsmasq + multiple DHCP Ranges based on net: tags

Simon Kelley simon at thekelleys.org.uk
Thu May 6 17:09:03 BST 2010


Rob Emery wrote:
> Hi all,
> 
> I am finally at the end of my tether attempting to get dnsmasq to allocate
> IPs to machines in different ranges based on the net: tags I've allocated, I
> don't see why this just won't work:
> 
>        # Configuration file for dnsmasq.
>        # Add local-only domains here, queries in these domains are answered
> from /etc/hosts or DHCP only.
>        local=/robtest/local/
>        listen-address=10.0.0.8
> 
> # Set these if you want to have a domain automatically added to simple names
> in a hosts-file.
> expand-hosts
> domain=robtest
> 
>        # For debugging purposes, log each DNS query as it passes through
> dnsmasq.
>        #log-queries
> 
>        dhcp-range=resv,10.0.4.1,10.0.4.254,255.255.0.0
>        dhcp-range=pc,10.0.6.1,10.0.7.254,255.255.0.0
>        dhcp-range=voip,10.0.8.1,10.0.9.254,255.255.0.0


These should be:

dhcp-range=net:resv,10.0.4.1,10.0.4.254,255.255.0.0
dhcp-range=net:pc,10.0.6.1,10.0.7.254,255.255.0.0
dhcp-range=net:voip,10.0.8.1,10.0.9.254,255.255.0.0

To quote the man page: "When it is prefixed with ’net:’ then its meaning
changes from setting a tag to matching it." and matching a tag set
previously by dhcp-host is what you want to do.

My apologies that this is horribly confusing and inconsistent. The next
release of dnsmasq largely fixes it by making tag:<tagname> match a tag
everywhere, and set:<tagname> set a tag everywhere. That doesn't help
you in the meantime.

> 
> 	##as a side note: if I do this without the tag, will it just apply
> it to all 3 correctly?

Yes, it will.

>        # Override the default route supplied by dnsmasq
>        dhcp-option=voip,3,10.0.0.1
>        dhcp-option=pc,3,10.0.0.1
>        dhcp-option=resv,3,10.0.0.1
> 
>        #force the dns server to be this machine
>        dhcp-option=voip,6,10.0.0.8
>        dhcp-option=pc,6,10.0.0.8
>        dhcp-option=resv,6,10.0.0.8
> 	
>        # Set the NTP time server addresses to be this machine
>        dhcp-option=voip,42,10.0.0.8
> 
>        #BT VOIP Phone:
>        dhcp-host=00:1f:9f:84:2b:cf,net:voip,Falcon
> 
> 
> To my brain, that should allocate the device with the MAC 00:1f:9f:84:2b:cf
> an address from the pool 10.0.8.1-10.0.9.254, but the IP it ends up with is
> 10.0.4.195! I've hunted through the archive and found scraps of info, but
> none of it seems to quite be doing what I'm trying to do.  
> 
> I think I've either misunderstood the net tags or completely messed up the
> syntax. Any help would be greatly appreciated!
> 

HTH


Simon.





More information about the Dnsmasq-discuss mailing list