카테고리 없음

ssh reverse tunneling

RootFriend 2018. 11. 28. 19:13



1) modify '/etc/ssh/sshd_config' as follows

TCPKeepAlive yes

GatewayPorts yes

ClientAliveInterval 60

ClientAliveCountMax 999999999


2) based on "external_server -- firewall -- internal_server" structure,


we can run following command on internal_server


$ sudo ssh -fN -R *:7777:localhost:22 id@external_server_ip -p 2222


where sshd port for external_server_ip is 2222 and port 7777 can be any available ports on external_server. 


3) connection.


on external_server, we can run following command to connect internal_server


$ ssh localhost -p 7777