So guys let us see ARP in action
So remember ARP operates between machines connected to the same subnet that is your machine should be present in the same subnet
So our protocol is meaningful and it operates only between the machines that is connected to the same subnet. So in this topology
ARP will operate between machines VM and VM1 because they have one interface each in the same subnet
So you can see in the topology
the eth2 to interface of VM and eth2 interface of VM1 are
Assigned an IP address such that
Such that the two interfaces
Falls in the same subnet and what is the subnet ? The subnet is 192.168.4.0
Similarly the ARP will also operate between machines VM1 and VM2 - because
They have one interface each in the same subnet
so same applies for machines VM1 and VM2. So ARP will operate in subnets - say A and ARP will operate in subnet, say, B.
ARP will not operate between machines VM and VM2
So you can see
Because they don't have any interfaces operating in the same subnet and that is the reason that our broadcast request
generated by VM will never reach to VM2 - and any ARP reply
Message generated by VM2 will never reach a VM because they are in different subnets
in fact the machine VM1 will act as an L3
router between subnet A and subnet B
So VM1 is a boundary between
Subnet A and subnet B. So ARP do not operate between machines present in different subnets so you can see machine
VM and VM2 are present in different subnets in this example.
As a demonstration you should start all the three VMs
That is VM, VM1 and VM2. And see the ARP table in all these machines using arp - n command
So I will show you the output of arp - n command on the machine VM
So I am on machine VM and the output of arp - n command is this
So do you see any entry for neighbor
For neighbor 192.168.4.1 in the arp cache or in the arp table there is no entry
Right, so there is no entry for
192.168.4.1 in the ARP table
Right, you can also check the ARP table entry for VM1
And you don't see any entry for the neighbor 192.168.4.2
which is a nbr of VM1. So you can see that none of the VMs -
that is VM Or VM1 installs the ARP table entry for its nbr.
Why I am saying neighbor because we have a point-to-point link between VMs
This point-to-point link that is the ends of point-to-point link or always in the same subnet
So here we are talking about two machines present in the same subnet and we are checking the ARP entry for the other machine (nbr)
Now
So initially, you will not see ARP entry for direct nbr machine. For example arp - n command on VM
We will not show you any
ip-mac mapping entry for IP address 192 168.4.1
the other machine in the same subnet as VM, so this I have already shown you now from the machine VM
ping 192.168.41 that is you are pinging a direct connected neighbor. After pinging
check arp - n on vm and vm1
You will see IP mac mappings on both the machines
So let's check
I'm on machine vm and I am pinging a neighbor. What is the neighbor of vm? 192 168
4.1
so
192.168.4. 1. I am able to ping
If you are not receiving this reply, it means there is some issue with your connectivity
Or with your configuration of VirtualBox
now after pinging, I'm checking the ARP entry on VM and
I can see the new entry has now popped up here, which is
192.168.4.1 it says that - for the neighbour
IP address
So if you run arp -n command again on a machine VM
you can see the last entry in ARP table which is a new entry now and
that entry says that for a machine present to the same subnet with IP address 192.168.4.1
The MAC address of the machine is this
and
That machine is reachable
via outgoing interface
ethernet 2.
So this is the meaning of ARP entry
so you can see I have displayed the
ARP table on machine VM and it says that the IP address 192.168.4.1
Is a machine present on the same subnet and it has the hardware or the mac-address the following -
And
This machine is reachable via outgoing interface eth2
So remember this eth2 is a outgoing interface or local interface
You can again check the same arp entry on the machine VM1
And
You can see that the new entry has been added to the arp table and this entry has the same meaning or the same semantics
As the entry we have just discussed on machine VM
So you can see that both our neighbors have learned
the IP address to MAC address mapping entry and
Has made the entry
entered into their respective arp tables
Right
So let us cover the steps that what has actually happened when you ping
192.168.4.1 from the machine VM. So what actually has happened
So ping command on VM asked VM to send hello that hello is actually called ICMP message
Now this is out of the context here, but just assume that ping command
Ask the machine to send hello - message to the destination IP address, which we are pinging
So for that VM need to know source MAC address, destination mac address, source ip address and destination ip address.
Any machine which wants to communicate with any other machine it wants these four parameters
for setting up the communication
Among these only destination MAC is not known to VM
So what will be VM do?
VM launches ARP broadcast request out on an interface
Which is in the same subnet as destination
Because it might be possible that on machine VM there could be other interfaces.
So it will launch ARP broadcast request out of which interface ?
So this is the criteria that it will launch our broadcast request out of an interface
on which the IP address
Configured is such that it lies in the same subnet as the destination you are pinging
Vm1 sees our broadcast request and it populates its ARP table using source IP and source mac address specified
in the ARP request message
VM1 replies with ARP reply message. VM on receiving ARP reply msg populates
Its ARP table with source mac and src ip specified in the ARP reply message
VM can now send a packet to VM 1
So you can see after step 5 both VM and VM1 has populated their respective ARP table
so remember ARP table is always populated using source IP and
Source MAC address specified in ARP broadcast request for ARP reply message
Right, so this is what happens behind the scene when you ping a
Machine which is present in the same subnet
This is how ARP protocol operates. ARP protocol helps
The Machine present in the same subnet to populate their ARP table before they actually carry out their communication
Because for the communication to happen between machines
Present anywhere inside the world that is within the same subnet on outside the subnet you need these four entities
Unless you know these four entities communication cannot happen
So this is how ARP protocol operates that is the ARP protocol in action. On
your Linux VM virtual machine you can use the command arp -n
to display the ARP cache
So this is all about ARP protocol guys next we will learn about L2 switch.