Partager via


IP routing

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

IP routing

In general terms, routing is the process of forwarding packets between connected networks. For TCP/IP-based networks, routing is part of Internet Protocol (IP) and is used in combination with other network protocol services to provide forwarding capabilities between hosts that are located on separate network segments within a larger TCP/IP-based network.

IP is the mailroom of the TCP/IP protocol, where IP data sorting and delivery take place. Each incoming or outgoing packet is called an IP datagram. An IP datagram contains two IP addresses: the source address of the sending host and the destination address of the receiving host. Unlike hardware addresses, the IP addresses within a datagram remain the same as it travels across a TCP/IP network.

Routing is the primary function of IP. IP datagrams are exchanged and processed on each host by using IP at the Internet layer.

Above the IP layer, transport services on the source host pass data in the form of TCP segments or UDP messages to the IP layer. The IP layer assembles IP datagrams with source and destination address information that is used to route the data through the network. The IP layer then passes datagrams down to the network interface layer. At this layer, data-link services convert IP datagrams into frames for transmission over network-specific media on a physical network. This process happens in reverse order on the destination host.

Each IP datagram contains a source and destination IP address. IP layer services on each host examine the destination address of each datagram, compare this address to a locally maintained routing table, and then decide what further forwarding action to take. IP routers are attached to two or more IP network segments that are enabled to forward packets between them. The following sections discuss IP routers and the use of routing tables in further detail.

IP routers

TCP/IP network segments are interconnected by IP routers, which are devices that pass IP datagrams from one network segment to another. This process is known as IP routing and is shown in the following illustration.

IP routing

IP routers provide the primary means of joining together two or more physically separated IP network segments. All IP routers share two essential characteristics:

  • IP routers are multihomed hosts.

    A multihomed host is a network host that uses two or more network connection interfaces to connect to each physically separated network segment.

  • IP routers provide packet forwarding for other TCP/IP hosts.

    IP routers are distinct from other hosts that use multihoming in one important way: an IP router must be able to forward IP-based communication between networks for other IP network hosts.

You can implement IP routers by using a variety of possible hardware and software products. Box-based routers--dedicated hardware devices that run specialized software--are common. In addition, you can use routing solutions that are based on software, such as the Routing and Remote Access service.

For information about IP routing with the Routing and Remote Access service, see Routing.

Regardless of the type of IP routers that you use, all IP routing relies on the use of a routing table to communicate between network segments.

Routing tables

TCP/IP hosts use a routing table to maintain knowledge about other IP networks and IP hosts. Networks and hosts are identified by using an IP address and a subnet mask. In addition, routing tables are important because they provide needed information to each local host regarding how to communicate with remote networks and hosts.

For each computer on an IP network, you can maintain a routing table with an entry for every other computer or network that communicates with the local computer. In general, this is not practical, and a default gateway (IP router) is used instead.

When a computer prepares to send an IP datagram, it inserts its own source IP address and the destination IP address of the recipient into the IP header. The computer then examines the destination IP address, compares it to a locally maintained IP routing table, and takes appropriate action based on what it finds. The computer does one of three things:

  • It passes the datagram up to a protocol layer above IP on the local host.

  • It forwards the datagram through one of its attached network interfaces.

  • It discards the datagram.

IP searches the routing table for the route that is the closest match to the destination IP address. The most specific to the least specific route is searched for in the following order:

  • A route that matches the destination IP address (host route).

  • A route that matches the network ID of the destination IP address (network route).

  • The default route.

If a matching route is not found, IP discards the datagram.

For more information, see The IP routing table.