How PING work through Multiple Switches and Routers.
When having PCs all connected to the same switch, then if PC1 want to contact PC2 , the process will be:
PC1: will send a broadcast, My MAC address is MMMMM, My IP address is : 192.168.12.10 and want to reach the Hostname 192.168.12.12 ,
Switch : will register the MAC address and the Port it has received the request on, and send the broadcast on all other Ports out (except from the port it was received). The broadcast will contain and ARP message that has the MAC address of PC1 and it IP address.
all other PCs will receive the Broadcast frame and check if it is destined to them.
Let's say PC2 will read the frame and will see that it is destined to it. it will reply back to the Switch with it is IP address and MAC address.
Switch: will register PC2 MAC address and the port it was received, and will send unicast reply to PC1 with the ARP message content that has MAC address and IP address of PC2
***Please correct me If I was wrong in my guessing above.
**Now I would like to take it to another Level, PC1 and PC 2 are apart away, separated by switches and routers. Then how does the process work to get PC1 able to reach PC2.