Sie sind auf Seite 1von 3

ADDING ROUTES IN WINDOWS ROUTING TABLE

WINDOWS ROUTING TABLE

Did you know that your router isn’t the only device with a routing table? Any device that relies on
TCP/IP for network communications has a routing table – including Windows.

Go ahead and open a command prompt in elevated privileges (Run in administrator mode) and type the
following command and press enter:

This will open the windows routing table as below:


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.

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.

ADDING A STATIC ROUTE IN WINDOWS ROUTING TABLE (DYNAMIC)

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.

SYNTAX:

C:\> ROUTE ADD <TARGET IP> MASK <NETMASK> <GATEWAY IP> METRIC <METRIC COST> IF
<INTERFACE>

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:

EXAMPLE:

C:\> ROUTE ADD 172.10.3.0 MASK 255.255.248.0 10.255.70.1 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.

2
ADDING A STATIC ROUTE IN WINDOWS ROUTING TABLE (PERSISTENT)

This Static route gets erased when the system reboots. 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 permanent.

SYNTAX:

C:\> ROUTE ADD –P <TARGET IP> MASK <NETMASK> <GATEWAY IP> METRIC <METRIC COST> IF
<INTERFACE>

OR

C:\> ROUTE ADD <TARGET IP> MASK <NETMASK> <GATEWAY IP> METRIC <METRIC COST> IF
<INTERFACE> -P

Assuming our previous example above, we can make the route persistent by typing the following
command,

EXAMPLE:

C:\> ROUTE ADD –P 172.10.3.0 MASK 255.255.248.0 10.255.70.1 METRIC 1

OR

C:\> ROUTE ADD 172.10.3.0 MASK 255.255.248.0 10.255.70.1 METRIC 1 –P

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

HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\SERVICES\TCPIP\PARAMETERS\PERSIS
TENTROUTES

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

C:\> ROUTE

If you decide to remove the static route, you can use route DELETE followed by the destination network
IP to delete the route windows routing table.

C:\> ROUTE DELETE 172.10.3.0