As an overall solution i'd like to split dns resolving between different servers, using dnsmasq.
i.e. Default to dns server A, unless explicitly set to dns server B per host (mac).
I'd like to split my network into dnsmasq tagged subnets, for this example say:
192.168.1.80-150 = green
192.168.1.40-50 = red
I would like dhcp leases to be handed by, by -default- tagged green, except for a few specific MACs where I would like to hand out the red tag. I have this part working successfully (I believe), where i explicitly set it by MAC - but what i would like is for everything -unless specified otherwise- to default to green.
I would then like to say "for all green tags, give them dns server A as their resolver", "for all red tags, give them dns server B as their resolver".
is this possible?
I have the following config that does not seem to work:
--8<--
dhcp-range=set:green,192.168.1.80,192.168.1.150,infinite
dhcp-range=tag:red,192.168.1.40,192.168.1.50,infinite
dhcp-option=net:green,option:dns-server,8.8.8.8,8.8.4.4
dhcp-option=net:red,option:dns-server,192.168.1.11
dhcp-host=AA:BB:CC:DD:CC:BB,redhost1,192.168.1.41,infinite,net:red
dhcp-host=BB:CC:DD:AA:BB:00,greenhost1,192.168.1.81,infinite,net:green
dhcp-option=option:router,192.168.1.1
--8<--
This does not seem to work however, I have different hosts being assigned different ip addresses based on whether i have matched their MAC, and then it seems as if the dns server is not correctly being handed out.
I believe the dns server is not being handed out because a "cat /etc/resolv.conf" on one of the hosts shows 127.0.0.1.
To summarise my queries:
- Can i make everything default to 'green', unless explicitly set to 'red' by MAC (at the moment I am having to explicitly put the mac of everything into the conf file)?
- Can i specify different DNS servers, for different tagged networks?
- For extra clarity I am a bit confused about the different between "tag" and "set" and in googling have found references to both, a short and clean definition of these would be great.
thanks very much