The link layer moves a datagram across one link, and it is the first layer whose answers depend on what that link physically is.
Words you will meet
-
Node node Simple Any device that runs a link-layer protocol. Precise In this chapter, any device running a layer-2 protocol: hosts, routers, switches and WiFi access points. The word is deliberately broader than 'host' or 'router', because the link layer treats them all the same way. introduced in ch. 6 — open in glossary — in this chapter, any device that runs a link-layer protocol: a host, a router, a switch, a WiFi (IEEE 802.11 wireless LAN) IEEE 802.11 wireless LAN Wireless LAN access; a user must be within a few tens of metres of the access point. WiFi is a trade name, not an abbreviation. introduced in ch. 1 access point.
-
Link link Simple The communication channel between two adjacent nodes. Precise A communication channel connecting adjacent nodes along a communication path. A datagram travelling from source to destination is moved over each individual link in turn, and over each one it is encapsulated in a link-layer frame. introduced in ch. 6 — open in glossary — the communication channel joining two adjacent nodes.
-
Framing framing Simple Wrapping a datagram in a frame before putting it on the link. Precise Almost all link-layer protocols encapsulate each network-layer datagram in a link-layer frame before transmission. A frame consists of a data field holding the datagram and a number of header fields, and its structure is specified by the link-layer protocol. introduced in ch. 6 — open in glossary — wrapping a datagram in a frame before putting it on the link.
-
Medium access control protocol medium access control protocol Simple The rules that say when a node may transmit. Precise A MAC protocol specifies the rules by which a frame is transmitted onto the link. For a point-to-point link it is simple or absent. The interesting case is a shared broadcast link, where it must coordinate the transmissions of many nodes — the multiple access problem. introduced in ch. 6 — open in glossary — written MAC (Media Access Control) Media Access Control The link-layer address burned into a network interface. Before a host has an IP address it is the only identity it has, which is why DHCP keys on it. Chapter 6 covers it properly. introduced in ch. 4 : the rules that say when a node may transmit.
-
Broadcast link broadcast link Simple One shared channel that everybody hears. Precise A link with multiple sending and receiving nodes all connected to the same single shared channel. When any node transmits a frame, every other node receives a copy. Ethernet and wireless LANs are examples. introduced in ch. 6 — open in glossary — one shared channel that every node on it hears.
-
Network adapter network adapter Simple The chip that does the link layer. Precise Also called a network interface controller. It implements framing, link access and error detection, so most of the link layer is hardware. Part of the link layer is still software on the host CPU, which is why the book calls the link layer the place in the stack where software meets hardware. introduced in ch. 6 — open in glossary — written NIC (Network Interface Controller) Network Interface Controller The chip that implements most of the link layer — framing, link access, error detection. Also called a network adapter. introduced in ch. 6 : the chip that does most of the link layer.
Why this matters
Chapters 4 and 5 delivered a datagram from any host to any other host in the world. They never said how it crossed a single cable.
That sounds like a detail and it is not. A datagram crossing the Internet is re-wrapped at every hop, by a different protocol each time. The properties of those protocols differ enormously. Some check for errors, some retransmit, and some have to negotiate for permission to speak at all.
This is also the first chapter where the answer is partly a piece of hardware. Everything above has been software.
One datagram, six links
The book’s opening example is a datagram travelling from a wireless host to a server inside one company network. It crosses six links.
The sending host has no cable. It encapsulates the datagram in an 802.11 frame and transmits it to the access point. Chapter 7 covers this link properly; here it is just the first of six.
The datagram is the same all the way across. What changes at every hop is the frame it travels inside, and the protocol that puts it there.
Read all steps as text
- Hop 1 · a WiFi link — The sending host has no cable. It encapsulates the datagram in an 802.11 frame and transmits it to the access point. Chapter 7 covers this link properly; here it is just the first of six.
- Hop 2 · an Ethernet link — The access point strips the 802.11 frame, takes the datagram out, wraps it in an Ethernet frame, and sends it to the link-layer switch. Same datagram, completely different frame.
- Hop 3 · switch to router — Another link, another frame. The switch is not the datagram’s destination and never looks at its IP address — section 6.4.3 explains how it forwards without doing so.
- Hop 4 · router to router — This is the hop chapters 4 and 5 spent their time on. To the link layer it is one more link, with one more frame, and it may use a protocol none of the others use.
- Hops 5 and 6 · Ethernet, twice more — Router to switch, then switch to server. Six hops in total, and the datagram that arrives at the server is byte for byte the datagram the wireless host sent.
- What was constant, and what was not — CONSTANT: the datagram, and the two IP addresses in its header. NOT CONSTANT: the frame, the frame’s addresses, the protocol, the rate of the link, and whether anybody was checking for errors. Every node in the middle unwrapped one frame and wrote a new one.
Over each link, the transmitting node node Simple Any device that runs a link-layer protocol. Precise In this chapter, any device running a layer-2 protocol: hosts, routers, switches and WiFi access points. The word is deliberately broader than 'host' or 'router', because the link layer treats them all the same way. introduced in ch. 6 — open in glossary encapsulates the datagram in a frame framing Simple Wrapping a datagram in a frame before putting it on the link. Precise Almost all link-layer protocols encapsulate each network-layer datagram in a link-layer frame before transmission. A frame consists of a data field holding the datagram and a number of header fields, and its structure is specified by the link-layer protocol. introduced in ch. 6 — open in glossary and transmits the frame into the link. Over the next link, some other node does it again, with a different frame.
The book uses a different word at each layer, and it is never careless about which. Neither is this site.
| Layer | Call it a… | Looks like | Its header says |
|---|---|---|---|
| application | message | What the application actually wants to send. | |
| transport | segment | Which program on the far host, plus error-detection bits. | |
| network | datagram | The addresses of the two hosts. | |
| link | frame | How to cross this one link — and it changes at every hop. |
M is the application's message. Ht, Hn and Hl are the transport, network and link headers. Each layer treats everything handed down to it as one opaque payload and puts its own header in front.
The four words, one last time. This chapter owns the bottom row — and it is the only row whose unit is rebuilt at every hop.
Everyday picture
The book’s own analogy, and it is a good one. A travel agent plans a trip from Princeton, New Jersey to Lausanne, Switzerland. A limousine from Princeton to JFK airport, then a plane from JFK to Geneva, then a train from Geneva to Lausanne.
Once the three reservations are made, each company is responsible for its own segment and nothing else. Each segment is direct, between two adjacent places, and the three use entirely different means of transport.
The tourist is the datagram. Each segment is a link. Each mode of transport is a link-layer protocol. The travel agent is a routing protocol.
Where the picture stops. The tourist survives the journey unchanged, and so does a datagram — but a real tourist is not put in a new box at every stage. A datagram is: the limousine company would have to unpack the traveller from a car-shaped container and repack them in a plane-shaped one.
Two kinds of link, and the chapter’s shape
| Point-to-point linkone sender, one receiver | Broadcast linkmany nodes, one shared channel | |
|---|---|---|
| Who is on it | ||
| Deciding when to transmit | ||
| Who hears a transmission | ||
| Examples | ||
| Where the chapter deals with it |
Cells marked ⓘ have a reason behind them — click to read it.
Almost every design decision in this chapter follows from which column a link is in. Click any cell.
In plain words
The word broadcast here does not mean television.
Traditional broadcasting is one fixed transmitter and many receivers. On a broadcast link every node can both send and receive, over the same shared channel, and that is what creates the problem: two of them may speak at once.
The book’s better analogy is a room full of people at a party, or a classroom. The air is the shared channel, everyone can hear everyone, and the whole difficulty is working out who talks and when.
What a link-layer protocol offers
| Service | What it means |
|---|---|
Cells marked ⓘ have an explanation — click to read it.
Only the first is universal. Every other row is a choice, and the choices are what make one link-layer protocol different from another. Click a cell marked ⓘ.
Reliable delivery at two layers is not duplication
TCP (Transmission Control Protocol) Transmission Control Protocol The Internet transport protocol that delivers data reliably and in order, with flow control and congestion control. introduced in ch. 1 already provides reliable delivery, end to end. So why would a link do it too?
Because the two repair different things. A link-layer retransmission fixes an error on the link where it happened, without the sender ever learning. A TCP retransmission crosses the whole path again.
On a wireless link, where errors are common, fixing them locally is far cheaper. On fibre, where they are rare, it is overhead for nothing — and many wired link-layer protocols therefore do not offer it at all.
Both can be right. It depends on the link, which is the theme of this whole chapter.
Where the link layer is implemented
Four layers in a column, each one software running on the host. That picture has been true for every chapter so far.
The first diagram in this book that answers a question about hardware. Every layer above has been software; this one is mostly not.
Read all steps as text
- The stack, as you have been drawing it — Four layers in a column, each one software running on the host. That picture has been true for every chapter so far.
- But a host is a machine — It has a CPU, memory, and a bus between them. The application, transport and network layers all run as software on that CPU, using that memory.
- And the link layer is mostly a chip — The network adapter — a network interface controller — implements framing, link access and error detection in hardware. Ethernet capability is either integrated into the motherboard chipset or sits on a low-cost dedicated chip.
- The link layer straddles the line — Part of it is software on the CPU: assembling addressing information, activating the controller, responding to its interrupts, handling errors and passing datagrams up. Part of it is the controller. The book’s phrase is exact — the link layer is the place in the protocol stack where software meets hardware.
For the most part the link layer is implemented on a chip called the network adapter network adapter Simple The chip that does the link layer. Precise Also called a network interface controller. It implements framing, link access and error detection, so most of the link layer is hardware. Part of the link layer is still software on the host CPU, which is why the book calls the link layer the place in the stack where software meets hardware. introduced in ch. 6 — open in glossary , also known as a network interface controller. Ethernet capability is either integrated into the motherboard chipset or provided by a low-cost dedicated chip.
On the sending side, the controller takes a datagram that the higher layers left in host memory. It encapsulates that datagram in a frame, fills in the frame’s fields, and transmits it following the link-access protocol. On the receiving side, a controller receives the whole frame and extracts the datagram. If error detection is used, the sending controller sets the bits and the receiving controller checks them — the host CPU (Central Processing Unit) Central Processing Unit The general-purpose processor. In a router it runs the control plane at millisecond timescales, never the per-packet data path. introduced in ch. 4 is not involved either time.
But part of the link layer is software on the CPU. It assembles link-layer addressing information and activates the controller hardware. It also responds to controller interrupts, handles error conditions, and passes datagrams up to the network layer.
In plain words
The book’s sentence is worth memorising, because no earlier chapter could have written it:
the link layer is a combination of hardware and software — the place in the protocol stack where software meets hardware.
Everything above the link layer is a program. Everything below it is physics. This layer is where the two are joined. Several of its design decisions make sense only once you know a chip is doing the work: a CRC (Cyclic Redundancy Check) Cyclic Redundancy Check The error-detection code used in link-layer adapters. Sender and receiver agree on a generator G; the sender appends bits so the whole pattern divides by G with no remainder under modulo-2 arithmetic. introduced in ch. 6 instead of a checksum, and error detection in the frame at all.
Check yourself
Check yourself
0 of 6 answered1.In this chapter, what is a "node"?
2.predictA datagram crosses six links on its way from a wireless host to a server. How many times is it encapsulated in a frame?
3.Which link-layer service is provided by almost every link-layer protocol?
4.TCP already provides reliable delivery from end to end. Why would a link-layer protocol provide it too?
5.Where is most of the link layer implemented?
6.What makes a link a "broadcast" link?
What to remember
- A datagram is re-framed at every hop. Six links means six frames, and the protocols need not be the same. The datagram itself is unchanged end to end; the frame around it is not.
- Four possible services: framing, link access, reliable delivery, and error detection and correction. Only framing is universal.
- Reliable delivery at the link layer is not redundant with TCP. It repairs an error where it happens, which is worth doing on a wireless link and wasteful on fibre.