Welcome to the World of Networking!
In this chapter, we are going to dive into The Internet. We use it every single day to stream videos, message friends, and do research, but have you ever wondered how data actually travels from a server in California to your phone in the UK? Don't worry if this seems like a lot of technical detail at first—we’ll break it down into simple, bite-sized pieces using analogies you already know.
By the end of these notes, you’ll understand the "magic" behind the screen: how packets move, how security keeps us safe, and how different devices talk the same language.
1. The Structure of the Internet
The Internet is essentially a "network of networks." It isn’t one single thing, but millions of private, public, academic, and government networks linked together.
Packet Switching
When you send a large file (like a photo), it isn't sent as one giant chunk. Instead, it is broken down into tiny pieces called packets. This process is called packet switching.
The Analogy: Imagine you want to send a 1,000-piece jigsaw puzzle to a friend by post. Instead of sending the whole box (which might get stuck or lost), you put each individual piece into its own envelope and address them all. They might take different routes, but they all arrive at your friend's house to be rebuilt.
Main components of a packet:
1. Header: Contains the sender’s IP, the receiver’s IP, the packet number (e.g., 1 of 50), and the protocol being used.
2. Payload: The actual data being sent (the "jigsaw piece").
3. Trailer: Contains error-checking data (checksum) to ensure the packet wasn't corrupted during the trip.
Routers and Gateways
How do those packets find their way? They use routers and gateways.
- Router: A device that looks at the IP address on a packet and decides the best path for it to take to reach its destination.
- Gateway: Used when two networks use different protocols. It "translates" the data so the different networks can understand each other.
Quick Review: Packet switching is efficient because if one path is busy or broken, packets can simply take a different route!
2. Addresses and Naming
Just like your house has a postcode, every device and resource on the internet needs a unique address.
IP Addresses and FQDNs
Computers love numbers; humans love words. That’s why we have different ways of identifying things:
- IP Address: A unique numerical address (e.g., 192.168.1.1).
- Domain Name: A human-friendly version (e.g., google.com).
- Fully Qualified Domain Name (FQDN): The complete domain name for a specific computer or "host" (e.g., www.aqa.org.uk).
The Domain Name System (DNS)
When you type www.youtube.com into your browser, your computer doesn't actually know where that is. It has to ask a DNS Server.
The Step-by-Step Process:
1. You type the URL into your browser.
2. Your browser sends the domain name to a DNS Server.
3. The DNS server looks up the IP address associated with that name in its database.
4. The DNS server sends the IP address back to your browser.
5. Your browser can now connect directly to the server using that IP.
Did you know? If a DNS server doesn't know the address, it asks another "higher-up" DNS server. This is a global, hierarchical system!
Internet Registries
Internet Registries are organizations that keep track of which IP addresses and domain names are assigned to whom. We need them to ensure that no two people own the same domain name or use the same public IP address at the same time.
Key Takeaway: DNS is like the "Phonebook" of the internet. It turns names we can remember into numbers the computers can use.
3. The TCP/IP Protocol Stack
For different types of computers to talk to each other, they must follow a set of rules called a protocol. The TCP/IP Stack is the most important set of rules on the internet. It is organized into four layers.
Memory Aid: Remember the layers using A T N L (All Tigers Need Lunch):
- Application Layer: Where the apps live (e.g., your browser). Uses protocols like HTTP, FTP, SMTP.
- Transport Layer: Breaks data into packets and ensures they arrive without errors (using TCP).
- Network Layer: Adds the source and destination IP addresses. Routers operate here.
- Link Layer: Handles the physical connection (cables, Wi-Fi) and uses MAC addresses.
Sockets and Ports
A Socket is like a "door" to a specific application on a computer. It is made by combining an IP Address and a Port Number.
\( \text{Socket} = \text{IP Address} + \text{Port Number} \)
- Well-known Ports: (0–1023) Used for standard services. E.g., Port 80 for HTTP, Port 25 for SMTP (Email).
- Client Ports: Temporary ports used by your device to receive data back from a server.
The Analogy: If the IP Address is the address of an apartment building, the Port Number is the specific apartment number where a specific person (the application) lives.
4. IP Standards: IPv4 vs IPv6
IPv4 uses 32 bits, allowing for about 4 billion addresses. Believe it or not, we have actually run out of these because there are so many phones, kettles, and lightbulbs connected to the internet!
IPv6 was introduced to solve this. It uses 128 bits, providing more addresses than there are grains of sand on Earth! It is written in hexadecimal to make it easier for humans to read.
Public vs Private IP Addresses
- Public IP: Routable across the whole internet. Every house usually has one unique public IP assigned by their provider.
- Private IP: Used inside your home network. Your phone and laptop have private IPs (like 192.168.0.5) that can't be seen from the outside world.
NAT and DHCP
- DHCP (Dynamic Host Configuration Protocol): Automatically assigns an IP address to a device when it joins a network. Like a hotel receptionist giving you a room key when you check in.
- NAT (Network Address Translation): Your router uses NAT to "hide" your private IPs behind one single public IP when you access the internet.
5. Internet Security
The internet can be a dangerous place! We use several methods to stay safe.
Firewalls
A firewall sits between a private network and the internet, monitoring traffic.
- Packet Filtering: Inspects the header of every packet and drops them if they come from a banned IP or port.
- Proxy Server: Acts as a middleman. Your computer asks the Proxy for a webpage; the Proxy gets it for you. This hides your internal network from the server.
- Stateful Inspection: Not only looks at the packet, but also looks at the context. It checks if the packet is part of an existing, safe conversation you started.
Encryption
- Symmetric Encryption: Both the sender and receiver use the same key to encrypt and decrypt. (Like a physical diary with one key).
- Asymmetric Encryption: Uses a Public Key (shared with everyone to encrypt data) and a Private Key (kept secret by the owner to decrypt it).
Malware: Viruses, Worms, and Trojans
- Virus: A piece of code that attaches to a file and needs a human to run/open it to spread.
- Worm: A standalone program that can self-replicate and spread across a network automatically without human help.
- Trojan: Malware disguised as something useful (like a "free game") to trick you into installing it.
Key Takeaway: Security is about layers. Firewalls keep people out, encryption keeps data secret, and digital signatures prove that a message is authentic.
6. Modern Web Technologies
CRUD and REST
Most web apps do four things with data: Create, Retrieve, Update, and Delete (CRUD).
REST is a way of mapping these actions to web commands (HTTP):
- POST → Create
- GET → Retrieve
- PUT → Update
- DELETE → Delete
JSON vs XML
These are ways to transfer data between a server and a web app.
- JSON: Modern, lightweight, and very easy for computers (and humans) to read.
- XML: Older, uses "tags" like HTML. It is "wordier" and takes up more bandwidth.
Thin vs Thick Clients
- Thin Client: Most of the processing happens on the server. Your device just displays the result (e.g., using a web browser to check Gmail).
- Thick Client: Most of the processing happens on your device. It might work offline (e.g., a video game installed on your PC).
Final Summary: The internet is a complex stack of rules (TCP/IP), addresses (IP/DNS), and security measures (Firewalls/Encryption) that allow us to share data (JSON/REST) across the globe in milliseconds!