CloudAcademia
EN

Networking · Module 02 · Your Home Network

Your Home Network

Lesson30 minFoundationsMarkdown

Showing raw Markdown: the renderer could not load.

## Why this matters
Your phone, laptop, TV and printer all "just work" on the Internet. Behind that sits one small box in a corner of your home, plugged into the wall. When the video stops loading or the printer cannot be found, knowing what that box does tells you where to look.

You do not need to be an engineer to understand it. This lesson explains the box with everyday pictures, shows you the numbers that identify your devices, and introduces one simple test, `ping`, that answers the question "can I reach that device?".

## Learning objectives
- Identify the parts of a home network (router, Wi-Fi access point, devices) and what each one does.
- Explain what an IP address is and the difference between the private address of a device and the public address of the home.
- Find your device's IP address and your router's address on your own computer or phone.
- Test whether another device is reachable with `ping` and read the result.

## Key concepts

### The home router: several devices in one box
The box your Internet company gave you is usually called "the router". That name is a little unfair, because it is really **several devices in one box**. Picture a small office building with one front door and five people working inside:

- **The line to your ISP.** Your **ISP** (Internet service provider) is the company that sells you Internet access. Its line reaches your home as a cable or as optical fibre. A **modem** (or, for fibre, an ONT, the fibre box) translates the signal on that line into something your home can use. In many homes this is built into the same box; in others it is a separate box with its own cable to the router.
- **The router.** A **router** passes traffic between your home and the Internet, like a post office that sends parcels out and delivers incoming ones to the right person.
- **A switch.** A **switch** is the group of sockets on the back (often four), where you plug in cables. It lets wired devices talk to each other and to the router.
- **A Wi-Fi access point.** An **access point** does the same job as the sockets, but without cables. It is the invisible cable: devices that join your Wi-Fi network are connected to the router through it.
- **A DHCP service.** **DHCP** (Dynamic Host Configuration Protocol) hands every new device an address, automatically, when it joins. You will meet addresses in a moment.

