This short tutorial explains how to set up and use VPN split tunneling on Mac. It also explains why to use split tunneling on macOS, presents the available options, and lists VPN client apps that offer access to this feature.
How to set up split tunneling on macOS [Summary]
Setting up VPN split tunneling on Mac may be either very simple (if you install an app capable of turning split tunneling on and off), or a little bit complicated as it requires some command-line skills, and patience.
- Option 1: Use a VPN client app that implements split tunneling.
- Step 1: Open the VPN app.
- Step 2: Define split tunneling rules.
- Step 3: Turn on the VPN connection.
- Option 2: Use the command line to define split tunneling rules.
- Step 1: Find the IP address of the website you want to access the VPN tunnel.
- Step 2: Run the
- Step 3: Check the setup.
- Option 3: Modify an OpenVPN configuration file and use the
As your goal is to set up an advanced VPN connection on macOS, I suggest that you first read our article on how to install a VPN on Mac. `You will learn what are the available VPN options on macOS.
Why use split tunneling on Mac?
Simply put, split tunneling allows you to control VPN traffic. Thus, you may let specific applications connect to the Internet using the VPN tunnel while allowing other apps to access the Internet directly.
Split tunneling is very convenient on Mac (as well as on other operating systems) for unblocking streaming channels or downloading torrents securely. You may obtain the perfect balance between security/privacy/anonymity and speed, and use VPN only for precise apps or websites.
How to set up VPN split tunneling on Mac
Depending on the way you installed the VPN on your Mac you have the following options.
Option 1: Use a VPN app that implements split tunneling
Several (not many) VPN services implement VPN split tunneling in their apps. Thus, if you subscribe to such a service, the only thing that you have to do is to establish the rules (which apps use the VPN and which are not), and turn the VPN on.
Split tunneling on Mac with ExpressVPN
ExpressVPN is one of the few VPN services that offer split tunneling within its apps.
For Mac, you need to:
- Install the ExpressVPN macOS app.
- Next, open the settings menu and click on Preferences.
- In the General tab, check the Split tunneling option.
- Click on the Settings button.
- Choose the split type:
- All apps use the VPN.
- Do not allow selected apps to use the VPN – inverse split tunneling.
- Only allow selected apps to use the VPN.
- If you choose Do not allow selected apps to use the VPN or Only allow selected apps to use the VPN, select the apps (e.g., Chrome, Safari, a torrent client app).
- Test the split tunnel:
- If you have selected Safari with Only allow selected apps to use the VPN, then turn ON ExpressVPN, open Safari, and load an IP locator website. You should see the IP address of the VPN server.
- If you have selected Safari with Do not allow selected apps to use the VPN, then turn ON ExpressVPN, open Safari, and load an IP locator website. You should see your public IP address. If you open another browser, you should see the IP address of the VPN server you are connected to.
Important! You need to turn ON the ExpressVPN app to activate the split tunneling.
Split tunneling on Mac with Shimo
To use Shimo you need to have access to a VPN server (from a VPN provider, from a network administrator, or set up by you). After setting up the VPN connection you may proceed with splitting the tunnel:
- Click on the Shimo icon from the menu bar.
- Click Preferences…
- Choose the VPN connection to configure and double click on it.
- Go to the Advanced tab.
- Disable Send all traffic over VPN.
- Add route(s) to Network Traffic Control by clicking the + button. The Target network is the IP address of the remote network that you want to access (e.g. 188.8.131.52). You may define it also as a network range, by appending /XX (e.g., 184.108.40.206/24).
- Select VPN as the Gateway.
- Set mode to Overwrite (do not use transmitted routes from VPN gateway).
- Click Save.
Option 2: Use the command line to define split tunneling rules
For manually created VPN connections with the L2TP protocol (L2TP over IPSec), you may set up a manual split tunneling mechanism to direct the traffic to a certain target (IP) through the VPN.
This is useful when you want to use the VPN tunnel only for loading a particular website or a specific web resource. You will need the IP address (or IP range) of the target/destination website. A simple way to find it is to use the
nslookup command or to load a site like this one and enter the domain name or URL.
For the next steps, you will need superuser administrative privileges, an existing L2TP connection, and the destination subnet (target IP address):
- Go to System Preferences > Network.
- In the left panel, click on the VPN connection and click on the Advanced button.
- Next, click on the Options tab.
- Disable the Send all traffic over VPN connection option.
- Click OK and, next, Apply.
- Connect to the VPN.
- Once connected, open the Terminal app (Launchpad > type Terminal).
ifconfigand hit Enter. Identify the network interface used by the L2TP connection (most probably it is ppp0).
- Log in as root to be able to run the necessary command. Type
sudo suinto the terminal and authenticate with your Mac password.
- Enter the following command, replacing [DESTINATION] with the subnet you want to be routed through the VPN, and [VPN INTERFACE] with the interface listed in the previous step (probably ppp0).
route add -net [DESTINATION] -interface [VPN INTERFACE]
You may add the “-p” if you want your route to remain active after reboot (persistent).
- Load the desired website. It is now accessed through the VPN tunnel.
- To remove the split tunneling rule, turn off the VPN, and type the following command:
route delete [DESTINATION]
To better understand how this works, you may first test with a IP locator website:
- Load, for example, xmyip.com. Notice your IP address.
- Find the IP address of the server where xmyip is located. It is 220.127.116.11.
- Turn on the VPN and follow the steps described above.
- Enter the following command:
route add -net 18.104.22.168 -interface ppp0
- Re-load xmyip. You should notice that your IP address is no longer shown. It is replaced by the IP of the VPN server.
- Don’t forget to remove the route after the test:
route delete 22.214.171.124
If you prefer you may use a script that allows you to easily manage one or more VPN connections with split tunneling.
Option 3: Modify an OpenVPN configuration file
You may use OpenVPN on Mac and modify the config files to split the traffic data. More precisely you may instruct OpenVPN to use the VPN tunnel only for specific websites:
- Find the IP of the website you want to access via VPN (either use a website for this or the
- Edit the OpenVPN (or Tunnelblick) config file.
- Add the following commands:
route [IP address of the website] 255.255.255.255
- Save changes.
- Restart the OpenVPN connection.
- To remove the split tunnel, delete the two rows, and restart the OpenVPN connection.
How to test split tunneling on Mac
It is always advisable to test your split tunneling setup. My recommendation is to firstly use a IP locator website, set the split, load the IP locator website, and check the IP address:
- With no VPN connection, load, for example, xmyip.com (IP: 126.96.36.199). Notice your public IP address.
- Set the VPN split for xmyip.
- Re-load xmyip. Observe that your IP address is no longer shown and it was replaced by the IP of the VPN server.
- If the test was successful, you may proceed with the website or websites you want to access through the VPN.
You have learned how to set up split tunneling on Mac and get your VPN connection to the next level of efficiency. However, make sure you are aware of the current setup, otherwise, you may leak your IP address.
Would you like to be notified when we publish new Mac VPN tips? Subscribe to our newsletter! It will make a Transylvanian baby-bat 🦇happy.