How do I point one domain name to two IPs? For example, I'd like to have the setup:

app.example.com IN A
app.example.com IN A

The hostname should resolve to whichever IP is up.

  • Your question is too vague. Pointing is only part of the problem. Do you want load-balancing between the two and in what shape (50%-50%? depending on servers capabilities? current load?)? Do you want "geo-located" responses so that askers get the IP "closer" to them? Do you want automated fail-over from one IP to the other if a problem arises? How do you define an IP is up? Who checks for that? When and how often? All of these problems can not be solved just at the DNS layer, so you need to specify more your needs and constraints. – Patrick Mevzek May 3 '18 at 22:52
  • Also, you are forgetting about IPv6, which is sad and/or bad. – Patrick Mevzek May 3 '18 at 22:53

Its called round robin DNS - you just set them both as A type records, and it should connect to either one.

  • Does it support failover as the OP specifies he needs it to connect to whichever server is up? Does he need some kind of load balancer and/or other network hardware or software? – Greg B Apr 30 '11 at 17:13
  • Well, if you have a load balancer, you'd be pointing your IP address at that. Considering this was a question on SU (as opposed to SF or here), that was the level of complexity i deemed appropriate for the answer ;) – Journeyman Geek May 1 '11 at 4:08
  • But its not enough detail for anyone looking at the question here. How can you achieve the failover support? – Greg B May 2 '11 at 8:25
  • howtoforge.com/high_availability_loadbalanced_apache_cluster i suppose with this, but i don't know the process well enough for a definitive answer. – Journeyman Geek May 2 '11 at 9:11

The Journeyman geek is correct, this is known as round robin or poor man's load balancing.

The site owner normally has no control over which IP address will be returned by the DNS server. This configuration does not support fail over as DNS does not account for server availability.

  • How might it be achieved? – Greg B May 2 '11 at 8:25
  • I wish DNS allowed for weighting of all record types, MX records have had it their own way for far too long now. – Chris Woods Feb 17 '13 at 4:01
  • 1
    @ChristopherWoods SRV have them and could be used for any protocol... it is just that one of the major ones (HTTP) specifically do not use SRV records :-( – Patrick Mevzek May 3 '18 at 22:49

one has to configure both IP addresses as A type records

  • This doesn't say anything that other answers don't already say. Such a short answer is not high quality. Please edit this to expand it and differentiate it from other answers. – Stephen Ostermiller May 3 '18 at 15:50

Your Answer

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