1

in this post Learn MAC addresses via replies to other hosts requests
I see that if host A sends an ARP query about host B, host C that resides in the same LAN will not learn host B MAC address, but will it learn host A MAC address when A sends the broadcast query?
will the answer be different if C is not a host, but a switch? or the gateway router?
I know that B's answer will be unicast, but does a switch that is in the way from A to B will learn B's MAC when B answers? Does the gateway router learn the mac address?
Thanks a lot!

1 Answer 1

1

First, understand that your gateway/router is just another host on your LAN, and it learns MAC addresses the same way as the other hosts. It just happens to be the host that knows how to reach other LANs, and the other hosts will be configured to send traffic for other LANs to it. Hosts, including your gateway/router, maintain an ARP table that associates MAC addresses to IP addresses. Since just about every host will send traffic to your gateway/router, it will learn the MAC addresses of the other hosts in that way.

Next, switches do not care about ARP, or anything to do with IP addressing. A switch will build a MAC address table from the frames entering the switch, which associates MAC addresses and switch interfaces (not IP addresses). This allows the switch to deliver frames destined to a MAC address to a particular switch interface, instead of sending them to all the switch interfaces, but the switch doesn't know or care about the IP address. Switches can deliver frames to hosts, regardless of the layer-3 packets (IPv4, IPX, IPv6, AppleTalk, etc.) carried in the layer-2 frames.

Hosts will learn the MAC addresses of other hosts from ARP requests, which are broadcast (sent to all the switch interfaces), but since ARP replies are unicast (sent only to a single switch interface), the other hosts will not see the ARP replies to learn from the reply.

RFC 826, An Ethernet Address Resolution Protocol -- or -- Converting Network Protocol Addresses has the basics of how ARP works, but the host OSes (off-topic here) can have some variations in implementation.

6
  • Thanks for the comprehensive answer, but from what i understand from your answer, C will learn As MAC address from the broadcast, while in the post I linked in my question the question specified "While this third host C receives and ignores host As ARP request"
    – DsCpp
    Commented Feb 16, 2018 at 15:17
  • C, and the other hosts, will learn the MAC address of a requesting host from a broadcast ARP request, but C, and the other hosts, will never see the ARP reply.
    – Ron Maupin
    Commented Feb 16, 2018 at 15:22
  • @RonMaupin actually if C is RFC 826 compliant it will not. Hosts are not supposed to cache MAC address from ARP request not targeted to them. I would not be surprised if an OS is not compliant on this point tough.
    – JFL
    Commented Feb 16, 2018 at 15:29
  • @JFL, if you look at what actually happens in most modern OSes, C will learn the IP and MAC addresses of the requesting host from a broadcast of an ARP request. C will not respond with an ARP reply, but it will actually update its ARP table with the information from the request source. This is to reduce the number of ARP requests that C, itself, would need to make. Notice the logic in Packet Reception. It updates its table before considering if it is the target.
    – Ron Maupin
    Commented Feb 16, 2018 at 15:36
  • So if I understand correctly, the RFC 826 specifies that other hosts should not learn from the ARP broadcast, but the OS will probably cache update the table anyway?
    – DsCpp
    Commented Feb 16, 2018 at 15:43

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.