ARP Timeouts. Why fixed periodic?

后端 未结 2 979
耶瑟儿~
耶瑟儿~ 2021-02-04 18:39

This one\'s been bugging me for years.

Basic question: Is there some reason ARP has to be implemented with fixed timeouts on ARP cache entries?

2条回答
  •  孤独总比滥情好
    2021-02-04 19:16

    RFC1122 Requirements for Internet Hosts discusses this.

         2.3.2.1  ARP Cache Validation
    
            An implementation of the Address Resolution Protocol (ARP)
            [LINK:2] MUST provide a mechanism to flush out-of-date cache
            entries.  If this mechanism involves a timeout, it SHOULD be
            possible to configure the timeout value.
    
          ...
    
           DISCUSSION:
                 The ARP specification [LINK:2] suggests but does not
                 require a timeout mechanism to invalidate cache entries
                 when hosts change their Ethernet addresses.  The
                 prevalence of proxy ARP (see Section 2.4 of [INTRO:2])
                 has significantly increased the likelihood that cache
                 entries in hosts will become invalid, and therefore
                 some ARP-cache invalidation mechanism is now required
                 for hosts.  Even in the absence of proxy ARP, a long-
                 period cache timeout is useful in order to
                 automatically correct any bad ARP data that might have
                 been cached.
    

    Networks can be very dynamic; DHCP servers can assign the same IP address to different computers when old lease times expire (making current ARP data invalid), there can be IP conflicts that will never be noticed unless ARP requests are periodically made, etc.

    It also provides a mechanism for checking if a host is still on the network. Imagine you're streaming a video over UDP to some IP address 192.168.0.5. If you cache the MAC address of that machine forever, you'll just keep spamming out UDP packets even if the host goes down. Doing an ARP request every now and then will stop the stream with a destination unreachable error because no one responded with a MAC for that IP.

提交回复
热议问题