Conceptually, the Linux resolver is a global process for the host. All interfaces use the same DNS server, defined in /etc/resolv.conf
There are 2 workarounds that I can think of:
There are 2 workarounds that I can think of:
- Use a local dns forwarder as DNS server, in other words, have “nameserver 127.0.0.1” in /etc/resolv.conf, and configure that DNS server to forward to different upstream DNS servers according to the incoming interface or IP address. Can be done with dnsmasq, for example.
- Segregate an interface and all the process instances that use it to a separate network namespace. In this case, each namespace uses its own network stack, including its own resolv.conf file.
(at this point you might want to use linux containers like Docker)For example, if you want a different version of /etc/resolv.conf for a network namespace used to isolate your vpn you would name it /etc/netns/myvpn/resolv.conf.
Statistics: Posted by epoch1970 — Fri Feb 02, 2024 4:38 pm