Windows – Default Route Configuration by IP Range

ciscoroutingsubnetwindows

I have a scenario where I need responses on a certain range of addresses to go out through one default route and another to go out through another but don't know how to setup the route add commands to configure each range. Here is the scenario:

  • Default gateway is 192.168.1.250
  • 192.168.1.0-99 default route is 192.168.1.251
  • 192.168.1.100-199 default route is 192.168.1.252

In basic terms I don't know how you define a range within a subnet using the subnet mask etc?

EDIT: To clarify purpose…

My implementation scenario is that basically traffic comes in from one of two firewalls to the same device, the traffic from firewall A goes to the lower range, and the traffic from firewall B goes to the upper range but the response needs to go back to the corresponding firewall through which the traffic was received. I have been told the way to achieve this is through route commands.

Firewall devices are Cisco, the servers where the route commands will be set are Windows 2003.

Best Answer

You can't split your subnet at the ip address boundary you've listed in your question but you can try to split it at the subnet mask bit boundary in the routing table of each server by creating the following routes on each server:

  1. route add 192.168.1.0 mask 255.255.255.128 "ip address of lower range firewall"

  2. route add 192.168.1.128 mask 255.255.255.128 "ip address of upper range firewall"

This means that the "lower range" firewall will need to have an ip address between 192.168.1.1 and 192.168.1.126 (.0 and .127 being unusable) and the "upper range" firewall will need to have an ip address between 192.168.1.129 and 192.168.1.254 (192.168.1.128 and 192.168.1.255 being unusable). Because each of these routes is more specific than the route to the default gateway on each server (0.0.0.0), these routes will have a lower metric and should thus be preferred over the default gateway route on each server. This should force each server to use these routes for traffic destined to the appropriate "range" of addresses.

From the perspective of the routing table, there are two subnets: 192.168.1.0/25 and 192.168.1.128/25.

I've just tried this on my Windows 7 computer and it seems to work, although I"ve never done this in a real scenario.