<figure class="diagram" style="--dg-w: 1040px"><svg xmlns="http://www.w3.org/2000/svg" class="dg" viewBox="0 0 1040 472" width="1040" height="472" role="img" aria-labelledby="homenet-parts-title homenet-parts-desc" font-family="Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" xml:lang="en">
<title id="homenet-parts-title">The parts of a home network</title>
<desc id="homenet-parts-desc">At the top, the Internet cloud, connected through your ISP and a fibre or cable line to a dashed area called your home router: several devices in one box. Inside the box are five cards: the modem or fibre box, which talks to the ISP line; the router, which passes traffic in and out; the switch ports, which are the sockets for cables; the Wi-Fi access point, which is the invisible cable; and DHCP, which hands out addresses. Below the box, four devices connect to it: a laptop and a printer by cable, and a phone and a smart TV by Wi-Fi.</desc>
<rect class="dg-bg" x="0.5" y="0.5" width="1039" height="471" rx="16" fill="#ffffff" stroke="#e3e3dd"/>
<rect class="dg-card" x="24" y="20" width="250" height="100" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l7"><g class="dg-icon" transform="translate(40 36) scale(1.2500)" fill="none" stroke="#6d28d9" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></g></g>
<g class="dg-l7"><text x="82" y="57" font-size="15" class="dg-ink" fill="#6d28d9" font-weight="700">The Internet</text></g>
<text x="42" y="88" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">websites, video, mail</text>
<rect class="dg-card" x="396" y="20" width="270" height="100" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l1"><g class="dg-icon" transform="translate(412 36) scale(1.2500)" fill="none" stroke="#0369a1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z"/><path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2"/><path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2"/><path d="M10 6h4"/><path d="M10 10h4"/><path d="M10 14h4"/><path d="M10 18h4"/></g></g>
<g class="dg-l1"><text x="454" y="57" font-size="15" class="dg-ink" fill="#0369a1" font-weight="700">Your ISP</text></g>
<text x="414" y="88" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">the company that sells</text>
<text x="414" y="108" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">you Internet access</text>
<g class="dg-l1"><path class="dg-stroke" d="M276 70H394" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><path class="dg-stroke" d="M531 122V160" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><rect class="dg-bg-plain" x="474.96" y="129" width="112.08" height="24" rx="12" fill="#ffffff"/><text x="531" y="145.5" font-size="12" class="dg-ink" fill="#0369a1" font-weight="600" text-anchor="middle">fibre or cable</text></g>
<g class="dg-l3"><rect class="dg-tint" x="24" y="160" width="992" height="176" rx="16" fill="#faf5f0" stroke="#e1ba9d" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(40 173) scale(0.7500)" fill="none" stroke="#b45309" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></g>
<text x="66" y="187" font-size="13" class="dg-ink" fill="#b45309" font-weight="700">Your home router: several devices in one box</text></g>
<rect class="dg-card" x="40" y="208" width="180.8" height="112" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l1"><g class="dg-icon" transform="translate(56 224) scale(1.2500)" fill="none" stroke="#0369a1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1"/><path d="M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9"/><path d="M21 21v-2h-4"/><path d="M3 5h4V3"/><path d="M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3"/></g></g>
<g class="dg-l1"><text x="98" y="245" font-size="13.5" class="dg-ink" fill="#0369a1" font-weight="700">Modem / fibre box</text></g>
<text x="58" y="276" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">talks to the ISP line</text>
<rect class="dg-card" x="234.8" y="208" width="180.8" height="112" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l3"><g class="dg-icon" transform="translate(250.8 224) scale(1.2500)" fill="none" stroke="#b45309" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="8" x="2" y="14" rx="2"/><path d="M6.01 18H6"/><path d="M10.01 18H10"/><path d="M15 10v4"/><path d="M17.84 7.17a4 4 0 0 0-5.66 0"/><path d="M20.66 4.34a8 8 0 0 0-11.31 0"/></g></g>
<g class="dg-l3"><text x="292.8" y="245" font-size="13.5" class="dg-ink" fill="#b45309" font-weight="700">Router</text></g>
<text x="252.8" y="276" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">passes traffic in and out</text>
<rect class="dg-card" x="429.6" y="208" width="180.8" height="112" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l2"><g class="dg-icon" transform="translate(445.6 224) scale(1.2500)" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M8 6h13"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M3 6h.01"/><path d="M3 12h.01"/><path d="M3 18h.01"/></g></g>
<g class="dg-l2"><text x="487.6" y="245" font-size="13.5" class="dg-ink" fill="#15803d" font-weight="700">Switch ports</text></g>
<text x="447.6" y="276" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">sockets for cables</text>
<rect class="dg-card" x="624.4" y="208" width="180.8" height="112" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l7"><g class="dg-icon" transform="translate(640.4 224) scale(1.2500)" fill="none" stroke="#6d28d9" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.86a10 10 0 0 1 14 0"/><path d="M8.5 16.43a5 5 0 0 1 7 0"/></g></g>
<g class="dg-l7"><text x="682.4" y="245" font-size="13.5" class="dg-ink" fill="#6d28d9" font-weight="700">Wi-Fi access point</text></g>
<text x="642.4" y="276" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">the invisible cable</text>
<rect class="dg-card" x="819.2" y="208" width="180.8" height="112" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l4"><g class="dg-icon" transform="translate(835.2 224) scale(1.2500)" fill="none" stroke="#c2410c" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="m3 16 4 4 4-4"/><path d="M7 20V4"/><path d="M11 4h10"/><path d="M11 8h7"/><path d="M11 12h4"/></g></g>
<g class="dg-l4"><text x="877.2" y="245" font-size="13.5" class="dg-ink" fill="#c2410c" font-weight="700">DHCP</text></g>
<text x="837.2" y="276" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">hands out addresses</text>
<rect class="dg-card" x="24" y="386" width="210" height="62" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l2"><g class="dg-icon" transform="translate(40 402) scale(1.2500)" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16"/></g></g>
<g class="dg-l2"><text x="82" y="423" font-size="14" class="dg-ink" fill="#15803d" font-weight="700">Laptop</text></g>
<g class="dg-l2"><path class="dg-stroke" d="M129 384V338" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l2"><rect class="dg-bg-plain" x="103.2" y="350" width="51.6" height="24" rx="12" fill="#ffffff"/><text x="129" y="366.5" font-size="12" class="dg-ink" fill="#15803d" font-weight="600" text-anchor="middle">cable</text></g>
<rect class="dg-card" x="284.667" y="386" width="210" height="62" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l2"><g class="dg-icon" transform="translate(300.667 402) scale(1.2500)" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><path d="M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6"/><rect x="6" y="14" width="12" height="8" rx="1"/></g></g>
<g class="dg-l2"><text x="342.667" y="423" font-size="14" class="dg-ink" fill="#15803d" font-weight="700">Printer</text></g>
<g class="dg-l2"><path class="dg-stroke" d="M389.667 384V338" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l2"><rect class="dg-bg-plain" x="363.867" y="350" width="51.6" height="24" rx="12" fill="#ffffff"/><text x="389.667" y="366.5" font-size="12" class="dg-ink" fill="#15803d" font-weight="600" text-anchor="middle">cable</text></g>
<rect class="dg-card" x="545.333" y="386" width="210" height="62" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l7"><g class="dg-icon" transform="translate(561.333 402) scale(1.2500)" fill="none" stroke="#6d28d9" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="20" x="5" y="2" rx="2"/><path d="M12 18h.01"/></g></g>
<g class="dg-l7"><text x="603.333" y="423" font-size="14" class="dg-ink" fill="#6d28d9" font-weight="700">Phone</text></g>
<g class="dg-l7"><path class="dg-stroke" d="M650.333 384V338" stroke="#6d28d9" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="7 6"/></g>
<g class="dg-l7"><rect class="dg-bg-plain" x="624.533" y="350" width="51.6" height="24" rx="12" fill="#ffffff"/><text x="650.333" y="366.5" font-size="12" class="dg-ink" fill="#6d28d9" font-weight="600" text-anchor="middle">Wi-Fi</text></g>
<rect class="dg-card" x="806" y="386" width="210" height="62" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l7"><g class="dg-icon" transform="translate(822 402) scale(1.2500)" fill="none" stroke="#6d28d9" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="15" x="2" y="7" rx="2"/><path d="m17 2-5 5-5-5"/></g></g>
<g class="dg-l7"><text x="864" y="423" font-size="14" class="dg-ink" fill="#6d28d9" font-weight="700">Smart TV</text></g>
<g class="dg-l7"><path class="dg-stroke" d="M911 384V338" stroke="#6d28d9" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="7 6"/></g>
<g class="dg-l7"><rect class="dg-bg-plain" x="885.2" y="350" width="51.6" height="24" rx="12" fill="#ffffff"/><text x="911" y="366.5" font-size="12" class="dg-ink" fill="#6d28d9" font-weight="600" text-anchor="middle">Wi-Fi</text></g>
</svg></figure>

