The prefix doesn't have to end on a dot. A longer prefix leaves fewer bits for hosts, so the network is smaller:
| Prefix | Network part | Addresses |
|---|---|---|
/16 | the first two numbers | 65,536 |
/24 | the first three numbers | 256 |
/28 | three numbers and 4 bits of the last | 16 |
In most networks two addresses are taken: the first is the network itself, the last is its broadcast address, which reaches every host on it at once. Machines get the ones in between, so a /24 has 254. (Clouds take a few more: AWS keeps 5 per subnet.)
ipcalc
Works out an address's network: where it starts and ends, and which addresses hosts can have. Always give it the prefix: without one, it guesses.
learner@ops:~$ ipcalc 10.0.0.5/24
…
Network: 10.0.0.0/24 00001010.00000000.00000000. 00000000
HostMin: 10.0.0.1 00001010.00000000.00000000. 00000001 ← first host
HostMax: 10.0.0.254 00001010.00000000.00000000. 11111110 ← last host
Broadcast: 10.0.0.255 00001010.00000000.00000000. 11111111
…The space in the binary is where the network part ends. Its first lines also show the netmask, 255.255.255.0: /24 written the old way, which you'll still see in config files. Ignore "Class": an older way of sizing networks.
Objectives
- What is the last address a machine can have on
192.168.50.0/28? - What is the broadcast address of
10.0.0.0/16?