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'm doing the following:

% autossh -i YYY.pem XXX@SERVER -N -R 90:localhost:9000 -o ServerAliveInterval=30

to forward a server port from the local machine to the public machine.

But connections are originating from on the local machine now. How do I forward the port so that connections appear to originate from their true IP?

For example, I have a echo listener that sits on port 9000. Whenever it gets a connection it prints the IP of the origin. Right now, it prints out over and over.

share|improve this question
I spent about 8 hours yesterday trying to find the answer to this, and I'm not sure there is one. I figured out how to forward with iptables dnat & ssh -w, but then the ip is hidden with a different ip. I tried making a bridge with tun0 but somehow it is not allowed. I've been trying a "route add" but this also does not work. I'm stuck if anyone has hints I would be interested. – iamacomputer Mar 22 '13 at 13:14
i've tried making a tap0 bridge with openvpn but still to no avail – iamacomputer Mar 22 '13 at 21:41
If I understand what you're trying to do here, you want to expose a port (90) that is on your FW (aka. SERVER), and direct any connections on port 90 to an internal server's port 9000? But you're initiating this setup from the host who's port 9000 is listening? – slm Mar 28 '13 at 5:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.