How to add a static route to the Windows Routing Table

Did you know that your router isn’t the only device with a routing table?

Yup, any device that relies on TCP/IP for network communications has a routing table – including Windows.

Go ahead and open a command prompt (Windows Key + x + c) and type:

route print

Using route print in Windows

The output is divided into three sections:

  • Interfaces List
  • IPv4 Route Table
  • IPv6 Route Table

The Interfaces List enumerates all your interfaces by MAC address and the next two sections list your dynamic and persistent routes for IPv4 and IPv6.

Each line under Active Routes is a TCP/IP route to a network or a specific device on the network.

To add a route we use the route ADD command to tell Windows which Network to add and then we enter the Subnet mask and Gateway.

But why would you ever add a static route in the first place?  People often add static routes when troubleshooting routing related problems.  For example, maybe you can’t ping a workstation from a server or perhaps can successfully ping that workstation but the ICMP echo reply chronically times out.  Sometimes we can isolate networking problems like this by manually entering a known route.  That’s where static routes come in.

So let’s say we’re on the 10.255.70.0 network and the default gateway is 10.255.70.1 and we want to add static route to our management VLAN located on the 172.10.3.0 network.

Assuming our subnet mask is 255.255.248.0 we could add the route like this:

route ADD 172.10.3.0 MASK 255.255.248.0 10.255.70.1

The format is as follows:

route ADD this network with this mask via this gateway IP.

The only drawback to this method is that after you reboot your static route will go poof!

In order to make it stay we need to make it persistent with the -p modifier.  So just add a -p to the end of the route and it’ll be permenent.

route ADD 172.10.3.0 MASK 255.255.248.0 10.255.70.1 -p

If later you decide to remove the static route, you can use route DELETE followed by the destination network IP.

route DELETE 172.10.3.0

That’s it for now!

About

Connect with Vonnie on Twitter

Posted in Windows, Windows 7, Windows 8, Windows 8.1, Windows Vista Tagged with: ,
  • Joltin Joe

    We are using OpenVpn, when the user connects he can not see any of the servers. IP range for VPN = 192.168.102.XXX the servers are 192.168.2.XXX is this a case where I need a static route? Sorry networking is not my strong suit. OpenVPN is running on our corporate FW.

    • Raboebie

      A very late response and I assume you probable solved this issue by now (I hope). In any case, no you won’t a static route. You must create an allow rule on your firewall to route the traffic from the OpenVPN server to the correct IP/Subnets

  • Muawia Yasin

    Hi,

    i want to route between my interfaces, I’m connecting to two networks through my wireless and my Ethernet,
    for example i want to route any request for 172.16.4.0/24 through my Wireless interface, and any other 0.0.0.0 to my Ethernet, is it possible to do?? and could you please explain how to do it ?

    thanks