ARP: address resolution protocol 地址解析协议,用于实现从 IP 地址到 MAC 地址的映射,即询问目标IP对应的MAC地址。
一般情况下,上层应用程序更多关心IP地址而不关心MAC地址,所以需要通过ARP协议来获知目的主机的MAC地址,完成数据封装。
-ARP table: each IP node (host, router) on LAN has table. <IP address; MAC address; TTL>
-ARP protocol: Same LAN
A wants to send datagram to B(B’s MAC address not in A’s ARP table)
A broadcasts ARP query packet, containing B's IP address (destination MAC address = FF-FF-FF-FF-FF-FF; all nodes on LAN receive ARP query)
B receives ARP packet, replies to A with its (B's) MAC address (frame sent to A’s MACaddress (unicast))
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)
-ARP protocol: routing to another LAN
walkthrough: send datagram from A to B via R
focus on addressing – at IP (datagram) and MAC layer (frame)
assume A knows B’s IP address, assume A knows IP address of first hop router, R (DHCP), assume A knows R’s MAC address (DHCP)
-ARP is “plug-and-play”: nodes create their ARP tables without intervention from net administrator
基于功能来考虑,它的功能最终是获取到MAC信息,服务于链路层,ARP是链路层协议