In this section of CCNA 200-301 tutorials, let us discuss the IPv4 addressing and subnetting. This topic will cover the brief introduction to IP v4 address, classes of IP v4 address and IP v4 subnetting concept.
Introduction to IP v4 Address
IP address is a numerical identifier that uniquely identifies the devices in a computer network. Two types of IP address are widely used in IP network.
- IP version 4
- IP version 6
IP v4 address is a 32 bit logical address.
It is written in decimal format. The 32-bit address length is divided into 4 equal parts called an octet. Each octet contains 8 bit and is separated by a dot.
For example, 192.168.5.10 is an IP v4 address.
Features of IP v4 Address
- IPv4 is a 32-bit length address.
- It is divided into 4 equal parts.
- Each part consists of 8 bits and is called Octet.
- Each octet is separated by dot notation.
- It is normally written in a human-readable numbering system ie decimal number.
- 232 = 4.7 billion of addresses are available for IPV4.
- IPv4 consists of two parts: The network part and the host part.
- The network part shows that the IP address belongs to which network. The host shows the number of different hosts in the same network.
Classes of IP v4 Address
IP v4 address is classfied into 5 classes:
- Class A address ranges from 0.0.0.0 to 127.255.255.255
- Class B address ranges from 126.96.36.199 to 188.8.131.52
- Class C address ranges from 192.0.0.0 to 184.108.40.206
- Class D address ranges form 220.127.116.11 to 18.104.22.168
- Class E address ranges from 240.0.0.0 to 255.255.255.255
The subnet mask is the 32-bit length of series of binary 0s (zeroes) and 1s (ones) that distinguishes the network part and the host part of an IP address. Series of 1s denote the network portion and 0s denote the host portion.
When we assign an IP address to any host in a network, a subnet mask is also given to it.
IP address is 192.168.5.10
The subnet mask is 255.255.255.0
If we convert subnet mask to binary bits, then it looks like this:
The series of 1s is called the network bits and the 0s are called host bit.
Network bit will remain unchanged for every IP assigned to any host in the same network and the network address is derived by ANDing the binary equivalent of IP address and the subnet mask.
These series of 0s can be varied from 0s to 1s for all the hosts within the same network.
Hence, in the above example,
The number of networks is given by = 2n, where n denotes the number of network bits.
and the number of hosts per network is given by=2h-2 where h is the number host bit
|Please click on the following link below for details on IP v4 Addressing|
|What is IP Address and its Classes | My Computer Notes|
What is Subnetting
Subnetting is a very important topic in the field of networking. It is quite interesting because it involves a lot of mathematical calculations. This tutorial tries to explain each and every term that is related to IP subnetting. I hope it probably helps you a lot to clear your doubt on the subject.
Subnetting is a technique of breaking down a single classful IP network into multiple, logical, and smaller sub-networks or subnets. It helps to create smaller networks out of a single large network. Subnetting is done to control the rapid exhaustion of the IP v4 address. There is unnecessary wastage of host IP addresses while using classful addressing. The wasted IP cannot be allotted to the other network. To overcome this problem, the concept of subnetting is evolved.
Benefits of Subnetting
The major benefit of subnetting is that it controls the rapid exhaustion of IP addresses. Apart from this, it has other benefits such as;
- Breaks up the large network into smaller manageable segments.
- Controls Broadcast traffic.
- Reduces network congestion.
- Enhance network security.
- Ease of administration.
Limitations of classful address explained with examples.
In classful addressing scheme, Class A, B, and C have following fixed numbers of host per network using their respective default subnet masks.
So, it is clear from the table above that
- Class A has 24 bits for the host, thus the number of hosts per network in Class A will be 224 – 2= 1,67,77,214.
- Class B has 16 bits for the host, thus the number of hosts per network in Class B is 216 – 2 = 65,534
- Class C has 8 bit for the host, then, the number of hosts per network in Class C will be 28 – 2 = 254
Concept of subnetting explained with an example
Now, let us understand, how subnetting helps to overcome the limitation of classful addressing and make the host addressing more flexible using subnetting.
Let us take an example to understand the topic more clearly.
Examples of Subnetting
You have a Class C network address 22.214.171.124/24.
Now, you can break this Classful network address in two ways in order to create new subnetwork. In the first case, how many equal subnets you want to create by breaking the given classful address and the second case is how many hosts you need in a new subnet
Case1: if we want to create 2 equal subnets out of the classful address 192.168.1.0/24
We know, default subnet mask of the 192.168.1.0 is 255.255.255.0
In binary it is written as :
In order to create 2 equal subnets out of 192.168.1.0/24, some host bits must be borrowed from the host to the network portion.
The number of subnet bits that have to be borrowed will be given by the formula,
|2<subnet_bits> >= Number of required subnets|
In our case, the Number of subnets = 2
Therefore, using the above formula,
we have, 2n >= 2, where n denotes the number of subnet bits.
or, 21 >= 2
Hence; when n=1, we can create two subnets.
Then, the new subnet mask will be
In decimal, the new subnet mask is written as 255.255.255.128
Now, there are 7 host bits available for each subnet.
Therefore, the numbers of hosts per subnet are given by
2h -2 = 27– 2 = 126, where h= number of host bits
Each block of subnets will have the maximum numbers of IP addresses as 256 – 128 = 128
The IP range for Subnet-0 is 192.168.1.0 to 192.168.1.127
The IP range for Subnet-1 is 192.168.1.128 to 192.168.1.255
|Subnets||Numer of hosts/subnet||Block size/ Total IP address||IP Range||Valid host IP||Network address||Broadcast address|
|Subnet-0||126||128||192.168.1.0 to 192.168.1.127||192.168.1.1 to 192.168.1.126||192.168.1.0||192.168.1.127|
|Subnet-1||126||128||192.168.1.128 to 192.168.1.255||192.168.1.129 to 192.168.1.254||192.168.1.128||192.168.1.255|
Case 2: if we want to create a subnet having 100 numbers of hosts
Earlier, when classful addressing is used, we have default 8 host bits for Class C.
Thus, the total number of valid host IP available using Class C default mask is
|28 – 2 = 254|
Then, the valid IP will be 192.168.1.1 to 192.168.1.254
192.168.1.0 is the network address and 192.168.1.255 is the broadcast address.
Thus, if we use classful addressing, we will have 254 host addresses in hand.
But, our requirement is to create a subnetwork which will have only 100 hosts.
Using a classful address, we are wasting 254-100 = 154 IP addresses that cannot be assigned to any other network.
Here, the concept of subnetting will work to save the wastage of unused IP addresses. This is done by keeping only that much host bits required for 100 hosts and the extra host bits are borrowed by the network. The extra host bits borrowed by the network is known as the subnet bits.
So, the number of host bits required for 100 hosts is given by the formula
|2<host_bits> – 2 >= Number of required hosts|
Therefore, using the above formula,
we have, 2h – 2 >= 100, where h denotes the number of host bits.
or, 27– 2 >= 100
Hence, 7 bits are kept for the host portion, and the rest bits are borrowed by the network.
Then, we will have a new subnet mask,
In decimal notation, it is denoted as 255.255.255.128
Block size of IP addresses is given by —-> 256 – 128 = 128
Therefore, the range of IP addresses for a new subnet will be from 192.168.1.0 to 192.168.1.127
Then, the valid host range is from 192.168.1.1 to 192.168.1.126
Here, IP addresses from 192.168.1.128 to 192.168.1 255 are still free to assign to another subnetwork.
From the above example, we have come to the conclusion that subnetting can be done in two ways.
- Subnetting based on the network where the number of subnets is taken as a priority.
- Subnetting based on the host where the host is taken as a priority.
There are a few things that you must know while creating subnets. For subnetting of any given classful address, the probable questions that arise in our mind are:
- How many network bits required to create each subnet?
- How many host bits available for host IP?
- How many subnets are formed?
- What are the numbers of hosts per subnet?
- What is the modified mask for the new subnets?
- What are the network and the broadcast addresses of the new subnets?
- What is the IP block size of the subnet?
- What is the IP range for the subnets?
- What is the valid host IP range for the subnets?
The solution of these is based on how we approach t to create subnets: whether network-based or host-based. We will solve all these questions in the latter part of the tutorials.
Let us discuss the two types of subnetting in more detail.
Types of subnetting
The subnetting is done by borrowing host bits to the network part. The borrowing of bits is done in two ways.
- Subnetting based on network or FLSM
- Subnetting based on host or VLSM
Subnetting based on the network (FLSM): This type of subnetting is done when fixed numbers of subnets are required to be created from the single large network. As a result, each new subnets created have the same subnet mask. Hence, this technique of subnetting is also known as the Fixed Length Subnet Mask ( FLSM).
FLSM explained with an example
If we want to create 4 subnets out of classful address 192.168.1.0/24 ( here, we are taking Class C address because class C address subnetting is easier to understand. During the subnetting of Class C, only the last octet of the IP address gets affected. We will also explain the concept of subnetting in all three classes of IP addresses separately in the forthcoming section).
To create 4 subnets, we have to borrow the following numbers of host bits to network section;
2n >= 4
or, 22 >=4
Therefore, Network bits required to borrow from the host portion = 2
Thus, the modified subnet mask will be :
In decimal, we can write as:
The block size or the total numbers of IP available for each subnet will be:
256-192 = 64
As we know, the total range of IP available for the given IP address is from 192.168.1.0 to 192.168.1.255
Hence, starting from 192.168.1.0, we can segment the classful address into 4 equal subnets in a group of 64 blocks.
The distribution of IP for FLSM is mentioned in the table below.
|Subnets||Subnets mask||CIDR Notation
||Block size||IP Range||Usable Host Range||Network Address||Broadcast Address|
||64||192.168.1.0 to 192.168.1.63||192.168.1.1 to 192.168.1.62||192.168.1.0||192.168.1.63|
|Subnet-1||255.255.255.192||/26||64||192.168.1.64 to 192.168.1.127||192.168.1.65 to 192.168.1.126||192.168.1.64||126.96.36.199|
|Subnet-2||255.255.255.192||/26||64||192.168.1.128 to 192.168.1.191||192.168.1.129 to 192.168.1.190||188.8.131.52||192.168.1.191|
|Subnet-3||255.255.255.192||/26||64||192.168.1.192 to 192.168.1.255||192.168.1.193 to 192.168.1.254||192.168.1.192||192.168.1.255|
Now, you can see from the table above that 4 subnets are created with an equal distribution of 64 IP blocks. Each subnet can have 64 IP addresses. FLSM is efficient if each subnet has an equal number of hosts i.e. 64 -2 = 62 (deducting network and the broadcast ID from the total IP block). Each subnet will have the same subnet mask 255.255.255.192 or /26 in CIDR notation.
But, there may be a situation where one subnet may have more than 62 hosts and may have less than 62. In such a case, FLSM or subnetting by the network will not be helpful.
There comes the concept of VLSM. VLSM says that we can create a subnet according to the requirements of the host.
Subnetting based on the host (VLSM): This type of subnetting is done when the host is taken as the first requirement. The subnet is created according to the numbers of hosts in a subnetwork. The subnets created will have a different subnet mask for each subnet. Hence, it is called Variable Length Subnet Mask (VLSM). The VLSM has more benefits over the subnetting based on the network or FLSM. It has better control over the wastage of IP than network-based subnetting.
Let us take an example for a better understanding of VLSM.
VLSM explained with an example
Your organization has four different departments viz Accounts, HR, Inventory, and Sales. You want to create separate subnets for each department. However, each department has variable hosts connected to the network such as
Account = 100 hosts
HR = 50 hosts
Inventory = 25 hosts
Sales = 10 hosts
In this case, you have the option to create each subnet with different subnet masks according to the host requirement.
For Accounts, where 100 hosts are connected,
The number of host bits required to create a subnet for 100 hosts is given by;
2h -2 >= 100, where h= number of required host bit to create subnets for 100 hosts
or, 27 >= 100
or, 126 >= 100
Hence, h = 7
Therefore, the new subnet mask for the subnet: Account is:
In decimal, it is written as 255.255.255.128
Thus, the block size for Accounts are 256 – 128 = 128
Hence, the range of IP for Account is from 192.168.1.0 to 192.168.1.127
The network address = 192.168.1.0
Broadcast address = 192.168.1.127
Therefore, the valid host range for Account is from 192.168.1.1 to 192.168.1.126
Next, for the HR department, where 50 hosts are connected,
So, the required number of host bits to connect 50 hosts is given by:
2h -2 >= 50
or, 26 – 2 >= 50
or, 62 >= 50
Hence, h = 6
Therefore, the new subnet mask for the HR is:
In decimal, it is written as 255.255.255.192
Thus, the block size for HR is 256 – 192 = 64
Hence, the range of IP for the HR department is from 192.168.1.128 to 192.168.1.191
The network address = 192.168.1.128
Broadcast address = 192.168.1.191
Therefore, the valid host range for HR is from 192.168.1.128 to 192.168.1.190
Next, for the Inventory department, where 25 hosts are connected,
So, the required number of host bits to connect 25 hosts is given by:
2h -2 >= 25
or, 25 – 2 >= 25
or, 30 >= 25
Hence, h = 5
Therefore, the new subnet mask for the Inventory Department is:
In decimal, it is written as 255.255.255.224
Thus, the block size for Inventory is 256 – 224 = 32
Hence, the range of IP for Inventory is from 192.168.1.192 to 192.168.1.223
The network address = 192.168.1.192
Broadcast address = 192.168.1.223
Therefore, the valid host range for Inventory is from 192.168.1.193 to 192.168.1.222
Finally, for the Sales department, where 10 hosts are connected,
So, the required number of host bits to connect 10 hosts is given by:
2h -2 >= 10
or, 24 – 2 >= 10
or, 14 >= 10
Hence, h =4
Therefore, the new subnet mask for the Sales department is:
In decimal, it is written as 255.255.255.240
Thus, the block size for Sales is 256 – 240 = 16
Hence, the range of IP for Sales is from 192.168.1.224 to 192.168.1.239
The network address = 192.168.1.224
Broadcast address = 192.168.1.239
Therefore, the valid host range for Sales is from 192.168.1.225 to 192.168.1.238
The distribution of IP for VLSM is mentioned in the table below.
|Subnets||Subnet Mask||CIDR Notation||Block Size||IP Range||Usable Host IP Range||Network Address||Broadcast Address|
|Accounts||255.255.255.128||/25||128||192.168.1.0 to 192.168.1.127||192.168.1.1 to 192.168.1.126||192.168.1.0||192.168.1.127|
|HR||255.255.255.192||/26||64||192.168.1.128 to 192.168.1.191||192.168.1.129 to 192.168.1.190||192.168.1.128||184.108.40.206|
|Inventory||255.255.255.224||/27||32||192.168.1.192 to 192.168.1.223||192.168.1.193 to 192.168.1.222||220.127.116.11||192.168.1.223|
|Sales||255.255.255.240||/28||16||192.168.1.224 to 192.168.1.239||192.168.1.225 to 192.168.1.238||192.168.1.224||192.168.1.239|
|TCP and UDP Protocols in Transport Layer||