Windows 11 offers an Always-On VPN (Virtual Private Network) feature that enables secure remote access to a corporate network or a private resource. However, what if the devices you want to connect don't support VPN client software? In such cases, you can set up a custom routing VPN connection using Windows 11.
Prerequisites
Before we dive into the steps to create a custom routing VPN connection, ensure the following:
- Both the Windows 11 machine and the remote device are connected to the internet.
- You have the necessary administrator privileges on both the Windows 11 machine and the remote device.
- You have the IP address or hostname of the remote device.
Steps to Create a Custom Routing VPN Connection
Step 1: Create a Static IP Address on the Remote Device
First, you need to configure a static IP address on the remote device. This is necessary to establish a stable connection between the Windows 11 machine and the remote device.
netsh interface ipv4 show interface
netsh interface ipv4 add route 0.0.0.0 remote-address metric 5
netsh interface ipv4 add route mask 255.255.255.255 metric 1
netsh interface ipv4 add route mask 255.255.255.255 metric 2
netsh interface ipv4 add route mask metric 1
netsh interface ipv4 add route mask metric 10
netsh interface ipv4 add interface ip
netsh interface ipv4 show interface
Replace
Step 2: Configure the Windows 11 Machine as a Router
Next, you need to configure the Windows 11 machine as a router. This involves setting up a static IP address, configuring the routing table, and enabling the NAT (Network Address Translation) service.
netsh interface ipv4 show interface
netsh interface ipv4 add route mask 255.255.255.255 metric 1
netsh interface ipv4 add interface ip
netsh interface ipv4 add interface ipaddress name="Primary" source=static address= subnet= gateway=
netsh interface ipv4 add interface interface ipv4 address add
netsh interface ipv4 show interface
netsh interface ipv4 show routing table
netsh interface ipv4 show interface interface ipv4v6
netsh interface ipv6 add interface ipv6 address add
netsh interface ipv6 show interface
netsh interface ipv6 show routing table
netsh interface ipv6 add interface interface ipv6v6 add
netsh interface ipv6 show interface
netsh interface ipv6 show routing table
netsh interface ipv4 set interface admin.enabled=yes
netsh interface ipv6 set interface admin.enabled=yes
netsh interface ipv4 show interface
netsh interface ipv6 show interface
netsh interface ipv4 add interface firewall set service type=remoteaccess name="RemoteAccess-Custom" protocol=tcp port= mode=enable
netsh interface ipv6 add interface firewall set service type=remoteaccess name="RemoteAccess-Custom" protocol=udp port= mode=enable
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=accept
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=accept
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=in action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=in action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=out action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=out action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1701 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1701 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1701 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1701 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=500 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=500 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=500 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=500 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1900 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1900 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1900 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1900 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=5636 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=5636 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=5636 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=5636 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1723 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1723 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1723 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1723 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=in action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=in action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=out action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=out action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1701 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1701 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1701 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1701 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=500 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=500 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=500 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=500 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1900 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1900 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1900 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1900 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=5636 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=5636 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=5636 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=5636 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1723 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1723 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1723 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1723 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=in action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=in action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=out action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=out action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1701 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1701 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1701 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1701 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=500 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=500 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=500 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=500 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1900 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1900 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1900 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1900 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=5636 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=5636 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=5636 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=5636 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1723 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1723 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1723 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1723 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=in action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=in action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=out action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=out action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1701 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1701 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1701 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1701 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=500 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=500 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=500 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=500 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1900 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1900 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1900 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1900 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=5636 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=5636 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=5636 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=5636 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1723 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1723 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1723 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1723 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=in action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=in action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=out action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=icmp dir=out action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1701 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1701 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1701 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1701 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=500 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=500 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=500 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=500 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1900 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1900 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1900 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1900 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=5636 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=5636 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=5636 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=5636 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1723 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport=1723 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1723 action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport=1723 action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=in localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=tcp dir=out localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=in localport= action=allow
netsh interface ipv4 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv6 add interface firewall add rule name="CustomRoutingRule" protocol=udp dir=out localport= action=allow
netsh interface ipv4 add interface