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

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.


share|improve this question

Binding is the easy part:

ifconfig eth0:0 netmask

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:

Listen 80

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.

share|improve this answer
ip rule can handle that for you, I will dig up the scripts I wrote for a radio station for this very task. – richo Dec 10 '10 at 2:38
is it possible make apache2 host to use that IP ? – taras Dec 10 '10 at 2:41
how can i use IP Rule for that ? can you point me :) thanks! – taras Dec 10 '10 at 2:44
@Taras the Listen line in the httpd.conf file will tell it to listen to that specific IP address. You probably have Listen 80 in there which tells it to listen to any address you have added. The specific version tells it to bind specifically. – sysadmin1138 Dec 10 '10 at 2:50
Then what IP will see the external FTP server's firewall ? the global IP bound to ? the task is more on to show the firewall different IP. – taras Dec 10 '10 at 3:04

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.