2

Scope of the question

This question is solely about getting a client requesting a domain: example.com to one of the two available servers. How it is handled from there on, is another problem to solve and should therefore not be mentioned in an answer.

Available tools

My available tools are two dedicated servers (server A and server B) distributed in two different data centers (data center A and data center B) located in another physical location. The purely fictional IP address of server A is represented as a.a.a.a and the IP address of server B is represented as b.b.b.b. Both servers come with a Linux distribution which does not really matter.

Since I want to take things in my own control, I do not wish to use any 3rd party services (managed DNS, CDN etc). Thus these are my only tools.

The Goal

The disaster I am counting on is a hydrogen bomb annihilating one of the two data centers used a week after I setup things correctly on both servers. I want my domain example.com to be available at all times, although I wouldn't bother for a few seconds or perhaps even a few minutes downtime since the servers are so reliable that they might not even crash more than once a year. Also a simple page displaying that "we are busy solving the problem" could extend this acceptable downtime to an hour or so.

My fixed solution

It has been a while since I asked this question, and now I have a reasonable redundant setup. Since it is closed, I cannot post this as an answer :(

Both servers turn out to have equal DNS records for the example.com domain:

# DNS records for both server A and server B
example.com. NS ns1a.example.com.
example.com. NS ns1b.example.com.
example.com. NS ns2a.example.com.
example.com. NS ns2b.example.com.
ns1a.example.com. A a.a.a.a
ns2a.example.com. A a.a.a.a
ns1b.example.com. A b.b.b.b
ns2b.example.com. A b.b.b.b
www.example.com. CNAME example.com.
example.com. A a.a.a.a
example.com. A b.b.b.b

Both servers got scripts running checking eachother for availability every minute. Both servers are name-servers of the example.com domain, so they can both change the DNS records. In case of trouble, the server which is still online will detect this, and remove the other server from the DNS records. Next to this, while the other server is still in the DNS records, browsers will automatically fallback to the other server within 2 seconds (tested with Mozilla Firefox)! Which is a really useful feature.

Because server A had 'authority' over example.com I did not know how to add server B as being able to control the DNS. Turns out that you can just add records for any domain, but they are only respected if the one who registered the domain first with DNS records adds this server as a nameserver with 'NS' in the DNS records.

I hope this will be of some use to somebody with a similar problem.

2
  • 1
    If you want redundancy, there's 3rd party companies (like a certain multi-billion dollar one...) that do this.
    – Nathan C
    Oct 3, 2013 at 12:20
  • In 2017 DNS round robin failover is imho the best way to provide high availability and redundancy given the context of this question (that is, if you only use VPS's). All modern browsers have a short A-record timeout. That is, if it is not responding, it will just try another (after ~2s).
    – Yeti
    Oct 29, 2017 at 15:17

1 Answer 1

1

Impossible. Simply like that. DNS is not made for that.

You can fake it if:

  • You keep your DNS TTL to a ridiculously low amount, basically invalidating all caching as per RFC - not "legal" for most domains which "require" minimum TTL
  • Use a script on the backup servre tocheck if primary is off (ping dies etc.) and then change automatically the DNS entries in the domain.

DNS per se has no HA mechanisms - it distributes answes in round robin, and they are cached, so normally it takes TIME to fall over.

HA is handled by having BOTH servers using the SAME IP - for which you require a LOT more than one IP Address (There are technical limitations) then using routing protocols to have this IP fall over to the other data center.

1: No

2: You tell me. Logically the IP address space from Data Center B becomes unreachable. THat is all - nothing else happens for DNS, people still go there to connect to the server.

3: YOu tell me. Logically the IP address space from Data Center A becomes unreachable. THat is all - nothing else happens for DNS, people still go there to connect to the server.

4: How? By sending half the people to A and half the people to B - REGARDLESS (!) whether A and B are online? DNS has ZERO provisions for High availability.

5: No, your registrar does nothing. YOU go to your registrar and point a name to an IP address. One "knows" that the correct entry is there by you checking whether you were smart enough to make the entry into the database correctly. Your registrar likely does not care. Now, OWNERSHIP - that is a legal matter. Your registrar has sold you the domain, informed the root registry for the domain about it. They give you a username and password. Who "owns" your password to this site?

I suggest you read a book how DNS works. Andd forget to solve availability problems with DNS - DNS is not designed for high availability. Oh, vote to close - beginner questions are not welcome here as per FAQ. Not a good decision in this case, but the rules stand.

4
  • I thought that when a primary NS is unreachable, that then the secondary NS is used instead and that one points to itself thus resulting in you ending up at the secondary NS server. If this is not the case, then why is it needed to have a primary and secondary NS at all? Also, I ain't really looking for High Availability in the sense that one needs to be redirected within the second. In the goal I state that a few minutes downtime is acceptable.
    – Yeti
    Oct 3, 2013 at 11:28
  • This is DNS (!) redundance, not helping with server. DNS has redundancy internally - but clients still will go to the failing server. And caching noramlly is for HOURS, not a few minutes.
    – TomTom
    Oct 3, 2013 at 11:31
  • Right now I think I'll go with the 'faking', the likelihood of a disaster through which the server is not back up in an hour is just too small for the trouble. However, if I would be prepared to use a 3rd party tool or something, what kind of approach would you advise given the situation? (my situation -> I already have a live backup of server A located on server B using database replication etc.)
    – Yeti
    Oct 3, 2013 at 11:59
  • Simple. Live with the fact that you can not do what you want. Contract a hoster that can - one that offers high availability.
    – TomTom
    Oct 3, 2013 at 12:01

Not the answer you're looking for? Browse other questions tagged .