MacBook – DNS Suffix on two network Interfaces on MacBook Pro

dnsmacbook pro

I got a new MacBook Pro for my work office and have a network issue.
On the MBP 13" I use the integrated Wi-Fi and an additional a Belkin USB Ethernet.

Now, with those two network interfaces I connect to two different networks:

a) Work network (Wi-Fi)
b) Test network (Ethernet)

From both networks I get an IP via DHCP incl. DNS server address and search domain / suffix:

a) DNS Server 10.10.10.10
a) Search domain .intern

b) DNS Server 172.16.30.1
b) Search domain .home

Right now the Ethernet (b) is on top of the list:

enter image description here

If I now want to connect (ping) to a device in test network (b) it works:

ping ubuntu.work

But If I try to connect (ping) to a device in the company network (a) it doesn't work:

ping server.intern

I tried to switch the order of the devices (first Wi-Fi, second Ethernet) and then the issue swaps around (now .intern works but .work not anymore). For me it seems that macOS is sticky to the first (main?) network interface. I also tried to set the test network (Ethernet – when on top of the adapter list) to manual IP and to leave the DNS server / search domain empty, but even then the DNS from the second device (Wi-Fi) will not be used.

Does anyone have a solution for that?
Can't be that I am the first one to come over that issue

Best Answer

The problem that you are having is that you have two separate networks with their own DNS that don't know about each other - .intern and .home.

The problem comes in when you try to ping a host on a network (whichever is primary; let's assume .home) to another network (.intern). It will fail because the DNS for .home knows nothing about the .intern domain. It will assume the request needs to be forwarded to the ISP's DNS; and they don't know about that domain either.

You can fix this by enabling Unbound DNS resolver on your Mac so it can query itself. You will need to configure it to perform a split-horizon DNS service. Then, set your Mac to query only itself for DNS lookups.

Basically, your Mac becomes a DNS server that's aware of both networks and will respond to its DNS queries accordingly.