and*_*ezl 5 ssh iptables ubuntu reverse-tunnel redhat-enterprise-linux
我设置了从家庭计算机到工作服务器的反向 SSH 隧道:
ssh -f -N -R 19999:localhost:22 remoteuser@server
Run Code Online (Sandbox Code Playgroud)
要连接到我的家庭计算机,我必须首先登录到服务器,然后从那里登录到我的家庭计算机:
otheruser@othermachine$ ssh remoteuser@server
remoteuser@server$ ssh -p 19999 homeuser@localhost
Run Code Online (Sandbox Code Playgroud)
但我希望能够跳过一步并直接通过端口 19999 连接,例如:
otheruser@othermachine$ ssh -p 19999 homeuser@server
Run Code Online (Sandbox Code Playgroud)
我不太熟悉iptables,而且我一直在阅读,但打开一个端口似乎很令人困惑。我很确定我需要添加一条规则iptables,但是我还需要做什么吗?
服务器是RHEL 6,我的家用计算机是Ubuntu 14.04
除了 之外iptables,您还需要使用(GatewayPorts)-g选项,并且服务器的配置必须进行设置。ssh/etc/ssh/sshd_configGatewayPorts yes