Q. When I add a static IP route, what value do I use for the interface?

Learn which value to use for the interface when adding a static IP route. Related:  IP Configuration Selection and Windows Interface ChangesTo view the routing table on your system, open a command prompt and type

John Savill

November 4, 2002

2 Min Read
Q. When I add a static IP route, what value do I use for the interface?

A. The Windows IP subsystem uses IP configuration information (e.g., subnets, gateways) to automatically create a routing table that dictates how the OS will send IP packets to other host systems.

Related:  IP Configuration Selection and Windows Interface Changes

To view the routing table on your system, open a command prompt and type

route print 

You'll see a routing table similar to the following sample table:

 

=======================================================================Interface List0x1 ........................... MS TCP Loopback interface0x2 ...00 10 a4 8b 4b 8e ...... Intel(R) PRO/100+ MiniPCI - Packet Scheduler Miniport0x4 ...44 45 53 54 42 00 ...... Nortel IPSECSHM Adapter - Packet Scheduler Miniport0x20003 ...00 04 5a 0c 96 db ...... Instant Wireless - Network PC CARD #2 - Packet Scheduler Miniport==============================================================================================================================================Active Routes:Network Destination     Netmask       Gateway     Interface Metric        0.0.0.0         0.0.0.0   192.168.1.1 192.168.1.100     30      127.0.0.0       255.0.0.0     127.0.0.1     127.0.0.1     1    192.168.1.0   255.255.255.0 192.168.1.100 192.168.1.100     30  192.168.1.100 255.255.255.255     127.0.0.1     127.0.0.1     30  192.168.1.255 255.255.255.255 192.168.1.100 192.168.1.100     30      224.0.0.0       240.0.0.0 192.168.1.100 192.168.1.100     30255.255.255.255 255.255.255.255 192.168.1.100             2     1255.255.255.255 255.255.255.255 192.168.1.100 192.168.1.100     1255.255.255.255 255.255.255.255 192.168.1.100             4     1Default Gateway:       192.168.1.1=======================================================================Persistent Routes:None

Occasionally, the automatically generated routing table will be inaccurate and you might want to use the Route Add command to force a particular route for some IP traffic. You can obtain information about this command by typing

route /?

at the command prompt, but the basic syntax is

route [-p] add  mask   metric  if 

For example,

route -p add 0.0.0.0 mask 0.0.0.0 192.168.1.1 metric 1 if 0x20003

This sample command uses the -p option to add a persistent route (i.e., 0.0.0.0) that will still be in place, even after a reboot, to all destinations. This persistent route will use the 192.168.1.1 gateway with the highest priority (i.e., metric 1) on interface 0x20003 (i.e., wireless network). The last piece of this information is the interface. Determining which value to use for the interface can sometimes be confusing. Basically, you use the Interface List value that appears in the first part of the routing table. In the sample table above, the valid values are 0x1, 0x2, 0x4, and 0x20003. Although this information is easy to obtain, the first part of the routing table often scrolls off screen, leaving users unsure of what value to use.

Learn more: Managing IP Routes Through WMI

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like