How to use multiple dns servers on debian?

i have a debian machine.
i am trying to use the dns servers 10.13.16.1 and 10.13.74.1 as primary and secondary dns respectivley. but i cannot figure out how to do this.

my expected behavior when resolving any domain:
lookup with 10.13.16.1, and if it cannot resolve, use the dns server on 10.13.74.1 to resolver.

what actually happens:
it tries to resolve on 10.13.16.1, fails, and the connection cant be made and the program exits with failure to resolve or host unreachable.

here is the entry in /etc/network/interfaces

iface vmbr0 inet static
bridge-ports none
bridge-stp on
bridge-fd 0
bridge-vlan-aware yes
bridge-vids 2-4094
bridge_maxwait 0
address 10.13.16.174
netmask 255.255.255.0
gateway 10.13.16.1
dns-nameservers 10.13.16.1 10.13.74.1

Hi,
Debian has gone through multiple flavors over handling DNS/networking in the course of recent releases, I guess you are having Debian 12 bookworm, but best to confirm, just in case.

For the issue you are describing, I can imagine the first DNS server 10.13.16.1
did send a NX record back, which you describe as “cannot resolve”. Problem with NX records are, that it means there is actually a response, and this is what the system is taking (and caching!).

If the failure mode is of the nature of “the Debian host not being able to reach the first DNS service”, can you post results of dig or nslookup, or a tcpdump?
(you can retract or best rewrite the entries you see as sensitive)

1 Like

Your desired behavior doesn’t really exist in DNS, your debian works as designed.

When configuring multiple DNS servers the client (your computer) will only use the second in case the first cannot connect to the DNS service.

What are you trying to accomplish?

i got my desired behavior by redoing this whole setup do just use dhcp.

2 Likes