2

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.

3

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? – Brendan Abel Feb 22 '17 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) – Jacob Evans Feb 22 '17 at 1:07
  • follow his links. – Jacob Evans Feb 22 '17 at 1:08
-1

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

domain privatedomain
search privatedomain publicdomain.com
nameserver 192.168.10.15
nameserver 10.10.1.15

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.

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.