Windows 7: how can I add an IP range in the “route” command?

I’m using two network connections, and I tried using the “route” command so that when I access a specific internal IP on my LAN, it would use connection 1, anything else would go normally through connection 2 (which doesn’t have access to my LAN).

The problem is I have a bunch of internal IP’s that I need to access, and the “route” command doesn’t seem to allow me to add an IP range instead of specific IP. And connection 1 doesn’t have internet access, so I can’t use it as my default connection.

Any idea how this can be solved?

Your help is appreciated

Solution:

The route command is all about routing ranges of IP.  The key to doing ranges is using the netmask portion of the route command.

Basic IP networking lesson

An IP address is a 32 bit number that represents an address on the internet.  Taken in binary, the IP address 10.0.0.1 would look like this:

10      .0       .0      .100001010 00000000 0000000 00000001

The netmask specifies which portion of the address is the fixed part of the range by specifying a binary 1, and the variable portion of the range is a 0.  So, a netmask of 255.255.255.255 represents all bits are fixed and therefore will only route the give IP.  A netmask of 0.0.0.0 means all bits are variable, or in other words this matches every IP address.  0.0.0.0 is used for the default route.  So, if you want to specify a range, you just need to specify the bits in the netmask you want to match.

If you wanted a route to apply to all the addresses from 10.0.0.0 to 10.0.0.255 your route command would look like

          Dest Ip       Netmask       Gatewayroute ADD 10.0.0.0 MASK 255.255.255.0 10.0.0.1

If you wanted a route to apply to only 10.0.0.100 and 10.0.0.103 your command would look lik    route ADD 10.0.0.100 MASK 255.255.255.252 10.0.0.1

And if you wanted a route to apply to all addresses 10.0.0.0 to 10.255.255.255 your route would look like

route ADD 10.0.0.0 MASK 255.0.0.0 10.0.0.1

You can also specify in the route command the interface it should use using the IF paramter:

route ADD 10.0.0.0 MASK 255.0.0.0 10.0.0.1 IF 2