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 SSH tunnel set up to my dedicated server via Putty which I am using as a socks proxy. The problem is I need to use a different outgoing IP address than the main IP of the dedicated server. I have a block of 30 ips for this server but even if I set up a web based proxy (php) it will use the main server ip.

Does anyone know a solution?


share|improve this question

Typically OS assumes the source IP address for a connection (the thing you've called "outgoing IP") to be equal to the main address of an outgoing interface (see ifconfig -a). Outgoing interface is determined by looking up the matching entry in the routing table (see netstat -rn or route).

You can play with adding/changing entries to the routing table, there is a chance that it will cause OS to select another outgoing interface, and - in turn - there is a chance that it will cause your OS to select another source IP address.

Other than that, if your server happens to be Linux you can work around the problem by using SNAT (see iptables).

share|improve this answer

First, do you have set up an alias for your NIC?

What happen if you ssh using the IP alias?

For the web base proxy, you should be able to specify what IP address to bind to. In Apache you just set the Listen option. Did you try it?

Alternatively, as kubanskamac mentioned, use iptables.

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.