The Big Picture: Two Kinds of Address
In Section 1 you met the MAC address, the name tag that works on one local network. But the Internet is millions of networks joined together. For a message to cross them, every device needs a second kind of address that says which network it is on and which machine it is on that network.
That is the IP address (Internet Protocol address). Think of a postal address:
| Address type | Real-life comparison | Works where |
|---|---|---|
| MAC address | The name of a person (fixed, personal) | Only on the local network |
| IP address | The street address (tells you where, can change when you move) | Across the whole Internet |
Your IP address can change when you move to another network (a café, your office, home). Your MAC address stays with the NIC. That is the main difference.
2.1 IPv4 Structure and Address Classes
What it is: IPv4 (Internet Protocol version 4) is the address system still used by most devices. An IPv4 address is 32 bits long. To make it readable, the 32 bits are cut into 4 bytes and each byte is written as a number from 0 to 255, separated by dots. This is called dotted decimal.
192 . 168 . 1 . 25
11000000 10101000 00000001 00011001 ← the same address in bits
└ 8 bits ┘ └ 8 bits ┘ └ 8 bits ┘ └ 8 bits ┘ = 32 bits in total
There are 2³² = about 4.3 billion possible IPv4 addresses. That sounds like a lot, but the world has more devices than that, which is why NAT (Section 9) and IPv6 (next topic) exist.
Two parts in one address. Every IP address is split into a network part (which street) and a host part (which house). Devices on the same network share the same network part:
192.168.1.25
└───┬────┘ └┬┘
network part host part ← where the line goes is decided by the subnet mask (2.3)
Address classes (the old system). Long ago the Internet divided addresses into fixed classes by the first number. You will still meet these names in books and exams:
| Class | First number | Fixed split (network . host) | Designed for |
|---|---|---|---|
| A | 1 – 126 | 8 bits . 24 bits | Very big networks |
| B | 128 – 191 | 16 bits . 16 bits | Medium networks |
| C | 192 – 223 | 24 bits . 8 bits | Small networks (up to 254 devices) |
| D | 224 – 239 | n/a | Multicast (group messages) |
| E | 240 – 255 | n/a | Reserved for experiments |
Today classes are not used. They wasted addresses (a class B network of 65,534 addresses was too big for a company with 300 PCs). The modern system, CIDR (see 2.3), lets the network part be any length. But the "class C" idea, x.x.x.0 with 254 hosts, is still how most home networks look.
Special and private ranges. Some addresses are set aside:
| Range | Name | Meaning |
|---|---|---|
10.0.0.0 – 10.255.255.255 (written 10.0.0.0/8) | Private | For use inside homes and companies. Not routed on the public Internet |
172.16.0.0 – 172.31.255.255 (172.16.0.0/12) | Private | Same idea |
192.168.0.0 – 192.168.255.255 (192.168.0.0/16) | Private | The usual home range |
127.0.0.1 (the whole 127.0.0.0/8) | Loopback | "This computer itself". Also named localhost. Packets never leave the PC |
169.254.x.x (169.254.0.0/16) | Link-local (APIPA) | A self-made address when no DHCP server answered (Section 5). It means "something is wrong" |
0.0.0.0 | "Unspecified" | "No address yet" or "any address" |
255.255.255.255 | Limited broadcast | "Everyone on this local network" |
Private versus public. A private address is like an apartment number: it is only meaningful inside the building. A public address is unique on the Internet. Your home devices have private addresses; your router has one public address from your Internet provider. (NAT in Section 9 connects the two.)
Default gateway. To reach any device outside your own network, your PC sends the message to a helper: the default gateway. This is the router's address on your network, for example 192.168.1.1. Think of it as the door to the outside world. Section 8 explains how it works.
See your own addresses (read-only):
ipconfig
ipconfig /all
Get-NetIPConfiguration
| Line you see | What it is |
|---|---|
| IPv4 Address | Your PC's address on this network |
| Subnet Mask | Where the network part ends (for example 255.255.255.0) |
| Default Gateway | The router's address |
| DHCP Server | The device that gave you the address (Section 5) |
| DNS Servers | Who translates names to addresses (Section 4) |
2.2 IPv6 Structure and Why It Exists
What it is: IPv6 is the newer version of IP. It was made because IPv4 is running out of addresses. An IPv6 address is 128 bits long (four times longer than IPv4).
How it looks. It is written as eight groups of four hex digits, separated by colons:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
To save space, two shortcuts are allowed:
- Drop leading zeros in a group:
0db8becomesdb8. - Replace one run of all-zero groups with
::(only once per address).
2001:db8:85a3::8a2e:370:7334
How many addresses? 2¹²⁸ is about 3.4 × 10³⁸. That is so many that every device on Earth can have a public address, and there is no need for NAT.
Parts of an IPv6 address. The first 64 bits are usually the network (called the prefix), and the last 64 bits identify the device on it.
| Address | What it is |
|---|---|
::1 | Loopback (IPv6's 127.0.0.1) |
fe80::... | Link-local: every IPv6 NIC makes one by itself; works only on the local network |
2000::/3 (starting with 2 or 3) | Normal public (global) addresses |
fc00::/7 (starting with fc or fd) | Private ("unique local") addresses |
IPv4 and IPv6 live side by side. Most PCs today have both (this is called dual stack). Windows tries IPv6 first if it works. Both are visible in ipconfig: you will see an "IPv6 Address" and a "Link-local IPv6 Address" starting with fe80::.
Differences that matter:
| Topic | IPv4 | IPv6 |
|---|---|---|
| Size | 32 bits | 128 bits |
| Written as | 192.168.1.25 | 2001:db8::25 |
| Address supply | About 4.3 billion (shortage) | Practically unlimited |
| Needs NAT? | Usually yes | No |
| Finding a neighbour's MAC | ARP (Section 3) | A different protocol (called NDP) |
2.3 Subnetting Basics
What it is: A subnet (sub-network) is a group of devices that share the same network part of the address and can talk to each other directly (without a router). Subnetting is the art of deciding where the network part ends and the host part begins.
The subnet mask. The subnet mask says which bits are the network part. Where the mask has 1 bits, that is the network. Where it has 0 bits, that is the host.
IP address 192.168.1.25 11000000.10101000.00000001.00011001
Subnet mask 255.255.255.0 11111111.11111111.11111111.00000000
└────── network part ──────┘└ host ┘
Here the mask has 24 ones. So the first 3 bytes (192.168.1) are the network, and the last byte (25) is the host.
CIDR notation (the short way). Instead of writing the whole mask, write the number of 1 bits after a slash. This is called CIDR (Classless Inter-Domain Routing) notation:
| CIDR | Mask | Host bits | Usable hosts | Typical use |
|---|---|---|---|---|
/8 | 255.0.0.0 | 24 | 16,777,214 | Huge private networks |
/16 | 255.255.0.0 | 16 | 65,534 | Large networks |
/24 | 255.255.255.0 | 8 | 254 | Most home and small-office networks |
/25 | 255.255.255.128 | 7 | 126 | Half of a /24 |
/30 | 255.255.255.252 | 2 | 2 | A link between two routers |
The rule for usable hosts: with h host bits there are 2^h addresses, but two are reserved, so you get 2^h − 2 usable ones:
- The all-zeros host is the network address (the name of the network itself).
- The all-ones host is the broadcast address (talk to everyone on the network).
Worked example for 192.168.1.0/24:
| Item | Value |
|---|---|
| Network address | 192.168.1.0 |
| First usable host | 192.168.1.1 (often the router) |
| Last usable host | 192.168.1.254 |
| Broadcast address | 192.168.1.255 |
| Usable hosts | 2⁸ − 2 = 254 |
Is the other computer on my network? Your PC does this check before every send: apply your mask to your address and to the target address. If the network parts are equal, the target is on the same network, so send directly (using its MAC, Section 3). If they differ, send to the default gateway.
Me: 192.168.1.25/24 Target: 192.168.1.40 → same network (192.168.1) → send directly
Me: 192.168.1.25/24 Target: 8.8.8.8 → different network → send to gateway
Why split a network at all? Smaller networks keep broadcast noise down, let you separate groups (guests, cameras, office PCs) and make rules (firewalls, Section 10) easier.
A tip for the exam. To work out a subnet fast, ask "how many host bits?". Then the block size is 2^host bits. A /26 has 6 host bits, so networks come in blocks of 64: .0, .64, .128, .192.
Summary
| Topic | Remember this |
|---|---|
| IP versus MAC | MAC = name on the local network; IP = address that works across the Internet |
| IPv4 | 32 bits, four numbers 0-255 separated by dots; about 4.3 billion addresses |
| Classes | Old fixed A/B/C split; replaced by CIDR |
| Private ranges | 10/8, 172.16/12, 192.168/16; loopback 127.0.0.1; 169.254.x.x means no DHCP answer |
| Default gateway | The router address that leads to every other network |
| IPv6 | 128 bits, eight hex groups, :: shortens zeros; fe80:: link-local; no NAT needed |
| Subnet mask / CIDR | /24 = 255.255.255.0 = 254 usable hosts; network and broadcast addresses are reserved |
| Same network? | Apply the mask: equal network part means send directly, otherwise use the gateway |