Setting up dnsmasq as resolver for local domains, forward others to campus nameserver

dnsmasqdomain-name-systeminternal-dnsweb-hosting

I'm tearing my hair out trying to setup dnsmasq. I'd like to be able to resolve certain local domains (just as a test) to my own machine, and forward the rest to my regular DHCP nameserver that's coming from campus. I'm running Ubuntu 20.04.

Here's what I need from dnsmasq:

  • A wildcard resolver to some local test domain.
  • Full compatibility with forwarding to my existing campus nameserver. I.e. I want 'search' from /etc/resolv.conf to still work, so 'neon' resolves to 'neon.cs.princeton.edu' as usual. I have been unable to even find the IP address of my campus nameserver, let alone keep 'search' working.

Best Answer

In your dnsmasq conf file add these lines to forward specific domains to different IPs.

server=/domain1.ca/192.168.2.4
server=/domain2.ca/192.168.2.5

And this line to forward to your 'campus nameserver'

server=10.0.0.8

If you don't have these two things working yet (forward domain, and forward all else), troubleshoot until you get this piece working.

Once that works, start testing the search domains after that.