Signals & Protocols
Computer Networking Basics · Networking & Cryptography track
5 min read
In this module
Bits on the Wire
Everything so far has happened inside a single machine. Modern computing depends on machines talking to each other — sharing data across a room, a building, or the entire planet. Networking is how that happens, and it starts with the physical question: how do you send a bit from point A to point B?
Physical Signals
Over copper, bits are voltage changes. Over fibre, pulses of light. Over Wi-Fi, patterns in radio waves. The medium differs, but the idea is the same: encode zeros and ones into a physical signal that can travel between devices.
Speed depends on the medium (fibre wins), distance, and how cleverly the signal is encoded. Modern Ethernet can push billions of bits per second down a single cable.
A protocol is an agreed-upon set of rules that two devices follow so they can understand each other. Without protocols, raw electrical signals would be meaningless noise. Protocols define how bits are grouped, how messages are structured, and how errors are handled.
Layers of Abstraction
Networking is organised into layers, each building on the one below. The most common model is the four-layer TCP/IP stack:
| Layer | Responsibility | Example |
|---|---|---|
| Application | Meaningful data for programs | HTTP, DNS, SMTP |
| Transport | Reliable (or fast) delivery between apps | TCP, UDP |
| Internet | Addressing and routing across networks | IP |
| Link | Moving bits between directly connected devices | Ethernet, Wi-Fi |
Each layer only needs to understand the layer directly above and below it. This separation is what allows a web browser to work identically whether you are on Wi-Fi, Ethernet, or a cellular connection - the upper layers never need to know what the physical medium is.
Textbooks and exams often use the seven-layer OSI model instead. It splits the link layer into physical (1) and data link (2), calls the internet layer network (3) and transport (4), and splits the application layer into session, presentation and application (5 to 7). Those numbers are why people call IP "layer 3" and a load balancer that reads HTTP "layer 7".
Here's what that layering looks like in actual bytes: the start of an HTTP request (just its first line, GET / HTTP/1.1) wrapped in a TCP header, then an IPv4 header, then an Ethernet header. Expand each layer and hover over the hex dump to see which bytes belong to which header. The HTTP text is the last 16 bytes; everything before it is 54 bytes of envelopes. Wrapping each layer's data in the next layer's header is called encapsulation, and the receiver peels the headers off in reverse order.
Network Packet Builder
70 bytesClick a layer to expand fields. Hover a field to highlight its bytes.
The field values are editable placeholders. One to fix: the TCP flags default to 5002, a SYN, but a segment carrying request data would be 5018 (PSH and ACK set). Try changing it. The Ethernet header starts with two 6-byte MAC addresses, the hardware addresses of the next hop and the sender; a host finds the MAC that goes with a local IP address using ARP. Then look at the IP header's protocol byte, 06 for TCP: that single byte is the only thing telling the receiver how to read the header after it.
Worked Example: Counting the Bytes
Follow that GET / HTTP/1.1 line from the browser down to the wire, adding up the bytes as each layer wraps it:
| Step | Layer adds | Running total |
|---|---|---|
| HTTP request line | 16 bytes of text: GET / HTTP/1.1 plus a carriage return and line feed | 16 |
| TCP | a 20-byte header: ports, sequence and acknowledgement numbers, flags | 36 |
| IPv4 | a 20-byte header: source and destination addresses, TTL, protocol 06 | 56 |
| Ethernet | a 14-byte header (two MAC addresses and a type, 0800 for IPv4) | 70 |
| Ethernet trailer | a 4-byte frame check sequence, a CRC the receiver uses to spot corrupted bits | 74 |
The receiver works up the same table in reverse. Its network card checks the CRC and drops the frame if it doesn't match. The type 0800 says "IPv4 inside", the protocol byte 06 says "TCP inside", and the destination port in the TCP header (80 for plain HTTP) says which program gets the last 16 bytes.
The wire carries a little more than the frame. Ethernet sends 8 bytes of preamble and start-of-frame delimiter before it, so the receiver can lock on to the signal's timing, and leaves at least 12 byte-times of silence after it. Frames shorter than 64 bytes get padded up to 64, a rule left over from the days when many machines shared one cable; ours is 74, so no padding. That's 74 + 8 + 12 = 94 byte-times, or 752 bits. On a 1 Gbit/s link each bit lasts a nanosecond, so the whole thing occupies the cable for about 0.75 microseconds. Only 16 of those 94 bytes are the message you wanted to send. A real request has many more header lines, so the overhead shrinks as a share, but it never goes away.
Predict: the frame reaches a router, which forwards it out of another port towards the server. Which of the four layers' bytes does the router change?
The Ethernet header and trailer are replaced completely: the router strips them off, then builds a new frame with its own MAC address as the source, the next hop's MAC as the destination and a fresh CRC. In the IP header it lowers the TTL by one and recomputes the header checksum to match. The TCP header and the HTTP bytes come out untouched, because a router works at layer 3 and has no reason to look above it. (Home routers also rewrite addresses and ports for network address translation, which changes more; that comes up with IP addressing.) Swap the cable for Wi-Fi and the same holds: only the link layer's wrapping differs.
Why This Matters
If you understand the layer model, you can reason about any networking problem by asking: "Which layer is responsible for this?" The next three lessons walk through the layers from bottom to top, ending with the HTTP requests your browser makes every time you load a page.