*Figure 1. One box does five jobs. Wired devices plug into the switch ports; Wi-Fi devices reach the same router through the access point.*

**Wi-Fi or cable?** Both carry the same data. Cable (Ethernet) is usually faster and steadier but needs a wire to every device, so it suits a desktop PC or a streaming TV. Wi-Fi works anywhere in range, so it suits phones and laptops, but its speed varies with distance, walls and neighbours' networks. If a video call keeps freezing on Wi-Fi, plugging in a cable is a quick test of whether Wi-Fi is the problem.

> [!CHECK]
> Which part of the home router gives each new device its address automatically?
>
> - [ ] The switch ports
> - [ ] The Wi-Fi access point
> - [x] DHCP
> - [ ] The modem
>
> DHCP is the service that hands out addresses when a device joins, whether by cable or by Wi-Fi. The switch and the access point only carry the traffic.

### An IP address is like a street address
For a letter to arrive, it needs an address on the envelope. For data to arrive, it needs one too. An **IP address** (Internet Protocol address) is a number that identifies a device on a network, so other devices know where to send data.

An address in the common form (IPv4) is four numbers from 0 to 255 separated by dots, for example `192.168.0.23`. Like a street address, it has two parts: the first numbers say *which street* (the network) and the last number says *which house* (the device). Two devices whose addresses start the same way, like `192.168.0.23` and `192.168.0.30`, live on the same street, which is your home network.

> [!NOTE]
> A newer form, IPv6, uses longer addresses with letters and colons. Your devices may have both; this module uses the shorter IPv4 form.

An address is not permanent. When you join the Wi-Fi, DHCP lends your device an address for a while. Next week it may get a different one. That is why you look the address up when you need it, as you will in the activities.

