为iPad/iPhone建立ssh tunnel翻墙

伟大的墙是永恒的话题,在pc上翻墙已经是家常便饭。在iPad,iPhone上一般用VPN,可是我已经买了ssh帐号,我不能为了iPad重新买个VPN吧,而且VPN还又流量限制。怎么办?动手翻吧就。折腾了好几个晚上居然都没成功,今天终于搞定了。

原 本不想折腾,可是该死的GFW越来越不要脸了。以前在iPad上购买的国家地理,Empire等杂志都居然不能下载了。第一时间怀疑是网络问题,不可能两 个杂志同时间全世界都不能下载吧。找了个免费的VPN试了一下,果然能下载了。验证了我的疑问,既然如此,我只好想办法在iPad上也用ssh tunnel翻墙吧。

原理:

使用ssh tunnel翻墙有多种方法,这里采用如下方法:

  1. 在iPad上建立ssh tunnel通道,
  2. iPad配置代理,
  3. 将所有的http访问都通过此通道,
  4. 从而翻墙一跃而过

先决条件:

  1. ssh 帐号
  2. 越狱的iPad/iPhone
  3. cydia中下载并安装:mobileterminal ,backgrounder,openSSH 应用
  4. 可以copy文件从pc至iPad文件系统中的工具,例如:windows下的ifunbox,itools,Mac系统下的iExplorer

步骤:

  • 打开mobileterminal,在命令行输入ssh命令
ssh -D localport username@host -p port -N

简单说明一下:

localport是建立通道后,本地侦听的端口

username是你的ssh用户名

host port 分别是你的ssh服务的域名和端口。

例如:

ssh -D 7070 luyu@fuckthegfw.com  -p 80 -N

  • 首次连接会提示(yes/no),输入“yes”,然后输入密码。
  • 按住Home键,当出现background enable时松手,这个步骤时为了保证mobileterminal 切到后台再切入前台时保持显示和状态
  • 编辑一个文本文件,并存为overall.pac
function FindProxyForURL( url, host ) {     return "SOCKS 127.0.0.1:7070"; }
  • 利用ifunbox等工具将overall.pac拷贝到iPad的/var/mobile目录下
  • 在iPad的设置->wifi->http代理 选择“自动”,“URL”填“file://localhost/var/mobile/iphone.pac”。

注意:

  • 有些ssh服务器在ssh连接时会返回类似这样的错误:

Can’t Change User’s Home Dir

注意包含-N参数,确保登录后不执行服务器命令

  • 必需使用pac文件,如果仅仅时填写手动的代理信息,会返回protocol mismatch的错误

原文http://luyus.info/?p=192

  1. 雷锋
    2015年1月20日12:40

    直接用PrettyTunnel这个越狱软件就可以了,超简单
    apt.feng.com/read-54bdcd5f0e1d1501678b49a5.html

  2. qlinknetwork
    2012年3月26日13:46

    试试这个 https://www.qlinknetwork.com/?r=vOmAC7d iOS翻墙的最好方式

  3. AS
    2012年3月25日14:01

    https://trac.torproject.org/projects/tor/wiki/doc/TorBOX
    “…About TorBOX
    TorBOX is a multi-system anonymity setup built around Tor’s Transparent Proxy. The basic idea is that Tor and clients using Tor run on two different isolated operating systems. This is the only way we know of that can reliably protect your anonymity from client application vulnerabilities and IP/DNS protocol leaks.10
    TorBOX consists of two machines, which are connected through a virtual, isolated network. One machine acts as the client or “Tor-Workstation”, the other as a proxy or “Tor-Gateway” which will transparently route all of the Tor-Workstation’s traffic through Tor.
    This setup can be implemented either through virtualization or through two dedicated computers instead of VMs. TorBOX is primarily intended for virtualization with VirtualBox. The two virtual machines, Tor-Gateway and Tor-Workstation, are based on Ubuntu. Other virtualization platforms (e.g. VMware) or other operating systems (e.g. Windows; *nix; BSD) could potentially also be used, but this is neither supported nor tested.
    TorBOX can be installed on every computer capable of running VirtualBox (supports Windows, OS X, Linux and Solaris) or similarly capable virtualization platform.
    “Bare metal” (installing Gateway and Workstation directly on the hardware/”metal”) is more secure than virtual machines, requires more physical space and hardware and electricity costs are higher. Keep in mind that you don’t need very powerful dedicated servers or desktops. For more information, see TorBOX/BareMetalHints.
    See SecurityAndHardening for the threat model and security of TorBOX.
    The listed advantages and disadvantages shall give you an overview, what TorBOX is useful for, what TorBOX can do for you, and what not. …”
    http://sourceforge.net/projects/torbox/?source=directory
    http://sourceforge.net/projects/torbox/files/torbox-0.1.3/
    “README < 3 hours ago 628 Bytes i
    Tor-Workstation-0.1.3.ova < 6 hours ago 299.9 MB i
    Tor-Gateway-0.1.3.ova < 7 hours ago 190.9 MB"

    (2012年3月25日)

  4. @twfcc
    2012年3月25日13:27

    iOS用ssh翻墙配合3proxy转换为HTTP代理较好,可全局代理,其他应用也能通过使用