试用ptunnel的ICMP代理

ptunnel - ping tunnel,官方功能描述如下(http://www.cs.uit.no/~daniels/PingTunnel/):
Ptunnel is not a feature-rich tool by any means, but it does what it advertises. So here is what it can do:

  • Tunnel TCP using ICMP echo request and reply packets
  • Connections are reliable (lost packets are resent as necessary)
  • Handles multiple connections
  • Acceptable bandwidth (150 kb/s downstream and about 50 kb/s upstream are the currently measured maximas for one tunnel, but with tweaking this can be improved further)
  • Authentication, to prevent just anyone from using your proxy

张小哥之前用python做了一个类似的DD,不知道功能咋样了。今天不研究原理和实现,先看看能不能解决实际问题,因为搬家之后机房和办公地点网络被限制了没法直接访问,但是可以ping,所以按理说ptunnel是可以支持的。

ptunnel使用比较简单,首先下载安装libpcap0.8-dev包,然后在源码目录下Make,便会产生ptunnel二进制文件,proxy和client共用同一个无差别的程序。在虚拟机上将网络配置成bridge,然后测试通过ptunnel代理登陆ssh的效果如下:

在作为proxy的服务器上以root权限运行ptunnel,不加任何参数:

ptunnel_server

然后在客户端(此处用windows平台,干净的机器需要安装winpcap,由于我曾经安装过wireshark,所以略过此步)开始和proxy的连接,cmd建议用管理员权限打开然后执行ptunnel:

ptunnel_client1

-p - proxy的地址
-lp - 本地端口
-da - 远程服务器地址(因为此处要登录proxy本身,所以地址和proxy server地址相同,否则请使用要通过proxy访问的远程服务器的地址)
-dp - 远程服务器端口

启动之后用putty ssh登录localhost:87811,成功连接了:

ptunnel_client_ssh1

在本地用虚拟机测试很顺畅,可是换到机房的ubuntu上,状况就不是很理想,偶尔能用ssh登录,但是很快就掉线,或者干脆只能提示login as:然后就停顿了。可能还是有策略限制,因为检查到大量的ICMP所以被阻止了。

ptunnel还支持密码功能(-x),以及全部的参数列举如下:

Client: ./ptunnel -p <proxy address> -lp <listen port> -da <destination address> -dp <destination port> [-c <network device>] [-v <verbosity>] [-f <logfile>] [-u] [-x password]
Proxy: ./ptunnel [-c <network device>] [-v <verbosity>] [-f <logfile>] [-u] [-x password]

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据