Subnetting

Networking

← Prev

IP address was designed originally with two levels – netid and hostid. So to reach a host we first need to reach the network and then the host. But 2 levels of hierarchy are not enough for any organization. For instance if an organization is allotted Class A block then it is quite obvious that the organization will divide the large network into smaller network for better management.

Subnetting is the process of dividing a network into smaller sub network (subnet) with each sub network having its own sub network address (first address of the sub network).

The following picture shows a 2-level hierarchy where an IP address is divided into netid and hostid.

32 bit IP Address

Netid

Hostid

Therefore in this case to reach a host, first we have to find the network address and then we can reach the host.

The following picture shows a 3-level hierarchy where an IP address is divided into netid, subnetid and hostid.

32 bit IP Address

Netid

Subnetid

Hostid

In this case first we need to find the network address after that we need to find the subnet to which the host belongs; after finding the subnet we can reach the host. Thus in subnetting the hostid part is reduced in size.

Subnetting Rule

We can only divide a given network in multiple of 2 to get the sub network. So a network can be divided into 2, 4, 6, 8, 10, etc. subnets.

Subnet Address

The first address of the sub network is called the subnet address.

Subnet Address = IP Address AND Subnet Mask

Subnet Mask

Subnet mask is a 32 bit number that is used to find the subnet address (first address of the sub network). There are n bits at the leftmost side of the 32 bit mask that is set to 1 while there remaining (32 – n) bit is set to 0.

Example

Consider an IP address 168.96.0.0 that is allotted to a college. The college authority wants to divide (subnet) the network into 4 sub networks. Find the network address, subnet addresses and number of hosts in each of the sub network?

Given:

IP Address = 168.96.0.0

This is a class B address so the Network Mask (default mask) = 255.255.0.0

Network address = IP address AND Network Mask

=168.96.0.0 AND 255.255.0.0

=168.96.0.0

In binary form

IP Address (Class B)

1010 1000

0110 0000

0000 0000

0000 0000

Network Mask

1111 1111

1111 1111

0000 0000

0000 0000

Network Address

= IP Address AND Network Mask

1010 1000

0110 0000

0000 0000

0000 0000

In decimal form

IP Address (Class B)

168

96

0

0

Network Mask

255

255

0

0

Network Address = IP Address AND Network Mask

168

96

0

0

There are 16 numbers of 1s and 16 numbers of 0s in the Network (default) Mask.

It is given that the college wants to divide this network into 4 sub networks.

We can represent 4 as 22

This means the subnetid will have two 1s.

Thus total number of 1s in the subnet mask is 16+2=18

And total number of 0s in the subnet mask is 32-18=14

In binary form

IP Address (Class B)

1010 1000

0110 0000

0000 0000

0000 0000

Subnet Mask

1111 1111

1111 1111

1100 0000

0000 0000

Subnet Address = IP Address AND Subnet Mask

1010 1000

0110 0000

0000 0000

0000 0000

In decimal form

IP Address (Class B)

168

96

0

0

Subnet Mask

255

255

192

0

Subnet Address = IP Address AND Subnet Mask

168

96

0

0

So the subnet mask = 168.96.192.0

Number of host in each subnet = 214 = 16,384

As there are 4 subnet so total number of host = 4 x no. of hosts in each subnet = 4 x 16,384 = 65,536

The four subnet addresses (first address of the subnet) are as follows

In binary form

Subnet 1

IP Address

Subnet Mask

Subnet Address

10101000 01100000 00000000 00000000

11111111 11111111 11000000 00000000

10101000 01100000 00000000 00000000

Subnet 2

IP Address

Subnet Mask

Subnet Address

10101000 01100000 01000000 00000000

11111111 11111111 11000000 00000000

10101000 01100000 01000000 00000000

Subnet 3

IP Address

Subnet Mask

Subnet Address

10101000 01100000 10000000 00000000

11111111 11111111 11000000 00000000

10101000 01100000 10000000 00000000

Subnet 4

IP Address

Subnet Mask

Subnet Address

10101000 01100000 11000000 00000000

11111111 11111111 11000000 00000000

10101000 01100000 11000000 00000000

In decimal form

Subnet 1

IP Address

Subnet Mask

Subnet Address

168

255

168

96

255

96

0

192

0

0

0

0

Subnet 2

IP Address

Subnet Mask

Subnet Address

168

255

168

96

255

96

64

192

64

0

0

0

Subnet 3

IP Address

Subnet Mask

Subnet Address

168

255

168

96

255

96

128

192

128

0

0

0

Subnet 4

IP Address

Subnet Mask

Subnet Address

168

255

168

96

255

96

192

192

192

0

0

0

← Prev