NivaarExam PrepOfficial exam papers ↗

25-Comp-B5 Computer Communications · December 2018

Question 8 of 9: IP Address Class, Network ID, Subnet ID, and Host ID

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

Reference texts: Stallings, Data and Computer Communications, 10th ed. — sampling and aliasing (Ch.5, Q1), cascaded gains/losses and decibels (Ch.3, Q2), Shannon–Hartley channel capacity (Ch.3, Q3), AM/FM analog modulation (Ch.5, Q4), LAN/network topologies (Ch.16, Q6), QPSK digital modulation (Ch.5, Q7), IP addressing and subnetting (Ch.18, Q8), and physical/link/network-layer terminology (Ch.3, 9, 11, 17, Q9); Kurose & Ross, Computer Networking: A Top-Down Approach, 8th ed. — error detection via CRC (Ch.5, Q5), IP addressing (Ch.4, Q8), and TCP/IP terminology (Ch.1, Q9).

This is a choose-any-5-of-9 exam; all nine questions are answered below.

Question 8: IP Address Class, Network ID, Subnet ID, and Host ID (20 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given.

QuantityValue
IP address198.53.147.45
Subnet mask255.255.255.224

Find. The address class, the (classful) network ID, the subnet ID, and the host ID, with the reasoning behind each.

Approach. Classify the address from its leading octet against the classful ranges; find the classful network ID by zeroing the host portion of that class's default mask; then find the subnet ID by bit-wise ANDing the full address with the GIVEN subnet mask, and the host ID as the bits left over once the subnet mask's 1-bits are removed.

  1. Classify the address. The first octet is $198$, which falls in the Class C range $192\text{-}223$: $$\boxed{\text{Class C}}$$
  2. Classful network ID. A default Class C mask is $255.255.255.0$ (/24): the first 3 octets are the network, the last is host. Zeroing the host octet of the given address: $$\text{Network ID} = \boxed{198.53.147.0}$$
  3. Interpret the given subnet mask. $255.255.255.224$ borrows bits from the classful host octet: $224 = 11100000_2$, i.e. the top 3 bits of the last octet are now subnet bits (/27 overall $= 24+3$), leaving 5 host bits. This carves the class C's 256 host addresses into $2^{3}=8$ subnets of $2^{5}=32$ addresses each (30 usable per subnet, after excluding the subnet's own network and broadcast addresses).
  4. Subnet ID. AND the full address with the subnet mask, octet by octet (only the last octet changes): $45 = 00101101_2$, $224=11100000_2$, so $45\ \&\ 224 = 00100000_2 = 32$. $$\text{Subnet ID} = \boxed{198.53.147.32}\ \ (\text{i.e. } 198.53.147.32/27)$$ This is the third of the 8 subnets ($0,32,64,96,128,160,192,224,\ldots$), covering host addresses $32$–$63$.
  5. Host ID. The bits NOT covered by the mask (the low 5 bits of the last octet) identify the host within its subnet: $45\ \&\ (\sim 224\ \&\ 255) = 45\ \&\ 31 = 00001101_2 = 13$. $$\text{Host ID} = \boxed{13}\ \ (\text{host } 13\ \text{within subnet } 198.53.147.32/27)$$
QuantityResult
ClassC
Network ID (classful)198.53.147.0
Subnet ID198.53.147.32 (/27)
Host ID13
Subnets available / hosts per subnet8 subnets × 30 usable hosts