0

using the very informative and detailed answer to this topic, Route the traffic over specific interface for a process in linux, I was able to selectively choose whether to run a process through a 3rd party VPN or not. The only issue I have is that all processes will still use the 3rd party VPN's DNS servers since /etc/resolv.conf is updated when the VPN connection is established. How can I have traffic directed through the VPN's gateway use its DNS server and traffic directed through my LAN's gateway use it or Google's nameservers as the DNS server?

1 Answer 1

0

So long as you use a single program, there will be no way to achieve that.

You may however run two separate instances of the DNS program, say dnsmasq, specifying for either program a different listening interface. For instance, n /etc/dnsmasq.conf1,

interface=eth0

and in /etc/dnsmasq2.conf

interface=tun0

Make sure you start the second copy of dnsmasq only when you activate the VPN.

3
  • thanks. I use a purely resolv.conf solution. is it possible to run two separate instances of that each using a different interface? Mar 27, 2016 at 16:13
  • @onlinespending No, it is not possible to do that. Mar 27, 2016 at 19:04
  • thanks. I was able to get this to work in a slightly different fashion, though running a second instance of dnsmasq. Complete solution is detailed here http://serverfault.com/a/766290/345463 Mar 31, 2016 at 16:40

You must log in to answer this question.

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