Nov 092007

As with the Unix,Linux and Solaris operating Systems, the route command can be used to add static routes in Windows. This should work on Windows 2000,XP,2003.

Windows Route Print command 

To view the existing routes,

C:\> route print

To add a static route,


C:\> route add <target> mask <netmask> <gateway IP> metric <metric cost> if <interface>


C:\> route add mask metric 1

Note: If there is more than one Network Interface and if the interface is not mentioned, the interface is selected based on the gateway IP.

This Static route gets erased when the system reboots. To avoid this, use the -p (Persistent) switch to the above command:

C:\> route -p add mask metric 1

This writes the persistent route to the following Windows Registry key as a string value (REG_SZ):


Also, you can write a small batch file with the route commands and add it to the startup folder to add the routes at startup (similar to the startup scripts in Solaris)

For more options like flushing the IP Routing table or to delete, modify IP Routing table entry use the route command with no arguements. This displays the various options for the route command.

C:\> route

This should help.

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

  10 Responses to “HowTo: Add persistent Static Routes in Windows”

  1. Just the info that I need. Thx.

  2. Very helpfull. Thanks

  3. please email me if i want to add static password for singale ip, my compuetr ip is and want to route this how can i do that?

  4. Great Infomation, Thank you.

  5. Thanks for that hint!
    Could have found that myself… but I didn’t read the full info/output. 😉

  6. I have one remote branch with an IP address of netmask is What is the best syntax or routing command for me to ping interanal client pc such as from our head office? My Head office had a MODEM LAN ip, and its directly connected to a router with LAN IP. Using pc, I cant ping remote modem modem but no luck to pc.Any helpfull advice?

  7. […] server routing table that points those specific ip addresses out via the secondary provider router HowTo: Add persistent Static Routes in Windows | route -p add mask metric 1 in your scenario you would […]

  8. Fantastic. The information got my job done.

  9. Thanks for the help… I had added a route without taking the print earlier and was then unable to connect to the network. I checked the files in winnt\system32\drivers\etc files but did not find anything.
    But I know where I should search (registry entries of course)!!!

 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=""> <s> <strike> <strong>