Is it possible to configure a domain-depentant nameserver for address-resolution (e.g. resolv.conf)?
e.g.
nameserver 1.2.3.4 for any domain abc.com
nameserver 4.3.2.1 for any domain cba.com
nameserver 1.4.2.3 for anything else
I am using a modern Debian.
Best Answer
You can’t do this with only
resolv.conf
, but with an intermediary DNS forwarding daemon such as Dnsmasq (packaged in Debian asdnsmasq
and related packages).With Dnsmasq, you’d configure Dnsmasq itself with the list of servers:
and tell it not to look at
resolv.conf
:Then you’d change your
resolv.conf
so it points to the Dnsmasq daemon, by removing all thenameserver
entries therein. You’d also need to ensure that any DHCP setup doesn’t overwriteresolv.conf
.