9

I use this for remote port forwarding over SSH tunnel:

ssh root@X.X.X.X -R 443:127.0.0.1:443

this binds to 0.0.0.0:443 and forwards to 127.0.0.1:443 .

The remote server has multiple IPs. Is it possible to specify the IP I want to bind to, for instance 10.10.10.1:443, instead of binding to all interfaces?

iptables is not available on the remote server.

Stefan D
  • 1,229
  • 2
  • 15
  • 29
  • 1
    The SSH man page says: -R [bind_address:]port:host:hostport but it doesn't work. It ignores the bind_address and binds to all interfaces :( – Stefan D Jan 19 '15 at 01:50

1 Answers1

17

I managed to solve it.

On the remote server I set in sshd_config:

GatewayPorts clientspecified

Then I changed the arguments on the client like this:

ssh root@X.X.X.X -R 10.10.10.1:443:127.0.0.1:443

Now it works as expected, SSH binds to port 443 on interface 10.10.10.1 and forwards all traffic over the tunnel to localhost:443 .

Stefan D
  • 1,229
  • 2
  • 15
  • 29