Route one IP address on a subnet via a different NIC from all the others

routingwindows 7

I have a windows 7 client with a wired ethernet NIC and a wireless 802.11g NIC.

The wired ethernet NIC is connected to a network switch and has subnet 192.168.0.*.

The wireless NIC is connected to a network switch and has subnet 192.168.1.*.

I also can start a VPN which accesses a network which also has subnet 192.168.0.*.

I have a linux system attached to the ethernet switch with an IP address in the 192.168.0.* range. When the VPN is connected, I can't access the linux system any more because, unsurprisingly, the packets are routed through the VPN instead of the ethernet switch.

Is there anything I can do on the W7 box to route just this single IP address corresponding to the linux box through the ethernet switch, leaving all the other 192.168.0.* addresses to be routed via the VPN?

Best Answer

You should be able to add a route to the Windows machine using the route command. Simply add the address as a /32 route, making it exit via the proper NIC.

Example:

route add 192.168.0.248 mask 255.255.255.255 0.0.0.0 if 11 metric 1

In this case "11" is an interface number, and 0.0.0.0 takes place of the gateway parameter because there is none.

Related Topic