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 ?
~$ 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