> [!CHECK]
> In the picture of an IP address as a street address, what does the last number of `192.168.0.23` correspond to?
>
> - [ ] The name of the street
> - [x] The house on the street, meaning the single device
> - [ ] The city
> - [ ] The postcode of your ISP
>
> The first numbers identify the network (the street) and the last identifies the device (the house) on it.

### Private addresses inside, one public address outside
Here is something surprising: **your neighbour's laptop may have exactly the same address as yours.** Both can be `192.168.0.23`, and nothing breaks. The reason is that there are two kinds of address.

A **private address** works only inside a home or office. It is like an internal extension number in a company: "ext. 23" means something only inside the building. Three ranges are reserved for this use by a standard called RFC 1918:

| Range | Where you usually see it |
|---|---|
| `192.168.0.0` to `192.168.255.255` | Most home routers (`192.168.0.x` or `192.168.1.x`) |
| `10.0.0.0` to `10.255.255.255` | Some routers, and many offices |
| `172.16.0.0` to `172.31.255.255` | Less common at home; some offices |

The Internet does not carry private addresses, so millions of homes reuse the same numbers.

A **public address** is the one the whole Internet can see. It is like the company's main phone number: unique in the world. Your ISP gives your home one public address, and **all** your devices share it when they talk to the Internet.

