Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSH Remote Port Forwarding Specify Interface

I use this for remote port forwarding over SSH tunnel:

ssh [email protected] -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.

like image 786
Stefan D Avatar asked Jan 18 '15 16:01

Stefan D


Video Answer


1 Answers

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 [email protected] -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 .

like image 57
Stefan D Avatar answered Oct 01 '22 17:10

Stefan D