DNS failover
11 answers
Handing out the address of a node that is actually up.
Looking for something specific
The searchable index covers all 326 answers at once and filters as you type.
262 Set up DNS failover from scratch
- Delegate a piece of your domain, such as
gslb.example.com. Never the whole domain. - DNS Failover, Add a zone. Give one nameserver name per node, such as
ns1.example.comandns2.example.com. You are inventing these now. - Add a name, such as
www, type A, TTL 30. - Add one answer per node. Pick the node and its address fills in.
- Create the records the page prints at your domain host.
- Point the name people actually use at it with a CNAME.
263 Create the delegation records at my domain host
Two kinds and you need both. The page prints them with your addresses already filled in.
| Record | What it does |
|---|---|
| NS | Says who answers for this part of your domain. One per node. |
| A, called glue | Gives the address of each nameserver. Needed because a nameserver named inside the zone it answers for cannot be looked up without it, which is a loop. |
The glue records are the ones people forget, and forgetting them looks exactly like the feature being broken.
264 Set up DNS failover in Amazon Route 53
Open the hosted zone for example.com, which is the parent of the part you are delegating. Create these records there, not in a new hosted zone.
| Name | Type | Value | TTL |
|---|---|---|---|
| gslb | NS | ns1.example.com. and ns2.example.com. | 300 |
| ns1 | A | 203.0.113.10 | 300 |
| ns2 | A | 203.0.113.11 | 300 |
| shop | CNAME | www.gslb.example.com. | 60 |
Do not create a hosted zone in Route 53 for gslb.example.com. Your nodes are the nameservers for it now, and a hosted zone as well gives two different sets of servers claiming the same name.
265 Test that DNS failover works
Ask each node directly, with no port on the end.
dig @203.0.113.10 www.gslb.example.com +short
dig @203.0.113.11 www.gslb.example.com +short
Both should answer and both should list every healthy node. Then ask the internet rather than the nodes, which tests the whole path:
dig shop.example.com +short
266 A name in DNS failover does not resolve
In this order, because the first two are where nearly all of these end.
- Ask the node directly with no port on the end. If that answers, the software is working and the problem is the delegation.
- Check the records at your domain host against the ones printed on the zone. The glue records are the ones people miss.
- Look at the DNS listener panel on each node. It reports what that node is really doing, which is not always what the page shows.
- Remember a name only starts working once the old answer has been forgotten everywhere, which can take longer than the TTL suggests.
267 Why does testing on the high port give the wrong answer?
The part that answers DNS runs without root on purpose, and a program without root cannot bind port 53. So it listens on 5353 instead, on UDP and TCP both, and a firewall rule the software manages sends UDP and TCP port 53 to it.
If you test against 5353 you get an answer whether or not the public path works. Always test with no port on the end, because that is the path your visitors use.
268 Choose a TTL
Thirty seconds is a sensible low number and is what the software suggests. Going much lower mostly buys extra lookups without moving anybody faster, because resolvers and browsers have their own ideas and some ignore very short values entirely.
269 Take one node out of the DNS answer
DNS Failover, edit the name, and turn off the answer for that node. Save. Wait at least twice the TTL before doing anything else, because that is the time for computers elsewhere to forget the old answer.
Skipping that wait is the difference between nobody noticing and a few people getting errors.
270 What should happen when every node is down?
Set If every node is down to hand them out anyway. If the health check itself is what broke, an empty answer takes the site down when it did not have to be.
271 Can I use DNS failover for the apex of my domain?
The name at the very top of a domain cannot be a CNAME, so an apex needs addresses rather than an alias. Either delegate the apex, which moves everything including your mail records onto these nodes, or use your provider's own failover feature for that one name.
272 How fast is DNS failover really?
| What happened | How long |
|---|---|
| Dead node removed from the answer | About 30 seconds |
| Node restored, back in the answer | About 5 seconds |
| A visitor whose computer had already asked | Up to the TTL on top, so about a minute |
Removal is deliberately slower than restoring, so a brief hiccup does not move everybody.