Jan 182008

A route describes the gateway IP address and network interface to use when sending packets to a network. The routing table on a host holds a list of destination networks and the routes to those networks. This recipe describes adding entries to this routing table that will not persist following a reboot. These temporary routes are useful during troubleshooting or when making changes to the network topology.

If you want to add static route you need to use route command

route syntax

route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]

-f : Clears the routing table of all entries that are not host routes

-p : When used with the add command, the specified route is added to the registry and is used to initialize the IP routing table whenever the TCP/IP protocol is started.

Command : Specifies the command you want to run.





mask Netmask : Specifies the netmask

Gateway : Specifies the forwarding or next hop IP address over which the set of addresses defined by the network destination and subnet mask are reachable.

metric Metric : Specifies an integer cost metric (ranging from 1 to 9999) for the route, which is used when choosing among multiple routes in the routing table that most closely match the destination address of a packet being forwarded.

if Interface : Specifies the interface index for the interface over which the destination is reachable.


To display the entire contents of the IP routing table, type:

route print

To display the routes in the IP routing table that begin with 10., type:

route print 10.*

To add a default route with the default gateway address of, type:

route add mask

To add a route to the destination with the subnet mask of and the next hop address of, type:

route add mask

To add a persistent route to the destination with the subnet mask of and the next hop address of, type:

route -p add mask

To add a route to the destination with the subnet mask of, the next hop address of, and the cost metric of 7, type:

route add mask metric 7

To add a route to the destination with the subnet mask of, the next hop address of, and using the interface index 0×3, type:

route add mask if 0×3

To delete the route to the destination with the subnet mask of, type:

route delete mask

To delete all routes in the IP routing table that begin with 10., type:

route delete 10.*

To change the next hop address of the route with the destination of and the subnet mask of from to, type:

route change mask

Incoming search terms:

  18 Responses to “How to Add Static route in Windows XP/2000/Vista”

  1. I’ve always wondered HOW exactly one is to determine the interface index, and WHY exactly microsoft decided to implement their rout command in such a silly way as to require it….have yet to see an answer to those questions on any website

  2. XP can choose the right interface by using the gateway you gave in the route command.

    However, to get interface index just type “print route” at the command prompt and read the interface index from the interface list which will be printed. (Dont include the quotes!)

    Step by Step Instructions:
    1. Click Start button and then select run
    2. Type command
    3. At the command prompt, type “route print”

  3. I am connecting to internet over the wireless and connecting to my lan over the local connection. The Ip assigned to my internet modem already exist on my Lan and cannot be changed and my ISP also insisted that they cannot change the ip on the modem. What do i do to solve this problem. what i do right now is I remove the lan cable to be able to use internet and vice versa. But that is too tasking.

  4. The “route” command is a powerful command however many users will find it challenging if used with vista, not because it is a difficult task, but because vista requires you to be something more than an administrator.

    Another reason why Vista is crap.

  5. I was wondering how you make this permanent, like so i don’t have to type it every time i startup my computer.

  6. Scott. Type a /p at the end to make it persistant

  7. Just a couple of corrections:
    To see the current routes on a Windows computer use:
    route print (not print route)
    To make a route entry permanent (persistent)
    use a -p just after the word route in the command
    (not /p)
    route -p ADD MASK

  8. I am trying to add routes to a bridge interface in a Windows 7 machine as the routes for the non-shared link dont appear without some assistance despite the info I have found to date which states the contrary. It adds the shared interface connection as a default route but not the other link which ensures traffic returning down that link is not getting there. I have tried configuring an IP address from the non-shared link network on the bridge interface itself. This allows traffic from the bridged device down the non-shared link but devices at the end of this link initiate and pass through the bridged connection to use the shared link due to no return path to them appearing in the bridging devices route table.

    So manually trying to add a route to the non-shared link after entering the following command I get the following message and no action:

    route -p ADD MASK
    The requested operation requires elevation.

    Would appreciate any suggestions on what it is suggesting I do. Or if I am barking up the wrong tree completely… Thanks

  9. Dear All,

    Windows 7 issue is resolved. We are now able to add multiple static route in windows 7.

    I found the process in the below link:


  10. Click with the right button on the “Command Prompt” icon, then select “Run as Administrator”

  11. “Some One” – route print * gives the interface indexes at the top.

  12. The above are much helpful.

    I have an environment which need gateway to be
    How to add it as the persistent route.

    Destination : 10.2xx.xx.x
    mask –
    gatway –

    How to achieve this?

  13. ip address-

    subnet mask-


    how to route add

  14. Hi,

    i have this funny messages popping up if i route add an ip in windows vista.
    please can you help me with command.

  15. I have Connected 2 Networks in my Laptop

    Wireless Network Card –,,
    Lan card – , ,

    When i connected simultaneously i cant ping one of the netowrok , so how can add a route ,
    Please do explain about Metric value and interface


  16. i type the same command but its not working
    route add metric 2 but it will display bad argument
    suggest me
    since my lan network is on and getway ip is

    • You forgot the “mask” command:

      You had: route add metric 2
      It should be: route add mask metric 2

  17. I think I am close but can’t quite get there.
    I have AT&T U-verse with its “Residential Gateway” at It has limited physical LAN ports and can’t seem to handle more than 5 WiFi connections at once. So I have 2 routers connected the the LAN ports of One router is for kids gaming, laptops, DVD, TV, etc. The 2nd router is for my home business.
    / \

    I would like to reach PCs and a printer on 192.168.2.x network via 192.168.3.x network
    In Windows 7 on 192.168.3.x network I added the following route but still cannot ping/reach the 192.168.2.x network
    route -p add mask

    I tried several variations of the above command and cannot reach 192.168.2.x network.

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>