1

On a Debian-based linux device I need to set up DNS lookups on two different DNS nameservers - one for local domain lookups, one for everything else.

My /etc/resolv.conf currently is:

# Generated by resolvconf
domain delta
search delta
nameserver 127.0.0.1
nameserver 192.168.200.1

The first nameserver on lo resolves almost anything, just not my local devices on the LAN ('delta'), which are resolved by dnsmasq on 192.168.200.1. I added the second nameserver manually for testing (resolvconf only adds 127.0.0.1). DNS requests on lo are redirected by an iptable rule to the WAN.

What I see with this /etc/resolv.conf is e.g.

> host cnn.com
cnn.com has address 151.101.65.67

> host alpha.delta
Host alpha.delta not found: 3(NXDOMAIN)

> host alpha.delta 192.168.200.1
Using domain server:
Name: 192.168.200.1
Address: 192.168.200.1#53
Aliases: 

alpha.delta has address 192.168.200.99

Two main questions right now:

  • Why isn't the lookup trying the second (local) DNS server? It's working if I specify it in the host command.
  • What is the best way to configure it, so that local domain lookups are served from a separate, local server (apart from the standard, outside one). Obviously /etc/resolv.conf could be overwritten; I tried to change /etc/resolvconf.conf but that did not update /etc/resolv.conf after a resolvconf -u.

I hope this is not a dumb question; I'm still trying to understand and learn about name resolution. So an kind of hints are welcome!

1 Answer 1

2

To answer your first question

Why isn't the lookup trying the second (local) DNS server? It's working if I specify it in the host command.

Additional DNS servers are only tried if a response is not received. "I can't find it" is a perfectly valid response.

The best way to achieve what you want is always a little subjective, however a way to do what you want is a follows.

First DNS server (Lets call it Alpha)
Second DNS Server (Lets call it Beta)

Configure Alpha as a forwarding DNS server, you would configure this with Forward Zones you would specify the name of your internal domain and the forwarder would be the IP of Beta

Configure Beta with whatever records you require for your local domain.

Requests for the internal domain would get forwarded to Beta all other requests would be sent to whatever forwards your define (Google for example)

It should be noted this can all be done within a single server if required.

2
  • You only need one DNS server for that. Dec 14, 2018 at 13:24
  • @GeraldSchneider agreed but as the OP wanted 2 I answered that, however I'll a note to the answer for others
    – Drifter104
    Dec 14, 2018 at 13:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .