April 30, 2014

How to add a static route in Windows 7

If you need to access internet /intranet resources on another network the easiest way to go around it is to add a route to your windows routing table. In windows based systems a simple syntax command will enable you do this easily.

Having used windows XP for a long time, adding a route was easy as taking candy from a kid but coming to windows 7 I had issues adding routes. I even thought the route command syntax must have changed on windows 7. But after a bit of try and error I finally managed to add a route to my routing table.

To add a route in windows you need to run a command on windows command prompt window (DOS)

Windows XP

To add a route in Windows XP, open the command prompt window

Start button go to Run, type cmd and press Enter/click Run

The window below appears

On the command prompt window type route print

This will display all the routes currently available on your system

If the route you need is not on the list this is how to add a temporally route
route add mask

Eg
route add 172.16.8.0 mask 255.255.255.0 172.16.1.250

(172.16.8.0 is the subnet I want to reach, 255.255.255.0 is a /24 subnet mask of the destination I want to reach while 172.16.1.250 is my gateway).

Press enter and the route is added to the routing table.

To make a route permanent i.e. a route that will always be there even after rebooting the PC add –p to the command above i.e.

route add 172.16.8.0 mask 255.255.255.0 172.16.1.250 –p

The route will be added on the routing table under persistent routes.

Well at times we do make mistakes and need to amend them, if by any chance you need to delete a route the command is

route delete
eg.
route delete 172.16.8.0

Windows 7

To add a route in windows 7 is exactly the same as in windows XP, same commands are used.

But here’s the catch, windows 7 has high user restrictions. This remits the ability to tamper with critical windows files which is good for general users but it’s a big minus when it comes to technical users. To add route to on a Win7 system you need to run the command prompt window with administrative rights.

Adding a route without admin rights will give you an error “The requested operation requires elevation”. I don’t understand why Microsoft could not simply display the error as “The requested operation requires administrative rights” or something closer to that.

To open the command prompt window with administrative rights go to

Start button, type cmd on the search combo box

A pop up list will appear with the cmd window as the first item on the Jump list.

Right click on the cmd icon and click, Run as administrator

The command prompt window should appear as below. Note the word 'Administrator' on the top bar.

With this you can add, delete and print routes just as it’s done on windows XP.

All the best as you route your network.
Posted 14th January 2013 by james mugambi
©