IP Subnetting

Publish Date: June 17, 2015

IP Subnetting

IP Subnetting is a process of dividing large network into the smaller networks based on layer 3 IP address. IP address is divided into the two components by subnet mask:

Network ID: Defines network segment of device.

Host ID: Defines the specific device on a particular network segment.

Benefits of Subnetting

  • Reduced network traffic: Subnetting can create subnetworks of small size which reduces the size of broadcast domain. More the broadcast domains, smaller the broadcast domains and the less network traffic on each subnetwork.
  • Optimized network performance: Reduced network traffic increases the overall performance of network.
  • Simplified management: Easy to identify and troubleshoot network problems in a group of smaller connected networks than within one huge network.
  • Reduced Address Space Wastage: We can prevent the wastage of valuable addresses by creating subnetworks which provides enough hosts and networks for our organization.
  • Spanning over large geographical distances: Because WAN links are considerably slower and more expensive than LAN links, a single large network that spans long distances can create problems in every area previously listed. Connecting multiple smaller networks makes the network more efficient.

Creating Subnets

To create subnetworks, you take bits from the host portion of the IP address and reserve them to define the subnet address. This means fewer bits for hosts, so the more subnets, the fewer bits available for defining hosts.

For the subnet address scheme to work, every machine on the network must know which part of the host address will be used as the subnet address. This is accomplished by assigning a subnet mask to each machine. A subnet mask is a 32-bit value that allows the recipient of IP packets to distinguish the network ID portion of the IP address from the host ID portion of the IP address.
The network administrator creates a 32-bit subnet mask composed of 1s and 0s. The 1s in the subnet mask represent the positions that refer to the network or subnet addresses.
When we have not created subnets, there is default subnet mask for each class of IP Address:

Address Class

Default Subnet Mask




Remember the Power of 2

To create subnets very easily and quickly, you need to remember the power of 2.

21 = 2
22 = 4
23 = 8
24 = 16
25 = 32
26 = 64
27 = 128
28 = 256

Classless Inter-Domain Routing (CIDR)

Classless Inter-Domain Routing (CIDR) is basically the method that ISPs (Internet service providers) use to allocate a number of addresses to a company or to a home customer. They provide addresses in a certain block size. When you receive a block of addresses from an ISP, what you get will look something like this: This is telling you what your subnet mask is. The slash notation (/) means how many bits are turned on (1s). Obviously, the maximum could only be /32 because a byte is 8 bits
and there are 4 bytes in an IP address: (4 × 8 = 32). But keep in mind that the largest subnet mask available (regardless of the class of address) can only be a /30 because you’ve got to keep at least 2 bits for host bits.

Subnet Mask CIDR Value /8 /9 /10 /11 /12 /13 /14 /15 /16 /17 /18 /19 /20 /21 /22 /23 /24 /25 /26 /27 /28 /29 /30

Subnetting (C Class Address)

In Class C address, we have 8 bits for host addressing. This means we have 8 bits to be borrowed from but leaving at least 2 bits for hosts, we can only subnet using remaining 6 bits. Here are the valid subnet masks for C class: (/24) (/25) (/26) (/27) (/28) (/29) (/30)

Subnetting is all about determining 5 parameters which are: Total number of Subnets, Hosts/subnet, Valid subnets, broadcast address of each subnet, valid host range.

Whether you are subnetting A class, B class or C class, you have to determine these 5 parameters and you are done.

Total subnets: 2x = number of subnets. Where x is the number of masked bits or 1s. For example in 11000000, the number of 1s gives us 22 subnets. In this example, there are 4 subnets.

Hosts per subnet: 2y – 2 = number of hosts per subnet. Where y is the number of unmasked bits or 0s. For example, in 11000000, the number of 0s gives us 26 – 2 hosts. In this example, there are 62 hosts per subnet. You need to subtract 2 for the network number and the broadcast address, which are not valid.

Valid subnets: 256 – subnet mask = block size or increment number. For example 256 – 192 = 64. The block size of a 192 mask is always 64. Start counting from 0 in the blocks of 64 until you reach the subnet mask value and these are our subnets 0, 64, 128, 192.

Broadcast address for each subnet: The broadcast address is always the number right before the next subnet. For example, the 0 subnet has a broadcast address of 63 because the next subnet is 64. The 64 subnet has a broadcast address of 127 because the next subnet is 128. And so on. The key is to remember that the broadcast address of the last subnet is always 255.

Valid hosts: Valid hosts are the numbers between the subnets, omitting the all-0s and all-1s. For example, if 64 is the subnet number and 127 is the broadcast address, So 65 to 126 is the valid host range.

Example 1: (/25)

Since 128 is 10000000 in binary, there is only 1 bit for subnetting and 7 bits for hosts. We’re going to subnet the Class C network address.

Total subnets: Since 128 is 1 bit on (10000000), the answer would be 21 = 2.

Hosts per subnet: We have 7 host bits off (10000000), so 27 – 2 = 126 hosts.

