Computer Networking Math 100 Questions with Solutions

IP subnet Calculator

IP Calculator

Solution:

Here, n = CIDR = 27

Network bit = 27

Host bit = 32 - n

= 32 - 27

= 5

= 255.255.255.224

= 00000000.00000000.00000000.00011111

= 0.0.0.31

Rule 1: ANDing given IP address with subnet mask (as bits are changed in the 4th octet, we only consider 4th octet here)

4th octet of given IP address (in binary) = 01110100

4th octet of subnet mask (in binary) = 11100000  ANDing we get = 01100000 = 96 So, Network Address =  175.231.232.96

Rule 2: Making host bits into zero of the given IP address

Here, host bit exists = 32 - 27 = 5

and, given IP address's 4th octet  = 116 = 01110100

converting host bits into zero we get = 01100000 = 96

Rule 1: ORing given IP address with Complement Subnet mask (as bits are changed in the 4th octet, we only consider 4th octet here)

4th octet of given IP address (in binary) = 01110100

4th octet of Complement subnet mask (in binary) = 00011111 ORing we get = 01111111 = 127 So, Broadcast Address =  175.231.232.96

Rule 2: Making host bits into '1' of the Above Network address

Here, 4th octet of Network address = 01100000

So, host bit exists = 32 - 27 = 5

converting host bits into '1' we get = 01111111 = 127

So, First Valid host = 175.231.232.97

Last Valid host = 175.231.232.126

5. An organization has an IP address 192.168.1.0/24, It should divide this address such that -

HQ LAN1 has 50 hosts

HQ LAN2 has 50 hosts

Sales LAN1 has 30 hosts

Sales LAN2 has 30 hosts

IT LAN1 has 12 hosts

IT LAN2 has 8 hosts

Solution:
 Host Network address Host Range Broadcast address Subnet mask 50 192.168.1.0 Bit needed for 50 hosts are = 6 (as 26= 64 and 0 + 64 = 64), So Host Range will be 192.168.1.1 to 192.168.1.62 192.168.1.63 Here, host bit = 6, So, making host bits Into zero we get Subnet mask = 255.255.255.192 Another way, here Network bits = 32 - 6 = 26, So, CIDR = /26 and we say Full form = 192.168.1.0/26 50 192.168.1.64 192.168.1.65 to 192.168.1.126 192.168.1.127 255.255.255.192 30 192.168.1.128 192.168.1.129 to 192.168.1.158 192.168.1.159 255.255.255.224 30 192.168.1.160 192.168.1.161 to 192.168.1.190 192.168.1.191 255.255.255.224 12 192.168.1.192 192.168.1.193 to 192.168.1.206 192.168.1.207 255.255.255.240 8 192.168.1.208 192.168.1.209 to 192.168.1.222 192.168.1.223 255.255.255.240

6. An IP address 192.168.10.0/23, Find –

Unique ID (host) number

Solution:

Here, CIDR = 23

11111111.11111111.11111110.00000000

=255.255.254.0

So, Subnet Mask =  255.255.254.0 (Ans - 1)

From CIDR we get host bit = 32 – 23 = 9

So, Total Host = 29=512

So, Unique or Usable Host = 512 – 2 = 510 (Ans - 2)

Now, to find Broadcast address we have to find Network address at First.  We see that there is a change in 3rd and 4th octet of subnet mask.

So, we have to work with 3rd and 4th octet of the IP address.

3rd and 4th octet of Given IP = 10.0 = 00001010.00000000

3rd and 4th octet of subnet mask = 254.0  = 11111110.00000000

Now, To Find Network address –

Network address’s 3rd and 4th octet = 00001010.00000000

= 10.0

(By chance, here Given IP address and Network address is same, it happens for CIDR 23, if CIDR changed, it will not remain same)

Now, From CIDR we know, here host bit = 32 – 23 = 9

So, to get Broadcast address, we will make last 9 bits of Network address into 1 (here in 3rd and 4th octet)

= 00001011.11111111

= 11.255

So, from the above discussion we get-

