Force static route for IP on same subnet

route

Any way to force the use of a defined host static route when the IP is on the same subnet and disregards the static route entry?

For instance I have a host host:
192.168.1.2 with subnet 255.255.255.0 and a default of 192.168.1.1

I'd like to communicate with 192.168.1.3 via 192.168.1.102.

Best Answer

Add the entry to the routing table:

Windows

route add 192.168.1.3 mask 255.255.255.255 192.168.1.102

Linux

route add -host 192.168.1.3 gw 192.168.1.102

However, you will likely have an asymmetric routing condition when return traffic from 192.168.1.3 returns to your 192.168.1.2 host. That return traffic, unless otherwise configured with a similarly mirrored route, will be directly delivered.