GATE | Gate IT 2005 | Question 76 - GeeksforGeeks

28 Jun, 2021
A company has a class C network address of 204.204.204.0. It wishes to have three subnets, one with 100 hosts and two with 50 hosts each. Which one of the following options represents a feasible set of subnet address/subnet mask pairs?
 (A) 204.204.204.128/255.255.255.192204.204.204.0/255.255.255.128204.204.204.64/255.255.255.128(B) 204.204.204.0/255.255.255.192204.204.204.192/255.255.255.128204.204.204.64/255.255.255.128(C) 204.204.204.128/255.255.255.128204.204.204.192/255.255.255.192204.204.204.224/255.255.255.192(D) 204.204.204.128/255.255.255.128204.204.204.64/255.255.255.192204.204.204.0/255.255.255.192Answer: (D)Explanation:  Background Reading:
IP address is used to uniquely identify a host.
->Address range
 Class A    1.0.0.1 to 126.255.255.254
 Class B    128.1.0.1 to 191.255.255.254
 Class C    192.0.1.1 to 223.255.254.254
 Class D    224.0.0.0 to 239.255.255.255

(127.0.0.0 to 127.255.255.255 – used for loopback functionality : which will point back to the computer’s own tcp/ip network configuration.)
(1)x.x.x.0 and x.x.x.255 addresses are used for directed broadcast address and network ID. So,these two addresses are not used by hosts.
(2)Network ID is computed by performing logical & on IP address with subnet mask. -> IPV4 addresses are 32 bit and they are used as follows for:
           Identifying Networks(bit no.)        Identifying Hosts(bit no.)
 Class A              1-8                        9-32 
 Class B              1-16                     17-32
 Class C              1-24                           25-32

Now, let’s come back to the question:
Here, company has class C address of 204.204.204.0(11001100.11001100.11001100.00000000), 1-24 bits are identifying the network. So, network has IP addresses from 204.204.204.0 to 204.204.204.255.
->Subnetting is a practice in which we can divide the network in two or more parts. For this we will have to borrow few bits from the hosts part.
-> In subnet mask, all network + subnetwork bits are 1 and host bits are 0.
Option (A) 
204.204.204.128/255.255.255.192
204.204.204.0/255.255.255.128
204.204.204.64/255.255.255.128

1) 11001100.11001100.11001100.10000000/11111111.11111111.11111111.11000000 Network bits-26 (as 26 bits are 1 in the subnet mask) so sub-network id = 204.204.204.128 (refer(2)) 6 bits ‘0’ in subnet mask,i.e. 64(i.e. 2^6) -2 = 62 hosts (refer (1) )
2) 11001100.11001100.11001100.00000000/11111111.11111111.11111111.10000000 Network bits-25 (as 25 bits are 1 in the subnet mask) so sub-network id = 204.204.204.0 (refer(2)) 7 bits ‘0’ in subnet mask,i.e. 128(i.e.2^7) -2 =126 hosts (refer (1) )
3) 11001100.11001100.11001100.01000000/11111111.11111111.11111111.10000000 Network bits-25 (as 25 bits are 1 in the subnet mask) so sub-network id = 204.204.204.0 ( refer(2)) 7 bits ‘0’ in subnet mask,i.e. 128(i.e.2^7) -2 = 126 hosts (refer (1) )
Though the networks are divided into subnets containing 62,126,126 hosts which satisfy our minimum criteria of 50,50,100. But, two subnets have same network ID thus,they are not different.Thus,this division is only of two subnets but we need 3 ,so A option is incorrect.
Option (B) 
204.204.204.0/255.255.255.192
204.204.204.192/255.255.255.128
204.204.204.64/255.255.255.128

1) 11001100.11001100.11001100.00000000/11111111.11111111.11111111.11000000 Network bits-26 (as 26 bits are 1 in the subnet mask) so sub-network id = 204.204.204.0 (refer(2)) 6 bits ‘0’ in subnet mask,i.e. 64(i.e. 2^6)-2=62 hosts (refer (1))
2) 11001100.11001100.11001100.11000000/11111111.11111111.11111111.10000000 Network bits-25 (as 25 bits are 1 in the subnet mask) so sub-network id = 204.204.204.128 (refer(2)) 7 bits ‘0’ in subnet mask,i.e. 128(i.e.2^7)-2=126 hosts (refer (1))
3) 11001100.11001100.11001100.01000000/11111111.11111111.11111111.10000000 Network bits-25 (as 25 bits are 1 in the subnet mask) so sub-network id = 204.204.204.0 (refer(2)) 7 bits ‘0’ in subnet mask,i.e. 128(i.e.2^7)-2=126 hosts (refer (1))
Though the networks are divided into subnets containing 62,126,126 hosts which satisfy our minimum criteria of 50,50,100. But, two subnets have same network ID thus,they are not different.Thus,this division is only of two subnets.
Option (C) 
204.204.204.128/255.255.255.128
204.204.204.192/255.255.255.192
204.204.204.224/255.255.255.192

1) 11001100.11001100.11001100.10000000/11111111.11111111.11111111.10000000 Network bits-25 (as 25 bits are 1 in the subnet mask) so sub-network id == 204.204.204.128 (refer(2)) 7 bits ‘0’ in subnet mask,i.e. 128(i.e. 2^7) -2 =126 hosts (refer 1)
2) 11001100.11001100.11001100.11000000/11111111.11111111.11111111.11000000 Network bits-26 (as 25 bits are 1 in the subnet mask) so sub-network id == 204.204.204.192 (refer(2)) 6 bits ‘0’ in subnet mask,i.e. 64(i.e.2^6)-2=62 hosts(refer 1)
3) 11001100.11001100.11001100.11110000/11111111.11111111.11111111.11000000 Network bits-26 (as 26 bits are 1 in the subnet mask) so sub-network id == 204.204.204.192 (refer (2)) 6 bits ‘0’ in subnet mask,i.e. 64(i.e.2^6) -2=62 hosts (refer 1)
Though the networks are divided into subnets containing 62,62,126 hosts which satisfy our minimum criteria of 50,50,100. But, two subnets have same network ID thus,they are not different.Thus,this division is only of two subnets.
Option (D) 
204.204.204.128/255.255.255.128
204.204.204.64/255.255.255.192
204.204.204.0/255.255.255.192

1) 11001100.11001100.11001100.10000000/11111111.11111111.11111111.10000000 –> Network bits-25 (as 25 bits are 1 in the subnet mask) so sub-network id == 204.204.204.128 (refer(2)) 7 bits ‘0’ in subnet mask,i.e. 128(i.e. 2^7)-2=126 hosts (refer(1))
2) 11001100.11001100.11001100.01000000/11111111.11111111.11111111.11000000 –> Network bits-26 (as 25 bits are 1 in the subnet mask) so sub-network id == 204.204.204.64 (refer(2)) 6 bits ‘0’ in subnet mask,i.e. 64(i.e.2^6)-2=62 hosts (refer(1))
3) 11001100.11001100.11001100.00000000/11111111.11111111.11111111.11000000 –> Network bits-26 (as 26 bits are 1 in the subnet mask) so sub-network id == 204.204.204.0 (refer(2)) 6 bits ‘0’ in subnet mask,i.e. 64(i.e.2^6)-2=62 host bits (refer(1)) This satisfies the minimum criteria of 50,50 and 100 hosts and all subnet IDs are different .Thus,option D is correct.
This explanation is provided by Shashank Shanker.Quiz of this Question
Gate IT 2005
GATE-Gate IT 2005
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE MOCK 2017 | Question 24
GATE | GATE-CS-2006 | Question 47
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90