Setup Routing Settings for Multiple VPNs Connection


If the line that can access the server is limited, VPN is often used to clear it, even in simple way, VPN is used to access the company server during telework, and it connects to the VPN server on the Internet to fix the connection source IP. By the way, if you use a lot of VPN connections , then the routing will be messed up, and you may not be able to access the target server even though you are connected to the VPN.

In Windows built-in VPN with L2TP/IPsec, SSTP if you connect without thinking, the default gateway will be VPN, so most communication such as communication to the Internet will go through the last connected VPN.

To avoid this, you need to set the routing yourself . All you have to do is organize which server the communication goes through which VPN.

Example case

Case explanation

  • Communication to the Internet does not go via VPN connection.
  • Communication to the FILE SERVER goes via VPN1 connection.
  • Communication to the WEB SERVER is via VPN2 connection.

Setup that will allow us to achieve this

Remove the default gateway setting of VPN.

  1. Press the Windows key + R key to start Run.
  2. Type control ncpa.cpl to open the network connection in Control Panel.
  3. Choose network adapter for VPN connection and select Properties from the right-click menu.
  4. Select Internet Protocol Version 4
  5. Click the Properties
  6. Click the Advanced
  7. Clear checkbox Use default gateway on remote network

With the settings we have completed two points

  • Communication to the Internet does not go via VPN connection.
  • Communication to the FILE SERVER goes via VPN1 connection.

Even if you connect a VPN, communication to the Internet will continue through your line as usual 😀. Also, when VPN1 is connected, the IP of the segment of is assigned to the PC at hand, so communication to the corporate network will automatically go through the VPN.

Set the communication to a specific server to go via VPN.

  • Press the start button and enter cmd
  • Right click on command prompt
  • Select Run as administrator
  • Add route route add

Now communication to WEB SERVER will now go through VPN2. 😀

📝 If you have multiple servers, you can add routes in the same way, and also if you have multiple VPNs, you can change the gateway and add routes in the same way. With this simple action, you can freely set the route, no matter how many VPN connections you have!

DevOps Consultant. I’m strongly focused on automation, security, and reliability.