1

I have 2 machines that switch back and forth between networks. One network has both configured in the DNS table, so that they can reach each other on that one. However, on the other network, they don't, but they will have static IP addresses there.

What I would like to do is configure both machines to FIRST query the DNS for an IP address when attempting to resolve a hostname, and, if that fails, THEN go to a static hosts file (i.e. /etc/hosts) to find an IP address for it. Can this be done, both on Win7 and Ubuntu?

1 Answer 1

1

What you want to do is change the hostname resolution order.

On Ubuntu, try looking in /etc/nsswitch.conf. There should be a line

hosts:    files dns

If you change that to

hosts:    dns files

it will try a DNS query first, and then go to /etc/hosts if the query fails.

(source: https://help.ubuntu.com/10.04/serverguide/network-configuration.html)

On Windows, try changing the settings in

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider

Change HostsPriority to be greater than DnsPriority (I'd recommend making it 2002).

(source: http://www.speedguide.net/articles/host-resolution-priority-tweak-1130)

You must log in to answer this question.

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