This short post is to show you how to add a static IP route in a windows routing table.
Problem or Goal:
Statically add an IP route in a windows routing table.
For my case, my laptop had two interfaces (The Local Area Connection on cable and the Wireless Network Connection), and i wanted to force traffic to a certain destination network out the LAN cable interface.
Statically define an IP route to your desired destination network and force it through the gateway that connects to the right interface.
route ADD xxx.xxx.xxx.xxx MASK xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx
route ADD “network” MASK “subnet mask” “gateway ip”
route ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.12
You can use this command to print the status of your routing table:
Your routing table should now reflect that change, and all traffic to the 10.10.10.x network will now be sent through the interface that connects to the 192.168.1.12 gateway.
The route add change will only stick across reboots if you add it with the -p flag, for example:route -p ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.12