I have a host with 2 NICs:

eno16777736 Link encap:Ethernet  HWaddr 00:0c:29:65:db:43  
          inet addr:  Bcast:  Mask:

eno33554992 Link encap:Ethernet  HWaddr 00:0c:29:65:db:4d  
          inet addr:  Bcast:  Mask:

One is static, the other one is DHCP:

auto eno33554992
allow-hotplug eno33554992
iface eno33554992 inet dhcp

auto eno16777736
iface eno16777736 inet static

eno33554992 gets a DNS from DHCP that is That's my own bind DNS that refuses recursive and has no forward. is actually the gateway/DNS of the VMWare Workstation NAT network that eno16777736 is attached to.

My resolv.conf looks likes this:

search localdom.net

Up to recently, this was working fine:

  • I was able to resolve local names
  • I was able to go out to the internet when the request was not found in the local DNS.
  • The only drawback was that my local dns was poluted by all those public requests that hit it first, but i can live with that

The problem is that on my public network (the one that gets accessed through someone has actually set up a host that resolves to 192.168.17.x adresses. Now, no matter what I do, whenever I try to resolve this host name, i end up hiting the public one instead of the private one.

So for this one hosts, it's like since it's found in the public DNS, it's never resolved by the private one, even though this one is supposed to come first. I i take down the public interface (eno16777736) then everything resolves through the local DNS but no internet access.

What is the proper way to fix this ? Should the bind server be on my dual nic server ?


~$ ip route show
default via dev eno16777736 dev eno33554992  proto kernel  scope link  src dev eno16777736  proto kernel  scope link  src

~$ sudo ip route change default via dev eno33554992
~$ ip route show
default via dev eno33554992 dev eno33554992  proto kernel  scope link  src dev eno16777736  proto kernel  scope link  src 
  • This sounds more like a routing problem than like a DNS problem. Can you please post your routing table? ip route show – MariusMatutiae Nov 24 '15 at 21:56
  • I see what you mean: see my edit, I changed the default route but when I ping I still get an answer from the public host – zlr Nov 24 '15 at 22:35

No, your problem is not the default, in fact you can leave the gateway thru eno16777736. Your problem is that you do not have a local route which encompasses all of on eno33554992.

I would try:

 ip route del dev eno33554992
 ip route add   dev eno33554992
| improve this answer | |
  • This works :) I don't get it though, the eno33554992 has a /25 netmask defined on it but the route needs to be for the whole network? What if I had another 192.168.17/25 subnet on another nic, does this mean that it would have to use the same route ? – zlr Nov 25 '15 at 7:53
  • @zir Your route was perfectly fine. However it allowed your pc to contact pcs in the subnet thru the other interface, and this meant allowing access to the other DNS. By rewriting the rule, I basically disconnected pcs in that subnet from your machine. And now, the only DNS server in that subnet is your own. If you had another subnet 192.168.17.xx on another NIC (with no DNS server on it) you could very well restore your previous route and add the route ip route add dev NIC3, and this would work just fine. – MariusMatutiae Nov 25 '15 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.