<figure class="diagram" style="--dg-w: 1040px"><svg xmlns="http://www.w3.org/2000/svg" class="dg" viewBox="0 0 1040 360" width="1040" height="360" role="img" aria-labelledby="homenet-addresses-title homenet-addresses-desc" font-family="Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" xml:lang="en">
<title id="homenet-addresses-title">Private addresses inside the home and one public address outside</title>
<desc id="homenet-addresses-desc">On the left, a dashed area for your home with private addresses: a laptop at 192.168.0.23, a phone at 192.168.0.24 and a smart TV at 192.168.0.25, all linked to the router, whose home side has the address 192.168.0.1. The router&#x27;s Internet side has the public address 203.0.113.45. A label says NAT swaps the private address for the public one. On the right, outside, a web server at 198.51.100.7. An arrow goes from the router to the server, and the reply comes back to the home&#x27;s public address. A note says private addresses repeat in millions of homes while the public address is unique.</desc>
<rect class="dg-bg" x="0.5" y="0.5" width="1039" height="359" rx="16" fill="#ffffff" stroke="#e3e3dd"/>
<g class="dg-l3"><rect class="dg-tint" x="20" y="20" width="560" height="270" rx="16" fill="#faf5f0" stroke="#e1ba9d" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(36 33) scale(0.7500)" fill="none" stroke="#b45309" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></g>
<text x="62" y="47" font-size="13" class="dg-ink" fill="#b45309" font-weight="700">Inside your home: private addresses</text></g>
<g class="dg-l1"><rect class="dg-tint" x="740" y="20" width="280" height="270" rx="16" fill="#f0f6f9" stroke="#9ac3d9" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(756 33) scale(0.7500)" fill="none" stroke="#0369a1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></g>
<text x="782" y="47" font-size="13" class="dg-ink" fill="#0369a1" font-weight="700">Outside: the Internet</text></g>
<rect class="dg-card" x="40" y="62" width="280" height="64" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l3"><g class="dg-icon" transform="translate(56 78) scale(1.2500)" fill="none" stroke="#b45309" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16"/></g></g>
<g class="dg-l3"><text x="98" y="99" font-size="14" class="dg-ink" fill="#b45309" font-weight="700">Laptop</text></g>
<g class="dg-l3"><rect class="dg-solid" x="176" y="82" width="110" height="26" rx="13" fill="#b45309"/><text x="231" y="99.5" font-size="12" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">192.168.0.23</text></g>
<g class="dg-l3"><path class="dg-stroke" d="M322 94H376" stroke="#b45309" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<rect class="dg-card" x="40" y="136" width="280" height="64" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l3"><g class="dg-icon" transform="translate(56 152) scale(1.2500)" fill="none" stroke="#b45309" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="20" x="5" y="2" rx="2"/><path d="M12 18h.01"/></g></g>
<g class="dg-l3"><text x="98" y="173" font-size="14" class="dg-ink" fill="#b45309" font-weight="700">Phone</text></g>
<g class="dg-l3"><rect class="dg-solid" x="176" y="156" width="110" height="26" rx="13" fill="#b45309"/><text x="231" y="173.5" font-size="12" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">192.168.0.24</text></g>
<g class="dg-l3"><path class="dg-stroke" d="M322 168H376" stroke="#b45309" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<rect class="dg-card" x="40" y="210" width="280" height="64" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l3"><g class="dg-icon" transform="translate(56 226) scale(1.2500)" fill="none" stroke="#b45309" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="15" x="2" y="7" rx="2"/><path d="m17 2-5 5-5-5"/></g></g>
<g class="dg-l3"><text x="98" y="247" font-size="14" class="dg-ink" fill="#b45309" font-weight="700">Smart TV</text></g>
<g class="dg-l3"><rect class="dg-solid" x="176" y="230" width="110" height="26" rx="13" fill="#b45309"/><text x="231" y="247.5" font-size="12" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">192.168.0.25</text></g>
<g class="dg-l3"><path class="dg-stroke" d="M322 242H376" stroke="#b45309" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<rect class="dg-card" x="378" y="100" width="242" height="130" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l3"><g class="dg-icon" transform="translate(394 116) scale(1.2500)" fill="none" stroke="#b45309" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="8" x="2" y="14" rx="2"/><path d="M6.01 18H6"/><path d="M10.01 18H10"/><path d="M15 10v4"/><path d="M17.84 7.17a4 4 0 0 0-5.66 0"/><path d="M20.66 4.34a8 8 0 0 0-11.31 0"/></g></g>
<g class="dg-l3"><text x="436" y="137" font-size="15" class="dg-ink" fill="#b45309" font-weight="700">Router</text></g>
<text x="396" y="168" font-size="12.5" class="dg-text" fill="#17171c" font-weight="500" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">home side:     192.168.0.1</text>
<text x="396" y="188" font-size="12.5" class="dg-text" fill="#17171c" font-weight="500" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">Internet side: 203.0.113.45</text>
<rect class="dg-card" x="770" y="100" width="220" height="90" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l1"><g class="dg-icon" transform="translate(786 116) scale(1.2500)" fill="none" stroke="#0369a1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="8" x="2" y="2" rx="2"/><rect width="20" height="8" x="2" y="14" rx="2"/><path d="M6 6h.01"/><path d="M6 18h.01"/></g></g>
<g class="dg-l1"><text x="828" y="137" font-size="15" class="dg-ink" fill="#0369a1" font-weight="700">Web server</text></g>
<text x="788" y="168" font-size="12.5" class="dg-text" fill="#17171c" font-weight="500" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">198.51.100.7</text>
<g class="dg-l1"><path class="dg-stroke" d="M622 150H760" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><path class="dg-stroke" d="M757 144l8 6-8 6" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><rect class="dg-bg-plain" x="672.92" y="114" width="38.16" height="24" rx="12" fill="#ffffff"/><text x="692" y="130.5" font-size="12" class="dg-ink" fill="#0369a1" font-weight="600" text-anchor="middle">NAT</text></g>
<g class="dg-l1"><path class="dg-stroke" d="M762 176H622" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="7 6"/></g>
<g class="dg-l1"><path class="dg-stroke" d="M625 170l-8 6 8 6" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><rect class="dg-bg-plain" x="666.2" y="190" width="51.6" height="24" rx="12" fill="#ffffff"/><text x="692" y="206.5" font-size="12" class="dg-ink" fill="#0369a1" font-weight="600" text-anchor="middle">reply</text></g>
<text x="500" y="258" font-size="12.5" class="dg-muted" fill="#5c5c68" font-weight="600" text-anchor="middle">NAT swaps the private address for the public one</text>
<text x="520" y="328" font-size="13.5" class="dg-text" fill="#17171c" font-weight="600" text-anchor="middle">Private addresses repeat in millions of homes. The public address is unique.</text>
</svg></figure>

*Figure 2. Inside, each device has its own private address. Outside, the home appears as one public address. The addresses shown are examples.*

> [!NOTE]
> The addresses in the figures are examples. `203.0.113.45` and `198.51.100.7` come from ranges reserved for documentation (RFC 5737) so they never belong to a real home or server. Your own values will differ.

