0

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 www.example.com, they are forwarded to the LB (VIP 91.2.12.134) which sends them to the Apache server IP ie 101.1.1.134. The issue is now, is that the Apache servers cannot route the request now to the domain's ip for www.example.com ie 138.12.12.134.

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

2 Answers 2

0

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 91.2.12.134 -j DNAT --to-destination 101.1.1.134

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.

1
  • 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, 2010 at 1:29
0

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.

You must log in to answer this question.