Routers Operate at Layers 1, 2, and 3

A router makes its primary forwarding decision at Layer 3, but as we saw earlier, it participates in Layer 1 and Layer 2 processes as well. After a router has examined the destination IP address of a packet and consulted its routing table to make its forwarding decision, it can forward that packet out the appropriate interface toward its destination. The router encapsulates the Layer 3 IP packet into the data portion of a Layer 2 data link frame appropriate for the exit interface. The type of frame can be an Ethernet, HDLC, or some other Layer 2 encapsulation - whatever encapsulation is used on that particular interface. The Layer 2 frame is encoded into the Layer 1 physical signals that are used to represent bits over the physical link.

To understand this process better, refer to the figure. Notice that PC1 operates at all seven layers, encapsulating the data and sending the frame out as a stream of encoded bits to R1, its default gateway.

R1 receives the stream of encoded bits on its interface. The bits are decoded and passed up to Layer 2, where R1 decapsulates the frame. The router examines the destination address of the data link frame to determine if it matches the receiving interface, including a broadcast or multicast address. If there is a match with the data portion of the frame, the IP packet is passed up to Layer 3, where R1 makes its routing decision. R1 then re-encapsulates the packet into a new Layer 2 data link frame and forwards it out the outbound interface as a stream of encoded bits.

R2 receives the stream of bits, and the process repeats itself. R2 decapsulates the frame and passes the data portion of the frame, the IP packet, to Layer 3 where R2 makes its routing decision. R2 then re-encapsulates the packet into a new Layer 2 data link frame and forwards it out the outbound interface as a stream of encoded bits.

This process is repeated once again by router R3, which forwards the IP packet, encapsulated inside a data link frame and encoded as bits, to PC2.

Each router in the path from source to destination performs this same process of decapsulation, searching the routing table, and then re-encapsulation. This process is important to your understanding of how routers participate in networks. Therefore, we will revisit this discussion in more depth in a later section.

0 comments