Return to protonvpn.com Facebook   Twitter   Reddit   Instagram   Mastodon   ProtonMail
Support Center / Bypassing VPN for certain websites on macOS

Bypassing VPN for certain websites on macOS

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 95.85.16.212

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.

netstat -rn

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 95.85.16.212 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 95.85.16.212

 

 

 

 

 

 

Post Comment

4 comments

  1. Erin

    NOTE! These bypasses… the static routes that the whole article is about… they disappear on reboot or interface disconnection! You’ll need a bit of knowledge of subnet masks, but here’s an example of a MUCH better method for establishing static routes: http://networknucleus.com/2018/06/07/persistent-static-routes-in-macos

  2. Sapiens

    ERRATUM: My previous post is incorrect.
    The command is inserted before the certificate.
    Syntax for each IP to bypass the VPN: route net_gateway
    This translates into this example for 1 IP (fictional IP address):
    route 103.102.166.224 255.255.255.255 net_gateway

  3. Sapiens

    This can be done at OpenVPN config file level as well. (mac os environment) – Tested 5 apr 2018 :
    Add the following line before the line:
    route (e.g. for 1 IP: 255.255.255.255) net_gateway
    net_gateway is automatically replaced with the correct address of the Internet gateway router when VPN connection is launched.

  4. Sapiens

    Hello,
    Is there a way to implement the bypass at the OpenVPN config file level?
    Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

Don't find your answer? We're happy to help you!     Contact Our Support Team

Secure your internet

Get ProtonVPN

For customer support inquiries, please submit the following form for the fastest response:
Support Form

For all other inquiries:
contact@protonvpn.com


-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: OpenPGP.js v4.10.10
Comment: https://openpgpjs.org

xsBNBFiYeeIBCACpwuYcTsACyjQaqY3tOUonokamGZf3VDuLvcA9nQnu4vlB
n1RFFUJa5Pmf2yZ9EjJFSldTl5lreE3tFf53CcZ9wKa1R6aMnN/0VqURJho0
ZTqevQlCvuJ9kKHkDck3Em0/1WWnhDJgabp+fOa5HAHoAvcNy5gVPuexTT/N
wp6QcfB7w+qFhf73s0bcSn5RC+FAYlQxZVFhFtA7/7LthBVatDJrYLYP9XJd
zOZqz9AX0XZwKal25RcVeGHkNKgloo0bTgro4D88MR7saqXFHTRhy3+Wss7c
uqrh0uIkVmqtadoK/rAbqOyFXQ2DlvSMVrEMLUvwlZbC0taqcKDfNA+FABEB
AAHNLWNvbnRhY3RAcHJvdG9udnBuLmNvbSA8Y29udGFjdEBwcm90b252cG4u
Y29tPsLAfwQQAQgAKQUCWJh54wYLCQcIAwIJEN4dfnhhw11TBBUIAgoDFgIB
AhkBAhsDAh4BAAoJEN4dfnhhw11T6PwIAKgIHTUaEcCFQ5WfmwGpdhRgFe7H
gnHR8UOFPrRKnbCOQgTVPGwCFt8UVFhEgbmtroThU89DpxFSYUOD6nZ2k1X3
X4Q9OsItFUUuhPtLJrkz5ghtZLmsAH/edTRbVU1Ew1E8KbylLFI1J5yId7zR
GdnaTXv/E7P3po5X/b08TFAhXSyYYUbMeQuthbJajtpFygr53lm47cOWa4N8
udqLhmpheaQj04DuqYXOGC08JQn+XbHzhFl5Yvlt9Idk8+7c2UJ0qgWKQ5ZV
mquRAw5HDCQM5OqF1MoImDxOH+tK3PUlvFDsLZ1WPEOHK/EN12sPBx0x1R04
fcPTPdbMwgIS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