The next two examples will bring together many of the concepts we have discussed.
The network layer must relate to and interface with various lower layers. Routers must be capable of seamlessly handling packets encapsulated into different lower-level frames without changing the packets’ Layer 3 addressing.
Let’s look at an example of this in a LAN-to-LAN routing situation. Packet traffic from source Host 4 on Ethernet network 1 needs a path to destination Host 5 on Token Ring Network 2. The LAN hosts depend on the router and its consistent network addressing to find the best path. When the router checks its router table entries, it discovers that the best path to destination Network 2 uses outgoing port To0, the interface to a Token Ring LAN.
Although the lower-layer framing must change as the router switches packet traffic from the Ethernet on Network 1 to the Token Ring on Network 2, the Layer 3 addressing for source and destination remains the same – in this example it is Net 2, Host 5 despite the different lower-layer encapsulations.
The packet is then reframed and sent on to the destination Token Ring network.
Now, let’s look at an example using a Wide Area Network.
The network layer must relate to and interface with various lower layers for LAN-to-WAN traffic, as well. As an internetwork grows, the path taken by a packet might encounter several relay points and a variety of data-link types beyond the LANs. For example, in the graphic, a packet from the top workstation at address 1.3 must traverse three data links to reach the file server at address 2.4 shown on the bottom:
The workstation sends a packet to the file server by encapsulating the packet in a Token Ring frame addressed to Router A.
When Router A receives the frame, it removes the packet from the Token Ring frame, encapsulates it in a Frame Relay frame, and forwards the frame to Router B.
Router B removes the packet from the Frame Relay frame and forwards the packet to the file server in a newly created Ethernet frame.
When the file server at 2.4 receives the Ethernet frame, it extracts and passes the packet to the appropriate upper-layer process through the process of de- encapsulation.
The routers enable LAN-to-WAN packet flow by keeping the end-to-end source and destination addresses constant while encapsulating the packet at the port to a data link that is appropriate for the next hop along the path.