CAP7001 · Unit 4: Network layer
Classful addressing, public and private addresses
10 practice questions · in the ETE syllabus
Key points
- Class ranges: A 1-126, B 128-191, C 192-223, D 224-239
- Default masks are 255.0.0.0, 255.255.0.0 and 255.255.255.0
- Usable hosts = 2^(host bits) - 2
- Private blocks: 10/8, 172.16/12, 192.168/16
- 127/8 is loopback and 169.254/16 is link-local
Classful addressing divides the IPv4 space into fixed classes, where the first bits of an address decide how many bytes form the netid and how many form the hostid.
| Class | First octet | Default mask | Hosts per network |
|---|---|---|---|
| A | 1-126 | 255.0.0.0 | 2^24 - 2 |
| B | 128-191 | 255.255.0.0 | 2^16 - 2 = 65534 |
| C | 192-223 | 255.255.255.0 | 254 |
| D | 224-239 | multicast, no netid | - |
| E | 240-255 | reserved | - |
Two host values are lost in each network: the all-zeros hostid names the network and the all-ones hostid is the directed broadcast. The block 127.0.0.0/8 is loopback, and 169.254.0.0/16 is the link-local block a host takes when DHCP fails.
Private addresses (RFC 1918) are not routed on the Internet: 10.0.0.0/8, 172.16.0.0 to 172.31.255.255 and 192.168.0.0/16. Everything else, such as 172.32.0.5, is public.
Worked example: 150.20.30.40 starts with 150, so it is Class B. Its network is 150.20.0.0 and its directed broadcast is 150.20.255.255.
Exam trap: the private 172 block ends at 172.31.255.255, so 172.15.x.x and 172.32.x.x are public addresses.
Try two questions
Which address can be assigned to a host on the public Internet?
- 172.31.255.1
- 10.200.1.1
- 192.168.100.7
- 172.32.0.5
Show the answer
D. The private 172 block ends at 172.31.255.255, so 172.32.0.5 is a public address.
Why not A: 172.16.0.0 to 172.31.255.255 is private, so this one is private.
Why not B: Anything in 10.0.0.0/8 is private.
Why not C: Anything in 192.168.0.0/16 is private.
Why can the address 127.0.0.1 not be given to a host interface on a physical network?
- It is a Class A address, and every Class A address is held by ISPs
- It is the directed broadcast address of the first Class A network
- The 127.0.0.0 block is reserved for loopback, so its packets never leave the host
- It is a private address that routers must translate with NAT
Show the answer
C. 127.0.0.0/8 is the loopback block used to test the local TCP/IP stack. Traffic sent to it is delivered back to the same machine.
Why not A: Class A addresses are not all reserved; only the 127 block is special.
Why not B: Broadcast addresses have all host bits set, which 127.0.0.1 does not.
Why not D: It is not in a private block and NAT is irrelevant to it.