Study FAQ
What happens to an Ethernet frame and its IP packet when traffic crosses a router?
Also asked as 2
- Which addresses change as a packet goes through a switch and then a router?
- How do the Ethernet and IP destinations differ on the way to a remote server?
Answer
A Layer 2 switch delivers the Ethernet frame within its VLAN using the destination MAC address. A router selects a next hop from the destination IP address and creates new link-layer encapsulation for the outgoing link. Without address translation, the source and destination IP addresses stay the same while the Ethernet addresses are local to each hop. The router also decrements the IPv4 Time to Live (TTL).
Consider a workstation at 192.0.2.10/24 reaching 198.51.100.20 through gateway 192.0.2.1. Assume the workstation and gateway share a working VLAN, the routes and return path are in place, and there is no NAT. The workstation sends an Ethernet frame to the gateway's MAC address. The frame carries a packet addressed to 198.51.100.20. The switch forwards that frame toward the gateway. On an outgoing Ethernet link, the router uses its outgoing interface's MAC as the new frame source and the next hop's MAC as the frame destination. A Layer 3 switch configured to route can perform the same routed step.
From the medium up, the OSI model distinguishes Physical, Data Link, Network, Transport, Session, Presentation and Application. These are responsibilities. For this IP exchange, the relevant encapsulation is application data inside a transport segment or datagram, then an IP packet, then a link frame encoded onto the physical medium. The response needs its own viable forwarding path. A local link or a learned MAC entry gives evidence about its own part of the exchange.
References
Full explanation
HPE6-A86: Following an Ethernet Packet Through the Network Layers
Study guide · HPE6-A86
Read the full explanation