Change the default traffic route on Windows

Hello,

If you have multiple network cards, multiple connections to internet or you are using a VPN and you want that some of your traffic goes out by  using  a specific interface; then you will need the “route” command!

As easy as this:
route -p add [destiny.ip] [gateway] if [interface.number]

For example:
route -p add 209.68.27.16 192.168.1.1

If the name resolve using netbios you have to add the interface number, ex:
route -p add 209.68.27.16 192.168.1.1 if 32
[seems that windows networking takes a different route and wont work with the default route]

You can get the interface number with this command:
route PRINT -4
[its the fist output, labeled as “Interface List”]

And delete a created route with:
route -p delete 209.68.27.16

Originally from:
http://superuser.com/questions/457020/openvpn-only-route-a-specific-ip-addresses-through-vpn

Edited: 10-mar-2023 [added when interface number is needed]

AC.

This entry was posted in Medium Technical and tagged , , , , . Bookmark the permalink.

Comments are closed.