So guys, going forward now, let us discuss one and two and example here.
In this example, we will going to combine the functioning of L2 switch as well as ARP protocol together
so that we understand that how the two concepts work together in order to make L2 routing possible.
So in this example you can see the topology in which I have two L2 switches, right?
And in this topology I have six host machines that is host machine A, B, C and D, e, F.
We will take an example in which the host machine C wants to communicate with the host machine.
D Right.
And this entire subnet is supported by two L2 switches.
You can see that the IP addresses are configured on all the host machines such that all the host machines
are present in the same subnet whose network ID is 12 .1.1.0 slash 24.
So all the host machines derive the same network ID.
In this topology, we will be using two types of table that is ARP table.
So the end host machines will have ARP table.
You can see these three empty boxes drawn against each host machine In this diagram.
This empty box actually represents an empty ARP table.
And since we have two al2 switches in this topology, therefore we have two Mac address table which
are currently empty and these two Mac address tables corresponds to two L2 switches in this topology.
So to start with, we have assumed that all the ARP tables and all the Mac tables in this topology are
empty.
So going forward.
So in our problem statement, we have host Machine C and this host machine C wants to communicate with
the host machine D, and this entire subnet is supported by two L2 switches.
So now let us discuss the steps which makes the communication between the source host machine C and
destination host machine D possible.
So step one C wants to send a data packet to destination host machine D whose IP address is 12 .1.1.2.
Now this IP address is a user input.
Now, the next thing that she does is that it verifies whether the destination IP address, which it
tries to communicate with, is in its own local subnet or is present in a remote subnet.
So in this case, the destination IP address 12 .1.1.2 belongs to the local subnet of host machine C.
Now when we will be discussing the L3, we will cover the scenario when the host machine detects that
the destination IP address with which it is trying to communicate with belongs to the remote subnet.
But for now, let us confine our discussion to a scenario where a destination machine belongs to the
same subnet as source host machine.
So in step three, the host machine C validates that the destination machine belongs to its own local
subnet.
When this happens, then source machine C look up its ARP table with destination IP address.
12 .1.1.2 as key.
Now we have assumed that ARP table of all the host machine in this topology is empty.
Therefore, the source host machine C will not find the IP address to Mac address entry in its ARP table
for destination machine D.
Right.
So as a result, host Machine C launches ARP broadcast request.
So the content of our broadcast request will be that source.
Mac address will be the Mac address of machine see Destination Mac address will be the broadcast address
and it is resolving an ARP for IP address.
12 .1.1.2.
So at this point of time the source machine see has launched our broadcast request Out of all the interfaces
which belongs to the subnet.
12 .1.1.0 slash 24.
In this example, the source host machine see has Interface IFC, which is operating in this subnet.
Therefore it will launch our broadcast request on the interface IFC.
So going forward now to switch one now, let us suppose that this is L2 switch one.
This L2 switch one receives our broadcast request message and therefore the L2 switch makes an entry
in the Mac table.
So l2 switch one will learn that the host machine whose Mac address is MC is sitting behind the port
P8.
In the next step.
Alto Switch also inspects the destination Mac address present in the Ethernet header of this ARP broadcast
request message.
But since the destination Mac address in this broadcast request message is a broadcast address.
Therefore L2 switch simply floods this ARP request message out of all the ports that is Port P5 Port,
P6 and Port P7.
Now you can see that in step seven, the host machine A and host Machine B also receives this broadcast
request message, but they simply discard this message silently.
Why they discard the message silently because their IP address do not match with the IP address for
which this ARP resolution is being happening.
You can see that our resolution is being done for 12 .1.1.2.
Therefore, any machine whose IP address do not matches with the IP address for which ARP resolution
is being happening, then that machine will simply discards the ARP broadcast request message.
So in this case, the host machine A and B simply discards this ARP broadcast request message.
Now in the next step, this ARP broadcast request message is received by L2 switch two.
So when L2 switch two receives this ARP broadcast request message, it will also update its Mac table.
Right.
And like L2 switch one.
It also flirts this broadcast request message out of all local ports.
Now host machine E and F receives this ARP broadcast request message, but they simply discards this
ARP broadcast request message for the same reason which I had explained in case of host machine A and
host machine B.
So as a result, in step number ten, this broadcast request message is received by the host machine
D.
Now the host machine will reply with the reply message why it chooses to reply with the ARP reply message
because it receives the ARP broadcast request message and the IP address for which ARP resolution was
taking place is same as the IP address of the machine d.
Therefore, the host machine d will reply with the ARP reply.
Now the content of the ARP reply message will be the following that is Destination Mac address will
be the Mac address of machine C, The source Mac address will be the Mac address of machine D and the
contents of the ARP reply simply says that Mac address for IP address 12 .1.1.2 is MD right.
So the host machine sends back the reply message.
Now this ARP reply message is received by L2 Switch two.
So remember, whenever L2 switch receives any packet, the first thing it does is to update its Mac
address table by inspecting the Mac header that is contained in the packet.
So this L2 switch will inspect the source Mac address in the ARP reply message and it will make an entry
in its Mac table.
Now in step number 12 L2 switch to also reads the destination Mac address in the packet which is actually
MC so l2 switch to forwards the packet to port P1 because it already has an entry in its Mac table.
So you can see that L2 switch to already has an entry in its Mac table and using this entry l2 switch
to will forward the frame out of port number P1.
So similarly L2 switch one receives this ARP reply packet and it does the Mac learning so it will install
an entry in its Mac table and L2 switch.
One also inspects the destination Mac address in the ethernet header of the frame to forwards the packet,
so l2 switch one ends up in forwarding the packet out of the port number P8.
And finally, the host machine C receives the ARP reply.
So when the host machine C receives the ARP reply, it will update its ARP cache.
So in the ARP cache, the host machine C has made an entry that for IP address.
12 .1.1.2.
The Mac address is MD and outgoing local interface is IFC.
Now let us see that.
Once the host machine C has an ARP resolution for IP address.
12 .1.1.2 with which it is trying to communicate with.
Then what is the packet content that is generated by host machine C?
So going forward now, we have assumed that all the host machines in the topology have populated its
ARP table by issuing the ARP broadcast request messages.
And we have also assumed that the L2 switch one and L2 switch two have populated the required entries
in their Mac table, which is required to make the communication between the host machine C and D possible.
Now, when Host Machine C has its ARP resolution done for destination IP address.
12 .1.1.2.
This is the frame that will be prepared by the host machine c.
Please note that I have specified only the required fields which are required in order to make the communication
between the host machine possible.
All other unnecessary fields I have omitted.
So you can see that this is ethernet header and in this Ethernet header or Mac header, the destination
Mac address is MD, which the host machine C has obtained via ARP resolution and the source Mac address
will be the Mac address of the source machine C that is the Mac address of this interface in the IP
header of the packet.
That is in the second layer of this diagram, The source IP address and destination IP address, as
you can see, will be the IP address of the host machine C and D respectively.
And then you have the transport header or it could be application header and you will have a required
payload on the top of IP header of the packet.
So you can see that when the source machine C issues this packet and places this frame on the wire,
you can see that L2 switch one will inspect the destination Mac address in the frame and it will know
that it has to forward the packet out of interface p six so the packet will be forwarded out of interface
p six.
Similarly, l2 switch two will receive this frame and it will again inspect the destination Mac address
specified in the ethernet header of the frame and it will use this entry to forward the packet out of
local port number P three.
So you can see that simply the packet is forwarded from host machine C to host machine D by L2, switch
one and l2 switch to and no other machine in this subnet ever sees any such frame which is generated
by the source machine C and destined to the destination machine D So you can see that using L2 switches,
the problem of thrashing is completely resolved.
There is absolutely no thrashing at all.
So this was the concept of L2 switch and ARP protocol for you.
So with this we have completed the basics of L2 routing.
We will come back again.
On the topic of L2 routing when we will be discussing the concept of virtual local area networks.
That is VLANs.