If the whole house shares one public address, how does the answer to a request for a web page reach the right device? The router keeps track. This is called **NAT** (Network Address Translation). When your laptop asks for a page, the router swaps the laptop's private address for the home's public address on the way out and remembers who asked. When the reply comes back to the public address, the router swaps it back and delivers it to the laptop. Think of a hotel front desk: guests in rooms phone out through the hotel's single number, and the desk connects the incoming answer to the right room.

> [!NOTE]
> Some ISPs go one step further and share one public address among many customers. This is called CGNAT (Carrier-Grade NAT). You may notice it if the "public address" shown by your router is not the same as the one a website reports for you. For everyday use you notice nothing, but it can matter for things like hosting a game server at home.

> [!CHECK]
> Your neighbour's laptop and yours both have the address `192.168.0.23`. Why does this not cause a problem?
>
> - [ ] Because the ISP gives each of you a different network name
> - [x] Because it is a private address that only has meaning inside each home
> - [ ] Because addresses that look the same are quietly changed by Wi-Fi
> - [ ] Because only one of the two laptops can be online at a time
>
> Private addresses are not carried over the Internet, so each home can reuse them. Only the public address must be unique.

### The default gateway and ping
Your laptop meets two kinds of destination. A printer in the next room is on the same street: the laptop sends data straight to it. A website is somewhere else entirely. For anything not on your street, your device hands the data to one chosen neighbour whose job is to forward it: the **default gateway**. At home, the default gateway is your router, usually with an address like `192.168.0.1` or `192.168.1.1`. It is the door out of your home.

<figure class="diagram" style="--dg-w: 1040px"><svg xmlns="http://www.w3.org/2000/svg" class="dg" viewBox="0 0 1040 300" width="1040" height="300" role="img" aria-labelledby="homenet-gateway-title homenet-gateway-desc" font-family="Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" xml:lang="en">
<title id="homenet-gateway-title">The default gateway is the door out of the home</title>
<desc id="homenet-gateway-desc">Your laptop at 192.168.0.23 has two kinds of destination. For the printer at 192.168.0.30, on the same home network, it sends the data straight there. For anything else, such as example.com somewhere on the Internet, it hands the data to the router at 192.168.0.1, which is the default gateway, and the router forwards it on.</desc>
<rect class="dg-bg" x="0.5" y="0.5" width="1039" height="299" rx="16" fill="#ffffff" stroke="#e3e3dd"/>
<g class="dg-l3"><rect class="dg-tint" x="20" y="20" width="640" height="260" rx="16" fill="#faf5f0" stroke="#e1ba9d" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(36 33) scale(0.7500)" fill="none" stroke="#b45309" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></g>
<text x="62" y="47" font-size="13" class="dg-ink" fill="#b45309" font-weight="700">192.168.0.0/24</text></g>
<rect class="dg-card" x="40" y="100" width="220" height="90" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l3"><g class="dg-icon" transform="translate(56 116) scale(1.2500)" fill="none" stroke="#b45309" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16"/></g></g>
<g class="dg-l3"><text x="98" y="137" font-size="15" class="dg-ink" fill="#b45309" font-weight="700">Your laptop</text></g>
<text x="58" y="168" font-size="12.5" class="dg-text" fill="#17171c" font-weight="500" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">192.168.0.23</text>
<rect class="dg-card" x="420" y="56" width="220" height="84" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l2"><g class="dg-icon" transform="translate(436 72) scale(1.2500)" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><path d="M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6"/><rect x="6" y="14" width="12" height="8" rx="1"/></g></g>
<g class="dg-l2"><text x="478" y="93" font-size="15" class="dg-ink" fill="#15803d" font-weight="700">Printer</text></g>
<text x="438" y="124" font-size="12.5" class="dg-text" fill="#17171c" font-weight="500" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">192.168.0.30</text>
<rect class="dg-card" x="420" y="160" width="220" height="100" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l3"><g class="dg-icon" transform="translate(436 176) scale(1.2500)" fill="none" stroke="#b45309" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="8" x="2" y="14" rx="2"/><path d="M6.01 18H6"/><path d="M10.01 18H10"/><path d="M15 10v4"/><path d="M17.84 7.17a4 4 0 0 0-5.66 0"/><path d="M20.66 4.34a8 8 0 0 0-11.31 0"/></g></g>
<g class="dg-l3"><text x="478" y="197" font-size="15" class="dg-ink" fill="#b45309" font-weight="700">Router</text></g>
<text x="438" y="228" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">default gateway</text>
<text x="438" y="248" font-size="12.5" class="dg-text" fill="#17171c" font-weight="500" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">192.168.0.1</text>
<rect class="dg-card" x="790" y="150" width="230" height="90" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l1"><g class="dg-icon" transform="translate(806 166) scale(1.2500)" fill="none" stroke="#0369a1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></g></g>
<g class="dg-l1"><text x="848" y="187" font-size="15" class="dg-ink" fill="#0369a1" font-weight="700">example.com</text></g>
<text x="808" y="218" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">somewhere on the Internet</text>
<g class="dg-l2"><path class="dg-stroke" d="M262 130H340V98H418" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l2"><path class="dg-stroke" d="M409 92l8 6-8 6" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l2"><rect class="dg-bg-plain" x="192.92" y="54" width="206.16" height="24" rx="12" fill="#ffffff"/><text x="296" y="70.5" font-size="12" class="dg-ink" fill="#15803d" font-weight="600" text-anchor="middle">Same network: straight there</text></g>
<g class="dg-l3"><path class="dg-stroke" d="M262 164H300V210H418" stroke="#b45309" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l3"><path class="dg-stroke" d="M409 204l8 6-8 6" stroke="#b45309" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l3"><rect class="dg-bg-plain" x="186.2" y="228" width="219.6" height="24" rx="12" fill="#ffffff"/><text x="296" y="244.5" font-size="12" class="dg-ink" fill="#b45309" font-weight="600" text-anchor="middle">Anywhere else: via the gateway</text></g>
<g class="dg-l1"><path class="dg-stroke" d="M642 210H780" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><path class="dg-stroke" d="M777 204l8 6-8 6" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><rect class="dg-bg-plain" x="676.12" y="176" width="71.76" height="24" rx="12" fill="#ffffff"/><text x="712" y="192.5" font-size="12" class="dg-ink" fill="#0369a1" font-weight="600" text-anchor="middle">Internet</text></g>
</svg></figure>

