Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 use a service that allots us X number of requests per IP and has allows us to setup 5 IPs with such a limit (I know.. it seems stupid they could not just up the limit 5x on one IP).

Pretend I have a linux box with the following address on the internet: - that is an Google IP and not mine... so feel free to try to hack into it :)

I setup apache+mod_proxy as a forwarding proxy (ProxyRequests On). i.e. you can setup firefox to use as a proxy, and all firefox traffic comes out as

So far so good.

Now I add more alias interfaces so the total looks like this:


I run apache+mod_proxy (single apache instance) which binds to all interfaces, but no matter which address I connect to use the forwarding proxy, all traffic goes out to the internet as

I have also tried running 5 different apaches, each binding to its own interface only, but that still sends the outbound request through

I was hoping to get it to work as follows:
I connect to and make a proxy request, and it goes out as
I connect to and make a proxy request, and it goes out as

Has anyone else had to deal with this issue? The fall back solution would be to just run apache on 5 separate boxes, but I would prefer it to all work on one box.


share|improve this question
up vote 0 down vote accepted

It appears mod_proxy does not have an option to select source IP when it opens the socket. However you can use iptables to SNAT traffic from a user to a pool of addresses.

iptables -A POSTROUTING -m owner --uid-owner httpd -j SNAT --to-source

IIRC it will distribute through the pool with each connection being mapped, so things should be evenly split. If you really need to control which requests go where, you could try running the multiple apache instances under different users and matching with separate rules.

share|improve this answer

Take a look at the Linux Advanced Routing and Traffic Control HOWTO, in particular at this page. Perhaps you want to leave routing to the kernel, which knows about it, than to apache, which is taking care of the "application" level.

share|improve this answer

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.