10.2 IP Routing Protocols  
  10.2.2 Routing versus switching  
Routing is often contrasted with switching. Routing and switching might seem to perform the same function to the inexperienced observer. The primary difference is that switching occurs at Layer 2, the data link layer, of the OSI model and routing occurs at Layer 3. This distinction means routing and switching use different information in the process of moving data from source to destination.

The relationship between switching and routing parallels that of telephone local and long distance calls. When a telephone call is made to a number within the same area code, a local switch handles the call. However, the local switch can only keep track of its own local numbers. The local switch cannot handle all the telephone numbers in the world. When the switch receives a request for a call outside of its area code, it switches the call to a higher-level switch that recognizes area codes. The higher-level switch then switches the call so that it eventually gets to the local switch for the area code dialed.

The router performs a function similar to that of the higher-level switch in the telephone example. Figure shows the ARP tables for Layer 2 addressing and routing tables for Layer 3 addressing. Each computer and router interface maintains an ARP table for Layer 2 communication. The ARP table is only effective for the broadcast domain (or LAN) that it is connected to. The router also maintains a routing table that allows it to route data outside of the broadcast domain. Each ARP table contains an IP-MAC address pair (the MAC addresses in the graphic are represented by the acronym MAC, as the actual addresses are too long to fit in the graphic). The routing tables also track how the route was learned (in this case either directly connected [C] or learned by RIP [R]), the network IP address for reachable networks, the hop count or distance to those networks, and the interface the data must be sent out to get to the destination network.

The Layer 2 switch can only recognize its own local MAC addresses and cannot handle Layer 3 IP addresses. When a host has data for a non-local IP address, it sends the frame to the closest router, also known as its default gateway. The host uses the MAC address of the router as the destination MAC address.

A Layer 2 switch interconnects segments belonging to same logical network or subnetwork.   If Host X needs to send a frame to a host on a different network or subnetwork, Host X sends the frame to the router that is also connected to the switch. The switch forwards the frame to the router based on the destination MAC address. The router examines the Layer 3 destination address of the packet to make the forwarding decision. Host X knows the IP address of the router because the IP configuration of the router also includes the IP address of the default gateway.

Just as a Layer 2 switch keeps a table of known MAC addresses, the router keeps a table of IP addresses known as a routing table. There is a difference between these two types of addresses. MAC addresses are not logically organized, but IP addresses are organized in a hierarchical manner. A Layer 2 device can handle a reasonable number of unorganized MAC addresses, because it will only have to search its table for those addresses within its segment. Routers need to handle a greater volume of addresses. Therefore, routers need an organized addressing system that can group similar addresses together and treat them as a single network unit until the data reaches the destination segment. If IP addresses were not organized, the Internet simply would not work. An example would be like a library that contained millions of individual pages of printed material in a large pile. This material is useless because it is impossible to locate an individual document. If the pages are organized into books and each page is individually identified, and the books are also listed in a book index, it becomes a lot easier to locate and use the data.

Another difference between switched and routed networks is switched networks do not block broadcasts. As a result, switches can be overwhelmed by broadcast storms. Routers block LAN broadcasts, so a broadcast storm only affects the broadcast domain from which it originated. Because routers block broadcasts, routers also provide a higher level of security and bandwidth control than switches.

 

Interactive Media Activity

Drag and Drop: Routing vs. Switching

After completing this activity, the student will be able to identify the differences between routing and switching.

   
 

Web Links

Routing vs. Switching

http://www.cs.cornell.edu/skeshav/ talks/infocom97panel/