<?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"
	>

<channel>
	<title>刀刀 &#124; Python,Nginx,Linux,FreeBSD</title>
	<atom:link href="http://tech.foolpig.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.foolpig.com</link>
	<description></description>
	<pubDate>Mon, 12 Dec 2011 09:22:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>traceroute和tracert的区别</title>
		<link>http://tech.foolpig.com/2011/12/12/tracert_traceroute/</link>
		<comments>http://tech.foolpig.com/2011/12/12/tracert_traceroute/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 09:22:34 +0000</pubDate>
		<dc:creator>foolpig</dc:creator>
		
		<category><![CDATA[东写西读]]></category>

		<category><![CDATA[tracepath]]></category>

		<category><![CDATA[traceroute]]></category>

		<category><![CDATA[tracert]]></category>

		<guid isPermaLink="false">http://tech.foolpig.com/?p=366</guid>
		<description><![CDATA[windows下的tracert和linux/BSD/router下的traceroute都用于探测数据包从源到目的经过路由的IP，但两者探测的方法却有差别。
默认情况下，tracert是向目的地址发出ICMP请求回显数据包，而traceroute是向目... ]]></description>
			<content:encoded><![CDATA[<p>windows下的tracert和linux/BSD/router下的traceroute都用于探测数据包从源到目的经过路由的IP，但两者探测的方法却有差别。<br />
默认情况下，tracert是向目的地址发出ICMP请求回显数据包，而traceroute是向目的地址的某个端口（大于30000）发送UDP数据报。<br />
两者用于探测的数据类型不同。但他们也有一个共同点：都是通过设置发送包的TTL的值从1开始、逐次增1的方法来探测。</p>
<p>也就是说tracert是ICMP，而traceroute是UDP的</p>
<p>linux 的 traceroute 可加 -I 参数改用 ICMP</p>
<p>PS：tracepath与traceroute差别不大，但是tracepath不能用-n来取消DNS query</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.foolpig.com/2011/12/12/tracert_traceroute/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[转]Linux下实现自动设置SSH代理</title>
		<link>http://tech.foolpig.com/2011/11/15/%e8%bd%aclinux%e4%b8%8b%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e8%ae%be%e7%bd%aessh%e4%bb%a3%e7%90%86/</link>
		<comments>http://tech.foolpig.com/2011/11/15/%e8%bd%aclinux%e4%b8%8b%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e8%ae%be%e7%bd%aessh%e4%bb%a3%e7%90%86/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 02:16:25 +0000</pubDate>
		<dc:creator>foolpig</dc:creator>
		
		<category><![CDATA[东写西读]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[proxy]]></category>

		<category><![CDATA[ssh]]></category>

		<category><![CDATA[代理]]></category>

		<guid isPermaLink="false">http://tech.foolpig.com/?p=365</guid>
		<description><![CDATA[SSH的巨大价值体现在能够配置为代理服务器上。不像在Windows下每次还需要手动登录设置，Linux有很好的工具链能够实现自动设置SSH 代理，就是expect和ssh的联合使用，再加上proxychains，任何程序... ]]></description>
			<content:encoded><![CDATA[<p>SSH的巨大价值体现在能够配置为代理服务器上。不像在Windows下每次还需要手动登录设置，Linux有很好的工具链能够实现自动设置SSH 代理，就是expect和ssh的联合使用，再加上proxychains，任何程序都可以享用代理了，在此我简单介绍一下。</p>
<p>首先要安装expect和openssh，如果没有，Ubuntu下输入apt-get install expect openssh-client即可安装。接下来需要写一段脚本：</p>
<div class="wp_codebox_msgheader"><span class="right"><sup><a title="WP-CodeBox HowTo?" href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank"><span style="color: #99cc00;"><br />
</span></a></sup></span></div>
<div class="wp_codebox">
<table border="0">
<tbody>
<tr id="p19331">
<td id="p1933code1" class="code">
<pre class="bash" style="font-family: monospace;"><span style="font-style: italic; color: #666666;">#!/usr/bin/expect</span>
 <span style="color: #000000; font-weight: bold;">set</span> timeout <span style="color: #000000;">60</span>
spawn <span style="color: #000000; font-weight: bold;">/</span> usr<span style="color: #000000; font-weight: bold;">/</span> bin<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-D</span> 本地端口 <span style="color: #660033;">-g</span> 用户名<span style="color: #000000; font-weight: bold;">@</span> 服务器
expect <span style="color: #7a0874; font-weight: bold;">{</span>
 <span style="color: #ff0000;">"password:"</span> <span style="color: #7a0874; font-weight: bold;">{</span>
send <span style="color: #ff0000;">"密码<span style="color: #000099; font-weight: bold;">/r</span> "</span>
 <span style="color: #7a0874; font-weight: bold;">}</span>
 <span style="color: #7a0874; font-weight: bold;">}</span>
interact <span style="color: #7a0874; font-weight: bold;">{</span>
timeout <span style="color: #000000;">60</span> <span style="color: #7a0874; font-weight: bold;">{</span> send <span style="color: #ff0000;">" "</span> <span style="color: #7a0874; font-weight: bold;">}</span>
 <span style="color: #7a0874; font-weight: bold;">}</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>把上面的中文替换成对应内容，保存为一个脚本文件，例如sshproxy.sh，然后给它执行权限，chmod +x sshproxy.sh。在终端下运行./sshproxy.sh，就会发现自动登录到了服务器上，而且在本地建立了一个socks5代理。而且使用这段脚本还不用担心会被踢，因为每60秒都要发送一个空格表示还在活动。如果把sshproxy.sh放到自动启动，那么以后每次启动都可以自动建立代理了。</p>
<p>这种方法建立的代理是socks5代理，在浏览器中很容易配置使用，但如果其他程序也想用它，而没有代理功能，该怎么办呢？在Windows下面的确不好办（需要各种付费的、不稳定的代理转换工具），而在Linux下一切很简单，只需要一个名叫proxychains的工具。Ubuntu安装方法为 apt-get install proxychains。安装完以后要设置/etc/proxychains.conf文件，删除[ProxyList]后面的内容，然后添加</p>
<div class="wp_codebox_msgheader"><span class="right"><sup><a title="WP-CodeBox HowTo?" href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank"><span style="color: #99cc00;"><br />
</span></a></sup></span></div>
<div class="wp_codebox">
<table border="0">
<tbody>
<tr id="p19332">
<td id="p1933code2" class="code">
<pre class="bash" style="font-family: monospace;">socks5 127.0.0.1 端口</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>把“端口”替换为SSH代理设置的端口。然后在想要运行的程序前加上proxychains ，即可使用代理。例如输入proxychains wget http://www.youtube.com -r，即可给wget设置SSH代理去下载。</p>
<p>正如其名，实际上proxychains是个代理链，我们可以设置多个代理，实现多级跳板连接。用在SSH代理上实在是大才小用了。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.foolpig.com/2011/11/15/%e8%bd%aclinux%e4%b8%8b%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e8%ae%be%e7%bd%aessh%e4%bb%a3%e7%90%86/feed/</wfw:commentRss>
		</item>
		<item>
		<title>mysql老版本官方下载地址</title>
		<link>http://tech.foolpig.com/2011/09/21/mysql-old-version/</link>
		<comments>http://tech.foolpig.com/2011/09/21/mysql-old-version/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 07:31:45 +0000</pubDate>
		<dc:creator>foolpig</dc:creator>
		
		<category><![CDATA[东写西读]]></category>

		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://tech.foolpig.com/?p=364</guid>
		<description><![CDATA[http://downloads.mysql.com/archives/... ]]></description>
			<content:encoded><![CDATA[<p>http://downloads.mysql.com/archives/</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.foolpig.com/2011/09/21/mysql-old-version/feed/</wfw:commentRss>
		</item>
		<item>
		<title>mysql启动部分错误及解决办法</title>
		<link>http://tech.foolpig.com/2011/09/01/mysql-start-error/</link>
		<comments>http://tech.foolpig.com/2011/09/01/mysql-start-error/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 06:50:13 +0000</pubDate>
		<dc:creator>foolpig</dc:creator>
		
		<category><![CDATA[东写西读]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[启动]]></category>

		<category><![CDATA[解决]]></category>

		<category><![CDATA[错误]]></category>

		<guid isPermaLink="false">http://tech.foolpig.com/?p=363</guid>
		<description><![CDATA[1、 install_mysql_db的时候出现“FATAL ERROR: Could not find ./bin/my_print_defaults”
解决办法：指定basedir和datadir
/usr/local/webserver/mysql/scripts/mysql_install_db &#8211;user=mysql &#8211;basedir=/usr/local/webserver/mysql &#8211;da... ]]></description>
			<content:encoded><![CDATA[<p>1、 install_mysql_db的时候出现“FATAL ERROR: Could not find ./bin/my_print_defaults”<br />
解决办法：指定basedir和datadir<br />
/usr/local/webserver/mysql/scripts/mysql_install_db &#8211;user=mysql &#8211;basedir=/usr/local/webserver/mysql &#8211;datadir=/usr/local/webserver/mysql/data</p>
<p>2、启动mysqld_safe的时候出现“Fatal error: Can&#8217;t open and lock privilege tables: Table &#8216;mysql.host&#8217; doesn&#8217;t exist”（可以查看日志的得到）<br />
解决办法：同上，指定datadir<br />
/usr/local/mysql-5.5.11/bin/mysqld_safe &#8211;user=mysql &#8211;datadir=/data/mysql/3306/data &#038;</p>
<p>3、启动mysql的时候出现“[ERROR] Plugin &#8216;InnoDB&#8217; init function returned error.”<br />
原因是以前启动的时候有了innodb的相关信息，只要删除data目录中得ib_logfile0等文件即可</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.foolpig.com/2011/09/01/mysql-start-error/feed/</wfw:commentRss>
		</item>
		<item>
		<title>关于阵列卡的配置参数Cache Policy(缓存策略)</title>
		<link>http://tech.foolpig.com/2011/08/31/raid-cache-policy/</link>
		<comments>http://tech.foolpig.com/2011/08/31/raid-cache-policy/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 08:15:32 +0000</pubDate>
		<dc:creator>foolpig</dc:creator>
		
		<category><![CDATA[东写西读]]></category>

		<category><![CDATA[cache policy]]></category>

		<category><![CDATA[缓存策略]]></category>

		<category><![CDATA[阵列卡]]></category>

		<guid isPermaLink="false">http://tech.foolpig.com/?p=362</guid>
		<description><![CDATA[Read-ahead（预读）启用逻辑驱动器的SCSI预读功能。 可将此参数设为No-Read-Ahead（非预读）、Read-ahead（预读）或Adaptive（自适应）。 默认设置为Adaptive（自适应）。
  *  No-Read-Ahead（非预读）指定控... ]]></description>
			<content:encoded><![CDATA[<p>Read-ahead（预读）启用逻辑驱动器的SCSI预读功能。 可将此参数设为No-Read-Ahead（非预读）、Read-ahead（预读）或Adaptive（自适应）。 默认设置为Adaptive（自适应）。<br />
  *  No-Read-Ahead（非预读）指定控制器在当前逻辑驱动器中不使用预读方式。<br />
  *  Read-ahead（预读）指定控制器在当前逻辑驱动器中使用预读方式。<br />
  *  Adaptive（自适应）指定如果最近两次的磁盘访问出现在连续的扇区内，则控制器开始采用Read-ahead（预读）。 如果所有的读取请求都是随机的，则该算法回复到No-Read-Ahead（非预读），但仍要判断所有的读取请求是否有按顺序操作的可能。<br />
Cache Policy（高速缓存策略） 适合在特定逻辑驱动器上读取。 它并不影响Read ahead（预读）高速缓存。<br />
  *  Cached I/O（高速缓存I/O）指定所有读取数据在高速缓存存储器中缓存。<br />
  *  Direct I/O（直接I/O）指定读取数据不在高速缓存存储器中缓存。 此为默认设置。 它不会代替高速缓存策略设置。数据被同时传送到高速缓存和主机。 如果再次读取同一数据块，则从高速缓存存储器读取<br />
Write Policy（写入策略） 将高速缓存方法设置为回写或通过写。<br />
  *  在Write-back（回写）高速缓存中，当控制器高速缓存已接收到某个事务中的所有数据时，该控制器将数据传输完成信号发送给主机。<br />
  *  在Write-through（通过写）高速缓存中，当磁盘子系统已接收到一个事务中的所有数据时，该控制器将数据传输完成信号发送给主机。<br />
Write-through（通过写）高速缓存与Write-back（回写）高速缓存相比具有数据安全的优势，但Write-back（回写）高速缓存比起Write-through（通过写）又有性能上的优势。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.foolpig.com/2011/08/31/raid-cache-policy/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

