1. Networking Fundamentals

4. IPv4 Addressing

4.3 Examples on subnetting:

Example 1 : You have an IP address of 156.16.3.47 with an 11-bit subnet mask. What are your valid hosts?

156.16.3.47 is a class B IP address and is normally used with a subnet mask of type 255.255.x.x

11 bit subnet mask is equivalent to 255.224.0.0=11111111.11100000.00000000.00000000

Netmask - 255.224.0.0

Wild card mask - 0.31.255.255

Network address -156.0.0.0/11

Broadcast: 156.31.255.255

Host Min: 156.0.0.1

Host max: 156.31.255.254

Host/Network-2097150

Example 2: What is the subnet Id of the IP address 165.212.18.5/20?

The subnet Id of the IP address 165.212.18.5/20 is 165.212.16.0 The available host address range is 165.212.16.1 - 165.212.31.254 Broadcast address: 165.212.31.255

Example 3: You have a network ID of 168.8.0.0. You need to divide it into multiple subnets with at least 500 hosts per each subnet. Which subnet mask should you use so that you will be able to divide the network into maximum number of subnets?

I. Find the Class of the IP address, in this case it is a class B network. Class B network has the form N.N.H.H. Therefore, we have a total of 16 bits (two octets) for assigning to internal networks and hosts. The minimum number of host addresses required is 500 (see the question). The last octet corresponds to 2^8 = 256 hosts which is still less than 500 Hosts.. Therefore, you have to borrow one more bit from the third octet to make it 256*2 = 512 Hosts. This leaves 7 bits in the third octet for assigning subnet addresses. This is equal to 2^7=128 subnets.

II. Write the 7 bits available for subnetting in third octet in the form 11111110 (last bit being the Host bit). The decimal equivalent of the first seven bits is 2^7+2^6+2^5+2^4+2^3+2^2+2^1= 128 + 64 +32 + 16 + 8 + 4 + 2 = 254.

III. Now the subnet mask required is 255.255.254.0.

Example 4: You have an IP address 156.233.42.56 with a subnet mask of 7 bits. How many hosts and subnets are possible?

Class B network has the form N.N.H.H, the default subnet mask is 16 bits long. There is additional subnet mask of 7 bits long.

7 bits of subnet mask corresponds to (2^7)=128 subnets.