1. LPU MCA Semester 1
  2. CAP7001
  3. Unit 4

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.

ClassFirst octetDefault maskHosts per network
A1-126255.0.0.02^24 - 2
B128-191255.255.0.02^16 - 2 = 65534
C192-223255.255.255.0254
D224-239multicast, no netid-
E240-255reserved-

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

Question 1 · Tier 4, Analyse

Which address can be assigned to a host on the public Internet?

  1. 172.31.255.1
  2. 10.200.1.1
  3. 192.168.100.7
  4. 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.

Question 2 · Tier 2, Understand

Why can the address 127.0.0.1 not be given to a host interface on a physical network?

  1. It is a Class A address, and every Class A address is held by ISPs
  2. It is the directed broadcast address of the first Class A network
  3. The 127.0.0.0 block is reserved for loopback, so its packets never leave the host
  4. 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.