Subnetting (Preview)

Subnetting is the process of subdividing a given network address to smaller sub networks. In order to create sub networks, we borrow bits from the host portion of a given network address. The figure below lists the classful IPv4 address and their default subnet masks. A classful address uses its default mask as defined by the value of the first octet.

Reading

Reynolds & Postel,‘ASSIGNED NUMBERS’, RFC 870, pp.2

The complete RFC 870 can be found here.

 

For example, if we look at the network 8.0.0.0 /8, as per the table below this is a classful network address belonging to class A. It has a default mask of /8 (255.0.0.0). That means first 8 bits are reserved for the network portion and the remaining 24 bits are reserved for the host portion.

 

Figure Legacy classful IPv4 address classes

 

However, if we borrow bits from the host portion of default class A network address 8.0.0.0 /8 and create sub networks, then those resulting subnetworks become classless network addresses. Therefore, classless means away with the default classful subnet mask and on with a custom subnet mask.

 

Let’s consider the classful network 192.168.10.0 /24 to demonstrate the process of subnetting. Also, let’s assume we have to assign these subnets to the below mentioned departments. Each department must be in a network of their own.

  1. Accounting
  2. Human Resource
  3. Finance
  4. Sales

 

 

 

Figure Local area network

 

 

Step 1 – Start with what you are given

Firstly, let’s examine what we have got.

  • 192.168.10.0 /24 is a class C network
  • It’s a classful network address.
  • The default subnet mask is /24 (255.255.255.0)
  • The number of host IDs we can assign is 254 (2^8-2)

 

 

Binary Representation of 192.168.10.0 1100000.10101000.00001010.00000000
Binary Representation of Subnet Mask 255.255.255.0 11111111.11111111.11111111.0000000
Network & Host Bits nnnnnnnn.nnnnnnnn.nnnnnnn.hhhhhhhh

 

 

Note: we cannot change 192.168.10.0. This is our address space. Only thing we can do is borrow host bits (h) which is going to result in reducing the number of hosts and extending the default subnet mask.

Step 2 – Determine the number of subnets that are needed

  • We need four subnets to assign to the four departments.

Step 3 – Determine the number of network bits needed

 

Now we need to decide in order to create 4 sub networks how many host bits we must borrow. To calculate the number of subnets that can be created from the bits borrowed, use the formula below.

 

Number of networks = 2^n

n= bits borrowed

 

Note: The last two bits cannot be borrowed from the last octet because there would be no host addresses available. Therefore, the longest prefix length possible when subnetting is /30 or 255.255.255.252.

 

The figure below depicts how many subnets we can create based on the number of host bits borrowed.

 

 

Figure Subnetting a /24 network

 

From the above figure, we can see all we need is to borrow 2 bits from the host portion and that will produce 4 subnets out of 192.168.10.0 /24.

 

Step 4 – Calculate the new mask

 

Figure below shows the original mask.

 

Figure Original mask

 

 

Now, let’s examine the mask that results from borrowing 2 bits from the host portion.

 

 

Figure Result of borrowing 2 bits

 

We can see the result is prefix length /26 or subnet mask 255.255.255.192. This will be the subnet mask for all of the resulting 4 subnets.

 

Figure Subnet mask 255.255.255.192

 

What are the resulting subnetworks?

 

The figure below shows the possible bit combinations for the last octet which determines the resulting four subnetworks based on the new subnet mask.

 

 

Figure Binary shown for the last octet

 

Network # Binary for Last Octet Network Address Subnet Mask Prefix Length
Network 1 192.168.10.00 00 0000 192.168.10.0 255.255.255.192 /26
Network 2 192.168.10.01 00 0000 192.168.10.64 255.255.255.192 /26
Network 3 192.168.10.10 00 0000 192.168.10.128 255.255.255.192 /26
Network 4 192.168.10.11 00 0000 192.168.10.192 255.255.255.192 /26

The resulting subnetworks

 

Step 5 – Confirm the number of host bits and calculate the number of hosts

To calculate the number of hosts that can be supported, use the following formula

 

Number of theoretical hosts per subnetwork = 2^n

Number of valid hosts = 2^n – 2

n= number of bits remaining in the host portion

 

Note: For any host ID,

  1. All bits within the host portion CANNOT be set to 1 because this host ID is reserved as a broadcast address.
  2. Also, all bits in the host portion CANNOT be set to 0 because this signifies the IP network ID.

When calculating the number of usable hosts, we apply the formula 2^n -2. The n is the number of available bits in the host portion and “-2” is to deduct two addresses we cannot use due to above two reasons.

 

 

Figure Remaining host bits

 

 

Therefore, number of hosts = 2 ^ 6 = 64 and the number of valid hosts = 2^6 – 2 = 62.

 

The figure below shows the host addresses in network 192.168.10.0 /26.

 

Figure Address range for the subnet 192.168.10.0 /26

 

  • IPv4 Network address is 192.168.10.0 and contains all 0 bits in the host portion of the address.
  • First IPv4 host address is 192.168.10.1 and contains all 0 bits plus a rightmost 1 bit in the host portion of the address.
  • Last IPv4 host address is 192.168.10.62 and contains all 1 bits plus a rightmost 0 bit in the host portion of the address.
  • IPv4 Broadcast address is 192.168.10.63 and contains all 1 bits in the host portion of the address.

 

Figure Address ranges for all four subnets

 

Now, we can assign the subnets to each department.

Figure Local area network

Back to: CCNA Routing and Switching 200-125 > IPv4 Addressing