The Route Table

Even a single-homed TCP/IP host has to make routing decisions. The route table controls these routing decisions. You can display the route table by typing route print at the command prompt. The following is an example route table from a single-homed machine. Windows NT automatically builds this simple route table based on the IP configuration of your host.


Network Address Netmask Gateway Address Interface Metric 0.0.0.0 0.0.0.0 172.16.16.1 172.16.48.169 1 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1 172.16.16.0 255.255.248.0 172.16.16.169 172.16.16.169 1 172.16.48.169 255.255.255.255 127.0.0.1 127.0.0.1 1 172.16.255.255 255.255.255.255 172.16.48.169 172.16.48.169 1 224.0.0.0 224.0.0.0 172.16.48.169 172.16.48.169 1 255.255.255.255 255.255.255.255 172.16.48.169 172.16.48.169 1

Network Address

The network address in the route table is the destination address. The network address column can contain:

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 is significant (must match) and a 0 need not match. For example, a 255.255.255.255 mask is used for a host entry.

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, the network address 172.16.48.0 has a netmask of 255.255.192.0. This netmask means that the first two octets must match exactly, the first 2 bits of the third octet must match (192=11000000), and the last octet does not matter. Because 18 in the decimal number system is equivalent to 00110000 in binary, a match would have to start with 0011. Thus, any address of 172.16 and the third octet of 48 through 255 (255=11111111) will use this route. This is a netmask for a subnet route and is therefore called the subnet mask.

Gateway Address

The gateway address is where the packet needs to be sent. This can be the local network card or a gateway (router) on the local subnet.

Interface

The interface is the address of the network card over which the packet should be sent out. 127.0.0.1 is the software loopback address.

Metric

The metric is the number of hops to the destination. Anything on the local LAN is one hop, and each router crossed after that is an additional hop. The metric is used to determine the best route.

Multihomed Router

The following is the default route table of a multihomed Windows NT host:

Network Address

Netmask

Gateway Address

Interface

Metric

0.0.0.0

0.0.0.0

172.16.24.1

172.16.24.193

1

0.0.0.0

0.0.0.0

172.16.40.1

172.16.40.139

1

127.0.0.0

255.0.0.0

127.0.0.1

127.0.0.1

1

172.16.24.0

255.255.248.0

172.16.24.193

172.16.24.193

1

172.16.24.193

255.255.255.255

127.0.0.1

127.0.0.1

1

172.16.40.0

255.255.255.0

172.16.40.139

172.16.40.139

1

172.16.40.139

255.255.255.255

127.0.0.1

127.0.0.1

1

172.16.40.255

255.255.255.255

172.16.40.139

172.16.40.139

1

224.0.0.0

224.0.0.0

172.16.24.193

172.16.24.193

1

224.0.0.0

224.0.0.0

172.16.40.139

172.16.40.139

1

255.255.255.255

255.255.255.255

172.16.40.139

172.16.40.139

1


To enable routing, check Enable IP Forwarding on the Routing tab of the Microsoft TCP/IP Properties dialog box. At this point, Windows NT will route between these two subnets.

A note on default gateways: in the TCP/IP configuration, you can add a default route for each network card. This will create a 0.0.0.0 route for each. However, only one default route will actually be used. In this case, the 199.199.40.139 is the first card in the TCP/IP bindings, and therefore the default route for this card is used. Because only one default gateway will be used, configure only one card to have a default gateway. This will reduce confusion and ensure the results you intended.

If the Windows NT router does not have an interface on a given subnet, it will need a route to get there. This can be done by adding static routes or by using MPR.

Adding a Static Route

The following is an example route.


Route Add 199.199.41.0 mask 255.255.255.0 199.199.40.1 metric 2

The route in this example means that to get to the 199.199.41.0 subnet with a mask of 255.255.255.0, use gateway 199.199.40.1, and that the gateway is 2 hops away. A static route will also need to be added on the next router, telling it how to get back to subnets reachable by the first router. With a network of a few routers or more, static routes can become very complicated.