Subnet comparison using a /30 mask
IP Addressing, Fragmentation & Address Resolution

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.


![Question 82, GATE 2003: A network uses the printed subnet mask 255.255.31.0. Which pair of addresses could belong to that network?
A. 172.57.88.62 and 172.56.87.233
B. 10.35.28.2 and 10.35.29.4
C. 191.203.31.87 and 191.234.31.88 [GFG; GateForum prints 191.03.31.87 as the first address.]
D. 128.8.129.43 and 128.8.161.55
The printed mask is noncontiguous; apply its literal bitwise AND, not an assumed CIDR repair.](../../../assets/questions/CS-2003-Q82-1.webp)
![Question 82, GATE 2003: A network uses the printed subnet mask 255.255.31.0. Which pair of addresses could belong to that network?
A. 172.57.88.62 and 172.56.87.233
B. 10.35.28.2 and 10.35.29.4
C. 191.203.31.87 and 191.234.31.88 [GFG; GateForum prints 191.03.31.87 as the first address.]
D. 128.8.129.43 and 128.8.161.55
The printed mask is noncontiguous; apply its literal bitwise AND, not an assumed CIDR repair.](../../../assets/questions/CS-2003-Q82-2.webp)