2

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!

james
  • 123
  • 5

2 Answers2

0

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).

kubanczyk
  • 13,812
  • 5
  • 41
  • 55
0

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.

Dan Andreatta
  • 5,454
  • 2
  • 24
  • 14