2

I have a host with 2 NICs:

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

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

One is static, the other one is DHCP:

auto eno33554992
allow-hotplug eno33554992
iface eno33554992 inet dhcp

auto eno16777736
iface eno16777736 inet static
    address 192.168.129.129
    netmask 255.255.255.0
    gateway 192.168.129.2
    dns-nameservers 192.168.129.2 

eno33554992 gets a DNS from DHCP that is 192.168.17.130. That's my own bind DNS that refuses recursive and has no forward.

192.168.129.2 is actually the gateway/DNS of the VMWare Workstation NAT network that eno16777736 is attached to.

My resolv.conf looks likes this:

nameserver 192.168.17.130
nameserver 192.168.129.2
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 192.168.129.2) 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 ?

EDIT:

~$ ip route show
default via 192.168.129.2 dev eno16777736 
192.168.17.128/25 dev eno33554992  proto kernel  scope link  src 192.168.17.129 
192.168.129.0/24 dev eno16777736  proto kernel  scope link  src 192.168.129.129

~$ sudo ip route change default via 192.168.17.129 dev eno33554992
~$ ip route show
default via 192.168.17.129 dev eno33554992 
192.168.17.128/25 dev eno33554992  proto kernel  scope link  src 192.168.17.129 
192.168.129.0/24 dev eno16777736  proto kernel  scope link  src 192.168.129.129 
  • 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
1

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 192.168.17.0/24 on eno33554992.

I would try:

 ip route del 192.168.17.128/25 dev eno33554992
 ip route add 192.168.17.0/24   dev eno33554992
  • 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 192.168.17.0/25 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 192.168.17.0/25 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.