*Figure 3. Same street: straight there. Anywhere else: via the default gateway.*

How do you test that a device can be reached? You ask "are you there?" and wait for an answer. The tool for this is called **ping**. It sends a tiny message to an address and measures how long the reply takes. Ping reports:

- **The time** of each reply, in milliseconds (ms, thousandths of a second). Smaller is better. Your router, in the next room, answers in a fraction of a millisecond to a few milliseconds. A website far away takes longer, often between 10 and 200 ms.
- **Packet loss**, the share of messages that got no answer. 0% is what you want. A few percent of loss can already make calls and games stutter. 100% means no answer at all.

> [!NOTE]
> Silence from a ping does not always mean the device is down. Some devices and websites are set to ignore ping on purpose. It is one clue, not proof.

> [!CHECK]
> Your laptop wants to open a web page. Where does it send the data first?
>
> - [ ] Directly to the website's server, because the laptop knows where it is
> - [ ] To the printer, because it is the nearest device
> - [x] To the default gateway, which is your router
> - [ ] To your neighbour's router
>
> A website is not on your home network, so the laptop hands the data to the default gateway, which forwards it towards the Internet.

## How it works
Follow one click, opening the page at `example.com` on your phone over Wi-Fi:

1. **Joining.** When your phone joined the Wi-Fi, DHCP gave it a private address (say `192.168.0.24`) and told it that the router `192.168.0.1` is the default gateway.
2. **Sending.** Your phone sees that `example.com` is not on its own street, so it sends the request to the default gateway.
3. **Translating.** The router swaps your phone's private address for the home's public address (NAT), remembers who asked and sends the request along the ISP line.
4. **Travelling.** The request crosses your ISP's network and the Internet to the website.
5. **Returning.** The answer comes back to the public address. The router recognises it, swaps the address back and delivers it to your phone, over the air, through the access point.

## Worked example
A family has a laptop, a phone and a printer. Their router is `192.168.0.1`.

