DNS Anycast at Smarthost

Anycast technology (definition based on Wikipedia) is a type of network transmission in which data is sent to the nearest, i.e. theoretically best, recipient.

Anycast can be used, among other things, to access services distributed across multiple servers. The most common case is the use of Anycast technology for DNS servers. Each client query to a DNS server is directed not to a specific machine, but to a group (cluster) of DNS servers.

Why should DNS-Anycast be used in DNS servers?

Every domain on the Internet should have at least two DNS servers specified to serve it, that is, to ‘translate’ the domain name into the IP address of the server on which the domain is hosted. Most operators recommend specifying up to three DNS servers.

In the specific case of smarthost.eu, these are the servers:

  • dns.smarthost.eu
  • dns2.smarthost.eu
  • dns3.smarthost.eu

A common problem is that these servers are given in this order, with the result that sometimes as many as 80-90% of queries to DNS servers actually go to the first DNS server. The other two handle a small number of queries.

This ‘’unequal‘’ load on DNS servers can result in slightly longer responses, due to the fact that the first DNS server may be heavily loaded.

The DNS server response time affects, as one parameter, the overall server response time, denoted as TTFB (Time To First Byte).

The solution for balancing the load on DNS servers is DNS Anycast technology.

How does DNS Anycast work in practice?

The implementation of DNS Anycast involves the removal of the ‘classic’, i.e. single machine, DNS servers in favour of multiple DNS servers using Anycast technology.

In practice, there are several DNS servers at each of the DNS server addresses that are given for a domain, rather than a single server machine. The servers themselves are usually not directly accessible and their exact number is unknown – they operate as if ‘in the background’ and are hidden behind a single DNS server name.

The DNS server name ‘dns.smarthost.eu’ can therefore be followed by multiple machines serving DNS queries.

The connection is managed by the BGP protocol and the connections themselves are routed randomly to all DNS machines.

Benefits of implementing DNS Anycast

DNS Anycast – reliability

With DNS Anycast, an increase in the reliability of DNS servers is therefore achieved, as instead of a single server, there are multiple nodes that handle DNS queries. When one DNS server fails, its role is taken over by the other nodes, and the failed one is dynamically and imperceptibly taken out of service.

In the classic approach, when, for example, the first DNS server is damaged, DNS queries from the Internet are still directed to the damaged machine before being switched to the backup server. This sometimes results in delays of several tens of seconds. With DNS Anycast, this does not happen.

DNS Anycast – increasing the speed of DNS responses

With DNS Anycast, it is possible to reduce the time element of TTFB, or ‘DNS server waiting time’. The reduction in time is possible because there are multiple DNS servers and they are less loaded than the first DNS server, which is where most of the queries go in the classic DNS server arrangement.

The key element in this case is the random (e.g. according to the round-robin algorithm), i.e. equal loading of multiple servers with DNS queries.

DNS Anycast – simple scalability

With DNS Anycast, you can easily add further machines that are components in the DNS cluster. The address of the DNS servers (e.g. dns.smarthost.pl) does not change, only further servers are added ‘in the backend’ of Anycast.

This is invisible and possible at any time ‘on the fly’, as in practice the client sending the DNS query does not know which server in the cluster it is connecting to, nor how many DNS servers make up the DNS cluster.

DNS Anycast – multi geographical expansion possible

With DNS Anycast, the system can be extended so that DNS servers are physically located in multiple geographical locations, e.g. on different continents. By doing so, the response time of the DNS server can be reduced for clients coming from more distant locations.

However, this requires complex BGP routing mechanisms, related to, among other things, broadcasting the same IP address across multiple ASN autonomous networks in different physical locations.

Good practices in the DNS system

DNS servers are to be available at all times. This is fundamental and self-evident. A number of good practices are therefore emerging that should be followed for the purpose of increasing DNS server availability.

It is good practice to specify 3 DNS servers for a domain instead of the mandatory two. The risk of two servers failing is always greater than that of as many as three servers failing.

Another good practice, on the service provider’s side, is for the DNS servers to be in two different autonomous networks (the so-called ASN, Autonomic System Network), with separate routing and geographical locations. This increases operational reliability already at the network traffic level.

At Smarthost, our DNS servers are physically located in two different autonomous networks (ASNs), and in addition DNS-Anycast support has been introduced allowing us to use a cluster of servers in our main ASN.

Our DNS server cluster managed by Anycast technology works automatically for all hosting accounts.

Albert