Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Im just starting to look at deploying a webpage and get into the joy of DNS etc. And im wondering how you set up multiple web-servers all with thier own hostnames/public IP addresses, and yet have them serve up a webpage from one domain.

For example, lets say you have a website example.com, and an A record in DNS that points at it's IP address of .

You want to have two servers, prod1 and prod2 with some kind of load balancer in front of them for fail over reasons.

The way I see it you would want to have the hostnames of these servers as prod1.example.com and prod2.example.com and perhaps loadb.example.com.

How would you set up the DNS so this would all work. ie you could ssh to any of the server domains, prod1.example.com, prod2.example.com or loadb.example.com and also just use the www.example.com url to go to the website. And would all these server names be resolvable from the public internet and is that safe?

This would be a linux environment, for arguments sake ubuntu, a django framework dynamic website, running in apache 2.2

Cheers Mark

share|improve this question

1 Answer 1

up vote 2 down vote accepted

This is actually very straightforward but exactly how you do it varies based on the LB you use.

In your example you would simply have an A record for example.com that points to a virtual IP address presented by the LB. The LB will periodically probe both Prod1 and Prod2 to check they're up (and sometimes how busy they are) and based on that hands each request to a server to work on. If required you can create additional A records for Prod1 and Prod2 if you wish to talk directly to a specific server with the LB ignoring that request.

Here's some extra detail;

Prod1.example.com=, which is Prod1's real IP
Prod2.example.com=, which is Prod2's real IP
Prod.example.com=, which the LB creates and points at both Prod1.example.com AND Prod1.example.com (you can use either DNS names or IPs).

Request comes to the LB at Prod.example.com, the LB knows both are up so sends the request to Prod1.example.com, the next request goes to Prod2.example.com and so on.

The example above uses a 'round robin' rule to balance the traffic but there are lots of other rules you could use instead (i.e. who's least busy) but that depends on the LB being used.

Is that ok? let us know if not and we'll come back to you.

share|improve this answer
Yes kinda. So example.com is pointed at a virtual address of the LB? Im presuming that the LB then has two IP addresses? Or does example.com have an A record that points just to the LB IP address? –  Mark Mar 22 '10 at 1:35
Yes example.com does point at the VIP on the LB but it can have one or more IPs depending on config. –  Chopper3 Mar 22 '10 at 9:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.