2012年5月14日星期一

[GFW BLOG(功夫网与翻墙)] 关于MAC下用SSH翻墙的小结

原文:http://www.k-nows.net/2012/03/28/mac-safari-ssh-cross-gfw/

回国这几天都是在用Mac+Safari上学校的ssh翻墙,简单,粗暴,高效。

方法一,终端加网络配置

这个真的是又简单又粗暴。。。分两步:

首先,打开你的终端,输入:

ssh -D port user@hostname 

其中port是你的端口号,挑一个你自己的机器上能用的,这个命令就是将访问forward到了你指定的端口上。

然后,打开"系统偏好设置"->"网络"->"高级"->"代理"->点选"SOCKS 代理"->旁边的"SOCKS 代理服务器"里填127.0.0.1,端口填你刚才写的那个,点个好点个应用,搞定。

注意,

  1. 终端的ssh连接不能关闭。
  2. 注意你的ssh的服务器的访问限制,尤其是像我这样的用学校的ssh服务器的,如果去访问了一些不该访问的,就该有学校的警告mail来了
  3. 这个方法简单粗暴但是也太粗糙,所有的访问都会通过ssh服务器来进行,所以即使我看个sina新闻也要绕到遥远的nagoya去,而且pipe还可能崩坏。

推荐人群:如果只是为了时不时地上个推上个fb的话,只要你的ssh也允许,可以尝试。

方法二,iSSH加.pac文件

这个方法相对稳定,但是我所在的这个网络环境实在是太坑爹了><。。。

首先,你需要下载一个app叫iSSH,如果你找不到,我会在稍后放出下载。点我下载

app很好设置,输入服务器地址,然后用户名密码都是你在ssh服务器上的,接着下面会有一个2选一的东东,选择SOCKS Proxy(-D),端口选择7070(稍后解释)。

其次,你需要准备一个.pac文件,如果你会写就请忽略这段,如果你不会,那就看下面一段代码:

function FindProxyForURL( url, host ) {  if ( shExpMatch(url, "*ip38*")      || shExpMatch(url, "*1-apple.com.tw*")      …      …      || shExpMatch(url, "*facebook.com*")      || shExpMatch(url, "*facebook cdn*")      …               || shExpMatch(url, "*twitter.com*")      || shExpMatch(url, "*twitter.com/amoiist*")      || shExpMatch(url, "*twitter.com/BeiJing1989*")      || shExpMatch(url, "*twitter.com/billzhong*")      || shExpMatch(url, "*twitter.com/nowhere1975*")      || shExpMatch(url, "*twitter.com/shizhao*")      || shExpMatch(url, "*twitter.com/VOTChinese*")      || shExpMatch(url, "*twitter.com/wenyunchao*")      || shExpMatch(url, "*twitter.com/wumao*")      || shExpMatch(url, "*twitter.com/zengjinyan*")      || shExpMatch(url, "*twitter.com/zuola*")      || shExpMatch(url, "*https://twitter.com/*")      || shExpMatch(url, "*https://www.twitter.com/*")      || shExpMatch(url, "http://apiwiki.twitter.com/*")      || shExpMatch(url, "http://dev.twitter.com/*")      || shExpMatch(url, "http://status.twitter.com/*")      …      || shExpMatch(url, "*youtube.com*")      || shExpMatch(url, "*hk.youtube.com*")      || shExpMatch(url, "*tw.youtube.com*")      || shExpMatch(url, "*youtube.com/get_video*")      || shExpMatch(url, "*Youtube CDN*")      …      )     return "SOCKS 127.0.0.1:7070";  else     return "DIRECT"; } 

这段就是.pac文件的内容,基本上,添加了这些就可以上推上fb看U2B了。其余的网址请自行添加,我稍后会放出下载。右键点我然后"另存为"

接着,打开"系统偏好设置"->"网络"->"高级"->"代理"->点选"自动代理配置"->"选取文件"->找你刚刚搞到的那个.pac文件,然后点个好点个应用。

最后,回到iSSH那个app上,可以点Connect了,然后打开Safari去爽去吧。

注意,

  1. 上面的iSSH的SOCKS Proxy -D的端口和.pac的文件末尾所写的那个端口必须一致,而之所以选择7070,是因为我最开始拿到这个文件的时候它写的就是7070==
  2. 这个方法相对上一个方法更稳定,因为它只有在访问那些需要翻墙的url的时候才会通过ssh服务器,所以限制更少,pipe也不容易崩坏,

推荐人群:如果你的ssh服务器对国内的网址很不友好的话,用这个会好点。

以上,
2012-3-28
于爵仕官邸某7楼床上



--
Posted By GFW BLOG 功夫网与翻墙 to GFW BLOG(功夫网与翻墙) at 5/14/2012 05:01:00 PM

--
1、翻墙利器赛风3下载地址: http://dld.bz/caonima326http://dld.bz/caonima745/
2、我们的订阅地址:http://feeds2.feedburner.com/chinagfwblog
3、停止订阅,请发邮件到
gfw-blog+unsubscribe@googlegroups.com
翻越防火长城,你可以到达世界上的每一个角落。(Across the Great Firewall, you can reach every corner in the world.)

1 条评论:

  1. insta keto is a greatest for long-term weight reduction success. That's as a result of these dieters are inclined to make healthy, lengthy-lasting lifestyle to their consuming habits and bodily activity, which carry on throughout their lives.this product is all about melting of fats it also improves the cognitive functionality. a person who is willing to cut down the excess pounds and want to get a slim and trimmed physique and give a try to this product which has no side effect and can work more efficiently than the other products. check out the video for more info and how to buy the product.
    InstaKeto Review (Update 2019) - Latest Report Released by ProbioticsJournal

    回复删除