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

I have a server with 5 ISP connections, i am using Apache web server and php engine to run my application.

Outgoing request to different API now needs to be send through a specific ISP (or a different IPs).

All my API request are sent using PHP and Web server. I am not sure that php will directly communicate with Gateway or it send request via web server.

Please help me to setup this. Thanks in advance.

share|improve this question
    
Can you please clarify your question? Do you have multiple gateways that you want to choose from? Which protocol(s) are you using? –  Khaled Dec 2 '10 at 11:16
    
Protocol http, yea i want use multiple gateways. Say API1 uses ISP1 API2 uses ISP2 similarly 5 gateways –  itsoft3g Dec 3 '10 at 21:41

2 Answers 2

The question is quite confusing but, if you are asking how to ensure that an outbound HTTP request is routed via a specific network interface, then you need to set up a static route.

Look up the "route" command. (man route)

share|improve this answer

This depends a rest deal on how your server and router are arranged, so adding more information to your question will improve the chance of getting an answer that is correct for your circumstances.

If the web server has multiple network interfaces (even if they are virtual interfaces like eth0:1, eth0:2, ...), one for each gateway, and you are using curl to make the requests then you can use curl's CURLOPT_INTERFACE option (see http://php.net/manual/en/function.curl-setopt.php) to select the out going interface.

It is unlikely that your server is configured this way though - you probably have the one interface and a single address and the egres router(s) on the wider network handle deciding which packets go out over which connection. If you have control of the machine(s) that are responsible for that routing decision then you will be able to setup specific routes for specific addresses using the route command as suggested by Rich. We would need more detail of your current network and routing configuration to be able to give more specific help than this.

share|improve this answer
    
Thanks for your time, i will look deep into it. –  itsoft3g Dec 3 '10 at 21:42

Your Answer

 
discard

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.