2

After reading about ARP and NAT I'm really confused about putting them to work together.

Let's suppose we have a router A with a public IP of IP(A). Plus, 2 devices behind that router B and C, each with its private IP; IP(B) and IP(C).

what if one device wants to connect to device B from outside the local network?

  • Does it sends ARP request using IP(A)? If so then how the router know if it should answer with the MAC address of B or C?

  • If it sends ARP request using IP(B) which is a private IP then how the pocket gets to the router at all and not to every router in the world.

1
  • 1
    Did you really "read about ARP" - or are you fishing for someone else to do your homework, like all of the other ARP questions this week? How does ARP work / what does ARP do? (both have been answered more than once on NE)
    – Ricky
    Oct 19, 2022 at 22:28

2 Answers 2

1

ARP resolves an IPv4 address to a hardware (MAC) address within a local network (broadcast domain ~ IP subnet).

NAT translates a source or destination IPv4 address to another IPv4 address between networks (with different addressing schemes, esp. public vs. private addresses).

Both have nothing in common, except for dealing with IPv4 addresses at large.

Does it sends ARP request using IP(A)?

No - different networks = no ARP.

ARP for A's IP address is only used by the last-hop gateway inside the network.

2

ARP is a broadcast that does not cross a router. ARP is only used on the local LAN to get the layer-2 address from a layer-3 address. When a host sends a packet, it builds a frame for the packet. If the destination IP address is on the LAN, it addresses the packet with the layer-2 address of the destination. If the destination IP address is on a different network, it addresses the frame with layer-2 address of its configured gateway (router).

NAT is completely different. It is a process that is often run on a router to translate an inside address to an outside address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.