So, First usable host address = 192.168.10.1

So, Last usable host address = 192.168.11.254 (Ans - 4)

Solution:

= 11111111.11111111.11111111.11110000

=255.255.255.240 (Ans – 1)

We get change in 4th octet of subnet mask

4th octet of IP = 0 = 00000010

4th octet of subnet mask = 11110000

ANDing 4th octet of IP with subnet mask

we get 00000000 = 0,

So, Network address = 192.168.10.0 (Ans – 2)

Here, CIDR = 28

So, making last (32 – 28) = 4 bits into 1 of network address

We get 00001111 = 15

So, First address = 192.168.10.1 (Ans – 4)

So, Last address = 192.168.10.14 (Ans – 5)

8. In the following IP address 172.20.0.0/27, find how many subnets and hosts per subnet?

Solution:

Here, given IP address  = 172.20.0.0

=172.20.0.00000000

=255.255.255.224

(Technique: 11100000 = (23 – 1)*25 = 7*32 = 224)

From 4th octet of subnet mask we get Network bit = 3 and host bit = 5

So, Number of subnet = 23 = 8 (Ans -1)

And hosts per subnet = 25 = 32

And, valid host per subnet = 32-2 = 30 (Ans -2)

Converting last (32-27)=5 bits of Network address into 1 we get

= 172.20.0.31

Extra: if ask how many connections is possible in this network?

Ans: The valid number of hosts is the answer; here in this math we can say it is 30

9. Find subnet of 172.16.2.1/22 which will be applicable for your office room having 50 and 23 PCs. Also find the first and last usable IP addresses along with broadcast address

Solution:

= 11111111.11111111.11111100.00000000

=172.16.00000010.00000001

= 172.16.00000000.00000000

= 172.16.0.0

For 50 PCs

We need minimum 6 bits for hosts (as 2^5=32 but 2^6=64)

= 172.16.0.0

= 172.16.0.1

= 172.16.0.62

= 172.16.0.63

For 23 PCs

We need minimum 5 bits for hosts (as 2^4=16 but 2^5=32)

= 172.16.0.64

= 172.16.0.65

= 172.16.0.94

= 172.16.0.95

Solution:

As we should divide the given network address into 4 subnets, we have to find a fixed CIDR for this operation.

Here, total hosts = 2^(32-23) = 2^9 = 512

Now, 512/4 = 128

We can write 2^7 = 128

We see, every subnet block will have 128 hosts.

So, our network bit will be (32-7) = 25

So, our new CIDR or subnet prefix = /25

1st Subnet:

Subnet mask = 255.255.255.128 (as new CIDR = \25, and 2^7 = 128)

2nd Subnet:

Subnet mask = 255.255.255.128 (as new CIDR = \25, and 2^7 = 128)

3rd Subnet:

Subnet address = 172.18.11.0/25 (as 4th octet is filled up in previous subnet block, so 3rd octet is changed)

Subnet mask = 255.255.255.128 (as new CIDR = \25, and 2^7 = 128)

4th Subnet:

Subnet mask = 255.255.255.128 (as new CIDR = \25, and 2^7 = 128)

11. Given IP address 211.17.180.0/24, Administrator wants to divide it into 32 subnets, so what will be the subnet mask and how many hosts belongs to every subnet, what is the first and last address of 1st and last subnet address?

Solution:

As we should divide the given network address into 32 subnets, we have to find a fixed CIDR for this operation.

Here, total hosts = 2^(32-24) = 2^8 = 256

Now, 256/32 = 8

We can write 2^3 = 8

We see, every subnet block will have 8 hosts.

So, our network bit will be (32-3) = 29

So, our new CIDR or subnet prefix = /29

255.255.255.11111000

=255.255.255.248 (Ans -1)

1st subnet:

Host number per subnet = 2^3 – 2 = 6 (Ans -2)

First address = 211.17.180.1 (Ans -3)

Last address = 211.17.180.6 (Ans -4)

Last subnet:

Host number per subnet = 2^3 – 2 = 6 (Ans -5)

