Add or remove persistent (static) routes in Microsoft Windows.

Adding a static route to your Windows routing table is pretty easy.

Just use an elevated command prompt (Run as administrator-where needed) and type the following example:

route -p add 10.11.12.13 255.255.255.255 10.11.12.14 metric 3 if 2

The “-p” argument is important if you want your route to be here when you reboot (persistent). You should be familiar with arguments “metric” and “if” if you are using this commands. A good starting point is HELP for this command. Type “route add –help”.

To check your result type “route print” and it should be under “Persistent routes” section.

 

 

 

To remove or to delete an entry, type this: “route -p delete 10.11.12.13”

 

 

The “p” argument is also important as it concerns the Persistent Routes table, otherwise it would concern the first Active route table.

Another trick to check and edit your persistent routes is through the system registry.

In your regeditor follow this path:

HKEY_LOCAL_MACHINE->SYSTEM->CurrentControlSet->

->Services->Tcpip->Parameters->PersistentRoutes

After any change that includes your network connection check that its settings are not changed (i.e. gateway).

When you are editing your routes just be sure they are not on a remote machine because you could get easily cut off:)

Join the Conversation

6 Comments

  1. Hi,

    I configure a HP StoreEasy with windows server 2012.
    I have 2 network (“production” and “backup”), i add a static route in backup network but when i test a backup network with a tracert command the packets pass by my production gateway (production network).
    Do you have an idee ?

    1. Hello! Could you send a route print output? This sounds like a metric issue and what does arp -a output say for the backup gateway? You can try by removing the default route and then adding it with the metric of 1.

  2. Hi Tino,

    Windows server 2012 r2 with virtual machines also win 2012 r2

    I am assigning pubic ip’s to the virtual machine like:
    route add xxx.xxx.xxx.xxx/32 192.168.1.1 IF 14 –p
    where xxx.xxx.xxx.xxx is a public ip

    However if I restart the Host, the routes ( persistant ) still exist in route print but aren’t working.
    I need to delete the routes and add manually again before I have a connection the the virtual servers again.
    Do you have any clue how to fix this ?

    Greetz Peter

  3. Ive added a huge range via the registry key but they are not showing in route print. Can persistent routes be added via the registry or just route add in command line?

  4. Doesn’t the subnet mask in the route add command have to have the word “mask” preceding it?

    route -p add 10.11.12.13 MASK 255.255.255.255 10.11.12.14 metric 3 if 2

Leave a comment

Your email address will not be published. Required fields are marked *

Visit Us On LinkedinVisit Us On Google PlusCheck Our Feed