Local DNS fails when another interface is connected

I have a LAN with a Linux server running BIND for addressing of local computers. When a workstation is connected to the local network (where there is no Internet access), I can successfully address devices using hostnames without any problems:

$ host server1.local
$ server1.local has address 192.168.2.2

$ host 192.168.2.2
$ 2.2.168.192.in-addr.arpa domain name pointer server1.local.

When that same workstation enables WiFi (or any secondary interface) and connects to the greater Internet, the machine can no longer address local devices by hostname. Presumably this is because it is using the wrong network interface’s DNS server to address my devices.

My BIND configuration is as follows:

$ORIGIN local.
$TTL 604800
@ IN SOA server1 admin (
                2008080101      ;serial
                04800           ;refresh
                86400           ;retry
                2419200         ;expire
                604800          ;negative cache TTL
                )
@       IN      NS      server1
@       IN      A       192.168.2.2
server1  IN      A       192.168.2.2
workstation1   IN      A       192.168.2.44
workstation2   IN      A       192.168.2.45

and the reverse DNS:

$ORIGIN 2.168.192.in-addr.arpa.
$TTL 604800
@ IN SOA server1.local. admin.local. (
                2008080101      ;serial
                604800          ;refresh
                86400           ;retry
                2419200         ;expire
                604800          ;negative cache TTL
                )

                NS      server1.local.
2       IN      PTR     server1.local.

44      IN      PTR     workstation1.local.
45      IN      PTR     workstation2.local.

How can I force clients to look at the correct network interface to find hosts in the “.local” namespace? Is it possible to do this from the BIND-configuration end, since I may not have complete control over the individual clients?

Answer

Certain versions of OS X assign preferences to DNS servers. This may cause your internal DNS server to be pushed down the preference order.

Try running this command to find out which server is being used:

scutil --dns | grep nameserver\[[0-9]*\]

Sources:

Attribution
Source : Link , Question Author : Jason Crystal , Answer Author : Community

Leave a Comment