
Layers and Packets
Why the internet chops everything into packets instead of holding a line open like a phone call; Paul Baran at RAND and Donald Davies at NPL, who reached the idea separately; the ARPANET's first word, 'lo', on 29 October 1969; Cerf and Kahn's network of networks; the four layers the internet really uses and the seven that OSI drew, and why OSI lost; encapsulation as envelopes inside envelopes; MTU and fragmentation; and ip addr, ip route get, and ping read line by line, ending with a ping that finds the largest packet your connection carries.
- 12 min
- 9 steps
- 8 questions
- 7 hands-on
- Lesson 19 of 24 in How Computers Work
- Drafted by Opus 5.5
In this lesson
- Two ways to share a wire
- LO
- A network of networks
- The four layers
- Envelopes inside envelopes
- Too big to fit
- Try it on Linux
- Where the first packets went
- Count your own routers
Picking up where you left off.
Two ways to share a wire
In 1965 Lawrence Roberts linked a computer in Massachusetts to one in California over a dial-up telephone line. The two machines worked well together, but the experiment showed that the circuit-switched phone system was “totally inadequate for the job” 1. A phone call is circuit switching: the network sets up an end-to-end circuit between two places and passes bits along it for the whole call 1, silences included.
Packet switching cuts a message into small blocks and sends each one separately; they share the lines with everyone else’s and are reassembled into the original message at the far end 2.
The idea arrived more than once. Paul Baran worked on it at the RAND Corporation from 1962, and in 1964 his group published a design for military voice networks; Donald Davies reached it at Britain’s National Physical Laboratory in Teddington in 1965–66; neither knew of the other 1 2. Davies named the blocks packets, and the ARPANET’s planners took the word from him in 1967 3. He had joined NPL in 1947 to work under Alan Turing on the Automatic Computing Engine 2; Turing returns in Algorithms and Turing Machines.
A popular story says the ARPANET was built to survive a nuclear war. Its builders call that a false rumor: only Baran’s separate RAND study on secure voice considered nuclear attack 1.
LO
The ARPANET’s packet switches were Interface Message Processors (IMPs), refrigerator-sized minicomputers built by Bolt Beranek and Newman, which won the contract in December 1968 1 4. The first went into Leonard Kleinrock’s lab at UCLA in September 1969; the Stanford Research Institute (SRI) was connected a month later 1.

At 22:30 on 29 October 1969, Kleinrock’s student programmer Charley Kline began to log in from UCLA’s SDS Sigma 7 to Bill Duvall’s SDS 940 at SRI. The L went through, then the O, then the system crashed. The full login worked about an hour later 5. The network’s first word was “lo” 4.

