So welcome back guys. In this lecture video we will going to understand and discuss the IP address mathematics.
So every IP address is associated with a mask value, which is
And a mask value is a value between 0 and 32
So we discussed in the last slide that the IP address size is 32 bits
Right!! and every IP address is associated with the mask value and
the value of this mask value is nothing but it is any value between 0 to
32
for ipv4 addresses just
to let you know that for ipv6 addresses the mask value is
0 to 128 because the size of ipv6 addresses is
128 bits
Right, so every IP address is associated with the mask value, which is the value between 0 and 32
Mask is used to form subnetworks
Right. So when we say that we have a subnet we should know the following three information regarding subnet
That is the network ID of a subnet.,What is the broadcast address of the subnet?
And what is the maximum number of machines which could be present in the subnet?
yeah, that is true that you cannot place as
Many machines as you want in a given subnet, there is maximum limit on the number of machines
Which you can connect to our given subnet
So given a subnet that is the IP address and the mask
We should be able to calculate these three information regarding a subnet
That is the network ID of a subnet, the broadcast address of the subnet and the maximum number of machines
Which can be present in that subnet.
So let us see how we can calculate each of these information for a given subnet
Let us take an example of machine B
So in our topology you can see that we have a machine B
Which has been assigned an IP address 11.1.1.3/24
24 is the mask value
So we will use the Machine B's IP address and mask value to compute these three pieces of information
for a given subnet
So I'm showing you here the results
the network ID of this entire subnet is
11.1.1.0/24
this is the network ID and thus broadcast address of the subnet is
11.1.1.255 and
the maximum number of machines that can be present in that subnet is
254
Why 254? we will discuss that
Why we have applied this formula to get the maximum number of machines
Which can be connected or can be placed in this subnet?
So let us discuss how each of these pieces of information is
Calculated from an IP address and a mask value
Assigned to one of the machines present in the subnet. in this example
We are taking the Machine B as a test machine
So the user input to
Calculate all these pieces of information is the IP address and the mask value of one of the machines present in the subnet
In our example, we have taken the IP address and the mask value that is assigned to a machine B
So let us see how to calculate the subnet ID from IP address and mask value of machine B
Right
So in order to calculate a subnet ID follow the following steps
so represent the IP address in binary format
So, this is 11.1.1.3
so this is the
binary representation of IP address 11.1.1.3
Now next is to create a binary number B
From mask such that first 24 bits are all ones and the remaining bits are 0
So remember the mask value that is assigned to the Machine B is 24
So prepare a binary number such that first 24
Bits are ones and the next 8 bits are 0
Remember the length of the mask value is 32 bits
So in step two we have obtained a number in which first 24 bits are all ones and
The next 8 bits are all 0
So to obtain the subnet ID
You just need to perform the logical and operation of the binary number, which you have calculated in step 2
With the IP address, which you have calculated in step one
so if we perform the binary and operation
between the results of
Between the results obtained from step one and step two
The final result that you obtain is the following binary
representation of
IP address. so this IP address is
11.1.1.0 and this is what is the subnet ID
So this is fairly very simple. follow the step 1 2 & 3 to calculate the subnet ID
Now you can convert the result that you have obtained in step 3 into the decimal format and
After converting this binary number into decimal format
You get 11.1.1.0/24, which is actually the network ID
Right, so this is fairly simple