跳板机上开启 GatewayPorts
1. 修改 sshd 配置
# 在 vps 上执行
echo "GatewayPorts yes" >> /etc/ssh/sshd_config
# 或编辑文件,找到 GatewayPorts 行改为 yes
sed -i 's/#GatewayPorts no/GatewayPorts yes/' /etc/ssh/sshd_config
# 如果已有该行
sed -i 's/GatewayPorts no/GatewayPorts yes/' /etc/ssh/sshd_config
2. 重启 sshd 生效
systemctl restart sshd
# 或
service ssh restart
3. 验证配置
sshd -T | grep gatewayports
# 输出: gatewayports yes 即为成功
然后在沙箱内发起反向隧道