L32 — Network Components: IP & DNS
How does the internet know where to send your data? We explore routers, switches, IP addresses, and DNS — the phone book of the internet. Hands-on with browser tools and online IP lookup.
🎯Learning Objectives
- Explain the role of a router vs a switch in a network
- Read an IP address and explain what each part means
- Describe what DNS does and why it exists
- Find your own IP address and look up the IP of any website
- Explain what a VPN is and why people use it
📖Theory
1. Key Network Devices
Router — the "traffic director". Connects two or more different networks together. Your home router connects your home LAN to the internet (the WAN). It decides which network each packet of data should go to.
Switch — the "local distributor". Connects devices within the same network. When your computer sends data to the printer, the switch forwards it to the right port. It doesn't interact with the internet at all.
Access Point (Wi-Fi) — the "wireless switch". Lets wireless devices (phones, laptops) join the wired network without a cable. Many home routers have a built-in access point.
Modem — converts the signal from your ISP (phone line, cable, fibre) into a signal your router can use. In many homes the modem and router are one box.
Code
Internet (ISP)
|
Modem
|
Router ──── Switch ──── PC1
| └── PC2
Wi-Fi AP └── Printer
|
Phones, laptops2. IP Addresses — The Internet's Street Addresses
Every device on a network has an IP address — a unique number that identifies it, like a street address.
IPv4 — the old format, still most common:
192.168.1.15
Four numbers (0–255) separated by dots. IPv4 allows about 4.3 billion unique addresses — which ran out in 2011 for public addresses.
IPv6 — the new format, much larger:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Eight groups of four hexadecimal digits. IPv6 supports 340 undecillion addresses — essentially infinite.
3. Public vs Private IP
| Type | Who sees it | Example | Changes? |
|---|---|---|---|
| Public IP | The whole internet | 95.24.103.45 | Usually changes every time you reconnect (dynamic) |
| Private IP | Only inside your home/office LAN | 192.168.1.x or 10.0.0.x | Set by your router's DHCP server |
When you visit a website, the server sees your public IP — not your device's private IP. Your router handles the translation (NAT — Network Address Translation).
To find your public IP right now:
- Open whatismyip.com or type
what is my ipinto Google
To find your private IP:
- Windows: press
Windows + R→ typecmd→ typeipconfig
4. DNS — The Internet's Phone Book
You type youtube.com in the browser. But computers don't understand names — they understand numbers. YouTube's server is actually at 142.250.74.198.
DNS (Domain Name System) translates human-readable domain names into IP addresses. Every time you visit a website, your computer first asks a DNS server: "What's the IP for youtube.com?"
Code
You type: youtube.com
↓
Browser asks DNS server: "IP of youtube.com?"
↓
DNS server answers: "142.250.74.198"
↓
Browser connects to 142.250.74.198
↓
YouTube loadsThis takes only a few milliseconds. Without DNS you'd have to memorise the IP address of every website you visit.
Popular DNS servers:
8.8.8.8— Google DNS (fast, worldwide)1.1.1.1— Cloudflare DNS (fastest, privacy-focused)- Your ISP's DNS — often the default, sometimes slow
5. Ports — The Building's Apartment Numbers
An IP address identifies a computer. But that computer may be running many services at once (a web server, an email server, a game server). Ports distinguish between them — like apartment numbers in a building.
| Port | Service |
|---|---|
| 80 | HTTP (regular websites) |
| 443 | HTTPS (secure websites) |
| 25 | Email (SMTP) |
| 3306 | MySQL database |
| 5432 | PostgreSQL database |
| 22 | SSH (remote login) |
When your browser connects to https://google.com, it actually connects to IP:443. You never type the port because browsers add it automatically for http/https.
6. What Is a VPN?
A VPN (Virtual Private Network) creates an encrypted tunnel between your device and a server somewhere else. Your real IP is hidden; the websites you visit see the VPN server's IP instead.
Why people use VPNs:
- Privacy: your ISP can't see which sites you visit
- Security on public Wi-Fi: coffee shop Wi-Fi could intercept your data; a VPN encrypts it
- Accessing restricted content: some services are available only in certain countries
Why VPNs are not magic:
- The VPN provider can see your traffic (you're trusting them instead of your ISP)
- Free VPNs often sell your browsing data — they have to make money somehow
- VPNs don't make you anonymous — they just shift who can track you
💻Code Examples
Example A — Finding your IP address
In the Windows Command Prompt (cmd):
ipconfig
You'll see something like:
Code
Ethernet adapter:
IPv4 Address. . . . . . . . . . . : 192.168.1.105
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1192.168.1.105— this computer's private IP192.168.1.1— the router's IP (your gateway to the internet)
Example B — Looking up a domain's IP
In the Command Prompt:
nslookup google.com
Output:
Code
Server: dns.google
Address: 8.8.8.8
Non-authoritative answer:
Name: google.com
Addresses: 2a00:1450:4010:c01::65
142.250.74.46The top section is which DNS server answered. The bottom shows the IP addresses for google.com. There are two because Google has many servers worldwide.
Example C — Online IP tools
These work in any browser, no installation:
| Tool | Link | What it shows |
|---|---|---|
| My IP | whatismyip.com | Your public IP + approximate location |
| IP Lookup | iplocation.net | Type any IP, see location and ISP |
| DNS Lookup | dnschecker.org | Type a domain, see its DNS records worldwide |
✏️Practice Tasks
In the Command Prompt, run:
ipconfig— write down your private IP and default gatewaynslookup google.com— write down one IP address you see- Open whatismyip.com — write down your public IP
- Go to iplocation.net and type your public IP — what city and ISP does it show?
Answer: what's the difference between your private IP (ipconfig) and your public IP (the website)?
💡 Hint
Use dnschecker.org:
- Type
google.com→ click "DNS Check" → note how many different IP addresses appear for different countries - Type
vk.com→ note the IPs - Type a made-up domain like
thisdoesnotexist12345.com→ what happens?
Then in the Command Prompt, change your DNS server temporarily:
Windows: Control Panel → Network and Sharing → your connection → Properties → IPv4 → DNS: set 8.8.8.8 (primary) and 1.1.1.1 (secondary). Open a website. Did it get faster? (You can change it back after.)
💡 Hint
Draw a network diagram in app.diagrams.net for a home network with these devices and assign realistic IP addresses:
- Router (gateway:
192.168.1.1, public IP:95.24.103.45) - Desktop PC (
192.168.1.100) - Laptop via Wi-Fi (
192.168.1.101) - Smartphone (
192.168.1.102) - Smart TV (
192.168.1.103) - Printer (
192.168.1.200)
Label each device with its IP address. Draw arrows showing which devices connect through the router (go to internet) vs which talk directly on the LAN. Add a "cloud" shape labeled "Internet / ISP".
💡 Hint
⚠️Common Mistakes
Confusing router and switch
A switch forwards data within one network. A router forwards data between networks (e.g., from your home network to the internet). Most home "routers" are actually router + switch + Wi-Fi access point combined in one box.
Thinking your IP reveals your exact address
An IP address shows your ISP and approximate city — not your street or apartment. Your ISP knows the exact address behind an IP, but a random website does not.
Trusting free VPNs completely
A free VPN has to pay its server bills somehow. The payment is usually your browsing data. For real privacy, use a paid, audited VPN (Mullvad, ProtonVPN) or simply trust your ISP.
Forgetting that DNS can be changed
Schools, governments, and ISPs can block websites by refusing to answer DNS queries for those domains. Changing your DNS server to 8.8.8.8 bypasses that blocking — which is why some schools block changing DNS settings.
🎓Instructor Notes
⚡ How to run this lesson (~80 min)
- [5 min] Recap L31. "What's the difference between LAN and WAN?"
- [10 min] Router vs switch — draw on the board. Physical box in the room (point to the actual router/switch if visible).
- [15 min] IP and DNS. Live demo: type
whatismyip.comon the projector. Show the city. Then runnslookup google.com. Students are usually surprised their IP shows a city. - [10 min]
ipconfigand ports. Run in cmd. Ask: "What's your default gateway?" They should say192.168.1.1or similar. Explain: that's the router. - [30 min] Tasks 1 + 2 in class. Task 1 = everyone runs
ipconfigand visits whatismyip.com. Task 2 = dnschecker.org exploration. - [5 min] Preview L33. We've seen how data travels — next lesson: who might try to intercept it and how to protect yourself.
💬 Discussion questions
- "If your public IP shows your city, can the government find out your home address from it?"
- "Why do we have both IPv4 and IPv6? Why not just switch to IPv6 immediately?"
- "Why might changing your DNS server to 8.8.8.8 make some websites load faster?"