Switch – Understanding ARP and Routers

arprouterswitch

Let's say there are two PCs, PC A and PC B.
PC A wants to communicate with PC B, such as sending a message.
I need to describe the arp packets for this task.

Known details:

PC A -> SW 1 -> Router -> SW 2 -> PC B

Host A and host B are in a different network

PC A : MAC Address a.a.a.a
IP Address 1.1.1.1
Default gateway 4.4.4.4

PC B : MAC Address b.b.b.b
IP Address 2.2.2.2
Default gateway 5.5.5.5

So, I wonder how the router would react to the arp packet.
If PC A wants to send a message to PC B, it will first send an arp packet with its own MAC and IP addresses as source and PC B's IP address and zero value for the MAC address as destination.The ethernet packet would contain PC A's MAC and IP as source but then I don't know wheter the destination ip would be A's default gateway or it will be a broadcast like the MAC address?
I believe that default configuration routers has the proxy arp disable.
What would actually happen?

Best Answer

Your reasoning is the wrong way. TCP/IP handles the layers top down, not bottom up.

PC A will first do a lookup in the routing table and decide that the only way to reach PC B is via the router specified in that routing table.

If the MAC address of the router is unknown it will send an ARP request to figure out which MAC address corresponds to the gateway IP.

Then the frame (containing the IP packet) will be sent to the MAC address of the router which will do a lookup in its routing table to see on which interface PC B is connected or via which next hop it should be routed. Assuming PC B is connected to another interface of the router the router will do a lookup (and if needed an ARP request) to figure out the MAC address of PC B and then forward the frame.