In Windows 10 how do you ensure all traffic goes through VPN?

What is the easiest way to ensure all traffic goes through the VPN in Windows 10? Are there any built in ways? I'm basically looking for an internet kill switch in the case the VPN fails.

I read that sometimes the OS gets confused and for some random reason just doesn't use the VPN when sending traffic, is this actually a valid concern?

4

3 Answers

Note:

Be sure you have only one network adapter enabled, example: if you are using ethernet, be sure wireless is disabled. If using wireless be sure no ethernet cable is connected, or disable the adapter in networking and sharing center > change adapter settings.

Open command prompt and do a command:

netstat /r

note the Interface ip address on the 0.0.0.0 line in the "Active Routes" section , lets just say it is 192.168.0.1

Connect to your VPN

Do another netstat /r

Note you will see a new ip route for the vpn (second 0.0.0.0. line), note that Interface new route ip

Now kill the original non vpn route with this command

route delete 0.0.0.0 192.168.0.1

then do another netstat /r

you will only see your vpn route now, and if your VPN line drops, you lose that route, so there are no more 0.0.0.0 routes and your external connection will be immediately cut off. If you want to access the internet you'll need to add the original route back with this command:

route add 0.0.0.0 mask 0.0.0.0 192.168.0.1 IF 8

The "IF 8" means "interface 8". The number 8 may be different on your computer, look at the output of netstat -r to get the correct number of your interface in the Interface List

All that being said I would disable ipv6, I have done this with no issues after doing so.

disable ipv6 command:

netsh interface teredo set state disabled

Enable ipv6 command:

netsh interface teredo set state default
7

These are 2 questions rolled into one.

I'm basically looking for a internet kill switch in the case VPN fails

@Moab's answer settles this question nicely.

What is the easiest way to ensure all traffic goes through the VPN in Windows 10?
Is there any built in ways?

This is a different question. Note that all traffic goes through the VPN has an implied "as long as the VPN connection is up". The built-in way to route Internet traffic over VPN will transparently fallback to the local Internet connection if the VPN gets disconnected for whatever reason.

That said, the following steps should answer the 2nd question:

  • right click the Start button, select Network Connections
    • then click "Change adapter options" (as of Windows 10 version 1703)
  • click the VPN connection you want to use, right-click, select Properties
  • click the Networking tab, select IPv4 from the list, click Properties
  • click Advanced, make sure "Use default gateway on remote network" is checked
  • repeat previous step for IPv6 if applicable
7

If you need to make sure that all the traffic goes though a single IP or pool known to you, you may adjust firewall blocking all other addresses leaving that single IP. Say, you need to use 10.10.10.10 only, so you should block all from 0.0.0.0 to 10.10.10.9 and from 10.10.10.11 to 255.255.255.255.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like