I have a linux machine with two network interfaces. They are both connected to local networks -- one is 192.168.*.*
, the other is 10.*.*.*
.
The 192.168.*.*
network is completely private and does not have internet access. The 10.*.*.*
network does have internet access.
Currently, I can do external ping's and the names will resolve
ping google.com
However, when I try to ping a machine name on the 192.168.*.*
network, the name will not resolve
ping computer-name
ping computer-name.domain
ping computer-name.domain.local
If I specify an IP address, it will resolve
ping 192.168.x.x
How can I set up DNS settings so that the machine names on the private local network will resolve, but I can still resolve external addresses?
I am using Centos6.
In situations like this you usually need to setup a DNS resolver that will forward to various upstream DNS servers based on the namespace. You can do this with DNSMasq, Bind and other DNS servers.
I was able to get this working by modifying my
/etc/resolv.conf
fileThe
privatedomain
is the local192.168.*.*
network domain name. Thepublicdomain.com
is the domain name for the10.*.*.*
network with internet access.It can now resolve all these requests correctly
The only downside to this is that when I try to resolve a name that isn't reachable from the private domain, there is a noticeable delay. For example:
I imagine it's because it's first attempting to resolve the name via the first nameserver on the
privatedomain
, which will eventually timeout, and then goes to the second nameserver which is able to resolve it.