IP Addressing
Networking Fundamentals
Chapter 4 · IP Addressing
net1-3 named IP as the protocol running at the Internet layer, handling addressing and routing. This chapter is that addressing, in full — the foundation net1-5's own subnetting chapter builds directly on top of.
IPv4 Structure and Notation
An IPv4 address is 32 bits, written as four "octets" separated by dots — dotted-decimal notation, e.g. 192.168.1.1. Each octet is 8 bits, giving a decimal range of 0–255 per octet. Underneath, 192 is really the binary 11000000 — the human-readable decimal form is purely a convenience over the actual 32-bit binary value.
32 bits means a total address space of 232 — roughly 4.3 billion possible addresses. That number matters directly later in this chapter, and again in net1-5: it's finite, and it ran out.
Public vs. Private IP Ranges
Three ranges (RFC 1918) are reserved specifically for private networks and are never routable on the public internet: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Every other address is potentially a public address — globally unique, routable across the internet, assigned down through IANA and regional registries to ISPs and organizations.
A home router makes this concrete: it has one public IP address facing the internet, while every device behind it — laptops, phones, smart TVs — gets a private 192.168.x.x (or similar) address that only means something inside that one household's network.
NAT — Network Address Translation
NAT is the mechanism that lets many devices with private addresses share one public address. When a device behind the router sends a packet outward, the router rewrites the packet's source IP and port to its own public IP, and tracks the mapping. When a response comes back, the router rewrites the destination back to the correct private IP and port and forwards it inward.
A direct, practical consequence: an unsolicited incoming connection generally can't reach a device behind a home router without extra configuration (port forwarding) — NAT only tracks mappings for connections initiated from the inside. This is incidentally security-relevant, though it isn't a security feature by design (see the warn-box below), and it's exactly why vpn1's own material needs special handling for NAT traversal when establishing a VPN tunnel.
A First Look at IPv6
IPv4's roughly 4.3 billion addresses are not enough for a world with vastly more connected devices than that — regional registries genuinely ran out of new IPv4 address blocks to hand out years ago, and NAT (above) has functioned as the major real-world stopgap ever since, not just an incidental convenience.
IPv6 addresses are 128 bits, written as eight groups of four hex digits separated by colons: 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Shorthand rules exist to make this less unwieldy — leading zeros within a group can be dropped, and one run of consecutive all-zero groups can be collapsed to ::.
Honestly: adoption remains uneven. Most home and office networks still run IPv4, usually behind NAT, as the primary protocol as of this course's writing. IPv6 adoption is genuinely growing, and "dual-stack" setups — running both IPv4 and IPv6 simultaneously during the long transition — are common.
A Worked Example — Reading a Real Address
Take 192.168.1.42. Conceptually, part of this address identifies "which network" and part identifies "which specific device on that network" — but exactly where that split happens can't be determined from the address alone. It requires a subnet mask alongside it, which is exactly why net1-5 exists as its own dedicated chapter.
| Address size | Notation | Exhaustion / adoption | |
|---|---|---|---|
| IPv4 | 32 bits (~4.3 billion addresses) | Dotted-decimal, e.g. 192.168.1.1 | Exhausted at the registry level; still the dominant protocol, usually behind NAT |
| IPv6 | 128 bits | Colon-separated hex, e.g. 2001:0db8::1 | Effectively inexhaustible; adoption real but uneven, often dual-stacked |
ip addr on Linux or ipconfig on Windows shows a device's private IP address. Visiting a "what is my IP" site from the same device shows the public IP NAT is translating that traffic to — two genuinely different addresses for the same device, at the same moment.
Hands-On Exercises
Explain why a laptop's own private IP address (e.g. 192.168.1.42) and its public-facing IP address (as seen by a "what is my IP" website) are different, and what mechanism is responsible for that difference.
📄 View solutionExplain why an unsolicited connection from the internet generally can't reach a laptop sitting behind a home router, without any firewall being involved at all.
📄 View solutionA colleague argues that a database server is "safe" from attackers because it's only reachable via a private 10.x.x.x address, never directly from the internet. Using this chapter's own warn-box, explain the flaw in that reasoning.
📄 View solutionChapter 4 Quick Reference
- IPv4: 32 bits, dotted-decimal notation, ~4.3 billion total addresses
- Private ranges (never internet-routable): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
- NAT — rewrites source IP/port on the way out, tracks the mapping, rewrites destination on the way back
- NAT is why unsolicited inbound connections generally can't reach a device behind a home router
- IPv6: 128 bits, colon-separated hex notation, effectively inexhaustible, adoption still uneven
- Determining "network part" vs. "host part" of an address requires a subnet mask — net1-5's own subject
- "Not internet-routable" is not a security control — don't confuse the two