An SSH tunnel (sometimes referred to as a
VPN") is an encrypted network
tunnel created through an
SSH connection. SSH is frequently used to tunnel insecure traffic over the Internet in a secure way. For example, Windows machines can share files using the
SMB protocol, which is not encrypted. If you were to mount a Windows filesystem remotely through the Internet, someone snooping on the connection could see your files. To mount an SMB file system securely, one can establish an SSH tunnel that routes all SMB traffic to the fileserver inside an SSH-encrypted connection. Even though the SMB traffic itself is insecure, because it travels within an encrypted connection it becomes secure.
可以看出,ssh tunnel能为那么没有经过加密就进行传输的数据提供了安全保证。
以下是本地基本实验环境:
客户端A IP:192.168.0.33 OS:windowsXP ssh clint:putty
服务器端B IP:10.0.0.1 OS:RHEL4U3 sshd:openssh sshd port:22
测试目的:建立ssh tunnel,当客户端访问服务器端sshd服务器,只需要的clint上访问localhost即可,实际经过加密后转发给B服务器.
基本网络拓扑图:
(1)开启ssh tunnel前的网络拓扑图
图1-1 开启ssh tunnel前基本网络拓扑图
(2)开启ssh tunnel后的基本网络拓扑图
图1-2 开启ssh tunnel后网络基本拓扑图
基本配置:
(1)B服务器开启sshd服务
#/etc/init.d/sshd restart
(2)A客户端建立ssh tunnel
图2-1 配置ssh tunnel
图2-2 登陆B服务器
检测ssh tunnel是否建立
C:\Documents and Settings\Administrator>telnet localhost 22
可以正常登陆,并检查发现登陆的实际服务器确实是B服务器.
至此,可用的ssh tunnel已经基本建立,当然可以根据实际应用的不同,修改图2-1的配置对其他业务进行ssh加密传输
注意:
建立ssh tunnel的putty在实验过程中不能关闭
后语:
对于linux客户端来说 配置起来更为简单
PS:建议chinaunix的blog系统能够实时的保存当前正在编辑的内容,刚才正在编辑文章时电脑重启,不得不另使我重新编辑文章.
参考文章:
Breaking Firewalls with OpenSSH and PuTTY
Tunneling protocol
使用 OpenSSH 隧道化技术确保 DB2 通信安全
如果你需要转载该文章或者使用于商业用途,请联系E-mail:xweiyao#gmail.com (请将#更换为@),并注明出处,谢谢合作!
顺便祝福下四川地震中的所有兄弟姐们,这一刻,我们又连在了一起。中国,挺住,中国,加油!