
#Netsh routing ip nat install windows 7 windows
The actual route chosen by Windows depends on several factors, including: the route metric, the specificity of the route (more specific routes, i.e.The route metric = interface metric + gateway metric.Requests are routed through the route with the lowest metric all else being equal.In windows, both the interface and the gateway is assigned a metric.Of course you'll have to adjust the interface names (use netsh interface ipv4 show interfaces to identify) and ip masks as needed. 0.0.0.0/0 through "Local Area Connection" comes third with a metric of 35.0.0.0.0/0 through "Wireless Network Connection" comes next with a metric of 29.Route 10.0.150.0/24 comes first with a metric of 21.Netsh interface ipv4 set route 0.0.0.0/0 "Wireless Network Connection" 192.168.0.254 metric=4 Netsh interface ipv4 set route 0.0.0.0/0 "Local Area Connection" 10.0.150.253 metric=15 Netsh interface ipv4 set interface "Local Area Connection" metric=20 Netsh interface ipv4 set interface "Wireless Network Connection" metric=25

bat file: netsh interface ipv4 show interfaces

Both commands have quirks and sometimes one is easier to use than the other (route requires an interface number instead of a name, which is cumbersome to find, while netsh is hard to use to add a route to a software-generated vpn route like TeamViewer).įor example, to temporarily route all traffic to the 10.0.150.x subnet through a VPN connection where your local address is 7.148.136.66, use: route add 10.0.150.0 mask 255.255.255.0 7.148.136.66 Use route or netsh to configure your routing table so that the route to your LAN subnet has a lower combined metric (interface+gateway) than the wildcard route to the internet. We can help Windows to properly route network traffic by configuring the routing table.
