The internet can feel like magic — you type a web address, and a page appears from halfway around the world in less than a second. But behind that click is a carefully organised system of physical cables, smart devices, and clever rules that let computers talk to each other. This chapter unpacks that system piece by piece, so you can see how data actually gets from here to there, and why that matters for keeping information safe.
Networks are everywhere: the Wi‑Fi in your home, the cellular link your phone uses, and the sprawling global web that connects millions of businesses. In this chapter, we answer one core question: how do computers find each other and exchange information reliably across the planet? We will look at the size and shape of networks, the hardware that moves data, the addressing system that gives every device a unique name, the service that translates human‑friendly names into those addresses, the layered model that organises all the communication rules, and finally the simple request‑response dance that powers the World Wide Web. By the end, you will see the internet not as a foggy cloud, but as a well‑engineered machine — and you will start to understand where its weak points lie, which is the first step toward protecting it.
Networks come in different sizes depending on how much ground they cover. The three most common categories are LAN (Local Area Network), MAN (Metropolitan Area Network), and WAN (Wide Area Network).
A LAN is small and personal. Think of your home Wi‑Fi or the computers inside a single school building. The devices are close together — usually within the same room or building — and the network is owned and managed by one person or organisation. Because the distances are short, data can travel extremely fast, and you do not need to rely on a phone company or internet provider to carry your traffic.
A MAN stretches across a city or a large campus. It might connect several school buildings or city offices that are a few kilometres apart. A MAN is often built with high‑capacity fibre‑optic cables and can be run by a local government or a service provider. It is larger than a LAN but still contained within one metropolitan area.
A WAN covers a huge geographic area — a country, a continent, or the whole world. The internet itself is the ultimate WAN. WANs are made of many smaller networks linked together by long‑distance connections, often undersea cables or satellite links. Because the distances are vast, WANs tend to be slower than LANs and are almost always managed by multiple organisations working together.
LAN: A small network confined to a single building or site, owned by one entity.
MAN: A network that spans a city or large campus, bridging multiple nearby locations.
WAN: A network that connects devices across countries or continents, usually built from many interconnected smaller networks.
Beyond size, every network has a shape — a topology. The topology describes how the devices are physically wired together (physical topology) and how the data actually flows between them (logical topology). Both matter because they affect speed, reliability, and how easy it is to add new devices.
Imagine a classroom of students passing notes. The seating arrangement is the physical topology; the route a note takes from one desk to another is the logical topology. Even if everyone sits in neat rows, the note might be passed hand‑to‑hand along a different path if someone is absent. Networks work the same way.
Here are the most common topologies:
Star: All devices connect to a central device, like a switch. If one cable breaks, only that device loses connection; the rest of the network stays up. This is the most popular topology for modern LANs.
Bus: All devices share a single main cable. Data travels along the cable and every device sees every message, but only the intended recipient accepts it. A break in the cable brings down the whole segment. Bus topologies were common in early Ethernet but are rare now.
Ring: Devices are connected in a closed loop. Data travels in one direction around the ring, and each device regenerates the signal. A single break can knock out the entire ring unless there is a backup path. Token Ring networks used this design.
Mesh: Every device connects to every other device (full mesh) or to several others (partial mesh). This gives incredible redundancy — if one link fails, data can take another route. Mesh topologies are expensive because of all the cables, so they are mostly used in WAN backbones or critical infrastructure.
Tree: A hierarchy of star networks connected together. You might have a core switch that links to several other switches, each of which connects to groups of computers. This is scalable and easy to manage, and it is what you see in many large organisations.
Topology: The layout or pattern of connections in a network, describing either the physical cabling or the logical flow of data.
A single network can mix these ideas. For example, your home LAN might use a physical star (all devices plug into one router) but logically behave like a bus because the Wi‑Fi signal is broadcast to everyone. Understanding topologies helps you spot weak points: a star network fails gracefully, while a bus network can be taken down by one cut cable.
📝 Section Recap: Networks are classified by size (LAN, MAN, WAN) and by the pattern of their connections (star, bus, ring, mesh, tree). The topology you choose affects how robust and fast the network will be.
The Hardware That Moves Data: Routers, Switches, and More#
A network is not just wires; it is filled with specialised devices that steer traffic. Let’s meet the key players.
Hubs are the simplest. A hub takes a signal coming in on one port and repeats it out to every other port. It does not look at the data or make any decisions — it just blasts the signal everywhere. That wastes bandwidth and creates security risks because every device sees everyone else’s traffic. Hubs are largely obsolete today.
Switches are smarter. A switch learns the unique hardware address (the MAC address) of each device plugged into it. When a frame of data arrives, the switch reads the destination MAC address and sends it out only on the port where that device lives. This keeps conversations private and frees up capacity. Switches are the workhorses of modern LANs.
Routers connect different networks together. While a switch moves data within a LAN, a router forwards data between LANs, or between your home network and the internet. Routers work with IP addresses (which we will cover next) and maintain a table of routes to decide the best path for each packet. Your home Wi‑Fi “router” is actually a combination device: it has a router, a switch, and a wireless access point all in one box.
Firewalls are the security guards. A firewall examines traffic entering or leaving a network and blocks anything that violates a set of rules. It can be a dedicated hardware appliance or software running on a server. Firewalls are essential for keeping attackers out and stopping sensitive data from leaking.
Servers are computers that provide services to other devices, called clients. When you visit a website, your browser is the client, and the machine hosting the website is the server. Servers can run on ordinary computers, but in data centres they are often powerful machines with redundant power supplies and fast network connections.
MAC address: A unique 48‑bit identifier burned into every network interface card, used for communication within a local network.
IP address: A logical address assigned to a device to identify it on a larger internetwork, such as the internet.
Think of a neighbourhood of houses. Each house has a unique street address (IP address) and every room inside has a door number (MAC address). A switch is like the internal hallway that delivers a note to the right room based on the door number. A router is the post office that reads the street address and sends the letter to the correct neighbourhood. A firewall is the security checkpoint that inspects each package before allowing it through the front gate.
📝 Section Recap: Hubs blindly repeat signals; switches forward data intelligently within a LAN using MAC addresses; routers connect different networks using IP addresses; firewalls filter traffic for security; servers provide services to clients. Each device plays a distinct role in keeping data flowing safely and efficiently.
Every device on the internet needs a unique address so that data can find its way. That address is an IP address. There are two versions in use today: the older IPv4 and the newer IPv6.
An IPv4 address is a 32‑bit number, usually written as four decimal numbers separated by dots, each between 0 and 255 — for example, 192.168.1.10. Because each of the four parts can be 0–255, there are (about 4.3 billion) possible IPv4 addresses. That once seemed like plenty, but with the explosion of smartphones, laptops, and smart devices, we have run out of fresh IPv4 addresses.
To help manage the address space, early designers divided IPv4 into classes based on the size of the network:
Class A: Supports very large networks (up to 16 million hosts). The first bit is 0, and the first octet ranges from 1 to 126. Example: 10.0.0.0.
Class B: For medium‑sized networks (up to 65,534 hosts). The first two bits are 10, first octet 128–191. Example: 172.16.0.0.
Class C: For small networks (up to 254 hosts). First three bits 110, first octet 192–223. Example: 192.168.0.0.
Class D: Reserved for multicast (sending to many devices at once), first octet 224–239.
Class E: Reserved for experimental use, first octet 240–255.
Classful addressing was simple but wasteful — a company that needed only 300 hosts would get a Class B with 65,534 addresses, leaving most unused. Today we use Classless Inter‑Domain Routing (CIDR), which allows flexible splitting of address blocks.
IPv6 solves the shortage by using 128‑bit addresses, giving an astronomical (about 340 undecillion) unique addresses. An IPv6 address is written as eight groups of four hexadecimal digits, separated by colons, like 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Leading zeros can be omitted, and a run of all‑zero groups can be shortened to :: once per address. IPv6 also simplifies packet headers and includes built‑in security features.
IP addresses are not handed out randomly. A global organisation called IANA (Internet Assigned Numbers Authority) allocates large blocks to five Regional Internet Registries (RIRs), each serving a part of the world:
ARIN: North America
RIPE NCC: Europe, the Middle East, and parts of Central Asia
APNIC: Asia‑Pacific
LACNIC: Latin America and the Caribbean
AFRINIC: Africa
These RIRs then distribute smaller blocks to internet service providers and large organisations, who in turn assign addresses to your home router and devices. This tiered system keeps the internet’s address book organised.
📝 Section Recap: IPv4 uses 32‑bit addresses written in dotted decimal, but we ran out; IPv6 uses 128‑bit addresses to give virtually unlimited space. Regional Internet Registries manage the global distribution of IP address blocks, ensuring every device gets a unique identifier.
Translating Names to Numbers: The Domain Name System#
People remember names like www.example.com far better than strings of numbers like 93.184.216.34. The Domain Name System (DNS) is the internet’s phonebook: it translates human‑readable domain names into IP addresses.
Domain names have a tree‑like structure, read from right to left:
Root: The very top, represented by a trailing dot (usually invisible to users). There are 13 root server clusters worldwide.
Top‑Level Domains (TLDs): The familiar endings like .com, .org, .net, and country codes like .uk, .jp.
Second‑Level Domains: The part you usually register, e.g., example in example.com.
Subdomains: Anything to the left, like www or mail. www.example.com is a subdomain of example.com.
Each level is managed by a different authority. The root servers know where to find the TLD servers; the TLD servers know the authoritative name servers for each second‑level domain; and those authoritative servers hold the actual IP address records.
When you type a URL into your browser, your computer first checks its local cache. If it doesn’t know the address, it asks a DNS resolver (usually provided by your internet service provider). The resolver then walks down the hierarchy:
It asks a root server: “Who handles .com?”
The root server replies with the IP address of a .com TLD server.
The resolver asks that TLD server: “Where is example.com?”
The TLD server returns the IP address of example.com’s authoritative name server.
The resolver asks that name server for the address of www.example.com, and gets back an IP address.
All of this happens in milliseconds. The resolver caches the answer so that future queries for the same name are instant. This distributed design means no single computer has to know every address, and the system can scale to billions of names.
DNS resolver: A server that performs the full lookup on behalf of your device, caching results for speed.
DNS is a prime target for attackers because if you can trick a resolver into returning a fake IP address, you can redirect users to a malicious site without them knowing. That is why DNS security is a major focus of cybersecurity.
📝 Section Recap: DNS converts domain names into IP addresses through a hierarchical system of root, TLD, and authoritative servers. A resolver walks the tree to find the answer, caching results along the way to speed up future lookups.
The Layered Blueprint: How TCP/IP Organises Communication#
Sending a photo from your phone to a friend’s device across the world involves many steps: breaking the image into pieces, addressing it, routing it through dozens of routers, checking for errors, and reassembling it. To manage this complexity, network engineers use a layered model. The TCP/IP model (also called the Internet protocol suite) is the blueprint for all modern internet communication.
The model has four conceptual layers, each with a specific job:
Link Layer (Network Access Layer): Handles the physical transmission of data over a specific medium — copper wire, fibre optic, radio waves. It deals with hardware addresses (MAC addresses) and the rules for putting bits onto the cable. Ethernet and Wi‑Fi live here.
Internet Layer: Takes data from the layer above and packages it into packets with source and destination IP addresses. This layer figures out the best path across multiple networks. The core protocol here is IP (Internet Protocol). It is a “best effort” delivery service — it does not guarantee that packets arrive or arrive in order.
Transport Layer: Adds reliability and ordering on top of IP. The two main protocols are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). TCP sets up a connection, numbers every byte, acknowledges received data, and retransmits lost packets. It ensures the data arrives complete and in sequence — perfect for web pages, email, and file downloads. UDP is a lightweight, connectionless protocol with no guarantees; it is used for streaming video, online gaming, and voice calls where speed matters more than perfect accuracy.
Application Layer: This is where the programs you use live. Protocols like HTTP (web browsing), SMTP (email), FTP (file transfer), and DNS (name resolution) all operate at this layer. They define the structure and meaning of the messages exchanged between applications.
Packet: A small chunk of data with a header containing source and destination addresses, sent across a network.
Imagine sending a thousand‑page book through the mail. The Application Layer writes the letter and decides what language to use. The Transport Layer (TCP) photocopies the book, numbers every page, and puts each page into a separate envelope with a sequence number. The Internet Layer writes the destination address on each envelope. The Link Layer hands the envelopes to the postal truck and drives them to the next sorting facility. At the receiving end, the layers work in reverse: the Link Layer unloads the truck, the Internet Layer checks the address, the Transport Layer puts the pages back in order and asks for missing ones, and the Application Layer reads the reassembled book. This layering means you can swap out one technology (e.g., replace Ethernet with Wi‑Fi) without rewriting the whole system.
📝 Section Recap: The TCP/IP model splits network communication into four layers — Link, Internet, Transport, and Application — each with a clear responsibility. TCP adds reliability and ordering on top of IP’s basic delivery, while UDP offers speed without guarantees.
The Web in Action: HTTP and the Request‑Response Cycle#
The World Wide Web is a collection of documents, images, and other resources linked together and accessed over the internet. The protocol that makes the web work is HTTP (Hypertext Transfer Protocol). Every time you click a link or type a URL, your browser performs a simple dance with a web server: the HTTP request‑response cycle.
You enter a URL:http://www.example.com/index.html.
DNS resolution: Your browser uses DNS (as we saw earlier) to turn www.example.com into an IP address.
TCP connection: Your browser opens a TCP connection to that IP address on port 80 (the default for HTTP) or port 443 (for HTTPS, the encrypted version). The three‑way TCP handshake — SYN, SYN‑ACK, ACK — establishes a reliable channel.
HTTP request: The browser sends an HTTP request message. It looks something like:
GET /index.html HTTP/1.1Host: www.example.com
The first line contains the method (GET to fetch a resource, POST to send data, etc.), the path, and the protocol version. Headers provide extra information like the host name and the types of content the browser can accept.
Server processing: The web server receives the request, finds the requested file or runs a program to generate a response.
HTTP response: The server sends back an HTTP response. It starts with a status line like HTTP/1.1 200 OK (success) or 404 Not Found (the famous error). Headers describe the content (type, length, caching rules), and then the actual HTML document follows.
Rendering: The browser parses the HTML, discovers it needs additional resources (images, CSS, JavaScript), and issues more HTTP requests for each of them. The page gradually appears on your screen.
Connection close: Once all resources are loaded, the TCP connection may be closed or kept alive for future requests.
Plain HTTP sends everything in clear text — anyone on the same network can read the request and response. HTTPS (HTTP Secure) wraps HTTP inside a layer of encryption provided by TLS (Transport Layer Security). This protects the confidentiality and integrity of the data. Today, most websites use HTTPS by default, and browsers mark plain HTTP sites as “not secure.”
HTTP method: A verb that tells the server what action to perform, such as GET (retrieve), POST (submit data), PUT (update), DELETE (remove).
The web is the most visible part of the internet, and its request‑response pattern is at the heart of everything from online banking to social media. Understanding this cycle is essential for spotting attacks like cross‑site scripting or man‑in‑the‑middle interception, which we will explore later.
📝 Section Recap: The web runs on HTTP, a simple request‑response protocol. A browser resolves a domain name, opens a TCP connection, sends a request, and receives a response that it renders into a page. HTTPS adds encryption to protect the data in transit.
We started by looking at how big a network can be — from a tiny home LAN to the globe‑spanning WAN we call the internet — and at the physical shapes that give networks their structure. Then we met the hardware heroes: switches that keep local traffic tidy, routers that connect distant worlds, and firewalls that stand guard. After that, we explored the addressing system that gives every device a unique name, the DNS phonebook that translates human‑friendly names into those numbers, and the layered TCP/IP model that breaks the huge problem of communication into manageable pieces. Finally, we watched the web come alive through the simple but powerful HTTP request‑response cycle. Each piece fits together like a well‑oiled machine, and knowing how it works is the first step toward understanding where things can go wrong — and how to defend them.
Key idea
What it means (plain English)
Why it matters
LAN, MAN, WAN
Networks sized for a building, a city, or the world.
Helps you choose the right technology and understand how data travels over different distances.
Network topology
The layout of connections (star, bus, ring, mesh, tree).
Affects reliability, speed, and how easily a network can grow or recover from breaks.
Switch vs. router
A switch forwards data within a LAN using MAC addresses; a router forwards data between networks using IP addresses.
Knowing which device does what lets you design networks that work and troubleshoot problems.