A small introduction to subnetting
What should we do if we have only one address and we need to assign addresses for multiple networks? The correct answer is subnetting.
Subnetting is division of one network into several smaller networks called subnets. Bits from host ID part of IP address are used to identify subnets.
This way we can create from one network more networks, but since a host in such new subnet will be identified by fewer number of bits, size of created networks will be reduced. An IP address in this case consist not only of two parts as it was before, but of three parts:
the first part identifies the network
the second part of clearly identifies particular subnet
the last part identifies concrete host.
Network mask of subnets (subnet mask) will be increased by a number of bits that were spent on subnetting. Each subnet forms a separate network, thus if communication among subnets is needed, use a router is necessity. Subnetting brings many advantages:
reduces network traffic – fewer packets will pass through a given network, because each subnet forms a separate broadcast domain
improves network performance – smaller number of packet are received and processed, so given that other packets can be handled faster
simplifies network maintenance – it is easier to identify and locate the problem in more of smaller networks than in one bigger
enhances network security – users with different privileges may be placed in different subnets.
There are two types of subnetting: with constant subnet mask and with variable-length subnet mask (VLSM). 2.4.1 Subnetting with Constant Subnet Mask When using a constant subnet mask for subnetting, network is divided into several smaller, equally sized networks. The whole procedure can be summarized in the following steps:
Find out the largest number of hosts that need to be in one subnet – max_IP
Add to max_IP two IP addresses – one IP address as subnet ID and the second as subnet broadcast (for explanation see 2.2.6 Reserved addresses)
Find out a number n in equation: max_IP + 2< = 2n
The number n represents the count of bits that are needed in address to identify a host
The rest bits minus bits of standard mask of network that is going to be subnetted, can be used to identify subnets. Example 1 Use Class C IP address 126.96.36.199 with mask /24. Create logical design that includes 8 networks with 20, 24, 29, 18, 26, 27, 26, 27 hosts. Other enlargement of the networks is not expected and the use of zero subnet and all-one subnet is allowed. We need in total 197 usable IP addresses.So let’s go subnetting as described in procedure above: the largest number of hosts is 29, max_IP = 29, add one IP address for subnet ID and one for subnet broadcast, max_IP + 2 = 31
nearest power of two to 31 is 32 = 2^5, n = 5, 11
5 bits are needed for identifying hosts, thus it leaves 27 bits for identifying network , 32 – 5 = 27
the standard Class C network mask is formed from 24 bits. 27-24 = 3 bits. We can create 2 ^ 3 = 8 subnets and that fulfils the needs according to assignment.
We created eight subnets, each of them has 30 usable IP addresses that can be assigned to hosts. Subnet mask is in slash format / 27 or 255.255.255.224 in decimal format. Range of IP addresses for each subnet can be clearly seen in Table 3 .
Create logical design that includes 6 networks with 10, 10, 10, 10, 57 and 100 hosts. Other enlargement of the networks is not expected and the use of zero subnet and all-one subnet is allowed. We need total 197 usable IP addresses; same as in previous example but this time little differently distributed in networks.
During subnetting we find out that we need to borrow 3 bits for creation at least 6 subnets. Given that, only 5 bits left for identifying of hosts, what limits the size of each subnet to maximum of 30 usable IP addresses and that is not enough to satisfy the needs according to the assignment.
This example cannot be successfully solved with constant mask. The solution is to use variable length subnet mask (VLSM) that allows flexible subnetting and avoid unnecessary wastage of IP addresses. 13 2.4.2 Subnetting with VLSM This type of subnetting divides a large network into several smaller subnets that don’t have to be the same size.
The subnetting with VLSM is done in similar way as subnetting with constant mask: the network is divided into several same sized networks. But the difference is that these networks can be further divided, until a approximately desired size subnet of is reached.
Simply said it is creating subnets from a subnet. Count of ones in subnet mask is increased with each dividing, reflecting with smaller size of created subnet. There are several methods of allocating subnets using VLSM. The methods differ mainly whether to allow an enlargement of the network or give as much residual address space as possible.
These methods are:
Sequential method – the most commonly used method, subnets are allocated one after another from the largest to the smallest (by number of hosts). This method provides very little space for enlargement of networks, but on the other hand gives the largest residual free space
Reverse binary method – a method that provides the best possibility for enlargement of networks, but all of that is at the expense of the size of the residual free space
Method of splitting in half – this method always divides the smallest suitable set of addresses into two parts when allocating new subnet. All in all this method is a compromise of previous two: it gives some possibility of extension and try also to keep together as much residual free space as possible.
Consider the previous example that could not be solved with constant mask. Try to solve it using VLSM. The rest of assignment remains same: Use IP class C address 188.8.131.52 with mask /24. Create logical design that includes 6 networks with 10, 10, 10, 10, 57 and 100 hosts.
Other enlargement of the networks is not expected and the use of zero subnet and all-one subnet is allowed. Also this time we need to create in total 197 usable IP addresses. As we can see in assignment, no other expansion of networks is expected. Therefore we choose the sequential method of allocating the subnets.
As shown in Figure, firstly we divide the original network into two subnets, and assign 100 hosts to the first subnet. The second subnet is subnetted further and divided again into two subnets. The first of these additional subnets is reserved for 57 hosts.
The second one is subnetted further again. This time we create four other equally sized subnets (labelled as S1, S2, S3, S4 in Table 4) with 14 usable IP addresses in each of them. We have successfully solved the problem (for comparison of hosts in particular subnets see Figure 6 ). Detailed range of IP addresses for each subnet is clearly shown in Table 4. Figure 6 Division of address space in Example, 16 Subnet Subnet ID The first usable IP address The last usable IP address Subnet broadcast.
Range of IP address for each subnet in the use of VLSM can very effectively meet the requirements for addressing as can be seen from previous example. In addition, it is also merit of VLSM that all the public IP addresses in IPv4 has not yet been exhausted. Although VLSM significantly reduces wastage of IP address, all IPv4 address will be assign in a short time. The ultimate solution to the lack of IP addresses will be (at least for several decades) the migration to IPv6 and its active using.