1

I am wondering whether it is possible to use IPv4 anycast to have multiple computers in the same IP subnet handle requests from other machines also in the same subnet.

I have two DNS servers on my LAN. Since I have learned that having two DNS servers on different IPs doesn't help redundancy (short reason: hosts will not always switch IPs and will keep using the IP of the offline server) I would like to set up some anycast IPs so that DNS requests will get sent to any DNS server that is up and running.

Looking into anycast, it is primarily used to route traffic to different sites using BGP, or to different destinations within a large site that has multiple routers. In my case there is only a single switch connecting everything and routing within the LAN only goes so far as ARP.

I can't find any information on how one might configure anycast in this situation. Can you simply assign two or more hosts the same IP address and the switch will figure out which port to send the packets to, dropping the port and clearing the ARP entry if the server goes offline? Will the hosts also reissue ARP requests if packets suddenly stop being responded to? Do you have to share a MAC address as well as an IP? Or is it impossible to use anycast with this setup and a routing protocol is required?

  • short reason: hosts will not always switch IPs and will keep using the IP of the offline server If any station do not switches to secondary DNS when primary fails - there are a problems on that station. Hosts must switch DNS server to its secondary if its primary do NOT answer AT ALL. If you have 2 DNS servers you may configure 2 IP scores on your DHCP, where first claims DNS1 as primary and DNS2 as secondary whereas second claims backward. If one of servers fails, you must disable its DNS service / interface or switch it off, and all users will use another DNS server. – Akina Sep 7 '18 at 9:13
  • @Akina: This is how it is meant to work but apparently it is quite well known that most client DNS resolver implementations fail at this (see the link in the question). In my case even if the primary DNS server is switched off many devices do not fall back to the secondary DNS server, and those that do randomly switch back to the primary (offline) server and then have DNS timeout errors. – Malvineous Sep 7 '18 at 9:24
  • Anycast only works with routers in between. In cannot work any other way. – Daniel B Sep 9 at 5:31
0

Is IPv4 anycast DNS within a single LAN possible?

No, anycast does not work this way. Your DNS clients will see that the IP address of the configured DNS server is within the same subnet, ARP for its MAC address, and then attempt to send the packet directly. Being in the same subnet, the switch will simply forward the packet to the server.

Can you simply assign two or more hosts the same IP address and the switch will figure out which port to send the packets to, dropping the port and clearing the ARP entry if the server goes offline?

No, assigning two different systems with the same IP address will cause an IP address conflict. Doing this will cause problems like packet loss and intermittent connectivity. Don't do it.

Will the hosts also reissue ARP requests if packets suddenly stop being responded to?

If the entire server goes down, then yes, the client will begin sending ARP requests. If only the DNS service fails (network still up), then no ARP-ing will occur. DNS requests will simply timeout or fail.

Do you have to share a MAC address as well as an IP?

No, this will also cause network issues.

Or is it impossible to use anycast with this setup and a routing protocol is required?

Protocol required.


tl;dr

Anycast is both complex and not suited for small single deployments. Stick with the two DNS servers you currently have.

  • 1
    Unfortunately the two DNS servers I have aren't working because when one goes offline half the machines on the network stop working. When you say assigning the same IP will cause packet loss, why is this? Assuming each server has its own unique IP, plus a second IP that is the same on both servers, presumably packets to the shared IP would go to one machine or the other, but they would not get lost? This seems to be how anycast works, sending packets randomly to one of the endpoints. Since DNS is stateless and requests fit in single packets, it would seem plausible in this situation. – Malvineous Sep 8 '18 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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