I have a web application running on apache2/Linux Redhat which downloads some files from an external FTP server. When the app connects to the FTP server i need to use a different fixed IP address. The purpose is to give a different IP to the FTP server administrator so they will enable it in their firewall.
Thanks.
Best Answer
Binding is the easy part:
And then add that IP address to your apache config
However, chances are real good that your server already listens on the extra IP address. You can tell this if your httpd.conf file has this in it:
Which tells the server to listen on port 80 of any IP address the server has.
The trickier part is getting your web-app to use that IP address on the outbound connection. Unless you take steps, outbound connections will likely use whatever is bound to "eth0" instead of "eth0:0". Your socket-building API may allow selecting either an interface or an IP address as part of the setup, your mileage may vary.
However, if you're behind a NAT gateway (if the server's actual IP address starts with 10, 172, or 192 this is a sure sign) and not binding publicly routeable addresses to your web-server things get more complicated. In that case your border device needs to be smart enough to know that traffic destined to a specific IP address needs to be rewritten as if it were coming from a second public IP address bound to the firewall. If your firewall/NAT can't do that, you may very well be out of luck.