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 PHP/Apache2/Linux Redhat which daily downloads some files from an external FTP server. I need to use a different public IP address for the FTP connection instead of primary IP address. Is it possible to change the origin IP address from Apache2/PHP ?


share|improve this question

What you're asking doesn't make logical sense. If the origin IP address is different than your address how would the FTP know to reply to your request at your new IP?

Its similar to sending a letter to someone with a different return address and then expecting a reply.

share|improve this answer
sorry, yes you are right, it was unclear. i edited it. hope its more clear now. thanks for your comments. – taras Dec 13 '10 at 2:50

to fake your ip is not possible because you will not see the response ... gets complicated.

one thing you can do is this - you have a static route into your server that says when you want to access ftp the go to second ip address not the default route - on the second ip setup iptables so that will do SNAT or MASQ to his own ip - that way the ftp server will talk with the second ip

from apache/php you could set on the second ip a proxy ... but again this is complicated - stick with the route as is very simple.

share|improve this answer
the static route solution looks promising. can you give more info and point me on how to configure a static route ? i am not very familiar with linux redhat. i appreciate your help ) – taras Dec 13 '10 at 3:52

Actually, when you edited your answer, you removed important information. The firewall in front of the FTP server was allowing your old IP address. You can't change anything in your server, at its new IP address, to make that firewall allow you back in, unless you still have control of the old IP and can install a proxy there. Make a phone call to the admin of the other firewall to add your new IP address

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.