<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sprayfly &#187; proxychains</title>
	<atom:link href="http://sprayfly.com/tag/proxychains/feed/" rel="self" type="application/rss+xml" />
	<link>http://sprayfly.com</link>
	<description>Languages, Linux, Life</description>
	<lastBuildDate>Wed, 14 Jul 2010 03:32:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>用 tsocks 和 proxychains 使 Linux 下所有软件能够翻墙</title>
		<link>http://sprayfly.com/2009/07/09/%e7%94%a8-tsocks-%e4%bd%bf-linux-%e4%b8%8b%e6%89%80%e6%9c%89%e8%bd%af%e4%bb%b6%e8%83%bd%e5%a4%9f%e7%bf%bb%e5%a2%99/</link>
		<comments>http://sprayfly.com/2009/07/09/%e7%94%a8-tsocks-%e4%bd%bf-linux-%e4%b8%8b%e6%89%80%e6%9c%89%e8%bd%af%e4%bb%b6%e8%83%bd%e5%a4%9f%e7%bf%bb%e5%a2%99/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 05:31:36 +0000</pubDate>
		<dc:creator>Jono</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[china]]></category>
		<category><![CDATA[翻墙]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[gfw]]></category>
		<category><![CDATA[gwibber]]></category>
		<category><![CDATA[proxychains]]></category>
		<category><![CDATA[SOCKS]]></category>
		<category><![CDATA[tsocks]]></category>
		<category><![CDATA[封锁]]></category>
		<category><![CDATA[封杀]]></category>

		<guid isPermaLink="false">http://sprayfly.com/?p=403</guid>
		<description><![CDATA[情况 由于最近在中国某个地方爆发了 riot, 所以境内很多网站又是无法访问 (twitter.com、facebook.com 等)，让我们这些网民很无奈。 使用 SSH 翻墙 我曾经介绍过如何使用 SSH 来建立一个 SOCKS 代理服务器，让你能够在 Firefox 里正常访问以上所提起的网址。然而不是所有 Linux 软件都能支持代理服务器。如果你最热爱的 Linux 工具需要访问&#8221;被封&#8221;的网站，又没有嵌入的代理支持，该怎么办呢？ 遇到这种情况当然不要放弃该软件&#8230; 毕竟我们用的系统是 Linux 而不是以前让我们咳声叹气，丧失信心的 Windows，总有一个方法去解决问题。 举个例子吧 我不久前发现了 Twitter 这个网站。我一开始不经常用，也搞不明白别人为什么对这个 web 2.0 服务都着了迷。后来我在推特上跟的人越来越多，跟着我的人亦是日益增多，不知不觉我也迷上了该网站，天天都会上。凡是经常用推特的人一般都会用一个推特的客户端，这才能跟得上朋友们的状态更新和最火热的网络新闻。本人作为 Ubuntu 的用户，我自然就选了 Gwibber 这个基于 GNOME 的客户端来访问我的推特。这个软件功能很丰富，用起来得心应手，不过总有一个问题让我有点遗憾，就是 Gwibber 还不听从 GNOME 的代理设置。平时这也不是一个很大的问题，但是每遇中国网络封锁较严重时，都会让我暂时无法使用该软件。 解决方案&#8230; Tsocks 经过几个 Google 搜索，我最终很高兴地发现 Linux 有一个能够强迫任何软件通过 SOCKS 代理上网的工具，其名就是 tsocks。Tsocks 是一个透明 SOCKS 代理软件，只要你电脑有一个连接到国外服务器的 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>情况</strong><br />
由于最近在中国某个地方爆发了 riot, 所以境内很多网站又是无法访问 (twitter.com、facebook.com 等)，让我们这些网民很无奈。</p>
<p><strong>使用 SSH 翻墙</strong><br />
<a href="http://sprayfly.com/2009/07/05/%E5%9C%A8-linux-%E4%B8%8B%E4%BD%BF%E7%94%A8%E4%BD%A0%E7%9A%84%E7%BD%91%E7%AB%99%E4%B8%BB%E6%9C%BA%E4%BD%9C%E4%B8%BA%E5%8A%A0%E5%AF%86%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8/">我曾经介绍过</a>如何使用 SSH 来建立一个 SOCKS 代理服务器，让你能够在 Firefox 里正常访问以上所提起的网址。然而不是所有 Linux 软件都能支持代理服务器。如果你最热爱的 Linux 工具需要访问&#8221;被封&#8221;的网站，又没有嵌入的代理支持，该怎么办呢？<br />
遇到这种情况当然不要放弃该软件&#8230; 毕竟我们用的系统是 Linux 而不是以前让我们咳声叹气，丧失信心的 Windows，总有一个方法去解决问题。</p>
<p><strong>举个例子吧</strong><br />
我不久前发现了 Twitter 这个网站。我一开始不经常用，也搞不明白别人为什么对这个 web 2.0 服务都着了迷。后来我在推特上跟的人越来越多，跟着我的人亦是日益增多，不知不觉我也迷上了该网站，天天都会上。凡是经常用推特的人一般都会用一个推特的客户端，这才能跟得上朋友们的状态更新和最火热的网络新闻。本人作为 Ubuntu 的用户，我自然就选了 <a href="https://launchpad.net/gwibber">Gwibber</a> 这个基于 GNOME 的客户端来访问我的推特。这个软件功能很丰富，用起来得心应手，不过总有一个问题让我有点遗憾，就是 Gwibber <a href="https://bugs.launchpad.net/gwibber/+bug/259830">还不听从 GNOME 的代理设置</a>。平时这也不是一个很大的问题，但是每遇中国网络封锁较严重时，都会让我暂时无法使用该软件。</p>
<p><strong>解决方案&#8230; Tsocks</strong><br />
经过几个 Google 搜索，我最终很高兴地发现 Linux 有一个能够强迫任何软件通过 SOCKS 代理上网的工具，其名就是 tsocks。Tsocks 是一个透明 SOCKS 代理软件，只要你电脑有一个<a href="http://sprayfly.com/2009/07/05/%E5%9C%A8-linux-%E4%B8%8B%E4%BD%BF%E7%94%A8%E4%BD%A0%E7%9A%84%E7%BD%91%E7%AB%99%E4%B8%BB%E6%9C%BA%E4%BD%9C%E4%B8%BA%E5%8A%A0%E5%AF%86%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8/">连接到国外服务器的 SSH 隧道</a>，你就能让任何软件翻墙。</p>
<p><strong>安装并配置 Tsocks</strong><br />
以下说明都是为了那些使用 Ubuntu  的 Linux 用户，不过在别的 Linux 发行版下，安装的过程应该与此差不多。</p>
<p>在终端中:</p>
<pre>sudo apt-get install tsocks</pre>
<p>修改配置文件:</p>
<pre>sudo nano /etc/tsocks.conf</pre>
<p>将其内容改成以下几行并保存退出:</p>
<pre>local = 192.168.1.0/255.255.255.0 #local表示本地的网络，也就是不使用socks代理的网络
server = 127.0.0.1 # SOCKS 服务器的 IP
server_type = 5 # SOCKS 服务版本
server_port = 9999 ＃SOCKS 服务使用的端口</pre>
<p>你可能需要修改一下以上内容，用你自己的 SSH 隧道设置。</p>
<p><strong>运行软件</strong><br />
用 tsocks 运行你的软件很简单，在终端中:</p>
<pre>tsocks 你的软件 &#038;</pre>
<p>我现在运行 Gwibber 都是这样运行的:</p>
<pre>tsocks gwibber &#038;</pre>
<p>祝你们翻墙愉快！</p>
<p><strong>EDIT&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;></strong></p>
<p>我今天还发现了另外一个工具，其功能似乎比 tsocks 要更丰富，配置起来更简单，而且不会那么容易出错。这个工具就是 <a href="proxychains.sourceforge.net/">proxychains</a>。以下有配置方法:</p>
<pre>sudo apt-get install proxychains</pre>
<p>修改配置文件 (/etc/proxychains.conf)，应该如下：</p>
<pre># proxychains.conf  VER 2.0
#
#        HTTP, SOCKS4, SOCKS5 tunneling proxifier.
#

# The option below identifies how the ProxyList is treated.
# only one option should be uncommented at time,
# otherwise the last appearing option will be accepted
#
# Dynamic - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# at least one proxy must be online to play in chain
# (dead proxies are skipped)
# otherwise EINTR is returned to the app
#
# Strict - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# all proxies must be online to play in chain
# otherwise EINTR is returned to the app
#
# Random - Each connection will be done via random proxy
# (or proxy chain, see  chain_len) from the list
# this option is good for scans

dynamic_chain
#strict_chain
#random_chain

# Make sense only if random_chain
chain_len = 2

# Quiet mode (no output)
#quiet_mode

# Write stats about good proxies to proxychains.stats
#write_stats

#Some timeouts in milliseconds
#
tcp_read_time_out 15000
tcp_connect_time_out 10000

[ProxyList]
# ProxyList format
#       type  host  port [user pass]
#       (values separated by 'tab' or 'blank')
#
#
#        Examples:
#
#            	socks5	192.168.67.78	1080	lamer  secret
#		http	192.168.89.3	8080	justu	hidden
#	 	socks4	192.168.1.49	1080
#	        http	192.168.39.93	8080
#
#
#       proxy types: http, socks4, socks5
#        ( auth types supported: "basic"-http  "user/pass"-socks )
#
#http 	10.0.0.5 3128
socks5 127.0.0.1 9999
socks4 127.0.0.1 9050
</pre>
<p>注意事项:</p>
<ol>
<li>要选 dynamic_chain 而不是 random_chain</li>
<li>可以列举几个代理服务器，proxychains  会按顺序用，代理无法访问即自动选用下一个</li>
<li>代理服务器要根据自己电脑的情况自行调整</li>
</ol>
<p><strong>运行 proxychains</strong><br />
运行 proxychains 跟运行 tsocks 完全一样。在终端中:</p>
<pre>proxychains 你的软件 &#038;</pre>
<p>比如说:</p>
<pre>proxychains chromium-browser &#038;</pre>
<p>我还是推荐你使用 proxychains！</p>
<div id="mainphotoarea"></div>]]></content:encoded>
			<wfw:commentRss>http://sprayfly.com/2009/07/09/%e7%94%a8-tsocks-%e4%bd%bf-linux-%e4%b8%8b%e6%89%80%e6%9c%89%e8%bd%af%e4%bb%b6%e8%83%bd%e5%a4%9f%e7%bf%bb%e5%a2%99/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
	</channel>
</rss>
