An IPv4 address is 32 bits written as four octets (192.168.1.10). IPv6 is 128 bits written in hex (2001:db8::1).
| Class | First octet | Default mask | Private range |
|---|---|---|---|
| A | 1 – 126 | 255.0.0.0 (/8) | 10.0.0.0 – 10.255.255.255 |
| B | 128 – 191 | 255.255.0.0 (/16) | 172.16.0.0 – 172.31.255.255 |
| C | 192 – 223 | 255.255.255.0 (/24) | 192.168.0.0 – 192.168.255.255 |
| D | 224 – 239 | — | Multicast |
| E | 240 – 255 | — | Experimental |
127.0.0.1 is the loopback (localhost) address.
Subnetting
Subnetting example: 192.168.1.0/26
- Mask /26 = 255.255.255.192 → host bits = 32 − 26 = 6
- Addresses per subnet = 26 = 64, usable hosts = 64 − 2 = 62 (network and broadcast are reserved)
- Number of subnets from a /24 = 22 = 4 → .0, .64, .128, .192
- First subnet: network 192.168.1.0, hosts .1 – .62, broadcast 192.168.1.63
Q & A
-
What is CIDR?Classless Inter-Domain Routing: writes the mask as /prefix length (for example /26), so networks are not limited to classes A, B and C.
-
What is NAT?Network Address Translation lets many devices with private IPs share one public IP through the router.