博客首页 注册 建议与交流 排行榜 加入友情链接         宝宝相册的专门空间
推荐 投诉 搜索: 帮助

Open My Dream!

find my dream and open it!
   finddream.cublog.cn
关于作者  
姓名:finddream
职业:纯粹的消费者
年龄:幼稚阶段
位置:最底层
个性介绍:平凡的不能再平凡

我的分类  




ssh tunnel基本配置
最近沉迷游戏,真有点玩物丧志了,不过总算及时悬崖勒马。晚上没事的时候,随后拿起了床边的一本书,其中的ssh tunnel深深吸引我了,得,今天索性给大家普及下ssh tunnel吧。
由于本地实验环境以及自身知识的限制,本文章只适合于初步接触ssh tunnel的非专业人士,o(∩_∩)o...
首先看下wikepedia对ssh tunnel的描述(http://en.wikipedia.org/wiki/Tunneling_protocol#SSH_tunneling):
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是否建立
         
图3-1  检查端口是否监听
  C:\Documents and Settings\Administrator>telnet localhost 22
     
     
可以正常登陆,并检查发现登陆的实际服务器确实是B服务器.
至此,可用的ssh tunnel已经基本建立,当然可以根据实际应用的不同,修改图2-1的配置对其他业务进行ssh加密传输
 
注意:
建立ssh tunnel的putty在实验过程中不能关闭
 
后语:
 对于linux客户端来说 配置起来更为简单
 #ssh -p 22 -L 22:localhost:22 username@10.0.0.1
 
PS:建议chinaunix的blog系统能够实时的保存当前正在编辑的内容,刚才正在编辑文章时电脑重启,不得不另使我重新编辑文章.
 
参考文章:
Breaking Firewalls with OpenSSH and PuTTY
Tunneling protocol
使用 OpenSSH 隧道化技术确保 DB2 通信安全
 
如果你需要转载该文章或者使用于商业用途,请联系E-mail:xweiyao#gmail.com (请将#更换为@),并注明出处,谢谢合作!
 
顺便祝福下四川地震中的所有兄弟姐们,这一刻,我们又连在了一起。中国,挺住,中国,加油!

 发表于: 2008-05-14,修改于: 2008-05-14 11:52 已浏览142次,有评论0条 推荐 投诉

  网友评论

  发表评论



Copyright © 2001-2006 ChinaUnix.net All Rights Reserved

感谢所有关心和支持过ChinaUnix的朋友们
页面生成时间:0.0133

京ICP证041476号