Valid subnets: 256 – 128 = 128. Start from 0 and count in block size, in this way the subnets are 0, 128.

Broadcast address for each subnet: The number right before the value of the next subnet is all host bits turned on and equals the broadcast address. For the zero subnet, the next subnet is 128, so the broadcast of the 0 subnet is 127 and for 128 subnet is 255.

Valid hosts: These are the numbers between the subnet and broadcast address. For 0 subnet, 1st host is 1 and last is 126 and for 128 subnet, 1st host is 129 and last is 254.

Example 2: (/26)

In this example, we’re going to subnet the network address using the subnet mask = Network address = Subnet mask

Total subnets: 192 is 2 bits on (11000000), Total subnets are 22 = 4 subnets.
Hosts per subnet: Remaining 6 host bits off (11000000), So 26 – 2 = 62 hosts.
Valid subnets: 256 – 192 = 64. Start from 0 and count in block size, so the subnets are 0, 64, 128, and 192.
Broadcast address for each subnet: The number right before the value of the next subnet is all host bits turned on is the broadcast address. For the 0 subnet, the next subnet is 64, so the broadcast address for the zero subnet is 63.
Valid hosts: Valid hosts are addresses between the network number and broadcast address. The easiest way to find the hosts is to write out the network number and the broadcast address. In this way, the valid hosts are obvious. The following table shows the 0, 64, 128, and 192 subnets, the valid host ranges of each, and the broadcast address of each subnet:

Subnets 0 64 128 192
First Host 1 65 129 193
Last Host 62 126 190 254
Broadcast Address 63 127 192 255

Subnetting (B Class Address)

Lets look at all the possible Class B subnet masks. In B Class, we have a lot more possible subnet masks than we do have with a Class C network address: (/16) (/17) (/18) (/19) (/20) (/21) (/22) (/23) (/24) (/25) (/26) (/27) (/28) (/29) (/30)

As you know that the Class B network address has 16 bits available for host addressing. This means we can use up to 14 bits for subnetting because as per rule, we have to leave at least 2 bits for host addressing. The process of subnetting a Class B network is same as Class C, except that you just have more host bits and you start
in the third octet.
Use the same network number for the third octet with Class B that you used for the fourth octet with Class C, but add a zero to the network portion and a 255 to the broadcast section in the fourth octet. The following table shows you an example host range of two subnets used in a Class B (/20) subnet mask:

Subnet Address 16.0 32.0
Broadcast Address 31.255 47.255

Subnetting (A Class Address)

The process of subnetting A class is same as Class B and Class C except that in A class you have 24 bits to play with and you start in the second octet.

According to rule, you must leave at least 2 bits for defining hosts. So, all the possible subnet masks in class A are: (/8) (/9) (/10) (/11) (/12) (/13) (/14) (/15) (/16) (/17) (/18) (/19) (/20) (/21) (/22) (/23) (/24) (/25) (/26) (/27) (/28) (/29) (/30)
Example 1:

You work for a large company and assigned a Class A network address. Presently, the company has 1000 subnets in all of its offices. You want to add 100 new subnets over the next three years, and you want to allow for the largest possible number of host addresses per subnet.
Which subnet mask would you choose?

Requirements: 1000 + 100 = 1100 subnets, and as many host addresses as possible

210 = 1024 subnets, which is not sufficient for our network. So we’ll borrow 1 more bit from host portion resulting:

211 = 2046.

11111111 00000000 00000000 00000000 = (A class natural subnet mask)
11111111 11111111 11100000 00000000 = (A class subnet mask after subnetting)

Answer: The subnet mask will give us enough subnets as well as hosts per subnet.

My final words about subnetting is more you practice, more perfect you will become.

Supernetting or Route Aggregation

A supernetwork or supernet is an IP network that is formed from the combination of two or more subnets with a common Classless Inter-Domain Routing (CIDR) prefix. The new routing prefix for the combined network aggregates the prefixes of the constituent networks. It must not contain other prefixes of networks that do not lie in the same routing path. The process of forming a supernet is often called supernetting, prefix aggregation, route aggregation or route summarization.

Route summarization reduces the routing entries updates in the routing table and also helps to reduce the bandwidth consumption by minimizing the size of routing table updates.
Consider the following network diagram:
Suppose that router R1 has 3 networks as shown above in its routing table and router R1 is connected to R2 using very slow speed WAN link. When router R1 need to send a routing table update towards R2, it will consume a lot of bandwidth if it keeps sending all the addresses separately. Instead, what it does is that it converts,, into what is known as summary route and send it in a single update, thus saving the precious WAN link bandwidth.
How Route Summarization Works
  1. Convert the addresses to binary format and align them in a list.
  2. Locate the bit where the common pattern of digits ends. (It might be helpful to draw a vertical line marking the last matching bit in the common pattern.)
  3. Count the number of common bits. The summary route number is represented by the first IP address in the block, followed by a slash, and then the number of common bits. According to diagram, the first 22 bits of the IP addresses from through are the same. Therefore, the best summary route is Summary Calculate

Microsoft Certified | Cisco Certified