The link layer moves data across a single local network, between devices that can reach each other without a router. Ethernet and Wi-Fi are the common examples.
Frames
The link layer sends frames. An Ethernet frame carries a destination MAC address, a source MAC address, a type field that says what is inside (such as IPv4 or IPv6), the data, and a checksum called the frame check sequence. A damaged frame is dropped.
The MTU is the largest network layer packet a link carries in one frame. On standard Ethernet it is 1500 bytes.
$ ip link show dev enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ... state UP
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ffSwitches and broadcast
A switch learns which MAC address is on which port by reading source addresses. It then forwards a frame only where it is needed. If it does not yet know the destination, it floods the frame out of the other ports.
The address ff:ff:ff:ff:ff:ff is broadcast, meant for everyone on the local network. Routers do not forward it onward. A VLAN splits one physical switch into separate logical networks. See the VLAN guide.
ARP
A host knows the destination IP address but needs a MAC address to build the frame. For IPv4, ARP does this. The host broadcasts "who has 192.168.1.1?", and the owner replies with its MAC. The answer is cached.
IPv6 does not use ARP. It uses Neighbor Discovery, carried in ICMPv6.
$ ip neigh
192.168.1.1 dev enp1s0 lladdr 52:54:00:aa:bb:cc REACHABLEStates such as STALE are normal. FAILED means resolution did not succeed.
For a destination on another network, the host resolves the gateway's MAC address, not that of the far server. The IP destination is still the far server.
Try it
Run ip neigh, ping your gateway, then run it again:
$ ip route
$ ping -c 1 192.168.1.1
$ ip neighUse the gateway address from your own ip route output. Find its entry and note the MAC address. Virtual machines and containers may show a virtual gateway. For more context, read the networking basics guide.
Check your understanding
Link Layer
All 5 sections ยท no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.