Windows – Choosing gateway based on Source IP in Windows

networkingnicroutingwindows

So here is the scenario

I have one NIC configured with two ips and two gateways for two diff networks.
Consider the gateway/subnet are 192.168.0.1/24 and 192.168.1.1/24. If connection is initiated from my NIC IP 192.168.0.100 it needs to go through 192.168.0.1 and likewise.

But to my understanding routes are chosen based on destination. I would like to know if the vice versa is possible in windows 7. I went through few threads.

  1. Rules based gateway selection under Windows This is pretty much opposite of what i need
  2. Routing decision when there are two default gateways on windows Thats with two NICs which I know is possible by specifying NIC when I add a static route

Any help would be appreciated.

Regards,
Siva R

Best Answer

What you're looking for has two possible methods of achieving.

First is Policy-Based Routing, when a next-hop choice is made by some policy. For example this may be a route-map or simple a packet filter forwarding a packet to gateway basing on it's IP header fields values.

Second is multiple FIB support. It's when an IP stack of the operating system has multiple Forward Information Base tables, simply speaking - routing tables. Using this method, packets are marking as belonging to multiple FIBs basing on their IP header values or basing on their source interface. Then the packet is forwarded accordingly to is routing table. And yes, multiple routing tables can have different gateways, including different default gateway.

So far none of these techniques isn't available in Windows. Simply because Windows just isn't a modern network OS.

I'd recommend using an intermediary router that is capable of doing this with any of the two methods I described.

Related Topic