JavaScript Editor Source code editor     Website development 

Main Page

Previous Section Next Section

Routing in TCP/IP

Routing in TCP/IP is a subject that has filled 162 RFCs (at last count) and could easily fill a dozen books. What is truly remarkable about TCP/IP routing is that it works so well. An average homeowner can call up an Internet browser and connect with a computer in China or Finland without a passing thought to the many devices forwarding the request around the world. Even on smaller networks, routers play a vital role in controlling traffic and keeping the network fast. The following sections discuss some of the concepts you'll need to be familiar with in order to understand routing in TCP/IP. The next hour discusses these concepts in greater detail.

What Is a Router?

The best way to describe a router is to describe how it looks. In its simplest form (or, at least, in its most fundamental form) a router looks like a computer with two network adapters. The earlier routers were actually computers with two or more network adapters (called multihomed computers). Figure 9.5 shows a multihomed computer acting as a router.

Figure 9.5. A multihomed computer acting as a router.


The first step to understanding routing is to remember that the IP address belongs to the adapter and not to the computer. The computer in Figure 9.5 has two IP addresses—one for each adapter. In fact, it is possible for the two adapters to be on completely different IP subnets corresponding to completely different physical networks (as shown in Figure 9.5). In Figure 9.5, the protocol software on the multihomed computer can receive the data from segment A, check the IP address information to see whether the data belongs on segment B, replace the Network Access layer header with a header that provides physical address information for segment B (if the data is addressed to segment B), and transmit the data onto segment B. In this simple scenario, the multihomed computer acts as a router.

If you really want to understand the scope of what the world's networks are doing, imagine the scenario in the preceding paragraph with the following complications:

  • The router has more than two ports (adapters) and can therefore interconnect more than two networks. The decision of where to forward the data then becomes more complicated, and the possibility for redundant paths increases.

  • The networks that the router interconnects are each interconnected with other networks. In other words, the router sees network addresses for networks to which it is not directly connected. The router must have a strategy for forwarding data addressed to networks to which it is not directly attached.

  • The network of routers provides redundant paths, and each router must have a way of deciding which path to use.

The simple configuration in Figure 9.5, combined with the preceding three complications, offers a more detailed view of the router's role (see Figure 9.6).

Figure 9.6. Routing on a complex network.


On today's networks, most routers are not multihomed computers. It is more cost effective to assign routing responsibilities to a specialized device. The routing device is specifically designed to perform routing functions efficiently, and the device does not include all the extra features found in a complete computer.

Introduction to Routing

Building on the discussion of the simple router described in the preceding section, a more general description of the router's role is as follows:

  1. The router receives data from one of its attached networks.

  2. The router passes the data up the protocol stack to the Internet layer. In other words, the router discards the Network Access layer header information and reassembles (if necessary) the IP datagram.

  3. The router checks the destination address in the IP header. If the destination is on the network from whence the data came, the router ignores the data. (The data presumably has already reached its destination because it was transmitted on the network of the destination computer.)

  4. If the data is destined for a different network, the router consults a routing table to determine where to forward the data.

  5. After the router determines which of its adapters will receive the data, it passes the data down through the appropriate Network Access layer software for transmission through the adapter.

The routing process is shown in Figure 9.7. It might occur to you that the routing table described in step 4 is a rather crucial element. In fact, the routing table and the protocol that builds the routing table are distinguishing characteristics of the router. Most of the discussion of routers is about how routers build routing tables and how the route protocols that assemble routing table information cause the collection of routers to serve as a unified system.

Figure 9.7. The routing process.


The two primary types of routing are named for where they get their routing table information:

  • Static routing Requires the network administrator to enter route information manually.

  • Dynamic routing Builds the routing table dynamically based on routing information obtained using routing protocols.

Static routing can be useful in some contexts, but as you might guess, a system that requires the network administrator to enter routing information manually has some severe limitations. First, static routing does not adapt well to large networks with hundreds of possible routes. Second, on all but the simplest networks, static routing requires a disproportionate investment of time from the network administrator, who must not only create but also continually update the routing table information. Also, a static router cannot adapt as quickly to changes in the network, such as a downed router.

By the Way

Most dynamic routers give the administrator the option of overriding dynamic route selection and configuring a static path a specific address. Preconfigured static routes are sometimes used for network troubleshooting. In other cases, the administrator might provide a static path to take advantage of a fast network connection or to balance network traffic.

Routing Table Concepts

It is best to focus on a few important concepts before continuing with the discussion of dynamic routing protocols. The role of the routing table and other Internet layer routing elements is to deliver the data to the proper local network. After the data reaches the local network, network access protocols will see to its delivery. The routing table, therefore, does not need to store complete IP addresses and can simply list addresses by network ID. (See Hours 4 and 5 for a discussion of the host ID and network ID portions of the IP address.)

The contents of an extremely basic routing table are as shown in Figure 9.8. A routing table essentially maps destination network IDs to the IP address of the next hop—the next stop the datagram makes on its path to the destination network. Note that the routing table makes a distinction between networks directly connected to the router itself and networks connected indirectly through other routers. The next hop can be either the destination network (if it is directly connected) or the next downstream router on the way to the destination network. The Router Port Interface in Figure 9.8 refers to the router port through which the router forwards the data.

Figure 9.8. The routing table.


The next hop entry in the routing table is the key to understanding dynamic routing. On a complex network, several paths to the destination might exist, and the router must decide which of these paths the next hop will follow. A dynamic router makes this decision based on information obtained through routing protocols.

By the Way

A host computer, like a router, can have a routing table; because the host does not have to perform routing functions, its routing table usually isn't as complicated. Hosts often make use of a default router or default gateway. The default gateway is the router that receives the datagram if it can't be delivered on the local network or to another router.

    Previous Section Next Section

    JavaScript Editor Source code editor     Website development