So guys having understood the basics of loopback IP address
Next we will try to learn that how does
l3 routing
happens when destination IP address and the IP header of the packet is actually the
loopback IP address of the destination machine
till now we have
seen the examples of l3 routing where
destination IP address in the packet actually belongs to the IP address of one of the local interface of a
destination machine
So how routing happens when destination IP address in the packet is actually the loopback IP address of the destination
Machine, is there any difference?
Let us see how routing happens in this case
So let us do a little recap here
let us suppose the destination IP address that is specified in the packet is
192.168.1.3
That is the packet is destined for the host machine C placed somewhere in the network
so let's say that l3 router A
Receives a packet with the destination IP address is equal to 10.168.1.3
Right. So router A will forward the packet as usual using l3 routing. the packet goes in the
internet and
Internet is nothing but it is a
complex topology of
hundreds of l3 routers
So let us say that all those l3 routers present in the internet
routes the packet and let us suppose that the packet eventually reaches the
l3 router B via l3 routing
Right now what will happen once the packet reaches the l3 router B
So let us apply the concepts of l2 routing and l3 routing we have done so far
so router B will inspect the destination IP address in the packet and it will see whether
The destination IP address that is specified in the packet belongs to one of its local subnet or not
Now you can see that router B has
Six local subnets, right? So this is one local subnet
this is another local subnet and you can say that router B has six local interfaces and
therefore router B has six local subnets
It so happens that the destination IP address that is specified in the packet falls in the subnet
10.168.1.
0/24
Right. So now router B knows that the packet is
Destined to a machine which is present in its local subnet on interface Ethernet 1
So from here onwards router B will use l2 routing
In order to deliver the packet to the destination machine C
so when the packet leaves the router B the
Source MAC address destination MAC address source IP and destination IP address in the packet is somewhat look like this
That is the source MAC address in the packet will be equal to the MAC address of Ethernet 1 interface of the router B. And
The destination MAC address will be the MAC address of the host machine C which is the destination of the packet
Source IP address here is irrelevant. You can assume there is
you can assume any value of the source IP address and it will remain unchanged throughout the packet journey and
Similarly the destination IP address of the packet as we have assumed will be 10.168.1.3
Right so destination IP address falls in the local subnet of router B
Right. And what is that local subnet that local subnet is this one let's call this local subnet as subnet A which is
10.168.1.0/24
right
So you can apply the IP address
mathematics and you can see that destination IP address is specified in the packet falls in the local subnet A of
Router B and therefore router B propagates the packet to the destination C via L2 routing
So we have just done the recap here
Because what we will going to discuss next
Actually relates very closely to what we have discussed in this slide
So let's take the another scenario. Now, let us say that destination IP address and
the packet is 122.1.1.1 and
This IP address is actually the loopback IP address of the destination machine C
Right
so let us say
So let us suppose that the router A receives a packet from elsewhere in the network with the destination IP address
122.1.1.1
So using usual l3 routing
assume that the packet will reach eventually to the l3 router B
Right
Now again apply the concepts of l2 routing and l3 routing
So l3 router B when receives a packet with the destination IP address 122.1.1.1
it will inspect the destination IP address of the packet and see whether
the destination IP address of the packet belongs or falls in any of its local subnet
now in this case the answer is no the
The destination IP address 122.1.1.1 do not belong any
Do not belong to any of the local subnet of router B
It means that the router B knows that the packet belongs to some remote subnet
Right and therefore router B decides to use
L3 routing in order to forward the packet to the next hop machine
Now given here is the l3 routing table for the router B
And it will look up the routing table entry in its routing table using destination IP address
and
The packet as a key and you can see that this entry in the routing table will match
So l3 router decides to forward the packet
towards the next hop IP address 10.168.
1.3
That is this IP address and outgoing interface is Ethernet 1
so destination IP address in the packet falls in the subnet 122.1.1.
1/32
Which is actually a remote subnet with respect to router B. right?
And therefore router B propagates the packet further to the destination node C via
l3 routing so you can see that l3 router B further propagates the packet to the destination machine C using
l3 routing only and
The packet content when the packet traverses from router B to destination machine C looks something like this
That is source MAC address will be equal to the MAC address of
Ethernet 1 interface of router B and
destination MAC address will be the MAC address of
Destination machine C
Source IP address could be anything. It is irrelevant here that what is the source IP address of the packet and
destination IP address in the packet is
122.1.1.1
So the point here to note here is that that instead of l2 routing
instead of L2 routing like in the previous example
here l3 routing is being used in order to propagate the packet from l3 router B to the
destination machine C
Despite the fact that destination machine C and
l3 router B shares a local subnet
10.168.1.
0/24
So when does the router decides whether it has to propagate the packet further using l2 routing or
l3 routing is the concept that we should understand here. in
the previous example the destination IP address
specified in the packet actually falls in the local subnet of l3 router B and therefore
Router B decides to propagate the packet further using l2 routing
But in this example, the destination IP address is specified in the packet
do not fall in any local subnet of router B
and therefore router B concludes that the packet belongs to some remote subnet in the topology
And therefore L3 router B stick to l3 routing in order to further propagate the packet
So you can see if
So the end result is that if destination IP address is the loopback address of destination machine
That is if the destination IP address that is specified in the packet is actually the loopback address of destination machine
Packet never undergoes l2 routing
You can see that the packet is delivered from the source machine A
To B using l3 routing and then from machine B to C It is delivered using l3 routing
So I have not discussed anything new here just stick to the
definitions that we have discussed and when we discussed l2 routing and l3 routing and
you
Really will not have any doubts or questions regarding this
So I am discussing one more routing example here in order to make the point clear
so in this diagram
You can see that machine D machine E and machine F
all the three machines are present in the same local subnet and what is that subnet the subnet is
12.1.1.0/24 that is this subnet
Right including the l3 router which is also
Which also shares the same subnet on interface IFR
Now
Machine D, E and F can communicate with each other using destination IP address as
12.1.1.X
using pure l2 routing only
Right. So we have already discussed this concept that all the machines which are present in the same local subnet can communicate with each other
using
l2 routing
Right. So machine D. Let us see the example here that machine D can actually send a packet to the machine E
using destination IP address as
12.1.1.3. If the machine D chooses the destination IP address as 12.1.1.3
then it is a case where source machine and destination machine both are present in the same local subnet and
Therefore using pure l2 routing only machine D can deliver a packet to the machine E
but now let us
Change the scenario a little bit
So let us try to understand that can machine D
Send a packet to machine E using destination IP address as 122.
1.1.1
where this IP address is actually the loopback IP address of the machine E
So, let's see how
So when machine D tries to send a packet to the destination IP address 122.
1.1.1 machine D would know that
This destination IP address do not fall in any of its local subnet
machine D only has one local subnet and that is
12.1.1.0/24 and clearly the destination IP address
To which the machine D is trying to send a packet is clearly do not falls in this subnet
Therefore machine D decides that it is not a case of l2 routing but it is a case of l3 routing
Therefore D is trying to send a packet to a remote sublet
Hence D can send a packet to E using destination IP address as 122.1.1.1
using only l3 routing and for that
D should have the following l3 routing entry in its routing table that is in order to reach this remote subnet
The next hope IP address is 12.1.1.3 and the local outgoing interface is IFD
So the final conclusion is that if destination address of the packet is actually the loopback address of a destination machine
Packet never undergoes l2 routing even if the communicating machines are physically present in the same subnet
So you can see in this example that machine D and machine E are actually present in the same physical subnet and
that same physical subnet is 12.1.1.0/24, but even then if
machine D wants to send a packet to the machine E
using destination IP address as loopback address of the machine E then machine D has to use the l3 routing and
The simple reason for this is that that loopback addresses are actually the subnet with one machine in it
So this was all about routing using loopback IP addresses