我试图转发端口139从一个Windows机器到我的Ubuntu SSH服务器在一个tun接口与IP地址10.0.0.1。
这样我就可以通过反向隧道访问我的Ubuntu服务器上的机器上的Windows共享。
我可以将端口转发到127.0.0.1,但不能转发到10.0.0.1。
在Windows上,我正在使用Tunnelier SSH客户端。
在我的Ubuntu服务器上,以下消息打印在auth.log中:
Received disconnect from 124.109.51.154: 11: Server denied request for client-side server-2-client forwarding on 10.0.0.1:139.
到目前为止,我已经尝试了以下设置:
GatewayPorts yes PermitTunnel yes AllowTcpForwarding yes
在/ etc / ssh / sshd_config文件中,但它没有工作。
我像这样设置了tun:
sudo tunctl -t loc_0 -u myusername sudo ifconfig loc_0 inet 10.0.0.1 netmask 255.255.255.0 up
Tunneler ssh客户端中的设置应该不重要,因为我可以将端口139成功转发到运行WinSSHD服务器的Windows计算机上的Microsoft环回适配器。
版本:Windows是XP SP3,Ubuntu是10.10。
更新:
我尝试将端口转发到一个大于1024的数字,提到tun的IP地址,并且它已成功连接, 但转发是在127.0.0.1而不是tun的IP地址10.0.0.1上完成的。
所以现在有两个独立的问题,从Windows机器连接时:
1)在小于1024的端口上转发可能被拒绝。 我们如何在服务器上允许?
2)即使我提到10.0.0.1这是tun的IP地址,转发也只在127.0.0.1上完成。
另一个尝试:我也尝试将Linux机器的端口22转发到tun的端口 55567.它显示成功。 但是,当我试图ssh进入该端口使用两个本地地址,在Linux机器的debugging显示中,我得到了错误Connection failed: no route to host使用127.0.0.1连接时Connection failed: no route to host ,只是使用tun的IP地址Connection refused 。
所以无论从Windows客户端还是Linux客户端连接,tun都不会获取转发的端口。
关于<1024,你只能通过使用root用于SSH隧道来做到这一点:
http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-ssh-beyondshell-tcpip.html
注意
设置端口转发以侦听1024以下的端口需要根级别访问。
关于127.0.0.1,你可能需要在你的ssh设置中使用'-g':
-g Allows remote hosts to connect to local forwarded ports.
这是什么:
sudo ifconfig eth0:0 10.0.0.1 up sudo ssh -g -L 139:10.0.0.1:139 user@sambahost