Routing table manipulation in Windows

Updated on 28th July 2015

In computer networking terms, routing is the process of forwarding TCP/IP packets between hosts that are connected to multiple IP networks. A host computer decides the best route for a packet with the help of a routing table. Routing table contains a default set of routes that are created when TCP/IP is started on a computer and based on that computers TCP/IP configuration.

The routes can be any of the following three type

  1. Network Route: A route to a specific destination network
  2. Host Route: A route to a specific host in the network
  3. Default route: A route that is used when no other route matches the destination address

The routing table of a host running Windows 7 contains the following fields

  • Network Destination
  • Netmask
  • Gateway
  • Interface
  • Metric

Depending on the type of route, the network destination can be a network address with host bits set to 0 (Network route), a host IP address (Host Route) or (Default route).

Netmask is the subnet mask used with Network destination to match the destination address.

Gateway is the IP address of the node used to forward the packet to other IP networks.

Interface is the address of the local network interface used to forward the IP packets.

Metric is an integer value between 1 to 9999 that indicates the cost for the route. When there are multiple routes for a destination, the route with the lowest metric is chosen.

When a computer needs to forward a packet it checks the routing table for an entry that matches the packets destination address and use the corresponding route. If a match for the destination address is not found then the default route is used which normally forwards the packet to default gateway of the local subnet.

On a Windows system you can use the route command to view and manipulate routing table. When used without parameters the route command displays the help. To dispaly all the contents of a routing table, open command prompt and type the command

C:\> route print
Interface List
 15...00 ff 10 83 ed 09 ......Juniper Network Connect Virtual Adapter
 19...10 0b a9 d1 e4 34 ......Intel(R) Centrino(R) Advanced-N 6205 #5
 13...b4 12 4c 13 2c de ......Intel(R) 82579LM Gigabit Network Connection
 11...10 2d f4 54 e0 5f ......Bluetooth Device (Personal Area Network)
  1...........................Software Loopback Interface 1
 21...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
 22...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
 23...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
 25...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #4
 24...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface

IPv4 Route Table
Active Routes:
Network Destination        Netmask          Gateway       Interface   Metric
       25         On-link        1         On-link      257         On-link      306         On-link      306         On-link      306         On-link      306         On-link      281         On-link      306         On-link      257         On-link      281
Persistent Routes:

Adding routes for network traffic segregation

In scenarios where you have multiple network interfaces connected to different networks, adding routes to the host's routing table is necessary to forward the packets to the correct network. To add a static route to the routing table run the route command as below:

route add destination mask subnetmask gateway if interface

Where destination is the IP address of host or network, subnetmask is the mask for the route entry and interface is the interface number of the interface to be used for that route. For example to add a static route to network with subnet mask and gateway address, type the command

route add mask IF 19

To make a static route permanent you can use the -p option when adding the route.

To delete a route, run the route delete command as below

route delete destination

For example, to delete the route that you added above

route delete

Post a comment


Your Comment

Email (We dont publish it)


Nothing the first to share wisdom.