Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have purchased 3X APACHE servers, and have a Mysql Server running behind them. We are using a hardware load balancer to balance the requests to the apache servers.

Our problem is that we set the rules for the Load Balancer (LB) to use the main public ips of the apache servers so that balancing happens on a per server basis in the Group. Also the A records of all the domains on the server to be balanced are pointing to the VIP of the LB.

Now the issue is once someone hits, they are forwarded to the LB (VIP which sends them to the Apache server IP ie The issue is now, is that the Apache servers cannot route the request now to the domain's ip for ie

How can we manage multiple domain routing from the main Apache servers, which are sent requests from the VIP of the LB?

thanks in advance

share|improve this question

Will need more information to go on, can you provide the output of?

iptables -t nat -L PREROUTING

Are you using a Layer 7 or Later3/4 hardware loadbalancer?

Assuming none layer7, this could just need a DNAT rule

iptables -t nat -I PREROUTING -d <VIP> -j DNAT --to-destination <local ip>

So in your case

iptables -t nat -I PREROUTING -d -j DNAT --to-destination

The loadbalancer should not be "sending" anyone anywhere, it should handle all the requests itself, can you clarify if this is the case or if a rule on the lodbalancer is senting a httpd redirect code such as 301/302.

share|improve this answer
Hi thanks, the LB is a Layer 4. Unfortunately there is no PREROUTING or DNAT and we only get once VIP per LB purchase (of 500 connections). – user60648 Nov 21 '10 at 1:29

What kind of load balancers are these? Is there a firewall between the load balancer and the web servers?

I know on F5 load balancers, in a configuration similar to what you are describing, it is required to turn on SNAT. With the SNAT enabled, the load balancer effectively proxies the request between the end user and the chosen web server. Effectively the load balancer makes the request on behalf of the end user and then returns the response to the user. Evidence of this is that all requests in your web server access_logs are filled with requests from your load balancer rather than direct end user IPs.

You want your load balancer to be the only point of contact between you and your end users. The end users should never need to know about individual web servers.

share|improve this answer

Your Answer


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