Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible that one domain name has multiple corresponding IP addresses?

Tags:

dns

For example, when we connect to www.example.com, at first we try to connect to 192.0.2.1. And if first try fails, then we try 192.0.2.222.

Is it possible? Can we register multiple backup IP addresses for one domain name?

like image 459
firia2000 Avatar asked Apr 21 '12 10:04

firia2000


People also ask

Why does a domain name have multiple IP addresses?

By giving mulitple IPs to the same domain name the incoming requests are simply split among the servers that listen on those IP addresses. Think of it as a first level load-balancing, without backend health check.

How many IP addresses can correspond to a domain?

That means a single domain can have more than one IP address.

Can a machine with single DNS name have multiple IP addresses?

Can a machine with a single DNS name have multiple IP addresses? How could this occur? ANS: Yes. Remember that an IP address consist of a network number and a host number.


3 Answers

This is round robin DNS. This is a quite simple solution for load balancing. Usually DNS servers rotate/shuffle the DNS records for each incoming DNS request. Unfortunately it's not a real solution for fail-over. If one of the servers fail, some visitors will still be directed to this failed server.

like image 54
Jens Bradler Avatar answered Oct 05 '22 23:10

Jens Bradler


You can do it. That is what big guys do as well.

First query:

» host google.com 
google.com has address 74.125.232.230
google.com has address 74.125.232.231
google.com has address 74.125.232.232
google.com has address 74.125.232.233
google.com has address 74.125.232.238
google.com has address 74.125.232.224
google.com has address 74.125.232.225
google.com has address 74.125.232.226
google.com has address 74.125.232.227
google.com has address 74.125.232.228
google.com has address 74.125.232.229

Next query:

» host google.com
google.com has address 74.125.232.224
google.com has address 74.125.232.225
google.com has address 74.125.232.226
google.com has address 74.125.232.227
google.com has address 74.125.232.228
google.com has address 74.125.232.229
google.com has address 74.125.232.230
google.com has address 74.125.232.231
google.com has address 74.125.232.232
google.com has address 74.125.232.233
google.com has address 74.125.232.238

As you see, the list of IPs rotated around, but the relative order between two IPs stayed the same.

Update: I see several comments bragging about how DNS round-robin is not convenient for fail-over, so here is the summary: DNS is not for fail-over. So it is obviously not good for fail-over. It was never designed to be a solution for fail-over.

like image 42
karatedog Avatar answered Oct 06 '22 01:10

karatedog


Yes this is possible, however not convenient as Jens said. Using Next generation load balancers like Alteon, which Uses a proprietary protocol called DSSP(Distributed site state Protocol) which performs regular site checks to make sure that the service is available both Locally or Globally i.e different geographical areas. You need to however in your Master DNS to delegate the URL or Service to the device by configuring it as an Authoritative Name Server for that IP or Service. By doing this, the device answers DNS queries where it will resolve the IP that has a service by Round-Robin or is not congested according to how you have chosen from several metrics.

like image 45
Ezra A.Mosomi Avatar answered Oct 06 '22 01:10

Ezra A.Mosomi