so welcome back guys let's start with the module three subnetting and IP
address maths so let us go through the table of contents of this module. In
this module we will be discussing subnetting in detail that is how subnets
are formed and what is the type of configuration that you need to do to
form a subnet we will study in detail the MAC addresses and IP addresses we
will discuss IP subnets that is the type of subnets local subnet and remote
subnets then every subnet has a network ID we will discuss how to calculate the
network ID and then we will discuss the IP airthmatic that is the type of
operations that we apply on IP addresses and then we will discuss the
point-to-point links and what is so special about point-to-point links and
then we will discuss the broadcast addresses and how to use the broadcast
addresses so in this module we will take a deep dive in l-2 and l-3 routing. L3
routing means the routing that is done by the layer 3 of the tcp/ip stack that
is the network layer l2 routing means the routing that is done by the layer 2
of the tcp/ip stack that is the data link layer so if you are appearing for
the networking interview 100% are the chances that you will be asked to
explain the routing so it is not possible that you appear for an
interview at networking MNC like cisco juniper etc the first question
that you will be asked will be to explain the l2 and l3 routing right so
if you are willing to build your carrier in the field of networking you must be
absolutely thorough with networking concepts and especially l2 and l3
routing concepts so you must be thorough with l2 and l3 routing
concept if you have any doubt please revise revise and revise it again l-2
and l-3 routing are not lengthy topic but they are deep enough and it is the
heart of networking so entire networking just revolves around routing any other
peripheral concept that you study in networking is directly or indirectly
related to routing there are hundreds of tutorials YouTube videos all over the
internet on this topic yet I find students find it very confusing so we
will pick you from the absolute ground zero level and build up your routing
concepts incrementally we will do demonstration of actually routing a
packet on the network topology observe all relevant routing table entries so
let's begin with this module so dividing a network into two or more a smaller
network is called subnetting right so the example the similar example that you
can realize in real world is like dividing a country into smaller islands
for example Mauritius Islands is a group of islands or dividing a high school
students into groups or separate batches right so both of these examples are
analogous to subnetting in subnetting also if we have a computer network which
contains extremely large number of networks that become unmanageable over a
period of time then subnetting is one way to mitigate the management problem
of large networks a subnet is a layer 2 network so remember a subnet is a layer
2 network that is data link layer takes care of data transfer from one machine
to another machine in the same subnet so if the source machine and the
destination machine are present in the same subnet
only l2 routing that is Layer 2 of the tcp/ip stack that is data link layer is
responsible to take the packet from source machine to destination machine in
the same subnet so as long as communicating machines are
present in the same subnet only datalink layer is responsible for data delivery
the l3 layer that is the network layer is out of question so if communicating
machines are present in different subnet right in this case the network layer is
responsible to take the data from one subnet that is the source subnet to
another subnet that is the destination subnet now the point that you should
note here is that network layer is responsible to take the packet from
source subnet this is source subnet I am NOT saying source machine I am saying
from source subnet that is the subnet in which where source machine is present to
destination subnet now I am NOT saying destination machine but destination
subnet that is the subnet in which destination machine is present so
network layer is responsible to take the packet from source subnet to destination
subnet and not from source machine to destination machine so this is a very
sharp point about the network layer functionality to be noted here so if the
communicating machines are present in the same subnet only data link layer is
responsible for data delivery from the source machine to the destination
machine and if the communicating machines are present in different
subnets the network layer is responsible to take the packet from source subnet to
destination subnet and once the packet reaches the destination subnet then
again data link layer is responsible to finally deliver the packet to the
correct destination machine
so once again you can see in this example that that suppose the router VM
wants to send data to the machine which has IP address 192.168.1.1 or to the
machine which has IP address 192.168.1.2. Now you can see
that both these IP addresses are present in the subnet 192.168.1.0/24. let's
call this subnet as A. Right ? Now this subnet A is a remote subnet with respect
to the virtual machine VM right so if VM wants to send data to either of these IP
addresses it means the communicating machines are
present in different subnets. Right ? Machine VM1 is said to be present in
subnet A with respect to the IP address 192.168.1.1 and machine vm 2 is
definitely present in subnet A so this is the case when the virtual machine VM
that is the router VM is trying to send the data to IP address which
belong to the subnet A , and subnet A is a remote subnet with respect to the router
VM so in this case L3 routing will be used. But consider a case when the router
VM wants to send a data to another machine which has an IP address
192.168.4.1. right now the IP address 192.168.4.1 is present in a subnet
192.168.4.0/24. let's call this subnet as B now this subnet is a local
subnet with respect to the sending machine that is router VM so the subnet
B is a local subnet of the router VM and VM is trying to ping an IP address
which lies in the same local subnet B. so in this case l2 routing will be
used for data delivery from router VM to router VM1. so I hope you understand
the concept or the logic here it it all depends whether the IP address that is
whether the destination IP address belong to the local subnet or remote
subnet with respect to a sending machine so going forward
machines do not have IP addresses so who have IP addresses only interfaces have
IP addresses machines do not have MAC addresses only interfaces have MAC
addresses so it is technically wrong when we say that certain machine X
has IP address blah blah blah machines do not have IP addresses it is
the interfaces of the machines which has IP addresses and same is true for MAC
addresses right so we always send data destined to a particular interface of a
remote machine. We do not send data to a subnet. so this example is similar to
like you are writing a letter to your friend so you will specify the exact
address of the house of your friend you will not specify the town in which where
your friend lives so same thing applies here whenever the source machine wants
to send a data to some remote machine the source machine has to specify the IP
address of one of the interface of a remote machine to which it is trying to
send the data right we do not send data to a subnet it is meaningless so you can
see that this is the IP protocol header or you can say in short it is a IP
header the things to note in this header is that see the source address
this source address is a 32-bit field and you can specify the IP address here
but without any mask value right and similarly this is the destination
address field which is again 32-bit field and you can specify the
destination address in this field but without any mask value right and in IP
header the source address and destination address are specified in the
form of integer equivalent, integer equivalent. what is integer equivalent ?
any IP address can be converted into its equivalent integer value which is a
32-bit value it is this integer value that we specify as a source address and
destination address in the IP header we will discuss later how this conversion
is done