4. Transmission and Reception of Anycast Datagrams
Historically, IP services have been designed to work even if routers are not present (e.g., on LANs without routers). Furthermore, many in the Internet community have historically felt that hosts should not have to participate in routing protocols to operate. (See, for instance, page 7 of STD 3, RFC 1122). To provide an anycasting service that is consistent with these traditions, the handling of anycast addresses varies slightly depending on the type of network on which datagrams with anycast addresses are sent.
On a shared media network, such as an Ethernet and or Token Ring, it must be possible to transmit an anycast datagram to a server also on the same network without consulting a (possibly non-existent) router. There are at least two ways this can be done.
One approach is to ARP for the anycast address. Servers which support the anycast address can reply to the ARP request, and the sending host can transmit to the first server that responds. This approach is reminiscent of the ARP hack (RFC 1027) and like the ARP hack, requires ARP cache timeouts for the anycast addresses be kept small (around 1 minute), so that if an anycast server goes down, hosts will promptly flush the ARP entry and query for other servers supporting the anycast address.
Another approach is for hosts to transmit anycast datagrams on a link-level multicast address. Hosts which serve an anycast address would be expected to listen to the link-level multicast address for
datagrams destined for their anycast address. By multicasting on the local network, there is no need for a router to route the anycast datagrams. One merit of this approach is that if there are multiple servers and one goes down, the others will still receive any requests. Another possible advantage is that, because anycast ARP entries must be quickly timed out, the multicasting approach may be less traffic intensive than the ARP approach because in the ARP approach, transmissions to an anycast address are likely to cause a broadcast ARP, while in the multicast approach, transmissions are only to a select multicast group. An obvious disadvantage is that if there are multiple servers on a network, they will all receive the anycast message, when delivery to only one server was desired.
On point-to-point links, anycast support is simpler. A single copy of the anycast datagram is forwarded along the appropriate link towards the anycast destination.
When a router receives an anycast datagram, the router must decide if it should forward the datagram, and if so, transmits one copy of the datagram to the next hop on the route. Note that while we may hope that a router will always know the correct next hop for an anycast datagram and will not have to multicast anycast datagrams on a local network, there are probably situations in which there are multiple servers on a local network, and to avoid sending to one that has recently crashed, routers may wish to send anycast datagrams on a link-level multicast address. Because hosts may multicast any datagrams, routers should take care not to forward a datagram if they believe that another router will also be forwarding it.
Hosts which wish to receive datagrams for a particular anycast address will have to advertise to routers that they have joined the anycast address. On shared media networks, the best mechanism is probably for a host to periodically multicast information about the anycast addresses it supports (possibly using an enhanced version of IGMP). The multicast messages ensure that any routers on the network hear that the anycast address is supported on the local subnet and can advertise that fact (if appropriate) to neighboring routers. Note that if there are no routers on the subnet, the multicast messages would simply simply ignored. (The multicasting approach is suggested because it seems likely to be simpler and more reliable than developing a registration protocol, in which an anycast server must register itself with each router on its local network).
On point-to-point links, a host can simply advertise its anycast addresses to the router on the other end of the link.
Observe that the advertisement protocols are a form of routing protocol and that it may make sense to simply require anycast servers
to participate (at least partly) in exchanges of regular routing messages.
When a host receives an IP datagram destined for an anycast address it supports, the host should treat the IP datagram just as if it was destined for one of the host's non-anycast IP addresses. If the host does not support the anycast address, it should silently discard the datagram.
Hosts should accept datagrams with an anycast source address, although some transport protocols (see below) may refuse to accept them.