Showing raw Markdown: the renderer could not load.
## Goal
Find your own device's address and your router's address, then test the connection with `ping` first to your router and then to a website. Finally, think about what changes when you leave your home Wi-Fi.
## Objectives
- Find your device's IP address and your router's (default gateway) address.
- Tell a private address from a public one by reading it.
- Test whether another device is reachable with `ping` and read the reply time and packet loss.
## Prerequisites
- A computer (Windows, macOS or Linux) connected to a home or office network, and optionally your phone on the same Wi-Fi.
- No accounts, no installation, no cost.
- The [Your Home Network lesson](lesson.md) of this module.
- You will type a few short commands in a **terminal**, a window where you type text commands. To open one:
- **Windows:** press the Windows key, type `cmd` and press Enter.
- **macOS:** press Command + Space, type `Terminal` and press Enter.
- **Linux:** press Ctrl + Alt + T (on most desktops), or search for "Terminal".
> [!WARNING]
> Every command here only **reads** information about your own device or sends a few tiny test messages to your router and to `example.com`, a website reserved for examples. Nothing changes any setting. Your own addresses are private to you: don't post them online with your name.
## Architecture
<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-lab-architecture-title homenet-lab-architecture-desc" font-family="Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" xml:lang="en">
<title id="homenet-lab-architecture-title">Lab map: your device, your router and example.com</title>
<desc id="homenet-lab-architecture-desc">Your device on the left is found in step 1 by looking up its own address. It connects to your router in the middle, which you find in step 2 as the default gateway and test with ping in step 3. The router connects to example.com on the Internet on the right, which you test with ping in step 4. Below the home network, a separate card for mobile data asks in step 5 what changes when you leave the home Wi-Fi.</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="160" 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">Your home network</text></g>
<g class="dg-l1"><rect class="dg-tint" x="780" y="20" width="240" height="160" rx="16" fill="#f0f6f9" stroke="#9ac3d9" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(796 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="822" y="47" font-size="13" class="dg-ink" fill="#0369a1" font-weight="700">The Internet</text></g>
<rect class="dg-card" x="40" y="60" width="230" height="100" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l2"><g class="dg-icon" transform="translate(56 76) 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="98" y="97" font-size="14" class="dg-ink" fill="#15803d" font-weight="700">Your computer or phone</text></g>
<text x="58" y="128" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">Step 1: your own address</text>
<rect class="dg-card" x="400" y="60" width="240" height="100" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l3"><g class="dg-icon" transform="translate(416 76) 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="458" y="97" font-size="14" class="dg-ink" fill="#b45309" font-weight="700">Your router</text></g>
<text x="418" y="128" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">Step 2: the default gateway</text>
<text x="418" y="148" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">Step 3: ping it</text>
<rect class="dg-card" x="800" y="60" width="200" height="100" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l1"><g class="dg-icon" transform="translate(816 76) 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="858" y="97" font-size="14" class="dg-ink" fill="#0369a1" font-weight="700">example.com</text></g>
<text x="818" y="128" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">Step 4: ping it</text>
<g class="dg-l2"><path class="dg-stroke" d="M272 110H396" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><path class="dg-stroke" d="M642 110H796" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l2"><rect class="dg-bg-plain" x="283.14" y="98" width="101.72" height="24" rx="12" fill="#ffffff"/><text x="334" y="114.5" font-size="11.5" class="dg-ink" fill="#15803d" font-weight="600" text-anchor="middle">Wi-Fi / cable</text></g>
<g class="dg-l1"><rect class="dg-bg-plain" x="700.34" y="98" width="37.32" height="24" rx="12" fill="#ffffff"/><text x="719" y="114.5" font-size="11.5" class="dg-ink" fill="#0369a1" font-weight="600" text-anchor="middle">ISP</text></g>
<rect class="dg-card" x="40" y="200" width="360" height="80" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l7"><g class="dg-icon" transform="translate(56 216) scale(1.2500)" fill="none" stroke="#6d28d9" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4.9 16.1C1 12.2 1 5.8 4.9 1.9"/><path d="M7.8 4.7a6.14 6.14 0 0 0-.8 7.5"/><circle cx="12" cy="9" r="2"/><path d="M16.2 4.8c2 2 2.26 5.11.8 7.47"/><path d="M19.1 1.9a9.96 9.96 0 0 1 0 14.1"/><path d="M9.5 18h5"/><path d="m8 22 4-11 4 11"/></g></g>
<g class="dg-l7"><text x="98" y="237" font-size="14" class="dg-ink" fill="#6d28d9" font-weight="700">Mobile data</text></g>
<text x="58" y="268" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">Step 5: what changes?</text>
</svg></figure>
*Figure 1. You look at the first two boxes, then test the path towards the third.*
## Steps
The outputs below come from a real Linux computer, with its addresses replaced by examples. **Your values will differ**: your address, your router's address and the reply times will not be the same. What matters is the shape of the output.
### Step 1 — Find your own IP address (8 min)
Pick your system and run the command, or follow the click path.
**Linux**
```bash
ip -4 addr
```
Expected output (example):
```text
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
inet 192.168.0.23/24 brd 192.168.0.255 scope global dynamic noprefixroute wlan0
valid_lft 80000sec preferred_lft 80000sec
```
- `lo` is the "loopback", a pretend network inside your own computer. Its address `127.0.0.1` means "this computer". Ignore it.
- `wlan0` (yours may be called `eth0`, `eno1`, `wlp3s0`…) is the real connection. The line starting with `inet` has your address: `192.168.0.23`. The `/24` after it says that the first three numbers (`192.168.0`) are the "street".
- `dynamic` means DHCP lent you this address. `valid_lft 80000sec` is how long the loan lasts (about 22 hours).
**macOS**
```bash
ipconfig getifaddr en0
```
Example of what you see (macOS format, not run here):
```text
192.168.0.23
```
This prints only your address. `en0` is the Wi-Fi on most laptops. If nothing is printed, try `en1`, or open System Settings > Network, choose your connection (Wi-Fi or Ethernet) and click Details to see the IP address.
**Windows**
```text
ipconfig
```
Example of what you see (Windows format, not run here; only the relevant part is shown):
```text
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 192.168.0.23
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
```
Look for the adapter that is in use (`Wi-Fi` or `Ethernet`) and read the line `IPv4 Address`. Adapters that say "Media disconnected" are not in use.
**Phone**
- **iPhone:** Settings > Wi-Fi, tap the (i) next to your network, and read "IP Address" and "Router".
- **Android:** Settings > Network and Internet (or Connections) > Wi-Fi, tap your network (or its gear icon) and look for "IP address" and "Gateway". The menu names differ between phones.
Write down your device's address. Is it one of the **private** ranges from the lesson (`192.168.x.x`, `10.x.x.x`, or `172.16.x.x` to `172.31.x.x`)?
<details>
<summary>Show the answer</summary>
On a home network the answer is almost always yes. A private address is normal and is what you should expect: it only has meaning inside your home. Your home's public address, the one the Internet sees, is held by the router and is not shown on your device.
</details>
### Step 2 — Find your router (the default gateway) (6 min)
Your device knows which neighbour is the door out of your home: the default gateway. Find it.
**Linux**
```bash
ip route
```
Expected output (example):
```text
default via 192.168.0.1 dev wlan0 proto dhcp src 192.168.0.23 metric 100
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.23 metric 100
```
The line that starts with `default via` names the gateway: `192.168.0.1`. The second line says that everything starting `192.168.0` is on your own street, reached directly. Anything else goes via the gateway.
**macOS**
```bash
route -n get default
```
Example of what you see (macOS format, not run here; the exact lines may vary):
```text
route to: default
destination: default
mask: default
gateway: 192.168.0.1
interface: en0
```
The `gateway` line is your router.
**Windows**
The `Default Gateway` line you already saw in Step 1 is your router. If you want to see it again, run `ipconfig`.
**Phone**
It is the "Router" (iPhone) or "Gateway" (Android) value from Step 1.
Write down the gateway address. Compare it with your own: do the first three numbers match?
<details>
<summary>Show the answer</summary>
On most home networks they match: for example `192.168.0.23` (you) and `192.168.0.1` (router). Both are on the same "street" (`192.168.0`), and only the last number, the "house", differs. That is why your device can reach the router directly.
</details>
### Step 3 — Ping your router (6 min)
Ask your router "are you there?". Replace `192.168.0.1` with **your** gateway address from Step 2.
**Linux and macOS**
```bash
ping -c 4 192.168.0.1
```
**Windows**
```text
ping -n 4 192.168.0.1
```
`-c 4` (Linux, macOS) and `-n 4` (Windows) mean "send four messages and stop". Without them, Linux and macOS keep going until you press Ctrl + C.
Expected output on Linux (example):
```text
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.507 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.423 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.496 ms
64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=0.461 ms
--- 192.168.0.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3074ms
rtt min/avg/max/mdev = 0.423/0.471/0.507/0.032 ms
```
Read it line by line:
- `64 bytes from 192.168.0.1` — a reply arrived from the router. `64 bytes` is the size of the tiny message.
- `icmp_seq=1` — the number of the message. `icmp` is the name of the protocol ping uses.
- `ttl=64` — a counter that stops messages from circling forever. You can ignore it.
- `time=0.507 ms` — **the time** the round trip took, in milliseconds. Under a few milliseconds is normal for a router in the same home.
- `4 packets transmitted, 4 received, 0% packet loss` — four sent, four answered: no loss. This is the line to check first.
- `rtt min/avg/max/mdev` — the fastest, average and slowest times (and how much they vary).
Example of what you see on Windows (Windows format, not run here):
```text
Pinging 192.168.0.1 with 32 bytes of data:
Reply from 192.168.0.1: bytes=32 time=2ms TTL=64
Reply from 192.168.0.1: bytes=32 time=1ms TTL=64
Reply from 192.168.0.1: bytes=32 time=2ms TTL=64
Reply from 192.168.0.1: bytes=32 time=2ms TTL=64
Ping statistics for 192.168.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2ms, Average = 1ms
```
The same information in different words: `time=2ms` is the time and `Lost = 0 (0% loss)` is the packet loss. macOS looks like Linux.
### Step 4 — Ping a website (5 min)
Now ask a computer far away. `example.com` is a website reserved for examples, so it is safe to use.
**Linux and macOS**
```bash
ping -c 4 example.com
```
**Windows**
```text
ping -n 4 example.com
```
Expected output on Linux (example; the site's address is replaced with one reserved for documentation, `2001:db8::…`):
```text
PING example.com (2001:db8::ac42:93f3) 56 data bytes
64 bytes from 2001:db8::ac42:93f3: icmp_seq=1 ttl=248 time=10.5 ms
64 bytes from 2001:db8::ac42:93f3: icmp_seq=2 ttl=250 time=13.8 ms
64 bytes from 2001:db8::ac42:93f3: icmp_seq=3 ttl=248 time=10.8 ms
64 bytes from 2001:db8::ac42:93f3: icmp_seq=4 ttl=249 time=10.9 ms
--- example.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 10.496/11.496/13.838/1.358 ms
```
Your command turned the name `example.com` into an address first, and ping then used that address. The address in brackets may be the long IPv6 form, as here, or a short IPv4 form like `192.0.2.243`. Both are fine, and the address may change over time. Everything else reads like Step 3.
Compare the times from Steps 3 and 4. Which is bigger, and why?
<details>
<summary>Show the answer</summary>
The website is bigger (here about 11 ms against 0.5 ms). The router is one hop away in your home. The message to the website has to cross your ISP's network and the Internet and come back, which takes longer. The packet loss should still be 0%.
If you see 100% packet loss to the website but the router answers, the problem is beyond your home (or the site ignores ping). If even the router doesn't answer, check your Wi-Fi or cable.
</details>
### Step 5 — Think: from home Wi-Fi to mobile data (5 min)
On your phone, turn Wi-Fi off, so it uses mobile data, and look at the connection details again, if your phone shows them (many don't). Without doing anything else, answer on paper:
1. Does your phone still have the same address as before?
2. Is your home router involved in the connection any more?
3. Would your own computer at home, still on Wi-Fi, be able to reach your phone's new address directly?
<details>
<summary>Show the answer</summary>
1. No. A phone on mobile data gets an address from the mobile operator, not from your router, so it changes as soon as you switch. It is often a private address too, shared through the operator's NAT.
2. No. Your home router is only used while the phone is on your Wi-Fi. On mobile data the traffic goes through the operator's network instead.
3. No, not directly. The computer's private address (for example `192.168.0.23`) means something only inside your home, and your phone is now outside it.
Switch Wi-Fi back on when you finish.
</details>
## Verification
You are done if you can state, with your own values:
- your device's address and whether it is private;
- your router's address (the default gateway);
- the reply time to your router and to `example.com`, and that packet loss was 0%.
## Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| `ping` shows `100% packet loss` to the router | Not connected to your network, or you typed the wrong address | Check that Wi-Fi or the cable is connected and re-read the gateway address from Step 2 |
| `Destination Host Unreachable` on Linux or macOS, `Destination host unreachable` on Windows | No device has that address on your network | Compare with the gateway from Step 2; one wrong digit is enough |
| `ping: example.com: Name or service not known` (Linux) or `could not find host example.com` (Windows) | The computer can't turn the name into an address: no Internet, or a name-lookup problem | Try again; if the router replies but names fail, restart your router |
| `ipconfig getifaddr en0` prints nothing on macOS | Your connection isn't `en0` | Try `en1`, or use System Settings > Network |
| Several adapters listed in `ipconfig` | Virtual or unused adapters | Use the one with an `IPv4 Address` and a `Default Gateway` |
| The website doesn't reply but opens in the browser | Some servers ignore ping on purpose | Not a problem: ping is only one clue |
## Challenge (optional)
Ping a device on your home network that isn't your router: another computer, a printer or a smart TV (use the address from its settings). Is the reply time similar to the router's? Does it change when that device is on Wi-Fi versus cable?
## Cleanup
Nothing to clean up: the lab only read information and sent a few test messages. Switch your phone's Wi-Fi back on if you turned it off, and close the terminal window.
## What you learned
- Your device has a private address, found in a few clicks or one command, and your router's address is the default gateway.
- The first numbers of both addresses match because they are on the same "street".
- `ping` shows whether a device answers, how long the reply takes (ms) and how many messages were lost.
- The router is quick to answer because it is close; a website takes longer; and on mobile data none of your home addresses apply.