Partilhar via


The IP routing table

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

The IP routing table

Every computer that runs TCP/IP makes routing decisions. These decisions are controlled by the IP routing table. To display the IP routing table on computers running Windows Server 2003 operating systems, you can type route print at a command prompt.

The following table shows an example of an IP routing table. This example is for a computer running Windows Server 2003, Standard Edition with one 10 megabit/second (Mbit/s) network adapter and the following configuration:

  • IP address: 10.0.0.169

  • Subnet mask: 255.0.0.0

  • Default gateway: 10.0.0.1

Description Network destination Netmask Gateway Interface Metric

Default route

0.0.0.0

0.0.0.0

10.0.0.1

10.0.0.169

30

Loopback network

127.0.0.0

255.0.0.0

127.0.0.1

127.0.0.1

1

Local network

10.0.0.0

255.0.0.0

10.0.0.169

10.0.0.169

30

Local IP address

10.0.0.169

255.255.255.255

127.0.0.1

127.0.0.1

30

Multicast addresses

224.0.0.0

240.0.0.0

10.0.0.169

10.0.0.169

30

Limited broadcast address

255.255.255.255

255.255.255.255

10.0.0.169

10.0.0.169

1

Note

  • The descriptions in the first column of the preceding table are not actually displayed in the output of the route print command.

The routing table is built automatically, based on the current TCP/IP configuration of your computer. Each route occupies a single line in the displayed table. Your computer searches the routing table for an entry that most closely matches the destination IP address.

Your computer uses the default route if no other host or network route matches the destination address included in an IP datagram. The default route typically forwards an IP datagram (for which there is no matching or explicit local route) to a default gateway address for a router on the local subnet. In the previous example, the default route forwards the datagram to a router with a gateway address of 10.0.0.1.

Because the router that corresponds to the default gateway contains information about the network IDs of the other IP subnets within the larger TCP/IP internet, it forwards the datagram to other routers until the datagram is eventually delivered to an IP router that is connected to the specified destination host or subnet within the larger network.

The following sections describe each of the columns displayed in the IP routing table: network destination, netmask, gateway, interface, and metric.

Network destination

The network destination is used with the netmask to match the destination IP address. The network destination can range from 0.0.0.0 for the default route through 255.255.255.255 for the limited broadcast, which is a special broadcast address to all hosts on the same network segment.

Netmask

The netmask is the subnet mask that is applied to the destination IP address when matching it to the value in the network destination. When netmask is written in binary, a "1" must match and a "0" need not match. For example, a default route uses a 0.0.0.0 netmask that translates to the binary value 0.0.0.0, so bits need not match. A host route--a route that matches an IP address--uses a 255.255.255.255 netmask that translates to the binary value 11111111.11111111.11111111.11111111, so all of the bits must match.

Gateway

The gateway address is the IP address that the local host uses to forward IP datagrams to other IP networks. This is either the IP address of a local network adapter or the IP address of an IP router (such as a default gateway router) on the local network segment.

Interface

The interface is the IP address that is configured on the local computer for the local network adapter that is used when an IP datagram is forwarded on the network.

Metric

A metric indicates the cost of using a route, which is typically the number of hops to the IP destination. Anything on the local subnet is one hop, and each router crossed after that is an additional hop. If there are multiple routes to the same destination with different metrics, the route with the lowest metric is selected.

For information about adding routes to the IP routing table, see Add a static IP route. For information about deleting routes in the IP routing table, see Remove a static IP route.

Multihomed hosts

The following shows the default routing table for a multihomed Windows Server 2003, Standard Edition host with this configuration:

  • Network adapter 1 (10 MB)

    • IP address: 10.0.0.169

    • Subnet mask: 255.0.0.0

    • Default gateway: 10.0.0.1

  • Network adapter 2 (100 MB)

    • IP address: 192.168.0.200

    • Subnet mask: 255.255.0.0

    • Default gateway: 192.168.0.1

Adapter Description Network destination Netmask Gateway Interface Metric

1

Default route

0.0.0.0

0.0.0.0

10.0.0.1

10.0.0.169

20

2

Default route

0.0.0.0

0.0.0.0

192.168.0.1

192.168.0.200

30

1

Loopback network

127.0.0.0

255.0.0.0

127.0.0.1

127.0.0.1

1

1

Local network

10.0.0.0

255.0.0.0

10.0.0.169

10.0.0.169

20

1

Local IP address

10.0.0.169

255.255.255.255

127.0.0.1

127.0.0.1

20

2

Local network

192.168.0.0

255.255.0.0

192.168.0.200

192.168.0.200

30

2

Local IP address

192.168.0.200

255.255.255.255

127.0.0.1

127.0.0.1

30

2

Subnet broadcast

192.168.0.255

255.255.255.255

192.168.0.200

192.168.0.200

30

1

Multicast address

224.0.0.0

240.0.0.0

10.0.0.169

10.0.0.169

20

2

Multicast address

224.0.0.0

240.0.0.0

192.168.0.200

192.168.0.200

30

1

Limited broadcast

255.255.255.255

255.255.255.255

10.0.0.169

10.0.0.169

1

2

Limited broadcast

255.255.255.255

255.255.255.255

192.168.0.200

192.168.0.200

1

Note

  • The descriptions in the first and second columns of the preceding table are not actually displayed in the output of the route print command.

For information about enabling IP forwarding on a multihomed computer running a Windows Server 2003 operating system, see Enable the Routing and Remote Access service.

Notes

  • When you configure a default gateway on each network adapter, you create a 0.0.0.0 route for each network adapter. However, only one default route is actually used. In the previous example, the 10.0.0.169 IP address is the first network adapter in the TCP/IP bindings, and therefore the default route for Network adapter 1 is used. Because only one default gateway is used, you only need to configure one network adapter with a default gateway. This reduces confusion and assures the results you intended.

  • If the IP router is a server running Windows Server 2003 and does not have an interface on a given network, it needs a route to get to that network. You can add static routes or use routing protocols that are provided by the Routing and Remote Access service. For information about IP routing with the Routing and Remote Access service, see Routing.