6

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?

NetworkNewbie
  • 63
  • 1
  • 1
  • 4
  • 1
    You are missing details (and have some mixed up potentially - are the gateways really in a different network than the hosts?) in your examples, but *PC A* should not ARP for a host not on the local subnet. It should pass the traffic to the gateway, and may then ARP for the gateway if necessary. – YLearn Dec 11 '13 at 21:55
  • Hi YLearn. PC A and PC B are in a different network. – NetworkNewbie Dec 11 '13 at 22:02
  • 1
    " I need to describe the arp packets for this task." this looks like another homework question – John Kennedy Dec 12 '13 at 01:00
  • @NetworkNewbie please be honest: Is this homework? This stack won't help you with homework, sorry. – Craig Constantine Dec 12 '13 at 01:29
  • This is not homework. I study networking by my own, and when I got to the arp protocol I got really confused. – NetworkNewbie Dec 12 '13 at 05:21
  • I think you probably need to get a better handle on IP addressing as well because the IP addresses that you put in your diagram don't make sense and wouldn't work. Also, you don't have any netmasks on your IP addresses, so its impossible to know just how screwed up your IP addressing is. – Jeff McAdams Dec 12 '13 at 15:15
  • @JeffMcAdams Your'e right. I tried to ask something related to the ARP protocol so I could understand it better. I'll do more reading.Can you suggest me a good book or article so I can study networking ? – NetworkNewbie Dec 13 '13 at 22:18

3 Answers3

14

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.

Teun Vink
  • 16,953
  • 6
  • 44
  • 70
  • So, let me get this straight, correct me if I wrong: Let's say that we powered on the network as we speak, the routing / arp tables at all interfaces are empty. PC A wants to send a message to PC B. therefore, it would lookup in its routing table and he sees that the only entry is the router, its default gatway. Then, PC A sends an arp packet which contains its own source IP and MAC and PC B IP address as destination. The ethernet frame which contains this packet adds PC A IP and MAC as source and the MAC address of the router right? but what about the ip destination? – NetworkNewbie Dec 12 '13 at 00:10
  • 3
    No, that's incorrect, read my answer again. There's no point in ARP'ing for nodes not on the same layer 2 network, so if PC A knows PC B is in another network it will send the packet to the router. To do so PC A will ARP for the MAC address for the router and forward the frame there. To answer your last question: The IP destination will be in the payload of the ethernet frame. – Teun Vink Dec 12 '13 at 06:11
1

In simple terms,if PCB sits in different network PCA doesnt bother about PCB's physical address.

When PCA wants to sends data to PCB sitting in different network, PCA needs to know the mac of its gateway. If it doesnt know it will send arp for gateway's physical address.Once ARP is resolved for its gateway address, it will use Destination IP address of PCB and Destination Mac address of gateway's interface.

0

If in different networks then pc A will determine if pc B resides on the same subnet or not by doing a binary AND operation that compares its own address and subnet mask with that of the destination address.
If not within the same subnet then pc A will send the frame to its default gateway which is the router in this case, which will in turn send it onwards to the destination host if it has a determined path to that address.

The router will reply to the arp with the mac address of the gateway. The router will strip off the source mac address and replace it with its own before exiting the egress interface.

MattE
  • 2,087
  • 4
  • 24
  • 34