My best guess is that I use a VPN connection at least two thirds of the time I am online. I usually have no issues in accessing any website or service. But, there’s an exception: I have two local services here in my adopted home country of Germany: one governmental and one private, that only allow connection from German IP addresses. As my VPN use is mostly to mask my geolocation, to virtually “move” to Finland, Sweden, UK and The Netherlands, I must always remember to disconnect the VPN when I need to use one of these services. Then, I must remember to reconnect the VPN when I am done. Quite often I forget I am using a VPN connection, and only notice it when one of these two services tells me that my IP is blocked.
A native Windows command comes to the rescue here. Using the command route.exe, we can set so-called static routing, to always use a user-specified connection to some specific IP addresses.
Let’s see how we can bypass an active VPN connection for a specific website. First, we must find out its IP. Use the ping command. Thus, for instance checking Win10.guru’s IP, the command is as follows (#1 in screenshot):
Ping shows that Win10.guru IP is 188.8.131.52. My DHCP host — the router — has a local private IP 192.168.2.1. I will now enter the following command to set a static routing for Win10.guru (#2):
route -p add 184.108.40.206 192.168.2.1
(route -p add X Y, where X is IP for the site you want to create static routing for, Y is your DHCP server.)
Checking the routes (#3), I can now see that connections to Win10.guru will use persistent static routing (#4), bypassing any active VPN connection:
To delete static routing for Win10.guru, I use the following command:
route delete 220.127.116.11 192.168.2.1
That’s it. Easy to set, easy to delete.
The title image is from excellent geolocation service https://ipapi.com/
Author: Kari Finn
A former Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.