It's true: Routers routebut that's not all they do. Despite all outward appearances, routers live complicated, hard-working lives. Routers continuously perform these functions:
Communicate information about known destinations with their neighboring routers
Discover new destinations
Compare different paths to the same destination
Select the best path to each known destination
Store that path in a table filled with other best paths
Send packets of data en route to their destination via the best known path
That sounds like quite a load for the router, and it is. Luckily for you, it's easier understanding how a router works. Start by looking at what a router is, what it does, and what it doesn't do.
|
A router is a specialized device designed to push IP packets (or other protocols' packets) through a network. Routing is actually a function that can be performed on a variety of physical platforms. A PC, for example, can be configured as a router, but it isn't a good or robust one. A software routing application can be run on a general-purpose computer such as a PC. Such routers are known as software-based routers. Cisco Systems makes a highly specialized line of routers, known as hardware-based routers, of all shapes and sizes to fit any network niche.
Regardless of its form, a router interconnects networks and regulates the flow of IP packets between those networks. For that to occur, a router must have the ability to interface with many types of physical networks.
For the purposes of routing, a network is defined as the collection of end systems and networking equipment bound by a common IP network address. Routers sit at the edge of that network and decide what to do with each packet it receives based on the IP network address in each IP packet's destination address field.
To route, a router must form the boundary, or edge, of a network so it can pass IP packets back and forth between two or more networks or subnetworks. So far, so good. What's not so clear is what a network is.
A network could be a local-area network (LAN). Ethernet has become the dominant type of LAN in the world today and is found in homes, small offices, and large enterprises. A network could also be a wide-area network (WAN). A WAN is a collection of LANs interconnected with routers, so you can think of a WAN as being a network of networks. Recall the example network in Chapter 7, "More Fun with IP Addresses," which shows how a router can create a series of subnetworks from within a single network. That's yet another example of a different type of network.
Regardless of a network's shape, a router has a paradoxical role in a network. It must simultaneously separate yet interconnect networks. Figure 11-1 illustrates this.
In Figure 11-1, you see a simple network consisting of two LANs interconnected by a small router. All share the same IP network address of 192.168.0.0/23, but that network address is subdivided into two subnetworks of equal size. The LAN on the left uses 192.168.0.0/24, which gives it host addresses that range from 192.168.0.1 to 192.168.0.255. The LAN on the right uses the other half of the /23 network, which forms the subnetwork 192.168.1.0/24. The valid host addresses in that subnetwork range from 192.168.1.0 through 192.168.1.255. The router's paradoxical job is to separate yet interconnect these two LANs.
The key to understanding the seemingly self-contradictory role and, subsequently, routing's function, is to recognize that the separation and interconnection occur at different levels.
Recall the OSI reference model mentioned throughout this book. Remember that IP operates at Layer 3the network layerof that model. LANs, such as Ethernet networks, operate at Layers 1 and 2 of that same model. Take a look at Figure 11-2, which is an abstract view of the network illustrated in Figure 11-1.
In Figure 11-2, you see that each LAN is just an OSI reference model's physical and data link layers. The router interconnects them at the network layer, but maintains separation at the physical and data link layers.
Now that you have the abstract perspective, take another look at the network itself. In Figure 11-3, you see the same network from Figure 11-1. The difference is that Figure 11-3 has dotted squares around the different network environments, indicating how a router both interconnects and separates.
By comparing Figures 11-1, 11-2, and 11-3, you can see that a router physically interconnects different networks using IP, but logically separates those networks at Layers 1 and 2. The big question is how that works.
Dig a little deeper and see how that router in routing protocol. Routing protocols, just like every other protocol in the TCP/IP family of protocols, is a highly specialized piece of software. These protocols don't run on desktop computers or other devices that humans use. Instead, they run on routers. Routing protocols enable routers to do the first five of the six critical functions identified in Table 11-1. The last function, forwarding packets, is a native function of a router's hardware and operating system and is independent of a routing protocol's presence.
There are many routing protocols and at least two schools of thought about what constitutes a best path. Focus on the mechanics of a router using the same small network used throughout this chapter; then you are ready to look at different ways to interpret the best way to get there from here!
|
The point about routers creating frames and not packets might sound like word games. Frames and packets are critically different. Both function as an envelope and carry a user's or application's data through a network, but that's where the similarities stop! Packets are persistent and are created once. Frames are only good for one link in a network.
In Figure 11-5 you see a computer connected to network 192.168.0.0/24 sending a packet addressed to a server in the 192.168.1.0/24 network. Although the computer can create an IP packet (thanks to its TCP/IP protocol stack), it cannot place the IP packet on that network. At least, it can't do that directly. The network is an Ethernet network, so it wraps that IP packet inside an Ethernet frame and places that frame on the network. That Ethernet frame is addressed to the Media Access Control (MAC) address of the router's E0 interface.
This is a subtle but important point: The IP packet embedded in that Ethernet frame bears the destination IP address of the server in network 192.168.1.0/24. However, Ethernet doesn't look at, use, or understand IP addresses. Ethernet uses MAC addresses.
Figure 11-6 shows you the next step in the process. Upon arrival at the router's E0 interface, the IP packet is pulled out of the frame and the frame is discarded. It has done its job! The IP packet, however, has some work to do. Specifically, it needs to get its data to its intended destinationthe server in network 192.168.1.0/24.
The routing protocol on the E0 interface takes a look at the destination IP address and sees that it is the network connected via its E1 interface. The packet is handed off to the E1 interface. The E1 interface must again wrap that IP packet in an Ethernet frame for transport through the next Ethernet network. This time, the Ethernet frame bears the destination MAC address of the server itself, rather than an intermediary network interface (as shown in Figure 11-5). This step is illustrated in Figure 11-7.
The server accepts this incoming Ethernet frame, strips it to reveal the IP packet inside, and processes that packet's contents. If nothing else, this sequence of illustrations shows you that packets are persistent, that frames are transient, and how that applies to the process by which routers forward packets.
Packets forwarded by routers must be rewrapped in a network frame, such as an Ethernet frame. Remember: IP packets operate at Layer 3 of the OSI reference model and network frames operate at Layer 2. Packets are persistent and, unless damaged or lost in transit, remain intact from source to destination. Network frames, on the other hand, are highly transient creations good for only one trip through a network. This iterative process of wrapping and unwrapping continues until the packet reaches its destination or is discarded.