|
| 1 | +# What is computer networking? |
| 2 | + |
| 3 | +> **Phase:** 00 — Getting Started |
| 4 | +> **Module:** Introduction |
| 5 | +> **Lesson:** 01 |
| 6 | +> **Tested on:** Ubuntu 24.04, Windows 11, macOS 14 · Python 3.12 |
| 7 | +
|
| 8 | +## Objective |
| 9 | +Understand what a computer network is, what it is made of, and see your own network with a few simple commands. |
| 10 | + |
| 11 | +## Explanation |
| 12 | +A **computer network** is two or more devices connected so they can share data. |
| 13 | + |
| 14 | +That's it. Your phone talking to your Wi-Fi router is a network. Your laptop opening a website on a server in another country is also a network — just a much bigger one. |
| 15 | + |
| 16 | +A network needs three things: |
| 17 | + |
| 18 | +1. **Devices** that send or receive data — laptops, phones, servers, printers, smart TVs. In networking we call them **hosts** or **nodes**. |
| 19 | +2. **A connection** between them — a cable (Ethernet, fibre) or wireless (Wi-Fi, mobile data). |
| 20 | +3. **Rules** that everyone follows so they understand each other. These rules are called **protocols**. You will meet many of them in this course: IP, TCP, DNS, HTTP and more. |
| 21 | + |
| 22 | +Networks come in different sizes: |
| 23 | + |
| 24 | +| Type | Size | Example | |
| 25 | +| ---- | ---- | ------- | |
| 26 | +| **PAN** — Personal Area Network | A few metres | Phone + Bluetooth earbuds | |
| 27 | +| **LAN** — Local Area Network | One home, office or building | Everything on your home Wi-Fi | |
| 28 | +| **WAN** — Wide Area Network | Cities, countries | A company linking offices in Lahore and London | |
| 29 | +| **The Internet** | The whole world | A network of networks | |
| 30 | + |
| 31 | +The **Internet** is not one big network. It is millions of separate networks — homes, companies, universities, internet providers — all connected together and following the same rules. |
| 32 | + |
| 33 | +## How it works |
| 34 | +When you send something over a network, it doesn't travel as one big piece. It is cut into small pieces called **packets**. |
| 35 | + |
| 36 | +Each packet carries: |
| 37 | +- **the data** — a small part of your message, photo or web page |
| 38 | +- **an address of where it's going** and **where it came from** — like an envelope |
| 39 | + |
| 40 | +A few devices move these packets around: |
| 41 | + |
| 42 | +- **Network card (NIC)** — the part inside your device that connects it to a network (Wi-Fi or cable). |
| 43 | +- **Switch** — connects devices *inside* one local network and sends each packet to the right device. |
| 44 | +- **Router** — connects *different* networks together and picks the path to the destination. Your home router connects your LAN to your internet provider. |
| 45 | +- **Access point** — gives Wi-Fi to devices. In most homes the router, switch and access point are all inside one box. |
| 46 | + |
| 47 | +A simple trip, opening a website from home: |
| 48 | + |
| 49 | +``` |
| 50 | +Your laptop → Wi-Fi → home router → internet provider → many routers → website's server |
| 51 | + (LAN) (the Internet / WAN) |
| 52 | +``` |
| 53 | + |
| 54 | +The server sends the page back the same way, in packets. Your laptop puts the packets back together and shows the page. |
| 55 | + |
| 56 | +## Examples |
| 57 | +- **Printing at home:** your laptop sends a document to the printer. Both are on the same LAN, so the packets never leave your house. |
| 58 | +- **Video call:** your voice is cut into packets, sent across the Internet to your friend's device, and joined back together — many times per second. |
| 59 | +- **Smart TV streaming:** the TV is a host on your LAN. It asks a server on the Internet for video, and the router passes the packets in and out. |
| 60 | + |
| 61 | +## Commands |
| 62 | +These commands are safe — they only show information about **your own** device. |
| 63 | + |
| 64 | +**See your device's network details** |
| 65 | + |
| 66 | +```bash |
| 67 | +# Linux |
| 68 | +ip addr # your network cards and addresses |
| 69 | +ip route # your default gateway (the router) |
| 70 | + |
| 71 | +# macOS |
| 72 | +ifconfig |
| 73 | +netstat -nr # routing table, look for "default" |
| 74 | + |
| 75 | +# Windows (Command Prompt or PowerShell) |
| 76 | +ipconfig # address, subnet mask, default gateway |
| 77 | +``` |
| 78 | + |
| 79 | +**Check if another device can be reached** |
| 80 | + |
| 81 | +```bash |
| 82 | +ping -c 4 1.1.1.1 # Linux / macOS — send 4 test packets |
| 83 | +ping 1.1.1.1 # Windows — sends 4 by default |
| 84 | +``` |
| 85 | + |
| 86 | +`ping` sends a tiny packet and waits for a reply. If replies come back, the path works. The `time=` number shows how long the round trip took, in milliseconds. |
| 87 | + |
| 88 | +## Practical work |
| 89 | +Map your own home network on paper. |
| 90 | + |
| 91 | +1. Run the command for your system from **Commands** and find: |
| 92 | + - your device's address (looks like `192.168.x.x` or `10.x.x.x`) |
| 93 | + - your **default gateway** — this is your router |
| 94 | +2. `ping` your router's address. Then `ping 1.1.1.1` (a public server). Compare the `time=` values — which is faster, and why? |
| 95 | +3. Run the small Python script for this lesson with `python3 my_network_info.py`. It shows your device name, its local address, and the network commands for your system: [my_network_info.py](code/01-what-is-computer-networking/my_network_info.py) |
| 96 | +4. Draw a simple picture: your devices → router → internet provider → Internet. Write each device's name next to it. |
| 97 | + |
| 98 | +> Only look at networks you own or are allowed to use. Don't scan or test other people's networks — even "just to look". You'll learn safe lab setups later in this phase. |
| 99 | +
|
| 100 | +## Common mistakes |
| 101 | +- **"The Internet and the web are the same."** No. The **Internet** is the network. The **web** (websites) is just one service that runs on it — like email, games and video calls. |
| 102 | +- **"Wi-Fi is the Internet."** Wi-Fi only connects you to your local router. You can have Wi-Fi with no internet if the router's connection to the provider is down. |
| 103 | +- **"Data travels in one piece."** It is always cut into packets, and packets can even take different paths. |
| 104 | +- **Mixing up router and switch.** Switch = inside one network. Router = between networks. |
| 105 | +- **`ping` fails, so the device is off.** Not always. Many devices and firewalls block ping on purpose. |
| 106 | + |
| 107 | +## Why it matters for security |
| 108 | +Almost every attack and every defence happens **over a network**. |
| 109 | + |
| 110 | +- To protect a system, you first need to know what is connected and how data flows. |
| 111 | +- Attackers look for weak devices on a network — an old router, an unprotected camera, a shared printer. |
| 112 | +- Defences like firewalls, VPNs and network segmentation (all later in this course) only make sense once you understand what a network is. |
| 113 | + |
| 114 | +Rule of thumb: **you can't secure what you don't understand.** This lesson is the first step. |
| 115 | + |
| 116 | +## Check your understanding |
| 117 | +1. What three things does every network need? |
| 118 | +2. What is the difference between a LAN and a WAN? Give one example of each from your own life. |
| 119 | +3. What is a packet, and why is data split into packets? |
| 120 | +4. Your laptop has Wi-Fi but websites won't load. Using what you learned, where could the problem be? |
| 121 | +5. **Task:** Find your default gateway and ping it. Write down your address, the gateway address and the average ping time. |
| 122 | + |
| 123 | +## References |
| 124 | +- [RFC 1122 — Requirements for Internet Hosts: Communication Layers](https://www.rfc-editor.org/rfc/rfc1122) (IETF) |
| 125 | +- [What is a LAN?](https://www.cloudflare.com/learning/network-layer/what-is-a-lan/) (Cloudflare Learning Center) |
| 126 | +- [How does the Internet work?](https://www.cloudflare.com/learning/network-layer/how-does-the-internet-work/) (Cloudflare Learning Center) |
0 commit comments