In this topic, I will discuss the MAC learning step by step process between switch and workstation. Below is the Network design we are using to explain the MAC learning process.
When both sender and receiver belong to the same network, Workstation doesn’t check its gateway IP address to send traffic and doesn’t need any routing to process a packet.
Below are steps Workation 1 will follow to learn the MAC address of workstation 2.
Step 1: (ARP request from Workation and switch )
- Workstation (192.168.1.10) trying to send its first packet to the workstation on the same subnet 192.168.1.20.
- Workstation first checks its routing table to figure out if the destination IP address in the same subnet as its IP address. As it doesn’t see ant gateway entry to subnet 192.168.1.0/24 in the routing table which means both IP address belongs to the same Subnet.
- Workstation than check its ARP table to check the MAC address of rip address 192.168.1.20. (initially, ARP table is empty).To get information about MAC address Workstation forward packet to Switch.
- When the packet arrived on Switch, switch learned the MAC address of Workstation 1 and populate its ARP table.
- Switch than checked the ARP table for destination Ip address, because it is the first packet ARP table of a switch is also empty.
- Switch than send a broadcast to lear MAC of destination on all ports (on the same VLAN) other than workstation 1 port.
- Only Workstation 2 will take that Packet all the other devices will receive broadcast but discard it as the IP address in broadcast only belongs to Workstation 2.
Step 2 (ARP reply from Workstation 2)
- When Packet received on Workstation 2 it checks the destination IP address on the packet and finds out that it belongs to it. So, it enters its own MAC address in the sender column to send an arp reply and also populate its ARP table with the MAC address inside the Packet.
- Switch on receiving the Packet from workstation 2, populate the ARP table with Worskattion 2 MAC address.
- Switch than send a unicast o Workation 1 with all the information on Fe1.
- Workstation 1 than populates its own ARP table with workstation 2 Mac address.
Step 3 (Worksattion 1 send packet to Worksation 2)
- Workstation 1 than sends a packet to Workstation 2.
- Switch upon receiving the packet from workstation 1 checked its ARP table and find it already has an entry about workstation 2 in its ARP table and send the packet out to Fe 2.