First address = 211.17.249 (Ans -6)

Last address = 211.17.180.254 (Ans -7)

(As total host is 256, x.x.x.255 is reserved for broadcast in this case)

12. Given a network address 172.16.0.0 where 512 subnets and 100 hosts per subnet are needed. What should be the subnet mask?

Solution:

We know,

There are some 1 and some 0 in subnet mask.

1 indicates network bit and

0 indicate host bit.

In a subnet mask, network bits are written at first, then host bits are written.

As the given network address is Class B network address, it has 16 bit network address and 16 bit host address. So, for 512 subnets, I have to borrow 9 bits (as 2^9 = 512) from the 3rd and 4th octet.

And the rest bits will remain 0 for host addresses.

(As 100 hosts is greater than 2^6 = 64 and lower than 2^7 = 128, the rest all bits need to be 0)

= 255.255.255.128 (Ans)

13. What subnet mask would you use for the 172.16.0.0 network, such that you can get 230 subnets and 170 hosts per subnet?

Solution:

172.16.0.0 is a Class B IP address where in 16 bit network ID & 16 bit host ID.

For 230 sub-networks you need to borrow 8 bits from 3rd octet in other words entire 3rd octet because 2^8 =256, you can accommodate 230 in 256.

Since you are leaving last octet as host ID, you get (2^8)-2 = 254 host IP addresses. First number is Network address & last number is Broadcast address in any subnet which can’t be assigned to any host so we do -2.

When you do subnetting , you don’t get the exact number of subnetworks & hosts that you wanted. you have to go for next higher available number. you asked for 230 subnetworks but you got 256 subnetworks. you asked for 170 hosts per subnet but you got 254 hosts per subnet.

So, Use the subnet mask 255.255.255.0 (Ans)

14. You have been asked to create a subnet mask for the 172.16.0.0 network. Your organization requires 900 subnets, with at least 50 hosts per subnet. What subnet mask should you use?

Solution:

900 subnets need minimum 10 bits for 3rd and 4th octet. The rest 6 bits (4th octet) is enough for 50 hosts.

= 255.255.255.192 (Ans.)

15. You are designing a subnet mask for the 172.25.0.0 network. You want 2200 subnets with up to 8 hosts on each subnet. What subnet mask should you use?

Solution:

2200 subnets need minimum 12 bits in 3rd + 4th octet. The rest 4 bit is enough for 8 hosts.

= 255.255.255.240 (Ans)

The benefits of using sub-netting are :

1. Reduction in the overall network traffic which increases the network performance.
2. Easy to manage and troubleshoot small network.
3. Increased control on address space in a network.
16. How can I subnet 172.16.0.0/16 into 3 subnets?

Solution:

You can divide it into either three unequal subnets, eg:
172.16.0.0/17
172.16.0.128.0/18
172.16.0.192.0/18

Or three equal subsets (with 172.16.0.192.0/18 wasted):
172.16.0.0.0/18
172.16.0.64.0./18
172.16.0.128.0/18

Alternative solution:

If you want to divide it in 3 equal subnets then it's not possible. For equal part you need to have 2**x subnets possible. So you can divide it in 2, 4, 8,… equal subnets only. Now if you want to divide 172.16.0.0/16 into three parts then best possible option to divide it in 4 equal part written below.
172.16.0.0/18
172.16.64.0/18
172.16.128.0/18
172.16.192.0/18

17. A large number of consecutive IP address are available starting at 198.16.0.0. Suppose that four organizations, A, B, C and D request 4000, 2000, 4000, and 8000 address, respectively, and in that order. For each of these, I need to give the first IP address assigned, the last IP address assigned, and the mask int the w.x.y.z/s notation. Please explain for each organization.

18. An organization want to use IP addresses between 192.168.5.0 and 192.168.7.255, For this what subnet mask should they use?

Solution: Here total hosts = 256 x 3 = 768
768 is between 2^9 and 2^10
(2^9 < 768 < 2^10)
So host bit = 10 and network bit = 22
so, subnet prefix = 192.168.5.0/22