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.

2 Answers 2


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.

  • Both networks have DNS servers. The problem is that neither DNS can resolve addresses on the other network and only one of the DNS servers can resolve external names. Is there a way to point to multiple DNS servers? Or to somehow direct certain requests (like all domain.local lookups) to a certain DNS? Feb 22, 2017 at 0:36
  • 1
    no...on your machine, you need to install bind and setup forwarders for each zone, then set your machine to point to localhost (bind) Feb 22, 2017 at 1:07
  • follow his links. Feb 22, 2017 at 1:08

I was able to get this working by modifying my /etc/resolv.conf file

domain privatedomain
search privatedomain publicdomain.com

The privatedomain is the local 192.168.*.* network domain name. The publicdomain.com is the domain name for the 10.*.*.* network with internet access.

It can now resolve all these requests correctly

ping computer.privatedomain
ping computer
ping computer2.publicdomain.com
ping google.com

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:

ping google.com

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.

You must log in to answer this question.

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