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

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?

Thanks!

share|improve this question

2 Answers 2

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

 
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.