1

I would like, in my network, the host 10.10.10.1 to resolve names via 8.8.8.8 and 10.10.10.2 via 8.8.4.4. They receive their DNS settings via the dnsmasq DHCP service.

I can imagine two solutions:

  • the hosts get a specific set of DNS servers depending on their IP
  • both hosts resolve though the dnsmasq server (so they both receive its IP address as DNS server) and dnsmasq redirects the requests based on the source IP of the requesting host.

Is this something which is configurable in dnsmasq?

The closest configuration I found is server=/example.com/8.8.8.8 which would redirect to 8.8.8.8 requests to resolve example.com. In my case however, it is the source which should trigger the condition and not the destination.

1

Perhaps you should consider using the "views" feature in BIND. I'm not sure exactly what you're doing, but it sounds like you need different IP resolution inside of your LAN from outside of your LAN.

BIND allows you to respond to queries with different results based on the source IP. Read more about it here: https://kb.isc.org/article/AA-00851/0/Understanding-views-in-BIND-9-by-example.html

  • 1
    Thank you for the answer - I +1 it but I was looking for a solution with dnsmasq if possible (I was hoping for the equivalent of views, actually) – WoJ Jun 11 '16 at 16:30
  • I gave up and moved to bind - the setup for this functionality was a breeze. – WoJ Jun 19 '16 at 19:16
1

You can do this by assigning a class to one of the servers. Then based on that class send a different list of DNS servers. The setting below use the mac address to set a tag which is used to specify a different server list. There are various conditions that can be used to set a tag.

dhcp-mac=set:alt,00:03:aa:bb:cc:dd
dhcp-option=6,8.8.8.8,8.8.4.4
dhcp-option=alt:6,8.8.4.4,8.8.8.8

It would be simpler to just set the /etc/resolv.conf on one server to the appropriate value.

  • Thank you. Would you know if there is a mechanism in dnsmasq which would do the dispatching at the server level? (my second "solution", akin to the views in bind) – WoJ Jun 11 '16 at 16:31
  • @Woj dnsmasq is a light-weight DNS/DHCP server. I haven't seen anything that would indicate is has anything similar to views. You could use two instances listening on different IP addresses. – BillThor Jun 11 '16 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.