A network of networks
The ARPANET was one network. Soon there were packet radio and packet satellite networks as well, each with its own rules 1. In May 1974 Vint Cerf and Bob Kahn published how to join them: hosts everywhere speak one common protocol, and machines they called gateways sit between networks, repackaging traffic for the next one and splitting packets too big for it 6. Every packet carries an internetwork header with its source and destination. The address began with an 8-bit network number, room for 256 networks, which the authors thought “sufficient for the foreseeable future” 6.
Their transmission control program grew into TCP and IP. The ARPANET switched to them on 1 January 1983, a flag day on which every host had to change at once 1.
Match up
This exercise needs JavaScript.
Baran and Davies reached packet switching separately in the 1960s; Kline sent the first host-to-host message in 1969; Cerf and Kahn’s 1974 paper joined unlike networks with gateways and one common protocol.
The four layers
The internet’s protocols are stacked in layers, each using the one below and serving the one above. The 1989 host requirements standard, RFC 1122, names four 7:
| Layer | Job | Examples |
|---|---|---|
| Application | what two programs say to each other | HTTP, SSH, DNS |
| Transport | delivery between programs, end to end | TCP (reliable, in order), UDP (bare datagrams) |
| Internet | carrying a packet across networks to an address | IP, with ICMP for errors |
| Link | moving a frame to the next machine on this network | Ethernet |
IP promises nothing: a datagram may arrive damaged, duplicated, out of order, or not at all, and the layers above deal with it 7.
The rival model, OSI, has seven: physical, data link, network, transport, session, presentation, application 8. It splits the wire from the protocol that runs on it and adds two layers above transport: session, for organizing a dialogue, and presentation, for a common representation of the data 8. The internet folds those two into the application layer 7.
OSI was meant to win. An ISO committee formed in 1977, the reference model became an international standard in 1984, and in 1988 the US government required its agencies to buy OSI products 9. But computer makers, telephone monopolies, and national delegations all had a say; disputes were settled by including both options, and the standards came slowly while TCP/IP was already running. In 1989 Brian Carpenter’s talk “Is OSI Too Late?” got a standing ovation, and by the mid-1990s OSI was finished 9. Even the internet’s own layering is loose: RFC 1122 calls strict layering “an imperfect model” 7.
Sort
This exercise needs JavaScript.
The link layer moves frames across one wire; IP carries addresses and the time to live across networks; TCP handles ports and reliability; the request itself is the application’s business.
Quick check
Every maker, phone company, and nation had a say, disputes were settled by adding options, and standards arrived late. The US government actually required OSI purchases from 1988.
Envelopes inside envelopes
Sending means wrapping. A browser’s request goes to TCP, which puts a 20-byte header in front: source and destination ports, sequence and acknowledgment numbers 10. IP adds its own 20-byte header with the two addresses and a time to live 11 12. The link layer wraps that in a frame addressed to the next machine; on Ethernet, a type field of hexadecimal 0800 says an IP packet is inside 13. This is encapsulation.
Each machine on the way opens only as many envelopes as it needs. A router takes the packet out of the frame, reads the destination, lowers the time to live, and puts the packet in a new frame for the next network, as Cerf and Kahn’s gateways did 6 11. TCP and the request inside stay sealed until the far end. The time to live is a self-destruct counter: every router takes off at least one, and a packet that reaches zero is destroyed, so a packet caught in a routing loop can’t circle forever 11.
Put in order
This exercise needs JavaScript.
Each layer wraps what it’s handed from above, so the link layer’s header goes on last and comes first.
Too big to fit
Every link has a largest packet it carries whole, its maximum transmission unit (MTU). On Ethernet it is 1,500 bytes 13. An IPv4 packet bigger than the next link’s MTU gets cut up: the router splits the data into fragments, each with a copy of the IP header, a “more fragments” flag, and an offset counted in 8-byte units, and the destination puts them back together 11. Every IPv4 host must accept a 576-byte datagram, whole or in pieces 11.
Fragments cause trouble enough that RFC 8900 is titled “IP Fragmentation Considered Fragile” 14. So senders avoid it. They set the Don’t Fragment bit; a router that can’t pass such a packet drops it and reports back, and the sender learns the path’s MTU and shrinks its packets 15. IPv6 goes further: routers never fragment, only the sender may, and every IPv6 link must carry at least 1,280 bytes 16.
Work it out
This exercise needs JavaScript.
Each fragment can carry 1,500 − 20 = 1,480 bytes of data, which is a multiple of 8. 1,480 + 1,480 + 1,020 = 3,980.
Try it on Linux
How Your Machine Is Connected introduced ip addr. Read it now as layers. The outputs below are examples: your interface names, addresses, and times will differ.
me@linuxbox:~$ ip addr show wlp2s0
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 3c:58:c2:1d:8e:41 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.23/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp2s0
valid_lft 74219sec preferred_lft 74219sec
mtu 1500: the largest packet this interface sends whole;ip link setcan change it 17.link/ether: the 48-bit hardware address, the link layer’s address 13.inet 192.168.1.23/24: the internet layer’s address 18.
Ask the kernel which route it would use to reach CERN’s web server 19:
me@linuxbox:~$ ip route get 188.184.67.127
188.184.67.127 via 192.168.1.1 dev wlp2s0 src 192.168.1.23 uid 1000
cache
It isn’t on the local network, so it goes via the router at 192.168.1.1, out of the Wi-Fi interface, with this machine’s address as the source.
Ping it four times, numbers only, no name lookups 12:
me@linuxbox:~$ ping -c 4 -n info.cern.ch
PING info.cern.ch (188.184.67.127) 56(84) bytes of data.
64 bytes from 188.184.67.127: icmp_seq=1 ttl=50 time=110 ms
64 bytes from 188.184.67.127: icmp_seq=2 ttl=50 time=109 ms
64 bytes from 188.184.67.127: icmp_seq=3 ttl=50 time=110 ms
64 bytes from 188.184.67.127: icmp_seq=4 ttl=50 time=109 ms
--- info.cern.ch ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 108.723/109.256/109.817/0.435 ms
56(84) bytes: 56 bytes of data, 84 with the 8-byte ICMP header and the 20-byte IP header 12.64 bytes from: each reply, 56 bytes of data plus the ICMP header.icmp_seq: the request’s number; a gap means one was lost.ttl=50: the reply’s time to live on arrival. The recommended starting value is 64 12, so if CERN’s server uses it, the reply crossed 14 routers.time: the round trip, here across the Atlantic and back.mdev: how much the times varied 12.
Now find the MTU by forbidding fragmentation with -M do and choosing the data size with -s 12:
me@linuxbox:~$ ping -c 1 -n -M do -s 1472 info.cern.ch
PING info.cern.ch (188.184.67.127) 1472(1500) bytes of data.
1480 bytes from 188.184.67.127: icmp_seq=1 ttl=50 time=111 ms
me@linuxbox:~$ ping -c 1 -n -M do -s 1473 info.cern.ch
PING info.cern.ch (188.184.67.127) 1473(1501) bytes of data.
ping: local error: message too long, mtu=1500
1,472 bytes of data plus 28 of headers is exactly 1,500. One byte more and the kernel refuses to send it.
Work it out
This exercise needs JavaScript.
Subtract the 20-byte IP header and the 8-byte ICMP header: 1,420 − 28 = 1,392. On Ethernet the same sum gives 1,472.
Find the mistake
This exercise needs JavaScript.
Each router takes at least one off the time to live, so 64 − 50 = 14. 1,500 bytes is Ethernet’s MTU; the IPv6 minimum for any link is 1,280.
Where the first packets went
- 3420 Boelter Hall, UCLA. The room where “lo” was typed reopened in 2011 as the Leonard Kleinrock Internet Heritage Site and Archive, with replica machines and the IMP log to page through 4. Check UCLA’s site for opening hours before going.
- The Computer History Museum’s internet timeline runs decade by decade from 1962, with the 1960s page covering everything in this lesson up to the IMP log 3.
- RFC 1122, section 1.1.3, two pages, is where the four layers are defined 7. Cerf and Kahn’s paper is twelve pages and readable in an evening 6.
Count your own routers
Run ip addr and note your MTU. Then ping three places at different distances: your router (from ip route), a server in your own country, and info.cern.ch. For each, write down the time and the TTL, and work out how many routers each reply crossed if it started at 64. Finally, find the largest -s that gets through with -M do; if it isn’t 1,472, something on your path, a VPN or a DSL line, has a smaller MTU.
Lesson complete
Nice work.
Teach it back
In two sentences, explain Layers and Packets to a friend who missed it.
Related lessons
Among the starsLessons that point here
Sources for this lesson
- 1Brief History of the Internet. Internet Society. 1997. verifiedRead November 15, 2026. In 1965 Roberts, with Thomas Merrill, connected the TX-2 in Massachusetts to the Q-32 in California over a low-speed dial-up telephone line; the computers worked well together, but 'the circuit switched telephone system was totally inadequate for the job.' Circuit switching interconnects at the circuit level, passing bits along an end-to-end circuit between two end locations. The ARPANET was to be joined by packet satellite networks, ground-based packet radio networks, and others; Kahn introduced open-architecture networking at DARPA in 1972. Work at MIT (1961-1967), RAND (1962-1965) and NPL (1964-1967) went on in parallel without the researchers knowing of each other; the RAND group wrote a paper on packet switching networks for secure voice in the military in 1964; Davies and Scantlebury of NPL presented a packet network paper at the 1967 conference where Roberts presented the ARPANET plan; the word 'packet' was adopted from the NPL work. BBN, under Frank Heart, won the IMP contract in December 1968; in September 1969 BBN installed the first IMP at UCLA; one month later, when SRI was connected, the first host-to-host message was sent from Kleinrock's laboratory to SRI. Footnote 5: the rumor that the ARPANET was built to survive nuclear war is false; only the unrelated RAND study on secure voice considered nuclear war. NCP, finished December 1970, relied on the ARPANET for end-to-end reliability and could not address networks beyond it, so Kahn began a new protocol for open-architecture networking; the ARPANET switched from NCP to TCP/IP in a flag-day transition on January 1, 1983, after years of planning.
- 2Donald Davies. Encyclopaedia Britannica. verifiedRead November 15, 2026. Donald Watts Davies, born June 7, 1924, Treorchy, Wales, died May 28, 2000; inventor of packet switching, along with Paul Baran; from 1947 worked on the Automatic Computing Engine under Alan Turing at the National Physical Laboratory, Teddington, and stayed with NPL all his career; in 1965-66 devised packet switching, in which a data stream is broken into blocks, 'packets, as Davies called them', sent separately and reassembled; it was used in the late 1960s as the basis of ARPANET.
Also cited in Algorithms and Turing Machines.
- 3Internet History of 1960s. Computer History Museum. verifiedRead November 15, 2026. The timeline has pages for the 1960s, 1970s, 1980s and 1990s, starting in 1962. 1964: work on packet switching networks goes on in parallel at MIT, RAND, and the National Physical Laboratory; Paul Baran, Donald Davies, Leonard Kleinrock and others; Baran is one of the first to publish. 1967: Davies, Baran, and Roberts learn of each other's work; from Davies the word 'packet' is adopted and the proposed ARPANET line speed is raised from 2.4 to 50 kbps. 1969: after installation in September, handwritten logs from UCLA show the first host-to-host connection, UCLA to SRI, on October 29, 1969; the first 'Log-In' crashes the SRI host, but the next attempt works.
- 4Archive Illuminates UCLA's Place in Internet History. UCLA Samueli School of Engineering newsroom. 2011. verifiedNov 9, 2011, read November 15, 2026. The first message, 'LO', the first two letters of 'LOGIN' cut short by a crash, went from UCLA to the Stanford Research Institute in Menlo Park; UCLA opened the Leonard Kleinrock Internet Heritage Site and Archive in 3420 Boelter Hall, the original lab, with replica machines and reproductions of documents including the handwritten IMP log, which visitors can page through; open then on Thursday afternoons and by appointment.
- 5The Day the Infant Internet Uttered its First Words. UCLA Computer Science Department (Kleinrock's pages). verifiedRead November 15, 2026. On October 29, 1969, at 22:30, Kleinrock's student and programmer Charley Kline set up a transmission from the UCLA SDS Sigma 7 host to programmer Bill Duvall at the SRI SDS 940 host; they meant to log in, transmitted the 'l' and the 'o', and then the system crashed; the full login was done about an hour later. The page shows the entry in the UCLA IMP log.
- 6A Protocol for Packet Network Intercommunication. IEEE Transactions on Communications 22(5): 637-648. 1974. verifiedRead in full November 15, 2026 in the IEEE-permitted reprint posted for a Princeton course (cs.princeton.edu/courses/archive/fall06/cos561/papers/cerf74.pdf). Proposes a common protocol for hosts on different packet networks, joined by GATEWAYs, with an internetwork header prefixed to each packet by the source host holding source and destination addresses, sequence number and byte count; gateways may fragment packets for a network with smaller packets; a transmission control program (TCP) in each host breaks messages into segments; introduces ports; address format of an 8-bit network field ('allows up to 256 distinct networks. This size seems sufficient for the foreseeable future') and a 16-bit TCP identifier (65,536 TCPs).
- 7RFC 1122: Requirements for Internet Hosts - Communication Layers. IETF. 1989. verifiedOctober 1989. Section 1.1.3: the Internet protocol suite has four layers, application, transport, internet, and link; the application layer 'essentially combines the functions of the top two layers -- Presentation and Application -- of the OSI reference model'; transport has TCP (reliable, connection-oriented, resequencing, flow control) and UDP (connectionless datagram); IP is a connectionless datagram service with no end-to-end delivery guarantee, so datagrams may arrive damaged, duplicated, out of order, or not at all, and the layers above are responsible for reliability; ICMP is part of IP; the link layer is the protocol for the directly connected network. Section 1.3.1: strict layering is an imperfect model; implementations involve creative breaking of it. Section 3.3.2: EMTU_R must be at least 576.
Also cited in IP, TCP, and DNS.
- 8ITU-T Recommendation X.200: Open Systems Interconnection - Basic Reference Model. International Telecommunication Union. 1994. verifiedApproved 1 July 1994; identical text published as ISO/IEC 7498-1. Read in the PDF November 15, 2026. Clause 6.1.2: seven layers, Application (7), Presentation (6), Session (5), Transport (4), Network (3), Data Link (2), Physical (1). 7.2.2: the Presentation Layer provides for common representation of data transferred between application-entities. 7.3.2.1: the Session Layer lets cooperating presentation-entities organize and synchronize their dialogue and manage their data exchange.
- 9OSI: The Internet That Wasn't. IEEE Spectrum. 2013. verifiedJuly 2013 (August 2013 print issue), read November 15, 2026. In 1977 British industry representatives proposed an ISO committee on packet-switching networks; Charles Bachman chaired it; the OSI reference model, seven layers from physical media (1) to applications (7), was published as an international standard in 1984, with options for both computer and telecom designs added to settle disputes, increasing size and complexity; the US government mandated OSI purchases in 1988; at a 1989 meeting Brian Carpenter's talk 'Is OSI Too Late?' got a standing ovation; Bachman had warned in 1978 of getting ten computer firms, ten telephone companies and PTTs, and experts from ten nations to agree; OSI's formal openness let any party join the design process, inviting tension and delay; by the mid-1990s the effort had ended; the internet was a research network that did not allow commercial traffic on its backbone until 1992; in 1992 internet engineers rejected the OSI CLNP as a replacement for IPv4.
- 10RFC 9293: Transmission Control Protocol (TCP). IETF. 2022. verifiedAugust 2022 (STD 7, obsoletes RFC 793). Figure 1: the TCP header without options is five 32-bit words (20 bytes): source port, destination port, sequence number, acknowledgment number, data offset/flags (including SYN, ACK, FIN, RST)/window, checksum/urgent pointer. 3.4.1: each new connection gets a 32-bit initial sequence number from a clock plus a secret pseudorandom function, because predictable ISNs are a security problem. 3.4: every octet sent on a TCP connection has a sequence number; acknowledgment is cumulative, so acknowledging X means all octets up to but not including X have arrived; this makes duplicates easy to detect after retransmission. 3.5, Figure 6: the three-way handshake, A sends SYN with SEQ=100, B replies SYN,ACK with SEQ=300 ACK=101, A sends ACK with SEQ=101 ACK=301, then data; its principal reason is to keep old duplicate connection requests from causing confusion. 3.8.1: the retransmission timeout must be computed dynamically (per RFC 6298), with exponential backoff. Header fields: Window, the number of data octets, beginning with the one acknowledged, that the segment's sender is willing to accept; FIN, no more data from sender. 3.4: the TIME-WAIT state limits the rate of connection reuse so that segments from an earlier incarnation of a connection are not mistaken for the new one.
Also cited in IP, TCP, and DNS.
- 11RFC 791: Internet Protocol. IETF (prepared for DARPA). 1981. verifiedSeptember 1981. Addresses are four octets (32 bits). Header fields include Total Length (16 bits, up to 65,535 octets), flags DF (Don't Fragment) and MF (More Fragments), fragment offset in units of 8 octets, Time to Live (8 bits), protocol, checksum, source and destination addresses. TTL is set by the sender and reduced wherever the datagram is processed (by at least one at each module); at zero the datagram is destroyed, to discard undeliverable datagrams. All hosts must accept datagrams of up to 576 octets, whole or in fragments; every internet module must forward a 68-octet datagram without further fragmentation; a gateway fragments a datagram too big for the next network, and the destination reassembles it.
Also cited in IP, TCP, and DNS.
- 12ping(8) manual page (iputils). man7.org (Linux man-pages). verifiedRead November 15, 2026. ping sends ICMP ECHO_REQUEST and reports ECHO_RESPONSEs; -4/-6 force IPv4 or IPv6; -c count stops after count requests; -n numeric output, no reverse DNS; -s packetsize sets data bytes, default 56, which with the 8-byte ICMP header makes 64; -M do sets the DF flag so packets too large are rejected; an IP header without options is 20 bytes; mdev is the population standard deviation of the round-trip times. TTL details: the TTL is the maximum number of routers a packet can pass through; each router decrements it by one; maximum 255, recommended initial value 64; ping prints the TTL of the reply it receives.
- 13RFC 894: A Standard for the Transmission of IP Datagrams over Ethernet Networks. IETF. 1984. verifiedApril 1984. Applies to 10-megabit Ethernet with 48-bit addresses; IP datagrams travel in standard Ethernet frames whose type field is hexadecimal 0800; the data field holds the IP header and data; the largest IP datagram sent over Ethernet is 1500 octets; gateways must accept full-length packets and fragment them if necessary.
- 14RFC 8900: IP Fragmentation Considered Fragile. IETF. 2020. verifiedSeptember 2020. Abstract: describes IP fragmentation and explains how it introduces fragility to Internet communication; proposes alternatives and gives recommendations for developers and network operators.
- 15RFC 1191: Path MTU Discovery. IETF. 1990. verifiedNovember 1990. A host discovers the path MTU by sending datagrams with the Don't Fragment (DF) bit set; a router that cannot forward one without fragmenting drops it and returns an ICMP error, and the host lowers its estimate.
- 16RFC 8200: Internet Protocol, Version 6 (IPv6) Specification. IETF. 2017. verifiedJuly 2017. IPv6 increases the address size from 32 to 128 bits; unlike IPv4, fragmentation is performed only by source nodes, not by routers; every link must have an MTU of at least 1280 octets.
Also cited in IP, TCP, and DNS.
- 17ip-link(8) and ip(8) manual pages. man7.org (Linux man-pages). verifiedRead November 15, 2026. ip link shows and changes network devices; 'mtu NUMBER' changes the MTU of the device, example 'ip link set dev ppp0 mtu 1400'. ip(8): -br, -brief prints only basic information in a table, supported by ip addr show, ip link show and ip neigh show.
- 18ip-address(8) manual page. man7.org (Linux man-pages). verifiedip address show: protocol addresses on each device, with state, link-layer address, and inet/inet6 addresses.
Also cited in How Your Machine Is Connected.
- 19ip-route(8) manual page. man7.org (Linux man-pages). verifiedRead November 15, 2026. 'ip route get' gets a single route to a destination and prints its contents exactly as the kernel sees it.