| Device | How it connects | Private address |
|---|---|---|
| Router | (the box itself) | `192.168.0.1` |
| Laptop | Wi-Fi | `192.168.0.23` |
| Phone | Wi-Fi | `192.168.0.24` |
| Printer | Cable | `192.168.0.30` |

All four start with `192.168.0`, so all four are on the same street. When the laptop prints, the data goes straight to `192.168.0.30` and never leaves the house. When the laptop opens a website, the data goes to `192.168.0.1`, which sends it out using the home's single public address.

Now the laptop pings the router and gets `64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.5 ms`: a reply came from `192.168.0.1` after 0.5 ms, so the router is reachable and close. If it then pings a website and gets about 18 ms with 0% packet loss, the whole path out to the Internet works too.

## Common pitfalls
- **"My IP address is the one my router shows."** The router has two addresses: a private one on the home side and a public one on the Internet side. Your device has its own private address. Always ask: which address, whose, and seen from where?
- **"My address changed, so something is wrong."** Addresses from DHCP are lent, not owned, and can change. That is normal.
- **"No ping reply means the Internet is down."** Check the router first, then a website. If the router replies but the website doesn't, the problem is beyond your home; if even the router is silent, look at your Wi-Fi or cable.

## Security considerations
The router is the front door to your home network, so a few small habits go a long way:

- **Change the router's admin password** if it is still the one printed on the label, and keep it somewhere safe. Anyone who can log into the router controls your network.
- **Use a strong Wi-Fi password** with WPA2 or, if your router offers it, WPA3, the standard that encrypts Wi-Fi traffic. Never leave Wi-Fi open or on an old standard like WEP.
- **Install router updates** when your ISP or the manufacturer offers them; they fix security holes.
- **Use a guest network** for visitors and less-trusted smart devices, if your router has the option.

## Summary
- A home router is several devices in one box: the link to the ISP, a router, switch ports, a Wi-Fi access point and DHCP.
- An IP address identifies a device, like a street address: the network part is the street, the last part is the house.
- Inside the home, devices use private addresses (RFC 1918: `192.168.x.x`, `10.x.x.x`, `172.16-31.x.x`). Outside, the home has one public address from the ISP.
- The router translates between them (NAT) and is the default gateway: the door out of your home.
- `ping` asks "are you there?" and reports reply time and packet loss.

## Glossary
| Term | Definition |
|---|---|
| ISP | Internet service provider: the company that sells you Internet access. |
| Modem | A device that turns the signal on your ISP's line into data your home can use; for fibre the box is called an ONT. |
| Router | A device that passes traffic between your home network and the Internet. |
| Switch | The group of sockets where you plug in cables, letting wired devices talk to each other. |
| Access point | The part of the router that connects devices by Wi-Fi instead of cables. |
| DHCP | Dynamic Host Configuration Protocol: the service that gives each device an address automatically when it joins. |
| IP address | A number that identifies a device on a network so data can be sent to it. |
| Private address | An address that works only inside a home or office, from the ranges reserved by RFC 1918. |
| Public address | An address that is unique on the Internet; your ISP gives your home one. |
| NAT | Network Address Translation: the router swaps private addresses for the public one and back. |
| CGNAT | Carrier-Grade NAT: an ISP shares one public address among many customers. |
| Default gateway | The device, usually your router, that receives all data meant for destinations outside your network. |
| Ping | A tool that sends a tiny message to an address and reports the reply time and packet loss. |
| Packet loss | The share of messages that received no reply. |

## Check your understanding
1. Name three jobs done by the box your ISP gave you, and say in your own words what each one does.
2. Why can two homes use the same private address without any problem?
3. Your ping to the router works, but your ping to a website gets no answer. What could this mean, and what would you check next?

## References
- [RFC 1918](https://www.rfc-editor.org/rfc/rfc1918) — Address Allocation for Private Internets.
- [RFC 5737](https://www.rfc-editor.org/rfc/rfc5737) — IPv4 Address Blocks Reserved for Documentation.
- [RFC 6598](https://www.rfc-editor.org/rfc/rfc6598) — IANA-Reserved IPv4 Prefix for Shared Address Space (used for CGNAT).
- [RFC 2131](https://www.rfc-editor.org/rfc/rfc2131) — Dynamic Host Configuration Protocol.