TCP/IP in Windows 2000 Professional

There are several instances where you might need to manually edit the local route table for your Windows 2000 Professional– based computer:

  • The computer has multiple network adapters (multihomed), and must access different default gateways for each adapter.
    If your computer is multihomed and has connections to two separate IP networks, such as the corporate network and the Internet, the default gateway for only one network is used. For the computer to be able to communicate with the other network, routes must be manually added to the route table.

  • The computer is multihomed, and has no access to a default gateway.
    The computer in this case must provide the routing information to send IP packets from one network to the next, because no router is provided to perform this task.

  • The required routing information is not provided by any default gateway, or a different route is wanted.

You can display the current route table to determine whether any changes are required. To see the route table for your computer, at the command prompt type route print .

The following example is a sample route table from a single-homed Windows 2000 Professional– based computer.

route print

========================================================================

Interface List

0x1 ........................... MS TCP Loopback interface

0x2000002 ...00 c0 4f 49 f3 b2 ...... 3Com EtherLink PCI (QoS Packet Scheduler)

========================================================================

========================================================================

Active Routes:

Network Destination Netmask Gateway Interface Metric

0.0.0.0 0.0.0.0 157.59.0.1 157.59.4.120 1

127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1

157.59.0.0 255.255.248.0 157.59.4.120 157.59.4.120 1

157.59.4.120 255.255.255.255 127.0.0.1 127.0.0.1 1

157.59.255.255 255.255.255.255 157.59.4.120 157.59.4.120 1

224.0.0.0 224.0.0.0 157.59.4.120 157.59.4.120 1

255.255.255.255 255.255.255.255 127.0.0.1 127.0.0.1 1

Default Gateway: 157.59.0.1

========================================================================

Persistent Routes:

None

This example shows a computer with the IP address 157.59.4.120, subnet mask of 255.255.248.0, and a default gateway of 157.59.0.1. The table contains the following seven entries:

  1. The first entry is the default route. This is the route to which the computer sends IP packets when the other route entries do not specify where to send them.

  2. The second entry is the loopback route. This is the route a host uses when sending packets to itself.

  3. The third entry is a subnet route for the locally attached subnet.

  4. The fourth entry is a host route for the local host (the route for this host computer).

  5. The fifth entry is a host route for a special type of IP broadcast address called the all-subnets directed broadcast.

  6. The sixth entry is the IP multicast route. This is the route used when the computer sends packets to reach an IP multicast group.

  7. The seventh entry is a host route for the limited broadcast address.

The following sections describe the columns shown in the Active Routes section of the net print command.

Network Address

The network address in the route table is the destination address. The network address column can have three different types of entries, listed here in the order in most to least specific.

  1. Host address (a route to a single, specific destination IP address).

  2. Subnet address (a route to a subnet).

  3. Default route (a route used when there is no other match).

If no match is found, the packets are discarded.

Netmask

The netmask defines which portion of the network address must match in order for that route to be used. When the mask is written in binary, a 1 indicates a bit that must match and a 0 indicates a bit that does not have to match.

For example, the mask of all 255s (all 1s) means that the destination address of the packet to be routed must exactly match the network address in order for this route to be used. For another example, if the network address 172.20.232.0 has a netmask of 255.255.255.0, then the first three octets must match exactly, but the last octet need not match.

Gateway Address

The gateway address is the forwarding IP address of where the packet must be sent. This can be the IP address of the host or the address of a gateway (router) on the local subnet. If the gateway address of the route is the host IP address, then the forwarding IP address is set to the destination IP address in the IP datagram.

Interface

The interface is the address of the network adapter over which the packet must be sent. 127.0.0.1 is the software loopback address.

Metric

The metric indicates the cost of the route and is commonly the number of hops to the destination. Anything on the local subnet is one hop, and each router crossed after that is an additional hop. The metric is used to determine the best route among multiple routes that most closely match the destination.

To add static routes, use the following format:

Route add < subnet > mask < netmask > < gateway > metric < metric > if < interface >

The following is an example route:

Route add 172.20.255.0 mask 255.255.255.0 172.20.234.232 metric 2 if 3

The route in this example means that to get to the subnet 172.20.255.0 with a mask of 255.255.255.0, use gateway 172.20.234.232, and that the route has a cost metric of 2 (for example, the subnet is 2 hops away), using interface 3.

Manual maintenance of route tables is error-prone. An error in one of the routes can prevent accessibility to a network location. Additionally, the status of many routes is dynamic – routers can go down or online, new routers might be added, or the metric of a route might change. Each change in the status of a route necessitates an equivalent alteration in the route table. Finally, the challenges of manually maintaining local route tables is multiplied when supporting a large number of computers in a department or enterprise.