Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 15 down vote accepted

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 would look like this:

10      .0       .0      .1
00001010 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 represents all bits are fixed and therefore will only route the give IP. A netmask of means all bits are variable, or in other words this matches every IP address. 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 to your route command would look like

          Dest Ip       Netmask       Gateway
route ADD MASK

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

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

route ADD MASK

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

route ADD MASK IF 2
share|improve this answer
Man this was EXTREMELY helpful. Thank you very very much! :D – KeyStroke Mar 21 '10 at 11:01

As you are using Windows 7, execute cmd.exe as an administrator by going to the Start Menu, typing cmd.exe in the search box, right clicking on cmd.exe, and selecting Run as administrator (or pressing Ctrl+Shift+Enter).

You will see a difference from the normal Command Prompt. Within this elevated Command Prompt you can add your static route, i.e.

route add mask -p
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .