To display the routing table (both IPv4 and IPv6) in Windows, use the route print command. In Unix/Linux, you can just use route without any command line switches. The output displayed by the Windows and Unix/Linux commands are similar. Here’s an example from a typical Windows client computer:

C:>route print
===========================================================================
Interface List
  8 ...00 12 3f a7 17 ba ...... Intel(R) PRO/100 VE Network Connection
  1 ........................... Software Loopback Interface 1
  9 ...02 00 54 55 4e 01 ...... Teredo Tunneling Pseudo-Interface
 10 ...00 00 00 00 00 00 00 e0  isatap.{D0F85930-01E2-402F-B0FC-31DFF887F06F}
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.1    192.168.1.110    276
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.1.0    255.255.255.0         On-link     192.168.1.110    276
    192.168.1.110  255.255.255.255         On-link     192.168.1.110    276
    192.168.1.255  255.255.255.255         On-link     192.168.1.110    276
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link     192.168.1.110    276
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link     192.168.1.110    276
===========================================================================
Persistent Routes:
  Network Address          Netmask  Gateway Address  Metric
          0.0.0.0          0.0.0.0      192.168.1.1  Default
===========================================================================
IPv6 Route Table
===========================================================================
Active Routes:
 If Metric Network Destination      Gateway
  9     18 ::/0                     On-link
  1    306 ::1/128                  On-link
  9     18 2001::/32                On-link
  9    266 2001:0:4136:e38c:2c6c:670:3f57:fe91/128
                                    On-link
  8    276 fe80::/64                On-link
  9    266 fe80::/64                On-link
 10    281 fe80::5efe:192.168.1.110/128
                                    On-link
  8    276 fe80::cca:9067:9427:a911/128
                                    On-link
  9    266 fe80::2c6c:670:3f57:fe91/128
                                    On-link
  1    306 ff00::/8                 On-link
  9    266 ff00::/8                 On-link
  8    276 ff00::/8                 On-link
===========================================================================
Persistent Routes:
  None
C:>

For each entry in the routing table, five items of information are listed:

  • The destination IP address

    Actually, this is the address of the destination subnet, and must be interpreted in the context of the subnet mask.

  • The subnet mask that must be applied to the destination address to determine the destination subnet

  • The IP address of the gateway to which traffic intended for the destination subnet will be sent

  • The IP address of the interface through which the traffic will be sent to the destination subnet

  • The metric, which indicates the number of hops required to reach destinations via the gateway

Each packet that’s processed by the computer is evaluated against the rules in the routing table. If the packet’s destination address matches the destination subnet for the rule, the packet is sent to the specified gateway via the specified network interface. If not, the next rule is applied.

In this example, the computer on which the route command was executed is on a private 192.168.1.0 subnet. The computer’s IP address is 192.168.1.100, and the default gateway is a router at 192.168.1.1.

Here’s how the rules shown in this example are used. Notice that you have to read the entries from the bottom up:

  • The first rule is for packets sent to 255.255.255.255, with subnet mask 255.255.255.255. This special IP address is for broadcast packets. The rule specifies that these broadcast packets should be delivered to the local network interface (192.168.1.100).

  • The next rule is for packets sent to 192.168.1.255, again with subnet mask 255.255.255.255. These are also broadcast packets and are sent to the local network interface.

  • The next rule is for packets sent to 192.168.1.100, again with subnet mask 255.255.255.255. This is for packets that the computer is sending to itself via its own IP address. This rule specifies that these packets will be sent to the local loopback interface on 127.0.0.1.

  • The next rule is for packets sent to 192.168.1.0, with subnet mask 255.255.255.0. These are packets intended for the local subnet. They’re sent to the subnet via the local interface at 192.169.1.100.

  • The next rule is for packets sent to the loopback address (127.0.0.1, subnet mask 255.0.0.0). These packets are sent straight through to the loopback interface, 127.0.0.1.

  • The last rule is for everything else. All IP addresses will match the destination IP address 0.0.0.0 with subnet mask 0.0.0.0 and will be sent to the default gateway router at 192.168.1.1 via the computer’s network interface at 192.168.1.100.

One major difference between the Windows version of route and the Unix/Linux version is the order in which they list the routing table. The Windows route command lists the table starting with the most general entry and works toward the most specific. The Unix/Linux version is the other way around: It starts with the most specific and works toward the more general. The Unix/Linux order makes more sense — the Windows route command displays the routing list upside down.

About This Article

This article can be found in the category: