GATE / CS ARCHIVE

GATE CSE 2019 / QUESTION 28

Subnet comparison using a /30 mask

Computer Networks · IP Addressing, Fragmentation & Address Resolution · Full GATE CSE 2019 paper

GATE 2019, Q28 2 marks · MCQ
Report issue

IP Addressing, Fragmentation & Address Resolution

Question 28, GATE 2019: Machines M, N, P have IPv4 addresses 100.10.5.2, 100.10.5.5, 100.10.5.6 and all use mask 255.255.255.252. Are all in one subnet (A), only M/N together (B), only N/P together (C), or all in different subnets (D)?
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (5 steps)

1. Two IPv4 interfaces are in the same subnet when bitwise AND of each address with the subnet mask yields the same network address. The first three octets are identical here, so only the last octet needs calculation.
2. The last mask octet 252 is binary 11111100. Thus the two low bits are host bits and each subnet spans four consecutive addresses, starting at multiples of four.
3. M has last octet 2=00000010; AND with 11111100 gives 0. Its network is 100.10.5.0/30, covering last octets 0 through 3.
4. N has 5=00000101 and P has 6=00000110. Masking either gives 4=00000100. Both belong to 100.10.5.4/30, covering 4 through 7.
5. Only N and P share a subnet, so C is correct. Comparing the first three octets alone would incorrectly assume a /24 mask; the supplied /30 mask is decisive.

Original paper, page 10 · Answer key