Introduction
This article explains how to configure Split DNS on a MacOS system when using a VPN profile. Split DNS allows you to use different DNS servers for different network interfaces. This can be useful when you want to access resources on both a local network and the internet simultaneously while connected to a VPN.
Prerequisites
Before you begin, make sure you have the following:
- A MacOS system with the latest updates installed
- A VPN client installed and configured
Split DNS configuration setup
To configure Split DNS on your MacOS system, follow these steps:
- Open the Terminal application.
- Run the following command to open the scutil configuration file:
- Add the following lines to the file:
- Save and close the file.
- Run the following command to set up the VPN interface:
- Run the following command to set up the Wi-Fi interface:
sudo nano /etc/resolv.conf.d/scutil.conf
Replace "nano" with your preferred text editor if you don't have it installed.
__:0:1:localhost
__:0:2:fe80::1
__:0:3:127.0.0.1
__:0:4:192.168.11.41
__:0:5:192.168.11.41
Replace "192.168.11.41" with the IP address of your local DNS server.
sudo scutil --dnsresolver State --set interface "en0" 1
sudo scutil --dnsresolver searchdomain --set interface "en0" "my-domain.com"
sudo scutil --dnsresolver nameserver --set interface "en0" 8.8.8.8
sudo scutil --dnsresolver nameserver --set interface "en0" 8.8.4.4
Replace "en0" with the name of your VPN interface.
sudo scutil --dnsresolver State --set interface "en1" 0
sudo scutil --dnsresolver searchdomain --set interface "en1" "my-domain.chn"
sudo scutil --dnsresolver nameserver --set interface "en1" 192.168.11.41
sudo scutil --dnsresolver nameserver --set interface "en1" 192.168.11.41
Replace "en1" with the name of your Wi-Fi interface and "my-domain.chn" with the name of your local network domain.
Troubleshooting
If you're experiencing issues with Split DNS, try the following:
- Check that your VPN client is connected and functioning properly.
- Check that your local DNS server is reachable.
- Check that your MacOS system is using the correct DNS servers for each interface. You can use the following command to check:
scutil --dnsresolver searchdomain --get interface "en0"
scutil --dnsresolver searchdomain --get interface "en1"
References
For more information, check out the following resources: