Refer to figure 6-9, the CCNA Official Cert Guide 200-301 Volume 1 illustrates that, to send a frame through WAN, router R1 changes frame header and trailer. However, as router operate at network layer, than why do router can change data-link header and trailer, and how? Thank you. enter image description here

Figure 3-9


A router doesn't "change data-link header". It throws away an encapsulating frame on reception and creates a new encapsulating frame for transmission.

A router forwards between networks. These networks use a certain data link layer (L2) protocol and that is employed by the router to reach the next hop. For that, it encapsulates the packet to be transported in an (new) L2 frame and forwards it. Note that framing depends on the L2 protocol used on that link which can differ considerably (Ethernet, Wi-Fi, PPP, HDLC, ATM, Fibre Channel, Infiniband, ...) - thx @ilkkachu!

The next hop removes the frame and looks at the packet, repeating the process as long as it's necessary to reach the destination.

Think of the L2 frame as a vehicle for the packet while it's being transported across a certain network. Of course, the packet is a vehicle for the transport-layer datagram in turn. (Which is a vehicle for the application-layer data as well.)

  • 3
    And in particular, the other network could have a totally different underlying L2 protocol. To take the vehicle analogy further, you could consider the network layer packet as a container which can be transported on a truck, train or a ship. If it's transferred from land to sea, then of course the underlying vehicle needs to be changed too. (Like all analogies, this breaks down if you try.) – ilkkachu Apr 3 at 9:56

When we say that a router "operates at the network layer," we mean that its main function -- routing packets -- is based on network layer information (i.e. IP addresses). But in fact, all IP devices use all layers (in the TCP/IP model) in order to communicate with other devices.


A router's function is simply to accept a data packet from one iterface and send it out of another one, hopefully bringing the packet one hop closer to its destination. The router uses a routing table to store selected routes to destination networks, and a forwarding table in hardware with the exact information needed to route a packet. Each route in the forwarding table points to a FEC (Forwarding Equivalance Class) which stores information about how to forward a packet (and all packets that match that route are treated equally). This information consists of: egress port + L2 encapsulation + VLANs (and possibly MPLS encapsulation). Initially the router doesn't know how to forward a packet, even if it has the correct route in hand. The router has to learn the FEC information using its own control protocols while installing a route in the forwarding table. For example: a router learned the following route from OSPF: via, and accepted it as best. Now it wants to install it in forwarding table in hardware.

But the router doesn't even know yet how to send a packet to the next hop - so what it does, in this case, is to look up in the routing table and find out how to reach it - so let's assume is directly connected to our router via port 3 - so now FEC holds port 3. And still, the router can't really use this forwarding entry yet, it doesn't know the MAC address of So it uses ARP in order to find out. Now FEC holds all needed information to send out a packet and the forwarding entry can be installed and used: ---> egress port 3 + Destination MAC (learned via ARP). To complete the picture, the router uses port 3's Source MAC, and now the frame is complete and a packet can be transmitted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.