Sometimes you do not want VPN to cover all your network traffic as for example you want to access some websites using your home IP address.
This guide will provide simple steps to do so.
1 – Open Terminal on your Mac. Go to the Launchpad and type in Terminal in the search box and open it.
2 – You need to have the IP of the website that you wish to exclude from the VPN tunnel. For this example we used www.ipleak.net
Type in this command in the Terminal :
ping -c1 YourWebsiteAddressHere
So in this case we used – ping -c1 www.ipleak.net
You can see the site IP address now, in this example is 188.8.131.52
Now please enter netstat -rn in to the terminal and find your default gateway IP address at the top of the routing table.
The IP will start 192.168.x.x and will have default as a destination.
In this case, our gateway is 192.168.201.1
Since you got the gateway IP and the IP of the website that you wish to exclude from the VPN , type in this to insert the routing rule.
sudo route -nv add TheWebsiteIP TheGatewayIP
In our case, it was : sudo route -nv 184.108.40.206 192.168.201.1
Enter your Mac username password that you use to log in to it and it will add the route.
Now you can go to the website that you used to bypass the VPN connection and test if it does show your real IP or not.
To delete the route from the routing table and allow VPN to reach it, type in this command :
sudo route delete TheWebsiteIP
In our case it was like this: sudo route delete 220.127.116.11