<?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>米糊网 &#187; 技术</title>
	<atom:link href="http://e200.net/archives/category/%e6%8a%80%e6%9c%af/feed" rel="self" type="application/rss+xml" />
	<link>http://e200.net</link>
	<description>生活不能没有追求，不能没有目标</description>
	<lastBuildDate>Tue, 29 Nov 2011 07:41:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>最新翻墙教程：chrome+goagent翻墙</title>
		<link>http://e200.net/archives/399</link>
		<comments>http://e200.net/archives/399#comments</comments>
		<pubDate>Wed, 16 Nov 2011 07:49:00 +0000</pubDate>
		<dc:creator>米糊排骨</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[goagent]]></category>
		<category><![CDATA[翻墙]]></category>

		<guid isPermaLink="false">http://e200.net/?p=399</guid>
		<description><![CDATA[开了tumblr后就想着要写篇翻墙教程，当时想法是只要你知道有墙的存在，即便完完全全在墙内，按照这个零基础教程也能完成翻墙教学，而且我这不会上传任何文件，所有资源均通过官方网站下载。 不幸的是，昨天发现tumblr疑似被墙了，至少我这上不去了（浙江网通），这篇放在墙外的翻墙教程多少显得有点尴尬，只能寄希望于传播了。 本教程主要涉及的工具为chrome+goagent 一、下载安装chrome，并注册gmail邮箱 1、google出的优秀浏览器，还没用上的速速下载。 http://www.google.cn/chrome/intl/zh-CN/landing_chrome.html  2、注册一个gmail邮箱 这一步很关键，后续会多次用到你的gmail邮箱账号。 https://mail.google.com/mail?hl=zh-CN 二、运行“hosts自动更新程序” 1、用安装好的chrome打开网址： https://chrome.google.com/webstore/detail/bcomihljbnefaobillhnajpgompoelme?hl=zh-CN 点击右上角的“启动应用程序”，接受程序自动下载的以“.bat”结尾文件。 如果没有出现下载提示，在chrome里打开新标签页，浏览器正中下方选择“应用程序”，然后点击出现的“Hosts自动更新程序”图标，接受下载。 有时下载的网站不一定能访问，可以在这里直接点击下载脚本文件（这一步需要gmail账号）： https://sandbox.google.com/storage/fgqi/hosts/fgqi.bat 2、运行程序 双击下载好的脚本文件“fgqi.bat” 由于下述步骤要使用到早就被墙掉的google服务，这里需要先更改对应服务的hosts地址。 这一步我们需要更新google服务地址，输入数字“1”并回车。 题外话：输入数字“4”并回车后，能搞定twitter和facebook的基本访问。 三、在GAE里创建app Google App Engine是一个开发、托管网络应用程序的平台，使用Google管理的数据中心。 1、登陆申请网址（这一步需要gmail账号）： https://appengine.google.com/start/createapp 如果上述步骤需要验证手机，输入+86前缀的大陆手机号码后会收到短信，在“Mobile Number”栏里输入你收到短信里的验证码code即可完成验证步骤。 2、创建app 完成验证后界面如下： 在Application Identifier栏输入你要创建的app名称（不支持中文），点击“Check Availability”以确认你要的名称还未被注册过。 为了方便起见，这里用“chaofannet”借代你创建的app名称。（请自行创建，勿对号入座） 下一栏“Application Title” 随便填，后期也可以随便改。 完成后点击页面下方的“Create Application”，如果前面有出现“Terms of Service”即使用条款，则需要在点击“Create Application”前，把使用条款下方的“I accept these terms”打钩。 至此，app创建成功，得到的AppID即chaofannet（借代用）。 四、下载goagent goagent是一个使用Python和Google Appengine SDK编写的代理软件。 登陆goagent官网： https://code.google.com/p/goagent/ 主页最上方即给出了下载链接，可见目前最新版为1.6.3稳定版，下载链接为bit.ly短网址，若无法解析，这里给出解析后的完整下载网址，如下： http://nodeload.github.com/phus/goagent/zipball/1.0 [...]]]></description>
			<content:encoded><![CDATA[<h3><a style="font-size: 14px; font-weight: normal;" name="more"></a>开了tumblr后就想着要写篇翻墙教程，当时想法是只要你知道有墙的存在，即便完完全全在墙内，按照这个零基础教程也能完成翻墙教学，而且我这不会上传任何文件，所有资源均通过官方网站下载。</h3>
<div id="post-body-516646701622802459">
<div>不幸的是，昨天发现tumblr疑似被墙了，至少我这上不去了（浙江网通），这篇放在墙外的翻墙教程多少显得有点尴尬，只能寄希望于传播了。</div>
<p><span id="more-399"></span></p>
<div>本教程主要涉及的工具为chrome+goagent</div>
<div><strong>一、下载安装chrome，并注册gmail邮箱</strong></div>
<div>1、google出的优秀浏览器，还没用上的速速下载。</div>
<div><a href="http://www.google.cn/chrome/intl/zh-CN/landing_chrome.html">http://www.google.cn/chrome/intl/zh-CN/landing_chrome.html</a><strong> </strong></div>
<div>2、注册一个gmail邮箱</div>
<div>这一步很关键，后续会多次用到你的gmail邮箱账号。</div>
<div><a href="https://mail.google.com/mail?hl=zh-CN">https://mail.google.com/mail?hl=zh-CN</a></div>
<div><strong>二、运行“hosts自动更新程序”</strong></div>
<div>1、用安装好的chrome打开网址：</div>
<div><a href="https://chrome.google.com/webstore/detail/bcomihljbnefaobillhnajpgompoelme?hl=zh-CN">https://chrome.google.com/webstore/detail/bcomihljbnefaobillhnajpgompoelme?hl=zh-CN</a></div>
<div>点击右上角的“启动应用程序”，接受程序自动下载的以“.bat”结尾文件。</div>
<div>如果没有出现下载提示，在chrome里打开新标签页，浏览器正中下方选择“应用程序”，然后点击出现的“Hosts自动更新程序”图标，接受下载。</div>
<div>有时下载的网站不一定能访问，可以在这里直接点击下载脚本文件（这一步需要gmail账号）：</div>
<div><a href="https://sandbox.google.com/storage/fgqi/hosts/fgqi.bat">https://sandbox.google.com/storage/fgqi/hosts/fgqi.bat</a></div>
<div>2、运行程序</div>
<div>双击下载好的脚本文件“fgqi.bat”</div>
<div><img src="http://2.bp.blogspot.com/-DTOmaV1bhV0/Tq5QohHkARI/AAAAAAAAABQ/MySUsE8WfPU/s1600/image001.jpg" alt="" /></div>
<div>由于下述步骤要使用到早就被墙掉的google服务，这里需要先更改对应服务的hosts地址。</div>
<div>这一步我们需要更新google服务地址，输入数字“1”并回车。</div>
<div>题外话：输入数字“4”并回车后，能搞定twitter和facebook的基本访问。</div>
<div><strong>三、在GAE里创建app</strong></div>
<div>Google App Engine是一个开发、托管网络应用程序的平台，使用Google管理的数据中心。</div>
<div>1、登陆申请网址（这一步需要gmail账号）：</div>
<div><a href="https://appengine.google.com/start/createapp">https://appengine.google.com/start/createapp</a></div>
<div>如果上述步骤需要验证手机，输入+86前缀的大陆手机号码后会收到短信，在“Mobile Number”栏里输入你收到短信里的验证码code即可完成验证步骤。</div>
<div>2、创建app</div>
<div>完成验证后界面如下：</div>
<div><img src="http://1.bp.blogspot.com/-422JJfP6t10/Tq5Qr_3wxhI/AAAAAAAAABY/CBb_Hf_1fd0/s1600/image002.jpg" alt="" border="0" /></div>
<div>在Application Identifier栏输入你要创建的app名称（不支持中文），点击“Check Availability”以确认你要的名称还未被注册过。</div>
<div>为了方便起见，这里用“chaofannet”借代你创建的app名称。（请自行创建，勿对号入座）</div>
<div>下一栏“Application Title” 随便填，后期也可以随便改。</div>
<div>完成后点击页面下方的“Create Application”，如果前面有出现“Terms of Service”即使用条款，则需要在点击“Create Application”前，把使用条款下方的“I accept these terms”打钩。</div>
<div>至此，app创建成功，得到的AppID即chaofannet（借代用）。</div>
<div><strong>四、下载goagent</strong></div>
<div>goagent是一个使用Python和Google Appengine SDK编写的代理软件。</div>
<div>登陆goagent官网：</div>
<div><a href="https://code.google.com/p/goagent/">https://code.google.com/p/goagent/</a></div>
<div>主页最上方即给出了下载链接，可见目前最新版为1.6.3稳定版，下载链接为bit.ly短网址，若无法解析，这里给出解析后的完整下载网址，如下：</div>
<div><a href="http://nodeload.github.com/phus/goagent/zipball/1.0">http://nodeload.github.com/phus/goagent/zipball/1.0</a></div>
<div>下载后得到的压缩包为“phus-goagent-ed8e710.zip”（对应目前最新的1.6.3稳定版），解压后会得到两个文件夹：“local”和“server”.</div>
<div><strong>五、上传goagent服务端并配置客户端</strong></div>
<div>1、上传服务端</div>
<div>双击打开之前解压后的“server”文件夹，找到并双击运行“uploader.bat”</div>
<div>这时界面提示“AppID:”</div>
<div>输入之前你在Application Identifier栏创建的app名称，如chaofannet</div>
<div><img src="http://2.bp.blogspot.com/-zCuhqpVtuIc/Tq5Qs-ZWZsI/AAAAAAAAABg/q1IYaQ20PaI/s1600/image003.jpg" alt="" /></div>
<div>出现Email提示后输入你的gmail账号，然后是密码。</div>
<div>注意：输入密码时，屏幕上不会出现任何符号，请不用担心，完整正确地输入密码后按回车即可。</div>
<div>上传完毕后会自动关闭。</div>
<div>2、配置客户端</div>
<div>双击打开之前解压后的“local”文件夹，找到并双击打开“proxy.ini”文件，</div>
<div>修改[gae]栏下的appid，将等号后面的“goagent”换成你的AppID，如将原来的“appid = goagent”换成“appid = chaofannet”，其余保持不变。</div>
<div>至此，绝大部分工作已经完成。</div>
<div><strong>六、配置chrome</strong></div>
<div>在chrome下安装Proxy SwitchySharp插件：</div>
<div><a href="https://chrome.google.com/webstore/detail/dpplabbmogkhghncfbfdeeokoefdjegm">https://chrome.google.com/webstore/detail/dpplabbmogkhghncfbfdeeokoefdjegm</a></div>
<div>安装后打开Proxy SwitchySharp插件的选项：</div>
<div><img src="http://3.bp.blogspot.com/-8qzg09ycHaQ/Tq5Qtw4XfbI/AAAAAAAAABo/7-qd1yIi0Uw/s1600/image004.jpg" alt="" /></div>
<div>在“导入/导出”栏目的最下行，“在线恢复备份”栏输入：</div>
<div><a href="https://raw.github.com/phus/phus-config/master/SwitchyOptions.bak">https://raw.github.com/phus/phus-config/master/SwitchyOptions.bak</a></div>
<div>至此，大功告成。</div>
<div><strong>七、翻墙！</strong></div>
<div>1、运行goagent.exe</div>
<div>位于之前解压后的“local”文件夹下</div>
<div>注意：第一次运行可能需要管理员权限。</div>
<div>题外话：我们还可以设置goagent程序开机自启动，除了最原始的手动拖到系统启动栏下，运行“local”文件夹下的“addto-startup.vbs”文件即可。</div>
<div>2、代理翻墙</div>
<div>打开chrom，在右上角Proxy SwitchySharp插件上点击选择GoAgent，如下：</div>
<div><img src="http://3.bp.blogspot.com/-RjIDphTSFPQ/Tq5Qu8xVpUI/AAAAAAAAABw/xy4bVMiF8AA/s1600/image005.jpg" alt="" /></div>
<div>题外话：请无视我的“Telex”代理协议，和本文无关。</div>
<div>至此，已经挂上代理，可以随意浏览墙外世界。</div>
<div>要想换回自己的ip，只需选择上图中的“直接连接”，即不用代理，回归墙内。</div>
<div><strong>八、结束语</strong></div>
<div>Google App Engine并非毫无限制，每个开发者只能拥有10个应用程序，即你最多只能创建并得到10个AppID。（貌似AppID创建了就不能删除)</div>
<div>Google App Engine提供给免费用户的流量是每天1GB.一般应用绝对够了。</div>
<div>登陆<a href="https://appengine.google.com/">https://appengine.google.com/</a> 点击你创建的AppID，可以看到你的流量图，以及每天免费配额还剩多少，如下图，我已经用了1GB中的7%</div>
<div><img src="http://3.bp.blogspot.com/-_opAu0vnj1g/Tq5Qv4fwyvI/AAAAAAAAAB4/Tx8Bg2ASOHo/s1600/image006.jpg" alt="" /></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://e200.net/archives/399/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>让IOU 连接真实网络</title>
		<link>http://e200.net/archives/384</link>
		<comments>http://e200.net/archives/384#comments</comments>
		<pubDate>Wed, 07 Sep 2011 16:26:24 +0000</pubDate>
		<dc:creator>米糊排骨</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[IOU]]></category>
		<category><![CDATA[NETMAP]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://e200.net/?p=384</guid>
		<description><![CDATA[在Ubuntu安装了IOU（从flyxj的虚拟机移植过来）之后，一直不知道如何让IOU连接真实网络，今天上网一路狂收总算有所收获，参见http://certcollection.org/forum/topic/85650-connect-iou-to-actual-interfaces-script/. 首先要在Ubuntu中安装python-libpcap， sudo apt-get install python-libpcap 通过ifconfig命令看看你电脑的网卡标识符是什么，比如我的以太网卡是eth0,无线网卡是wlan0，然后修改./LAB/IFMAP文件，如下： 1&#124;eth0 其中eth0是你要连接电脑的网卡。 最后修改./LAB/NETMAP文件，如下： 1:0/0 2:0/0 1:3/0 3:3/0 2:0/1 3:0/1 1:1/3 2:1/3 3:1/3 1023:1 主要看最后一行，1023:1代表的是你的电脑的网卡eth0，整句话的含义就是将router 1,2,3的以太网口1/3都连接在你电脑网卡的eth0上。 现在到router 1上配置一下e1/3的ip地址，可以设置与你电脑的eth0地址在一个网段，设置好以后你就可以ping通eth0了。]]></description>
			<content:encoded><![CDATA[<p>在Ubuntu安装了IOU（从flyxj的虚拟机移植过来）之后，一直不知道如何让IOU连接真实网络，今天上网一路狂收总算有所收获，参见<a href="http://certcollection.org/forum/topic/85650-connect-iou-to-actual-interfaces-script/">http://certcollection.org/forum/topic/85650-connect-iou-to-actual-interfaces-script/</a>.</p>
<p><span id="more-384"></span></p>
<p>首先要在Ubuntu中安装python-libpcap，</p>
<pre>sudo apt-get install python-libpcap</pre>
<p>通过ifconfig命令看看你电脑的网卡标识符是什么，比如我的以太网卡是eth0,无线网卡是wlan0，然后修改./LAB/IFMAP文件，如下：</p>
<pre>1|eth0</pre>
<p>其中eth0是你要连接电脑的网卡。</p>
<p>最后修改./LAB/NETMAP文件，如下：</p>
<pre>1:0/0 2:0/0
1:3/0 3:3/0
2:0/1 3:0/1
1:1/3 2:1/3 3:1/3 1023:1</pre>
<p>主要看最后一行，1023:1代表的是你的电脑的网卡eth0，整句话的含义就是将router 1,2,3的以太网口1/3都连接在你电脑网卡的eth0上。</p>
<p>现在到router 1上配置一下e1/3的ip地址，可以设置与你电脑的eth0地址在一个网段，设置好以后你就可以ping通eth0了。</p>
]]></content:encoded>
			<wfw:commentRss>http://e200.net/archives/384/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>转：Connect IOU with real networks or dynamips</title>
		<link>http://e200.net/archives/377</link>
		<comments>http://e200.net/archives/377#comments</comments>
		<pubDate>Wed, 07 Sep 2011 14:39:09 +0000</pubDate>
		<dc:creator>米糊排骨</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Dynamips]]></category>
		<category><![CDATA[IOU]]></category>
		<category><![CDATA[NETMAP]]></category>

		<guid isPermaLink="false">http://e200.net/?p=377</guid>
		<description><![CDATA[转自：http://inetpro.org/wiki/Connect_IOU_with_real_networks_or_dynamips This guide provides explanations to a script called iou2net.pl (script is at the end of the article), which allows you to attach IOU instances to real network (interfaces). In its functionality, its similar to what the ioulive tool does. For more information about IOU or ioulive, ask your Cisco SE/AM that provided you with [...]]]></description>
			<content:encoded><![CDATA[<p>转自：<a href="http://inetpro.org/wiki/Connect_IOU_with_real_networks_or_dynamips">http://inetpro.org/wiki/Connect_IOU_with_real_networks_or_dynamips</a></p>
<p>This guide provides explanations to a script called iou2net.pl (script is at the end of the article), which allows you to attach IOU instances to real network (interfaces). In its functionality, its similar to what the ioulive tool does. For more information about IOU or ioulive, ask your Cisco SE/AM that provided you with your copy of IOU, or check out the IOU FAQ from evilrouters.net.<br />
<span id="more-377"></span><br />
Why another script that does nearly the same thing as ioulive? While playing around with IOU, i tried to come up with a way to attach IOU instances to dynamips directly. I managed to get this working for single instances, but came to the conclusion that its best to integrate such functionality in dynagen directly. Unfortunately, Im not a good programmer and have no experience with python, nor the time to dig through the dynagen sources and extend the code. This script is a byproduct of this work, where i tried to document the packet format that IOU uses to communicate between instances. For now, the script allows to attach to real network adapters and tap interfaces, and to communicate through UDP “links” as known from dynamips and qemu.<br />
<span class="Apple-style-span" style="font-weight: bold;"><strong>Contents</strong></span></p>
<pre>1 Installation
    1.1 Dependencies
2 Usage
    2.1 NETMAP
    2.2 Mode of operation / interfaces
      2.2.1 PCAP mode
      2.2.2 TAP mode
      2.2.3 UDP mode
    2.3 Other Options
      2.3.1 Packet Capture
      2.3.2 Logging and Debugging
3 Limitations
4 What works
5 IOU communication
    5.1 General
    5.2 IOU header
    5.3 Interface MAC addresses
6 Script</pre>
<h4><strong>Installation</strong></h4>
<p>The program is written in perl and can be copied directly from the source listing (end of the article) to a file. Make the file executeable with</p>
<pre>chmod +x ./iou2net.pl</pre>
<h5><strong>Dependencies</strong></h5>
<p>iou2net depends on some perl modules. Most of them should come with your default perl distribution. Best case, the extra installation of Net::Pcap should do the trick to satisfy dependencies. On Ubuntu and Debian systems, this is provided with the “libnet-pcap-perl” package. Of course, beside the perl package, you need libpcap too.</p>
<pre>sudo apt-get install libnet-pcap-perl libpcap0.8</pre>
<p>For systems that dont pack the perl module, use CPAN to install it:</p>
<pre>perl -MCPAN -e 'install Net::Pcap'</pre>
<p>Now try to start the script, it should start without any module warnings, printing the help screen:</p>
<pre>./iou2net.pl</pre>
<p>Other dependencies may arise if you do not have tunctl or brctl commands. You can resolve this with the following:</p>
<pre>sudo apt-get install uml-utilities bridge-utils</pre>
<h4><strong>Usage</strong></h4>
<h5><strong>NETMAP</strong></h5>
<p>iou2net will forward frames between a IOU instance and a (real) network adapter. IOU needs a special mapping in its NETMAP file. The interface of the IOU instance you want to forward from has to be listed as a source entry, with a “@&lt;hostname&gt;” suffix at the end. The destination of the mapping will be a pseudo IOU instance number, with a pseudo interface number. iou2net.pl will use this pseudo IOU instance ID to connect to the real IOU instance, and do its frame relaying.</p>
<p>Example NETMAP file:</p>
<pre>10:1/1				11:1/0
10:1/2				12:1/0
10:1/0@iou-test		        20:0/0@iou-test</pre>
<p>The first two mappings are normal connections between IOU instances at the same host (R10, 1/1 &lt;-&gt; R11, 1/0 and R10, 1/2 &lt;-&gt; R12, 1/0). The last one connects interface 1/0 of R10 to pseudo router (instance) 20, interface 0/0.</p>
<p>You can choose any ID (&lt;1024), as long as its not used by any real IOU instance. Specify this ID with the option “-p” when launching the script. Dont use this arbitrary ID for anything else in your mappings/topology. iou2net will need to read through this NETMAP file, to determine the correct mapping. By default, it looks in the current directory for the file NETMAP. If you want to use a file in a different directory (and/or with a different name), use the “-n” option.</p>
<h5><strong>Mode of operation / interfaces</strong></h5>
<p>You must specify where the frames should be forwarded to/received from. The script can operate in either of the 3 modes:</p>
<ul>
<li>PCAP (-i), attaching to real network interfaces</li>
<li>TAP (-t), for a Layer 2 point-to-point connection to a tapX interface</li>
<li>UDP (-u), sending and receving frames over UDP links as seen in dynamips and qemu</li>
</ul>
<p>At least pcap and tap mode require super user privileges, so run the script with sudo.</p>
<h6><strong>PCAP mode</strong></h6>
<p>PCAP mode is the preferred method when dealing with traffic from real network interfaces. Just specify the real network interface with the -i option. iou2net.pl will put this interface into promiscuous mode.</p>
<pre>$ sudo ./iou2net.pl -i eth0 -p 20</pre>
<h6><strong>TAP mode</strong></h6>
<p>This is a point-to-point interface type, usually found in Linux and *BSD (tap is for L2, tun is for L3 connections). Its useful especially in bridging configurations. Specify the tap interface with the -t option (full name, like “tap3&#8243;). If the tap interface does not exist already, the script will create it for you.</p>
<pre>$ sudo ./iou2net.pl -t tap0 -p 99</pre>
<p>In any case, you are responsible to bring the tap interface “up”. If desired, you also need to deal with further bridging configuration.</p>
<p>For example, the following setup allows IOU to talk to the local machine and to communicate with the real network attached to eth0. A bridge br0 is created, bridging traffic between eth0 and tap0. Traffic from the host itself lands on br0 and gets forwarded to the bridge member interfaces accordingly.</p>
<pre>tunctl -t tap0
ifconfig eth0 0.0.0.0 promisc up
ifconfig tap0 0.0.0.0 promisc up
brctl addbr br0
brctl stp br0 off
brctl setfd br0 1
brctl sethello br0 1
brctl addif br0 eth0
brctl addif br0 tap0
ifconfig br0 &lt;your host ip settings&gt;
(launch IOU)
iou2net.pl -t tap0 -p 111</pre>
<h6><strong>UDP mode</strong></h6>
<p>For communication with other programs that provide UDP connectors (like dynamips NIO_udp), use this mode. The argument -u requires a port mapping format. It can be just “source-port:remote-port” for links that are local to the host that runs both applications.</p>
<p>It also can be of “source-port:remote-host:remote-port”, if communication between applications on different hosts, across a network, is desired. remote-host must be an IP address or a resolveable hostname/FQDN.</p>
<pre>$ sudo ./iou2net.pl -u 23001:192.0.2.20:23000 -p 12</pre>
<p>Note that the port scheme is always as seen by IOU. In the remote application, you have to specify the ports in reverse meaning – spt:23000 and dpt:23001 from the example above.</p>
<h5><strong>Other Options</strong></h5>
<h6><strong>Packet Capture</strong></h6>
<p>With -f &lt;capture file&gt;, the script will write any frame received by IOU and the external connector to a capture file. This file can be opened by wireshark/tshark, even if the script is still running. If the file already exists, it will be overwritten without any warning.</p>
<h6><strong>Logging and Debugging</strong></h6>
<p>Mainly for troubleshooting purposes, the switches -v and -d will turn on chitchat mode. -v will provide some information during the setup phase of the script. When setup is done and the script is ready to do frame forwarding, no further messages will appear.</p>
<p>-d will do the same as -v, but print the frame header of any received and sent frame during runtime.</p>
<h4><strong>Limitations</strong></h4>
<ul>
<li>This is only tested with Linux so far. Im sure it will run at other modern Unices, too. From perl perspective, porting this to windows is a possible, yet a pointless approach, because there is no IO_W_ (afaik).</li>
<li>The script focusses on Ethernet connectivity. Bridging together Serial interfaces works for udp links. The packet capture and the debug output are not useable without additional translation, because the interpretation of the header format is not aware of serial encapsulation protocols.</li>
<li>With the current implementation, TAP mode will not work on *BSD</li>
<li>For the NETMAP mapping line that is related with iou2net.pl pseudo ID, you must use id:x/y interface notation and not the “compressed” id:z format. Its just a matter of implementation in the script, im too lazy to add this.</li>
<li>There is not much sanity checking. The last occurence of a line that contains the pseudo ID as a destination is used, no matter how many other mappings with this ID exist before in the NETMAP file. These are typos anyway (see next limitation).</li>
<li>A single instance of this script will handle one IOU &lt;-&gt; network mapping. If you, for example, have multiple NICs in your systems and therefore want multiple IOU interfaces to be forwarded, you must launch multiple instances of the script. Every mapping must get a unique pseudo ID as the destination, and every instance of the script must be started by adding this unique ID.</li>
</ul>
<p>Example:</p>
<pre>$ cat NETMAP</pre>
<pre>10:1/0@iou-test		20:0/0@iou-test
10:1/1@iou-test		21:0/0@iou-test
11:1/0@iou-test		22:0/0@iou-test
[...]

$ sudo ./iou2net.pl -i eth0 -p 20 &amp;
[...]
$ sudo ./iou2net.pl -i eth1 -p 21 &amp;
[...]
$ sudo ./iou2net.pl -u 12001:12000 -p 22 &amp;
[...]</pre>
<ul>
<li>Run all your IOU instances as the same user, otherwise you end up with different “netio” subdirectories in /tmp, and your IOU instances cannot talk to each other. The script needs to know the real uid of the user, therefore you should invoke iou2net.pl with sudo, from the same user that runs the IOU instances.</li>
</ul>
<h4>What works</h4>
<p>I’ve done some quick tests with a local IOU instance, one Ethernet interface bridged to a real network where a c1841 is located</p>
<ul>
<li>Basic communication at layer 2 and 3 (Ethernet), up to MTU of 1500</li>
<li>OSPF adjacency over Broadcast segment (multicast)</li>
<li>ISIS adjacency</li>
<li>LDP adjacency</li>
<li>MPLS encapsulation over Ethernet (@1500 byte [MPLS] MTU, no baby giant/jumbo frame support)</li>
<li>IPv6 auto discovery</li>
<li>various connectivity tests toward v4 and v6 Internet</li>
<li>attaching IOU to dynamips</li>
<li>using a bridge configuration on Linux with tap interfaces, to talk to the host that serves IOU</li>
<li>communication between dynamips and IOU running at different hosts, with UDP connectors</li>
</ul>
<h4>IOU communication</h4>
<h5>General</h5>
<p>In this chapter, i will outline the packet format and methods IOU uses when communicating outside of an IOU instance.</p>
<p>Inter-instance communication is done through UNIX domain sockets. These are created in the subdirectory “/tmp/netio&lt;uid&gt;”, with a numeric filename that corresponds to &lt;instance ID&gt;. You can sniff this traffic with strace, like</p>
<pre>$ strace -e sendto,recvfrom -xx -o capturefile.txt &lt;your IOU command line&gt;</pre>
<h5>IOU header</h5>
<p>When sending frames, IOU will submit the entire L2 frame, prepended with a IOU proprietary header. This header is required at the receiving instance, to make the distinction to which local interface the frame is destined to. This is important, because the sockets are per instance (router) and have no way to decide to which internal interface to forward to (whithout extra logic that looks at MAC addresses etc.).</p>
<p>Furthermore, IOU does sanity checks with this header. When receiving a frame, the source information (sending ID, sending interface) is checked against the mappings that were read from the NETMAP file. It is not possible to send frames to an instance with valid destination ID and interface numbers and faked/unknown source information; the source ID and interface numbers have to match also.</p>
<p>The header format is described in the script. I cannot say if the last two bytes are really a delimiter that is always 0×0100, or if these fields serve a different purpose.</p>
<p>The script walks through the NETMAP file and determines the correct mapping, extracts the source IOU instance ID and its interface numbers. As discussed above, this is important for constructing the IOU header. Then it creates a socket $iou_pseudo_sock for out IOU pseudo ID (the destination), the real IOU instance (the source) will send its frames to this socket. This socket will be read- and writeable by anyone, since this script runs as root, where you usually run IOU as a normal user. Furthermore, we bind to the socket of the source IOU instance ($iou_router_sock). The IOU header that is used when sending frames to the real IOU instance is now prebuild, all the required information is available. Next, the mode of operation is determined and sender/receiver logic is invoked.</p>
<p>For every frame sent by the source IOU instance, we strip off the first 8 bytes (the IOU header), and transmit the frame.</p>
<p>When receiving a frame from the external network, the precomputed IOU header will be prepended, and the resulting frame is sent to the socket of the source IOU instance.</p>
<h5>[<a href="http://inetpro.org/wiki/index.php?title=Connect_IOU_with_real_networks_or_dynamips&amp;action=edit&amp;section=17">edit</a>]Interface MAC addresses</h5>
<p>IOU uses self-gererated MAC addresses for its interfaces. If an interface maps only to other IOU instances at the local host, it will have an OID of AA:BB:CC. Whether communication is internal or not is determined through the mappings in the NETMAP file. Any mapping that does not have a “@…” suffix is considered internal.</p>
<p>For interfaces that require external communication – mappings that have a “@…” suffix in the NETMAP file – a different interface MAC address is generated by IOU. The format is documented in the script. The script caclulates the MAC address of the source IOU instance and its interface, to generate a capture filter in PCAP mode. Because the real network interface card is put into promiscuous mode, this filter ensures that only useful traffic is seen by IOU (unicasts destined to its MAC, broadcasts, multicasts).</p>
<p>This MAC addresses generation has another implication. If you run the same IOU instance ID at different hosts, and you bridge the same interfaces together, you end up with duplicated MAC addresses (assuming both users running IOU use the same UID). Even if you use different IOU interfaces for external bridging, you may end up with odd results, because IOU may consider the MAC from the remote instance to be local (same IOU instance ID). Therefore, make IOU instance IDs unique across all your installations.</p>
<h4>Script</h4>
<pre>#!/usr/bin/perl

use strict;
use warnings;
use Getopt::Long;
use Net::Pcap;
use IO::Select;
use IO::Socket;
use IO::File;
use Time::HiRes qw(gettimeofday);

my $version      = "v0.4";
my $version_date = "22-Apr-2011";

###################################################################################
# CHANGES
# =======
#
# v0.4, 22-Apr-2011
# -----------------
# - for frame read, switched from fork to select
# - added bridging via udp links and tap interfaces
# - encoding issues hopefully fixed
# - more sane construction of IOU header and MAC address
# - verbose output
# - packet trace output (MAC headers)
# - writing traffic to pcap file
#
# v0.31, 28-Jan-2011
# -----------------
# - MAC address is now in "ether" format (bytes separated with ":") for building
#   the capture filter
#
# v0.3, 27-Jan-2011
# -----------------
# - better capture filter handling, after understanding how IOU generates
#   MAC addresses (related code is still ugly)
# - hostnames with hyphen are now accepted
#
# v0.21, 26-Jan-2011
# -----------------
# - changed socket_base handling after receiving hint that "1000" is the uid
#   that IOU is started with</pre>
<p>&nbsp;</p>
<pre>#
# v0.2, 24-Jan-2011
# -----------------
# - added pcap filter to allow for better performance on busy nics
#
# v0.1, 23-Jan-2011
# -----------------
# - first release
#
###################################################################################

my $help = &lt;&lt;EOF;

iou2net.pl: bridge between iou and real networks (IOUlive replacement)

usage:
iou2net.pl 	[-vd] [-f capture file] [-i interface]  [-n netmapfile]
		[-p instance ID] [-t interface] [-u portmap]

NOTE:	-&gt; You _must_ launch IOU before starting this script.
	-&gt; -i, -t  or -u, and -p are required as a bare minimum.
	-&gt; Most operation require super user privileges; use sudo or run as
	   root.

-v
	Optional, provides verbose output

-d
	Optional, provides debug output (verbose + prints frame headers)

-f
	optional, write frames to a capture file that can be opened with
	wireshark

-i interface (PCAP mode)
	Specify the interface you want to bridge to. This makes the script
	to run in PCAP mode.

-n NETMAP file
	Optional. Per default, the script tries to open ./NETMAP. If you
	want to use a NETMAP file located elsewhere, use this argument.

-p instance ID
	IOU requires a pseudo instance. When bridging your IOU router
	interface, specify an unused ID as the target in your NETMAP file,
	like

	1:2/1\@hostname    666:1/0\@hostname

	666 is the pseudo IOU instance ID, hostname is the host where IOU
	and the script runs at. When starting the script, use -p 666 then.
	After launching the IOU router instance #1, use interface 2/1 for
	external connectivity. The Interface 1/0 at the pseudo instance
	does not have any practical meaning for router configuration.

-t interface (TAP mode)
	Specify the tap interface you want to attach to. This makes the script
	to run in TAP mode. If the interface does not exist, the script will
	create it, otherwise it will attach to it. You are responsible to
	have the interface in an "up" state and for any additional bridging
	that may be required.

-u portmap (UDP mode)
	Will establish communication through UDP links (dynamips, qemu).
	Portmap has the following format:

	(1) source-port:dest-port	or
	(2) source-port:remote_host:dest-port

	The first variant is used for UDP communication at the local host
	only (target runs at the same host).
	The second variant allows to communicate with a target that runs at
	a remote system. &lt;remote_host&gt; must be an IP address or a resolveable
	hostname/FQDN.
	Port numbers are always from a local (IOU) perspective, therefore
	they are the reverse of what gets defined at the target system.

CAVEATS: For now, you need to use x/y interface format in the NETMAP file, at
least for the mapping this script requires. Also, for bridging multiple router
interfaces, separate instances of this script must be launched, and you need
an unique pseudo IOU ID per instance.

EOF

my $err;
my $verbose;
my $debug;
my $pcap_recv_data;
my $iou_recv_data;
my $iou_header;
my $iface;
my $netmap_file = "./NETMAP";
my $netmap_handle;
my $uid;
my $socket_base;
my $iou_pseudo_sock;
my $iou_router_sock;
my $pseudo_instance;
my $pseudo_instance_interface_major;
my $pseudo_instance_interface_minor;
my $iou_instance;
my $iou_interface_major;
my $iou_interface_minor;
my $select_handle;
my $pcap;
my $pcap_filter;
my $udp_conn;
my $udp_shost;
my $udp_dhost;
my $udp_spt;
my $udp_dpt;
my $udp_listener;
my $tap;
my $tap_handle;
my $cap_file;
my $cap_handle;
my $cap_dumper;

GetOptions(
    'help' =&gt; sub { print "$help"; exit(0); },
    'v+'   =&gt; \$verbose,
    'd+'   =&gt; \$debug,
    'i=s'  =&gt; \$iface,
    'n=s'  =&gt; \$netmap_file,
    'p=i'  =&gt; \$pseudo_instance,
    'u=s'  =&gt; \$udp_conn,
    't=s'  =&gt; \$tap,
    'f=s'  =&gt; \$cap_file
);

print "iou2net.pl, Version $version, $version_date.\n";

die "\nPlease provide -i, -t or -u, and -p!\n$help"
  unless ( ( $iface || $udp_conn || $tap ) &amp;&amp; $pseudo_instance );

$verbose = 1 if $debug;

# socket directory is a directory below $TMPDIR (/tmp), composed of "netio" plus
# uid of the user that runs the iou binary
# since we assume this script gets invoked with sudo by most people:
# try to be smart about getting real UID, $&lt; does not (always?) return real uid when using sudo

$uid         = $ENV{SUDO_UID};
$uid         = $&lt; unless ( defined $uid );    # apparently not started with sudo
$socket_base = "/tmp/netio$uid";
print "UID: $uid\n"                           if $verbose;
print "Socket base directory: $socket_base\n" if $verbose;

open( netmap_handle, $netmap_file )
  or die "Can't open netmap file $netmap_file\n";

# walk through NETMAP file and try to determine the source IOU instance
while (&lt;netmap_handle&gt;) {

    # stop when there is a match for our pseudo instance ID as the destination
    next
      if !(
              $_ =~
m/^\d+:\d+\/\d+@[\w-]+[ \t]+$pseudo_instance:\d+\/\d+@[\w-]+(\s|\t)*$/
      );
    my $inputline = $_;
    chomp($inputline);

    print "Found valid mapping line in NETMAP: $inputline\n" if $verbose;

    # ignore any hostname statements
    $inputline =~ s/\@[\w-]+//g;

    my @connline = split( /[ \t]+/, $inputline );
    $connline[0] =~ s/(\s\t)*//g;
    $connline[1] =~ s/(\s\t)*//g;
    my @iou_src = split( /:/, $connline[0] );
    my @iou_dst = split( /:/, $connline[1] );
    $iou_instance = $iou_src[0];
    ( $iou_interface_major, $iou_interface_minor ) = split( /\//, $iou_src[1] );
    ( $pseudo_instance_interface_major, $pseudo_instance_interface_minor ) =
      split( /\//, $iou_dst[1] );
}
close(netmap_handle);
print
"Using pseudoinstance $pseudo_instance, interface $pseudo_instance_interface_major/$pseudo_instance_interface_minor\n"
  if $verbose;

die
"Could not find any valid mapping for IOU pseudo instance $pseudo_instance in NETMAP file"
  unless ( ( defined $iou_instance )
    &amp;&amp; ( defined $iou_interface_major )
    &amp;&amp; ( defined $iou_interface_minor )
    &amp;&amp; ( defined $pseudo_instance_interface_major )
    &amp;&amp; ( defined $pseudo_instance_interface_minor ) );

# unlink socket for IOU pseudo instance
unlink "$socket_base/$pseudo_instance";

# create socket for IOU pseudo instance
$iou_pseudo_sock = IO::Socket::UNIX-&gt;new(
    Type     =&gt; SOCK_DGRAM,
    Listen   =&gt; 5,
    Local    =&gt; "$socket_base/$pseudo_instance"
) or die "Can't create IOU pseudo socket\n";

# availability to read shall be queried through select()
$select_handle = IO::Select-&gt;new();
$select_handle-&gt;add($iou_pseudo_sock);

# allow anyone to read and write
chmod 0666, "$socket_base/$pseudo_instance";

print "Created pseudo IOU socket at $socket_base/$pseudo_instance\n"
  if $verbose;

# attach to real IOU instance
$iou_router_sock = IO::Socket::UNIX-&gt;new(
    Type =&gt; SOCK_DGRAM,
    Peer =&gt; "$socket_base/$iou_instance"
) or die "Can't connect to IOU socket at $socket_base/$iou_instance\n";
print "Attached to real IOU socket at $socket_base/$iou_instance\n" if $verbose;

# precompute IOU header
# IOU header format
# Pos (byte)    value
# ==============================================================
# 00 - 01       destination (receiving) IOU instance ID
# 02 - 03       source (sending) IOU instance ID
# 04            receiving interface ID
# 05            sending interface ID
# 06 - 07       fixed delimiter, looks like its always 0x01 0x00
#
#               interface ID = &lt;major int number&gt; + (&lt;minor int number&gt; * 16)

$iou_header = pack( "nnCCH4",
    $iou_instance,
    $pseudo_instance,
    ( $iou_interface_minor &lt;&lt; 4 ) | $iou_interface_major,
    ( $pseudo_instance_interface_minor &lt;&lt; 4 ) |
      $pseudo_instance_interface_major,
    "0100" );

print "Precomputed IOU Header: ", unpack( "H*", $iou_header ), "\n" if $verbose;

# provide a clean exit
$SIG{INT} = \&amp;caught_sigint;

# Open capture file
if ( defined $cap_file ) {
    $cap_handle = Net::Pcap::pcap_open_dead( DLT_EN10MB, 1500 );
    $cap_dumper = Net::Pcap::pcap_dump_open( $cap_handle, $cap_file )
      or die "Cant open capture file: $!";
    print "Opened file $cap_file for packet dump.\n" if $verbose;
}

# Determine Mode and setup sender and receiver logic
if ( defined $iface ) {
    print "Working in pcap mode.\n" if $verbose;

    # construction of IOU MAC address for external connectivity
    # Pos (byte)            value
    # ==============================================================
    # 0 (high nibble)       from IOU instance ID (2 bytes, only 10 bits used),
    #                       the two least significant bits from the high byte
    #                       are taken and shifted one bit left
    # 0 (low nibble)        always 0xE
    # 1 - 3                 UID of the user that runs the IOU instance
    # 4                     low byte of the IOU instance ID
    # 5                     interface ID
    #
    # for x64 systems, binary math works well, like
    # $mac = (((($iou_instance &amp; 0x0300) &lt;&lt; 1 ) &lt;&lt; 36 ) + 0xE0000000000 );
    # $mac += $uid &lt;&lt; 16;
    # $mac += ($iou_instance &amp; 0xFF) &lt;&lt; 8;
    # $mac += ($iou_interface_minor &lt;&lt; 4) + $iou_interface_major;

    my $macstring;
    $macstring = pack( "CH6CC",
        ( ( $iou_instance &gt;&gt; 7 &amp; 6 ) &lt;&lt; 8 ) + 0xE,
        unpack( "xH6", pack( "N", 0xFF000000 ^ $uid ) ),
        $iou_instance &amp; 0xFF,
        ( $iou_interface_minor &lt;&lt; 4 ) | $iou_interface_major );

    $macstring = uc( join( ":", unpack( "(H2)*", $macstring ) ) );

    print "Using MAC $macstring.\n" if $verbose;

    # bind to network interface, promiscuous mode
    $pcap = Net::Pcap::open_live( $iface, 1522, 1, 1, \$err );
    die "pcap: can't open device $iface: $err (are you root?)\n"
      unless ( defined $pcap );

    # build a capture filter for IOU interface MAC address
    # this will match only what is destined to $macstring, plus multicasts
    # and broadcasts
    Net::Pcap::compile( $pcap, \$pcap_filter,
        '(ether[0] &amp; 1 = 1) or (ether dst ' . $macstring . ')',
        0, 0xFFFFFFFF )
      &amp;&amp; die 'Unable to compile capture filter';
    Net::Pcap::setfilter( $pcap, $pcap_filter )
      &amp;&amp; die 'Unable to assign capture filter';
    print "Capture filter set: (ether[0] &amp; 1 = 1) or (ether dst '"
      . $macstring . "')\n"
      if $verbose;

    print
"Forwarding frames between interface $iface and IOU instance $iou_instance, int $iou_interface_major/$iou_interface_minor (MAC: $macstring) -  press ^C to exit\n";

    while (1) {

        if ( grep { $_ eq $iou_pseudo_sock } $select_handle-&gt;can_read(0.001) ) {

            # IOU frame received via pseudo ID socket
            $iou_pseudo_sock-&gt;recv( $iou_recv_data, 1522 );
            log_iou_frame( "R:I-&gt;P", $iou_recv_data ) if $debug;

            $iou_recv_data = unpack( "x8a*", $iou_recv_data );

            # send IOU generated frame to real network
            Net::Pcap::sendpacket( $pcap, $iou_recv_data );
            write_pcap_dump($iou_recv_data) if $cap_dumper;
            log_frame( "S:I-&gt;P", $iou_recv_data ) if $debug;
        }
        else {

            my %pcap_hdr;
            my $return =
              Net::Pcap::pcap_next_ex( $pcap, \%pcap_hdr, \$pcap_recv_data );
            if ( $return eq 1 ) {
                write_pcap_dump($pcap_recv_data) if $cap_dumper;
                log_frame( "R:P-&gt;I", $pcap_recv_data ) if $debug;

                # add IOU header in front of the received frame
                # and send frame to IOU socket
                $iou_router_sock-&gt;send(
                    pack( "a*a*", $iou_header, $pcap_recv_data ) );
                log_iou_frame( "S:P-&gt;I",
                    pack( "a*a*", $iou_header, $pcap_recv_data ) )
                  if $debug;

            }
        }
    }
}
elsif ( defined $udp_conn ) {

    # accept localport:remotehost:remoteport, or localport:remoteport
    if ( $udp_conn =~ m/^\d+:\d+$/ ) {
        ( $udp_spt, $udp_dpt ) = split( /:/, $udp_conn );
        $udp_shost = $udp_dhost = "127.0.0.1";
    }
    elsif ( $udp_conn =~ m/^\d+:[\w\.]+:\d+$/ ) {
        ( $udp_spt, $udp_dhost, $udp_dpt ) = split( /:/, $udp_conn );
        $udp_shost = "";
    }
    else {
        die "UDP port format doesnt match";
    }

    print "Working in UDP mode.\n" if $verbose;

    # bind to udp port
    $udp_listener = IO::Socket::INET-&gt;new(
        Proto     =&gt; "udp",
        LocalPort =&gt; $udp_spt,
        LocalAddr =&gt; $udp_shost,
        PeerPort  =&gt; $udp_dpt,
        PeerAddr  =&gt; $udp_dhost
    ) or die "Can't bind to UDP port.\n";

    print
"Forwarding frames between UDP ports local:$udp_spt, $udp_dhost:$udp_dpt and IOU instance $iou_instance, int $iou_interface_major/$iou_interface_minor -  press ^C to exit\n";

    $select_handle-&gt;add($udp_listener);

    while (1) {
        my ($readable) =
          IO::Select-&gt;select( $select_handle, undef, undef, 0.001 );

        foreach my $socket (@$readable) {
            if ( $socket == $iou_pseudo_sock ) {

                # IOU frame received via pseudo ID socket
                $iou_pseudo_sock-&gt;recv( $iou_recv_data, 1522 );
                log_iou_frame( "R:I-&gt;U", $iou_recv_data ) if $debug;

                $iou_recv_data = unpack( "x8a*", $iou_recv_data );

                # send IOU generated frame via udp
                $udp_listener-&gt;send($iou_recv_data);
                write_pcap_dump($iou_recv_data) if $cap_dumper;
                log_frame( "S:I-&gt;U", $iou_recv_data ) if $debug;
            }
            else {
                $udp_listener-&gt;recv( $iou_recv_data, 1522 );
                write_pcap_dump($iou_recv_data) if $cap_dumper;
                log_frame( "R:U-&gt;I", $iou_recv_data ) if $debug;

                $iou_router_sock-&gt;send(
                    pack( "a*a*", $iou_header, $iou_recv_data ) );
                log_iou_frame( "S:U-&gt;I",
                    pack( "a*a*", $iou_header, $iou_recv_data ) )
                  if $debug;
            }
        }
    }
}
elsif ( defined $tap ) {

    print "Working in TAP mode.\n" if $verbose;

    # get file handle
    $tap_handle = IO::File-&gt;new( "/dev/net/tun", O_RDWR )
      or die "Cannot open /dev/net/tun";

    # make it tap (not tun)
    my $ifr = pack( 'Z16s', $tap, 0x1002 );
    ioctl $tap_handle, 0x400454ca, $ifr
      or die "Can't ioctl() on device $tap: $!";

    print
"Forwarding frames between TAP interface $tap and IOU instance $iou_instance, int $iou_interface_major/$iou_interface_minor -  press ^C to exit\n";

    $select_handle-&gt;add($tap_handle);

    while (1) {
        my ($readable) =
          IO::Select-&gt;select( $select_handle, undef, undef, 0.001 );

        foreach my $socket (@$readable) {
            if ( $socket == $iou_pseudo_sock ) {

                # IOU frame received via pseudo ID socket
                $iou_pseudo_sock-&gt;recv( $iou_recv_data, 1522 );
                log_iou_frame( "R:I-&gt;T", $iou_recv_data ) if $debug;

                $iou_recv_data = unpack( "x8a*", $iou_recv_data );

                # send IOU generated frame via udp
                $tap_handle-&gt;syswrite($iou_recv_data);

                write_pcap_dump($iou_recv_data) if $cap_dumper;
                log_frame( "S:I-&gt;T", $iou_recv_data ) if $debug;
            }
            else {
                $tap_handle-&gt;sysread( $iou_recv_data, 1522 );
                write_pcap_dump($iou_recv_data) if $cap_dumper;
                log_frame( "R:T-&gt;I", $iou_recv_data ) if $debug;

                $iou_router_sock-&gt;send(
                    pack( "a*a*", $iou_header, $iou_recv_data ) );
                log_iou_frame( "S:T-&gt;I",
                    pack( "a*a*", $iou_header, $iou_recv_data ) )
                  if $debug;
            }
        }
    }

}
else {

    # catchall, we really shouldnt land here
    print "No valid mode of operation selected.\n\n$help";
    caught_sigint();
}

sub caught_sigint {
    print "\n...stopped.\n";
    print "Cleaning up.\n";
    $select_handle-&gt;remove( $select_handle-&gt;handles );

    if ( defined $pcap ) {
        Net::Pcap::breakloop($pcap);
        Net::Pcap::close($pcap);
        print "Closed pcap receiver loop.\n" if $verbose;
    }
    if ( defined $udp_listener ) {
        $udp_listener-&gt;close;
        print "Closed udp listener.\n" if $verbose;
    }
    if ($tap_handle) {
        $tap_handle-&gt;close;
        print "Closed tap handle.\n" if $verbose;
    }
    if ($cap_handle) {
        Net::Pcap::pcap_dump_flush($cap_dumper);
        Net::Pcap::pcap_dump_close($cap_dumper);
        print "Closed dump file.\n" if $verbose;
    }

    $iou_pseudo_sock-&gt;close;
    $iou_router_sock-&gt;close;

    exit(0);
}

sub log_frame {
    my ( $direction, $frame ) = @_;
    return if ( length($frame) &lt; 14 );

    # Print direction, source mac, destination mac and ethertype
    print "$direction                      S ",
      join( ":", unpack( "x6(H2)6", $frame ) ),
      " D ",
      join( ":", unpack( "(H2)6", $frame ) ),
      " T ",
      unpack( "x12H4", $frame ),
      "\n";
}

sub log_iou_frame {
    my ( $direction, $frame ) = @_;
    return if ( length($frame) &lt; 22 );

    # Print direction, IOU header, source mac, destination mac and ethertype
    print "$direction IOU ",
      unpack( "H16", $frame ),
      " S ",
      join( ":", unpack( "x14(H2)6", $frame ) ),
      " D ",
      join( ":", unpack( "x8(H2)6", $frame ) ),
      " T ",
      unpack( "x20H4", $frame ),
      "\n";
}

sub write_pcap_dump {
    my $frame = shift @_;
    my %header;
    $header{len} = $header{caplen} = length($frame);
    ( $header{tv_sec}, $header{tv_usec} ) = gettimeofday();
    Net::Pcap::pcap_dump( $cap_dumper, \%header, $frame );
    Net::Pcap::pcap_dump_flush($cap_dumper);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://e200.net/archives/377/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>转载：Cisco IOU迁移至RHEL 6.1</title>
		<link>http://e200.net/archives/372</link>
		<comments>http://e200.net/archives/372#comments</comments>
		<pubDate>Wed, 07 Sep 2011 14:05:24 +0000</pubDate>
		<dc:creator>米糊排骨</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Dynamips]]></category>
		<category><![CDATA[IOU]]></category>
		<category><![CDATA[NETMAP]]></category>

		<guid isPermaLink="false">http://e200.net/?p=372</guid>
		<description><![CDATA[听说IOU可以比Dynamips节省CPU资源，马上谷歌搜取大量教程、软件，首先在VMware下尝试了一下，启了6台路由器、4台交换机，CPU运行依然平稳，果然比Dynamips运行的爽多了，我可是在X60s上运行的，马上想到移植到Ubuntu 11.04，教程内方法有效，移植比较顺利，特此收藏！ 文章转自：http://wesleyou.blog.51cto.com/3189109/591931 一、     IOU简介 Cisco IOU （Cisco IOS On Unix），IOU基于unix/linux环境，比之GNS3、小凡都要节省不少系统资源。 IOU包括以下文件： i86bi_linux-adventerprisek9-ms                  // 带有IOS高级特性的IOU i86bi_linux-ipbase-ms                          // 带有基本的IP路由功能的IOU i86bi_linux-tpgen+ipbase-ms.PAGENT.4.7.0         // 带有基本的IP路由功能和流量生成工具的IOU i86bi_linuxl2-upk9-ms.M                       // 带layer 2功能的IOU， iourc                                       // license文件 NETMAP                                     // topology文件 wrapper-linux                                // IOU的管理控制器   二、     IOU的使用方法 1.   wrapper-linux的使用： ./wrapper-linux [-v] –m&#60;image name&#62; -p&#60;port number&#62; &#8212; &#60;iou options&#62; &#60;router id&#62; where &#60;port number&#62; is in the range &#60;1024-65550&#62; all options after the ‘&#8211;’ are passed to iou [-v] : display [...]]]></description>
			<content:encoded><![CDATA[<p>听说IOU可以比Dynamips节省CPU资源，马上谷歌搜取大量教程、软件，首先在VMware下尝试了一下，启了6台路由器、4台交换机，CPU运行依然平稳，果然比Dynamips运行的爽多了，我可是在X60s上运行的，马上想到移植到Ubuntu 11.04，教程内方法有效，移植比较顺利，特此收藏！<br />
文章转自：<a href="http://wesleyou.blog.51cto.com/3189109/591931">http://wesleyou.blog.51cto.com/3189109/591931</a></p>
<p><span id="more-372"></span><br />
<strong>一、     </strong><strong>IOU</strong><strong>简介</strong></p>
<p>Cisco IOU （Cisco IOS On Unix），IOU基于unix/linux环境，比之GNS3、小凡都要节省不少系统资源。</p>
<p>IOU包括以下文件：</p>
<p>i86bi_linux-adventerprisek9-ms                  // 带有IOS高级特性的IOU</p>
<p>i86bi_linux-ipbase-ms                          // 带有基本的IP路由功能的IOU</p>
<p>i86bi_linux-tpgen+ipbase-ms.PAGENT.4.7.0         // 带有基本的IP路由功能和流量生成工具的IOU</p>
<p>i86bi_linuxl2-upk9-ms.M                       // 带layer 2功能的IOU，</p>
<p>iourc                                       // license文件</p>
<p>NETMAP                                     // topology文件</p>
<p>wrapper-linux                                // IOU的管理控制器</p>
<p><span style="font-family: Batang;"> </span></p>
<p><strong>二、     </strong><strong>IOU</strong><strong>的使用方法</strong></p>
<ol>
<li><strong>1.   </strong><strong>wrapper-linux</strong><strong>的使用：</strong></li>
</ol>
<p>./wrapper-linux [-v] –m&lt;image name&gt; -p&lt;port number&gt; &#8212; &lt;iou options&gt; &lt;router id&gt;</p>
<p>where &lt;port number&gt; is in the range &lt;1024-65550&gt;</p>
<p>all options after the ‘&#8211;’ are passed to iou</p>
<p>[-v] : display version;</p>
<p>-m：指定IOU镜像</p>
<p>-p：指定用于telnet的端口，范围是1024-65550；</p>
<p>&#8211;：用于传递iou的参数。</p>
<p>&nbsp;</p>
<ol>
<li><strong>2.   </strong><strong> IOU</strong><strong>用法：</strong></li>
</ol>
<p>以i86bi开头的文件都能使用一下参数</p>
<p>Usage:&lt;image&gt; [options] &lt;application&gt; id</p>
<p>&lt;image&gt;: unix-js-m | unix-is-m | unix-i-m | …</p>
<p>&lt;application id&gt;: instance identifier (0 &lt; id &lt;= 1024)</p>
<p>Options:</p>
<p>-e &lt;n&gt;     number of Ethernet interface (default 2)  // 指定etherne的模块数量</p>
<p>-s &lt;n&gt;     number of Serial interface (default 2)    // 指定serial的模块数量</p>
<p>-n &lt;n&gt;     Size of nvram in kb (default 16kb)    // 指定nvram的大小，默认16kb</p>
<p>-b &lt;string&gt;  IOS debug string</p>
<p>-c &lt;name&gt;  Configureation file name</p>
<p>-d          Generate debug information</p>
<p>-t          Netio message trace</p>
<p>-q          Supperss informational messages</p>
<p>-h          Display this help</p>
<p>-C         Turn off use of the host clock</p>
<p>-m &lt;n&gt;     Megabytes of router memory (default 128MB)  // 指定路由器的内存，默认128M。</p>
<p>-L         Disable local console,use remote console  // 关闭本地console，开启远程console。</p>
<p>-u&lt;n&gt;      UDP port base for distributed networks   // 基于分布式网络的UDP端口。</p>
<p>-R         Ignore options from the IOURC file     // 忽略IOURC文件</p>
<p>-U         Disable unix: file system location</p>
<p>-W         Dsiable watchdog timer</p>
<p>-N         Ingnore the NETMAP file             // 忽略NETMAP文件</p>
<p>&nbsp;</p>
<p><strong>IOU</strong><strong>举例：</strong></p>
<p>./ i86bi_linux-adventerprisek9-ms  -p 2000 &#8211;  -e 4 –s 4 1</p>
<p>-e 4  // 配置4个Ethernet接口模块，每个模块4个接口，0-3；</p>
<p>-s 4  // 配置4个serial 接口模块，每个模块4个接口，0-3；</p>
<p>1  // 路由器的进程名</p>
<p>Serial为Ethernet+1</p>
<p>在此列中：</p>
<p>Ethernet 16个，e0/0 &#8212;- e3/3；</p>
<p>Serial 16个， s4/0 &#8212;- s7/3。</p>
<p>&nbsp;</p>
<p><strong>wrapper-linux</strong><strong>使用举例：</strong></p>
<p>./wrapper-linux –m  ./ i86bi_linux-adventerprisek9-ms  -p 2000  &#8211;  -e 4 –s 4 1  &amp;</p>
<p><span style="font-family: Batang;"> </span></p>
<p><strong>三、     </strong><strong>用NETMAP建立网络拓扑</strong></p>
<p><strong>NETMAP</strong><strong>文件的书写格式：</strong></p>
<p>路由器实例名：插槽号/该插槽上的接口号</p>
<p><strong> </strong><strong>分布式书写格式：</strong></p>
<p>路由器实例名：插槽号/该插槽上的接口号@IP_Add | Hostname</p>
<p>&nbsp;</p>
<p><strong>NETMAP</strong><strong>实例：</strong></p>
<p>1:0/0  2:0/0</p>
<p>1:0/1  3:0/0</p>
<p>1:0/2  4:0/0</p>
<p>1:4/0@192.168.1.1 2:4/0@192.168.1.2</p>
<p>1:4/1@wesley.org  3:4/1@linux.com</p>
<p>&nbsp;</p>
<p>解析：1:0/0表示第一台路由器ethernet接口，第一个模块的第一个接口，即 e0/0；</p>
<p>1:4/0 表示第一台路由器serial接口，第一个模块的第一个接口，即s4/0。</p>
<p>&nbsp;</p>
<p><strong>四、     </strong><strong>迁移&amp;互通</strong></p>
<p>网上很多IOU基本都是使用cdlinux或者andlinux作为载体的，不是很方便更改top，局限性比较大，况且自己动手丰衣足食嘛。</p>
<p>系统环境：VMware WorkStation 7.14</p>
<p>Red Hat Enterprise Linux 6.1</p>
<p>*Python-2.6</p>
<p>Openssl-0.9.8</p>
<p>IOU文件：L3&amp;L2 IOU</p>
<p>（NETMAP、iourc 、i86bi_linux-adventerprisek9-ms、i86bi_linuxl2-upk9-ms.M 、wrapper-linux、crack.py（破解L2IOU&lt;达人作品，不知何人！&gt;））</p>
<p>&nbsp;</p>
<p><strong>  1</strong><strong>、迁移</strong></p>
<p><strong>  &gt;&gt;&gt;</strong><strong>在RHEL 6.1的root下创建目录：</strong></p>
<p>[root@wesleyou ~]#mkdir cisco_iou</p>
<p>&gt;&gt;&gt;copy IOU文件至cisoc_iou目录：</p>
<p>[root@wesleyou cisco_iou]#cp i86b*  wrap-linux NETMAP iourc cisco_iou</p>
<p><strong>  *&gt;&gt;&gt;</strong><strong>编译安装python-2.6：</strong></p>
<p>[root@wesleyou python2.6]#./configure</p>
<p>[root@wesleyou python2.6]#make &amp; make install</p>
<p>[root@wesleyou python2.6]#make clean</p>
<p><strong>*&gt;&gt;&gt;</strong><strong>添加PATH：</strong></p>
<p>[root@wesleyou python2.6]#export PATH=/usr/local/bin/python2.6:$PATH</p>
<p>注：带*的是指如果服务器python低于2.6的情况下，当然除此之外还有yum、rpm等方法。</p>
<p><strong>&gt;&gt;&gt;</strong><strong>安装openssl：</strong></p>
<p>[root@wesleyou python2.6]# cd ~</p>
<p>[root@wesleyou ~]# rpm –ivh openssl-0.9.8-*.rpm</p>
<p><strong>&gt;&gt;&gt;</strong><strong>连接lib库</strong></p>
<p>[root@wesleyou ~]# ln –s /usr/lib/libcrypto.so.0.9.8e libcrypto.so.4</p>
<p>注：./wrapper-linux 会调用这个库文件，如果没有就会报错。在这很感谢撒加大神提供的解决思路和方法。</p>
<p><strong>  &gt;&gt;&gt;</strong><strong>设置IOU运行级别</strong></p>
<p>[root@wesleyou cisco_iou]# chmod 777 *       // 偷懒的做法</p>
<p><strong>     &gt;&gt;&gt;</strong><strong>破解license</strong></p>
<p>[root@wesleyou cisco_iou]# python ./crack.py</p>
<p>&nbsp;</p>
<p>注：此处很重要，该程序是为了获取license，L3&amp;L2 IOU都能使用。此程序为互联网上流出，何人所写，不清楚，感谢作者的无私奉献。</p>
<p><strong>     &gt;&gt;&gt;</strong><strong>修改iourc</strong></p>
<p>[root@wesleyou cisco_iou]# vi iourc</p>
<p>&nbsp;</p>
<p>License格式：</p>
<p>hostname  = license_number;</p>
<p>准备工作基本上都做完了，至此可以测试一下L3&amp;L2 IOU。测试命令参见上文。</p>
<p>&nbsp;</p>
<p><strong>  2</strong><strong>、搭建拓扑</strong></p>
<p><strong>   </strong></p>
<p>说明：路由器使用L3IOU来模拟，而交换机则都通过L2IOU来模拟，至于PC可以使用L3IOU或者L2IOU皆可。</p>
<p>&nbsp;</p>
<p><strong>    &gt;&gt;&gt;</strong><strong>创建一个放置拓扑文件和启动脚本的目录：</strong></p>
<p>[root@wesley cisco_ou]# mkdir lab01</p>
<p>[root@wesley cisco_ou]# mv NETMAP lab01</p>
<p>[root@wesley cisco_ou]# cd lab01</p>
<p>&nbsp;</p>
<p><strong>&gt;&gt;&gt;</strong><strong>创建拓扑文件</strong></p>
<p>[root@wesley lab01]# vi NETMAP</p>
<p># ! /bin/bash</p>
<p># written by wesley</p>
<p># date:2011/6/17</p>
<p>1:0/0  2:0/0</p>
<p>1:0/1  3:0/0</p>
<p>2:0/1  4:0/0</p>
<p>3:0/1  4:0/1</p>
<p>3:0/2  4:0/2</p>
<p>3:0/3  5:0/0</p>
<p>4:03  6:0/0</p>
<p>&nbsp;</p>
<p><strong>&gt;&gt;&gt;</strong><strong>创建启动脚本：</strong></p>
<p>[root@wesley lab01]# vi start</p>
<p>&nbsp;</p>
<p># !/bin/bash</p>
<p># written by Wesley</p>
<p># and thanks for 撒加、flyxj、残泪、棕鹰、骁鹰&#8230;</p>
<p># anyone who is help me to improve !!!</p>
<p>&nbsp;</p>
<p>export  NETMAP=../lab01/NETMAP           // 设置NEMAP的变量，将其添加至环境中</p>
<p>port=2000                                 // 设置端口变量</p>
<p>for ((i=1;i&lt;7;i++));do</p>
<p>dport=‘expr $port + $i’</p>
<p>../wrapper-linux –m ./ i86bi_linux-adventerprisek9-ms –p $dport &#8212; -e 2 –s 2 –R –U $i &amp;</p>
<p>if (($i&gt;2));then</p>
<p>../wrapper-linux –m ./ i86bi_linuxl2-upk9-ms.M –p $dport &#8212; -e 4 –R –U　$i  &amp;</p>
<p>fi</p>
<p>sleep 2</p>
<p>done</p>
<p>unset NETMAP                       // 将NETMAP从环境变量中取消</p>
<p>&nbsp;</p>
<p><strong>     &gt;&gt;&gt;</strong><strong>创建关闭IOU的stop：</strong></p>
<p>[root@wesleyou cisco_iou]# vi stop</p>
<p>&nbsp;</p>
<p># ！/bin/bash</p>
<p># written by Wesley</p>
<p># and thanks for 撒加、flyxj、残泪、棕鹰、骁鹰&#8230;</p>
<p># anyone who is help me to improve !!!</p>
<p>&nbsp;</p>
<p>kill –HUP ` ps –a | grep wrapper-linux | awk ‘{print $1}’`    // 退出IOU</p>
<p>&nbsp;</p>
<p>注：很多朋友都用的killall，但是我发现使用killall后并不能得到完全释放，当想再次试验的时候会提示地址已被使用。</p>
<p>&nbsp;</p>
<p>最后再次感谢撒加大神、flyxj，残泪、骁鹰、棕鹰等网友的帮助，还要感谢我的领导spy在linux方面对我的指导。</p>
<p>另：恭喜flyxj一次pass IE。</p>
]]></content:encoded>
			<wfw:commentRss>http://e200.net/archives/372/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MS-DOS 30岁啦</title>
		<link>http://e200.net/archives/366</link>
		<comments>http://e200.net/archives/366#comments</comments>
		<pubDate>Fri, 29 Jul 2011 09:21:38 +0000</pubDate>
		<dc:creator>米糊排骨</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://e200.net/?p=366</guid>
		<description><![CDATA[想不到吧，MS-DOS都已经三十了，这个东东于1981年7月27日诞生，至今已经整整30岁了。想当年我也曾经拥有这样的5寸软盘，现在想起来还真是唏嘘。 你偶尔还会用MS-DOS吧？在XP/Win7下，他叫cmd。现在除了技术人员，一般人也最多在重装系统时见到这个东东吧，哦还有 ping 网站啥的。 尽管现在图形界面已经横行，不过还是怀念当年对着单色显示器敲着键盘通宵打游戏的感觉。  包括当年的经典游戏，俄罗斯方块、战斧、三国演义、Doom等等，还记得94年左右小谭同学花了1800元买了一批国外的游戏软件，寄来的是20~30张5寸软盘，那在当年绝对是有钱人的行为，令人羡慕啊。 &#160; MSDOS wiki 1980年，西雅图電腦产品公司（Seattle Computer Products）的一名24岁的程序员蒂姆·帕特森（Tim Paterson）花费了四个月时间编写出了86-DOS操作系统。1981年7月，微软以五萬美元的代價向西雅图公司购得本產品的全部版权，并将它更名为MS-DOS。它成功地成为IBM PC采用的操作系统。 西雅图電腦产品公司后来曾将微软告上法庭，指控微软在购买86-DOS版权时，并未透露IBM是其客户。微软在1986年向西雅图计算机产品公司又支付了100万美元，了结了双方之间的纠纷。]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-363" title="MS-DOS Floppy Disk" src="http://e200.net/files/2011/07/8295_o-251x300.jpg" alt="5寸软盘" width="251" height="300" /><br />
想不到吧，MS-DOS都已经三十了，这个东东于1981年7月27日诞生，至今已经整整30岁了。想当年我也曾经拥有这样的5寸软盘，现在想起来还真是唏嘘。</p>
<p>你偶尔还会用<a title="查看 MS-DOS 的全部文章" href="http://mkv.cn/tag/ms-dos" target="_blank">MS-DOS</a>吧？在XP/Win7下，他叫cmd。现在除了技术人员，一般人也最多在重装系统时见到这个东东吧，哦还有 ping 网站啥的。</p>
<p>尽管现在图形界面已经横行，不过还是怀念当年对着单色显示器敲着键盘通宵打游戏的感觉。  包括当年的经典游戏，俄罗斯方块、战斧、三国演义、Doom等等，还记得94年左右小谭同学花了1800元买了一批国外的游戏软件，寄来的是20~30张5寸软盘，那在当年绝对是有钱人的行为，令人羡慕啊。<br />
<span id="more-366"></span><br />
&nbsp;</p>
<p>MSDOS wiki</p>
<p style="padding-left: 30px;">1980年，西雅图電腦产品公司（Seattle Computer Products）的一名24岁的程序员蒂姆·帕特森（Tim Paterson）花费了四个月时间编写出了86-DOS操作系统。1981年7月，微软以五萬美元的代價向西雅图公司购得本產品的全部版权，并将它更名为<a title="查看 MS-DOS 的全部文章" href="http://mkv.cn/tag/ms-dos" target="_blank">MS-DOS</a>。它成功地成为IBM PC采用的操作系统。</p>
<p style="padding-left: 30px;">西雅图電腦产品公司后来曾将微软告上法庭，指控微软在购买86-DOS版权时，并未透露IBM是其客户。微软在1986年向西雅图计算机产品公司又支付了100万美元，了结了双方之间的纠纷。</p>
]]></content:encoded>
			<wfw:commentRss>http://e200.net/archives/366/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DB120-B1无线网关超级用户的自主设置</title>
		<link>http://e200.net/archives/134</link>
		<comments>http://e200.net/archives/134#comments</comments>
		<pubDate>Sat, 22 May 2010 02:34:26 +0000</pubDate>
		<dc:creator>米糊排骨</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[DB-120]]></category>
		<category><![CDATA[中国电信]]></category>
		<category><![CDATA[商务领航]]></category>
		<category><![CDATA[大亚]]></category>

		<guid isPermaLink="false">http://e200.net/?p=134</guid>
		<description><![CDATA[昨天买了一台DB120-B1，中国电信定制的商务领航E8-B1网关(以下简称e8网关)，本来想刷成公版固件的，拆机看了Flash的型号是MX29LV128的，杯具了，据说是刷了必成砖，只好退而求其次，尽量在现有电信的版本上取消电信定制的限制了，还好网上有很多教程，现在摘抄如下：中国电信的定制终端超级用户名几乎都是：telecomadmin，超级密码也都是：nE7jA%5m；无线网络名称（SSID）的前一部分“ChinaNet-”也不可修改。]]></description>
			<content:encoded><![CDATA[<p>昨天买了一台DB120-B1，中国电信定制的商务领航E8-B1网关(以下简称e8网关)，本来想刷成公版固件的，拆机看了Flash的型号是MX29LV128的，杯具了，据说是刷了必成砖，只好退而求其次，尽量在现有电信的版本上取消电信定制的限制了，还好网上有很多教程，现在摘抄如下：中国电信的定制终端超级用户名几乎都是：telecomadmin，超级密码也都是：nE7jA%5m；无线网络名称（SSID）的前一部分“ChinaNet-”也不可修改。这当然很不爽，下面教程教你如何取消这些限制。</p>
<p><span id="more-134"></span><br />
一、<strong>设置新的密码</strong></p>
<p>主机用网线连接e8网关，拔掉电话线；</p>
<p>在浏览器打开【http://192.168.1.1】；</p>
<p>输入用户名【<span style="font-size: small">telecomadmin</span>】，输入密码【<span style="font-size: small">nE7jA%5m</span>】；</p>
<p>进入login页面后，点击【管理】，设置新的密码，并确定。我们<span style="text-decoration: underline">将用这个新密码替换超级用户的密码</span>。</p>
<p><strong>二、开启e8网关的TELNET的访问控制</strong></p>
<p>从IE地址栏进入【<a href="http://192.168.1.1/scsrvcntr.cmd?action=view">http://192.168.1.1/scsrvcntr.cmd?action=view</a>】</p>
<p>勾选表格中【LAN】对应的【TELNET】项，保存并应用。（在完成以下操作后，应将此项还原）</p>
<p>三、<strong>修改e8网关的配置</strong></p>
<p>在华军下载软件TFTPD32，并打开TFTPD32。这时，可以在TFTPD32的窗口看到自己的IP地址 192.168.1.x ；</p>
<p>从开始菜单运行『命令提示符』 ；</p>
<p>输入 TELNET 192.168.1.1</p>
<p>login: 输入admin</p>
<p>password:输入admin（这里是不显示密码的）；</p>
<p>出现“&gt;”提示符后输入：</p>
<p>tftp -p -f cfg.xml -tc 192.168.1.x （这里的IP地址就是在TFTPD32窗口看到的）。</p>
<p>稍候，点击TFTPD32窗口的[Show Dir]按钮，可以看到TFTPD32目录中的cfg.xml文件。</p>
<p>下载一个UltraEdit32 来打开cfg.xml文件。</p>
<p>在cfg.xml文件中的&lt;SystemInfo&gt;下方，可以看到：</p>
<p>。。。。。。</p>
<p>&lt;sysUserName value=”admin”/&gt;      —— 这是刚才TELNET时所用到的用户名</p>
<p>&lt;tr69c state=”enable”  。。。。。。  —— TRC069远程议管理协议</p>
<p>。。。。。。</p>
<p>&lt;sysPassword value=”YWRtaW4=”/&gt;    —— 这是刚才TELNET时所用到的加密后的密码</p>
<p>&lt;sptPassword value=”c3VwcG9ydA==”/&gt;</p>
<p>&lt;usrUserName value=”useradmin”/&gt;       —— 这是e8网关底部标签上的用户名</p>
<p>&lt;usrPassword value=”xxxxxxxxxxxxx”/&gt; —— 这是我们在第一步修改后的加密密码</p>
<p>&lt;ctUserName value=”telecomadmin”/&gt;     —— 这是web界面的超级用户名</p>
<p>&lt;ctPassword value=”bkU3akElNW0=”/&gt;     —— 这是web界面的超级用户的加密密码：<span style="font-size: small">nE7jA%5m</span></p>
<p><strong>修改用户名和超级用户密码</strong></p>
<p>修改用户名”useradmin”；</p>
<p>修改超级用户名”telecomadmin” ————这两个不要使用相同的用户名。</p>
<p>将修改后的加密密码”xxxxxxxxxxxxx”，替换掉超级用户的加密密码”bkU3akElNW0=”；</p>
<p><span style="color: #ff0000"><span style="text-decoration: underline">如果在&lt;SystemInfo&gt;段没有超级用户的设置参数，可以参照上面的格式添加</span>。</span></p>
<p><strong>禁用电信</strong><strong>TRC069</strong><strong>远程管理</strong></p>
<p>将&lt;tr69c state=”enable” 中的enable替换为disable。目的是禁止远程控制恢复到原来的统一标识。</p>
<p><strong>修改完全属于自己的</strong><strong>无线网络名称（</strong><strong>SSID</strong><strong>）</strong></p>
<p>在cfg.xml文件中开始处的&lt;WirelessCfg&gt;部分，找到：</p>
<p>&lt;wlMssidEntry enblSsId=”1&#8243; ssId=”ChinaNet-rMd4&#8243;。。。。。。，</p>
<p>将引号中的ChinaNet-rMd4，修改为自己的无线网络名。</p>
<p>修改完成后，存盘。</p>
<p><strong>上传修改后的配置文件</strong></p>
<p>在命令行输入：</p>
<p>TELNET 192.168.1.1</p>
<p>login: admin</p>
<p>password:admin</p>
<p>出现“&gt;”提示符，输入：</p>
<p>tftp -g -f cfg.xml -tc 192.168.1.x  (与上面IP相同)</p>
<p>完成后回车，稍候e8网关会重新启动，至此，e8网关的超级用户名和密码等等，完全是自己的了。</p>
<p>以后需要设置e8无线网关时，拔掉电话线，在web用自己的超级用户名和密码登陆，然后在地址栏输入：<a href="http://192.168.1.1/index.html">http://192.168.1.1/index.html</a>，并回车，既可进入完全的设置界面了。</p>
]]></content:encoded>
			<wfw:commentRss>http://e200.net/archives/134/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac 硬件驱动(.kext)安装方法</title>
		<link>http://e200.net/archives/123</link>
		<comments>http://e200.net/archives/123#comments</comments>
		<pubDate>Mon, 08 Mar 2010 01:48:20 +0000</pubDate>
		<dc:creator>米糊排骨</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Kext]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[驱动程序]]></category>

		<guid isPermaLink="false">http://e200.net/?p=123</guid>
		<description><![CDATA[Mac OS X Tiger是一个UNIX架构的核心的系统，所以如果有一些UNIX系统概念其实在底层的架构会很容易了解，系统核心，通常会有包含了硬件支持的程序在内，也就是说有一些需要在系统核心启动就跟着支持的基础硬件组件（例如CPU 指令集支持、内存管理...），大多放在核心中，不过Mac是一种经由APPLE公司自行订制化的核心，基础的硬件支持大多也以APPLE计算机为主，但是，并不会把所有的驱动程序都放在核心中，通常只有『必要的』才会放在核心，不然核心可能会过度肥大，整个系统执行效率就更差。]]></description>
			<content:encoded><![CDATA[<p>摘自：<a href="http://l24317.blog2.cnool.net/Article/2007/09/24/13541.html">http://l24317.blog2.cnool.net/Article/2007/09/24/13541.html</a><br />
一、Mac驱动程序的概念</p>
<p>我想用我所理解的系统概念为各位稍微的介绍一下在Mac上的驱动程序概念，基本上，Mac OS X Tiger是一个UNIX架构的核心的系统，所以如果有一些UNIX系统概念其实在底层的架构会很容易了解，系统核心，通常会有包含了硬件支持的程序在内，也就是说有一些需要在系统核心启动就跟着支持的基础硬件组件（例如CPU 指令集支持、内存管理&#8230;），大多放在核心中，不过Mac是一种经由APPLE公司自行订制化的核心，基础的硬件支持大多也以APPLE计算机为主，但是，并不会把所有的驱动程序都放在核心中，通常只有『必要的』才会放在核心，不然核心可能会过度肥大，整个系统执行效率就更差。<br />
<span id="more-123"></span></p>
<p>那么还有许多硬件驱动怎么办呢？通常会把他作成模块程序，然后在核心本身支持模块加载功能，在Linux 中叫做 Kernel Loadable Modules(KLM) 的架构，而在Mac OS X 中，称为 Mac OS X Kernel Extension，其实就把他想成是『驱动程序』就可以了，也就是Mac OS X系统中许许多多的 .kext 文件名的程序集，大多放在 /System/Library/Extensions/ 中，当核心有需要就去找到相应的设备ID然后叫起那个程序来支持硬件。</p>
<p>而现在的MAC OSX86 中其实问题比较多就是在硬件没有驱动支持，也就是没有相应的驱动程序可以使用，相关的HCL (硬件兼容列表）可以到 http://wiki.osx86project.org/wiki/index.php/HCL 下找到，进而可以找到相应可使用的驱动程序。</p>
<p>看了第一部分，假设您已经有简单的概念后，我们知道，其实Mac的驱动程序就是 Kernel Extension，也就是硬件相对应的 .kext 档案，我无法告诉妳哪里一定找的到兼容的kext可以用，但是可以提供个下载驱动的地址http://www.weiphone.com/thread-1918-1-1.html<br />
因为，kext 档案不一定每一种硬件都有人为他制作驱动，所以还是请您自己去查 相关的HCL (硬件兼容列表），先确定有支持，如果不在内建的系统中，应该都有下载kext的连结和说明，所以以下程序我都假设已经找到了kext的档案，</p>
<p>二、实例：安装T43网卡：</p>
<p>我当初找到了 T43 用的 Broadcomd 5751 的kext档案 AppleBCM5751Ethernet.kext<br />
我以他为例安装入系统内的步骤如下：</p>
<p>1. 打开终端：<br />
打开终端，执行：</p>
<pre>sudo -s</pre>
<p>然后键入你的密码，做好切换管理员的动作。<br />
PS. sudo 是一个安全为考虑的执行管理指令的方法，这边不多做介绍。</p>
<p>2. 复制kext 到相应目录：<br />
相应目录是 ” /System/Library/Extensions/ ” ，<br />
只要把你找到的驱动 .kext 档案复制到 /System/Library/Extensions/ 中，<br />
方法一：直接进入” /System/Library/Extensions/ “目录中，将自己的驱动 .kext 档案复制到里面，中途可能要输入密码；<br />
方法二：假设你的驱动叫AppleBCM5751Ethernet.kext，并放在桌面的，<br />
指令如下：</p>
<pre>cp ~/Desktop/AppleBCM5751Ethernet.kext /System/Library/Extensions/</pre>
<p>3. 更改文件权限：<br />
文件权限是UNIX系统中蛮重要的一个观念，在Unix为基础的Mac OS X中也一样，就是要把这些复制到系统内的文件的权限切换成系统（管理员）拥有与使用，指令如下：</p>
<pre>sudo chown -R root:wheel /System/Library/Extensions/AppleBCM5751Ethernet.kext
sudo chmod -R 755 /System/Library/Extensions/AppleBCM5751Ethernet.kext</pre>
<p>4. 清除 kext 的快取：<br />
要清除已经安装并制作快取的kext 快取内容，不然可能下次重启之后系统还是去读取快取，就不会读到新放进去kext 驱动<br />
指令如下：</p>
<pre>rm /System/Library/Extensions.kextcache
rm /System/Library/Extensions.mkext
kextcache -k /System/Library/Extensions</pre>
<p>5. 系统重启：<br />
硬件驱动后基本上是需要重启才会加载，可以点选右上角的苹果点选重启系统，或是使用指令 reboot 重启，接下来就是祈祷重启后系统一切正常，硬件支持良好啦！</p>
]]></content:encoded>
			<wfw:commentRss>http://e200.net/archives/123/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avira 2009去广告和启动画面的方法</title>
		<link>http://e200.net/archives/120</link>
		<comments>http://e200.net/archives/120#comments</comments>
		<pubDate>Sat, 27 Feb 2010 11:27:44 +0000</pubDate>
		<dc:creator>米糊排骨</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Avira]]></category>
		<category><![CDATA[去广告]]></category>
		<category><![CDATA[启动画面]]></category>
		<category><![CDATA[小红伞]]></category>

		<guid isPermaLink="false">http://e200.net/?p=120</guid>
		<description><![CDATA[今天重装了电脑，又忘了如何设置Avira小红伞去广告的方法，现收集至此，方便查找。摘自：http://chapi.blogbus.com/logs/47977727.html 一、去弹广告 　依次单击“开始”→“设置”→“控制面板”，在控制面板窗口依次双击“管理工具”→“本地安全策略”。 　　在“ 本地安全策略”窗口左边选择“软件限制策略”，依次单击“操作”→“创建新策略”。然后在“其他规则”上单击鼠标右键选择“新路径规则”，在弹出窗口中单击“浏览”按钮，选择“C:\Program Files\AntiVir PersonalEdition Classic\avnotify.dll”，在“安全级别”下拉列表中选择“不允许”（表示不让这个dll文件执行，1，“应用”并“确定”。 　　按照Step2的操作，在“软件限制策略”中将“C:\Program Files\AntiVirPersonalEdition Classic\avnotify.exe”的安全级别设置为“不允许”。全部设置后之后，在“本地安全策略”可以看到两个新增的软件限制策略，确定无误即可。 　　这样设置以后，AntiVir就再不会弹出烦人的广告窗口了，我们就可以安静地使用小红伞了。 二、去小红伞启动画面。。。 编辑注册表： 找到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 在右边的avgnt项目中编辑： 原值是： 小红伞安装路径\avgnt.exe” /min 现在在/min后加个 /nosplash 成为： 小红伞安装路径\avgnt.exe” /min /nosplash 这样，下次启动不会出现了]]></description>
			<content:encoded><![CDATA[<p>今天重装了电脑，又忘了如何设置Avira小红伞去广告的方法，现收集至此，方便查找。摘自：http://chapi.blogbus.com/logs/47977727.html<br />
<span id="more-120"></span><br />
一、去弹广告</p>
<p>　依次单击“开始”→“设置”→“控制面板”，在控制面板窗口依次双击“管理工具”→“本地安全策略”。<br />
　　在“ 本地安全策略”窗口左边选择“软件限制策略”，依次单击“操作”→“创建新策略”。然后在“其他规则”上单击鼠标右键选择“新路径规则”，在弹出窗口中单击“浏览”按钮，选择“C:\Program Files\AntiVir PersonalEdition Classic\avnotify.dll”，在“安全级别”下拉列表中选择“不允许”（表示不让这个dll文件执行，1，“应用”并“确定”。<br />
　　按照Step2的操作，在“软件限制策略”中将“C:\Program Files\AntiVirPersonalEdition Classic\avnotify.exe”的安全级别设置为“不允许”。全部设置后之后，在“本地安全策略”可以看到两个新增的软件限制策略，确定无误即可。<br />
　　这样设置以后，AntiVir就再不会弹出烦人的广告窗口了，我们就可以安静地使用小红伞了。</p>
<p>二、去小红伞启动画面。。。</p>
<p>编辑注册表：</p>
<p>找到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run</p>
<p>在右边的avgnt项目中编辑：</p>
<p>原值是：   小红伞安装路径\avgnt.exe” /min</p>
<p>现在在/min后加个 /nosplash</p>
<p>成为：      小红伞安装路径\avgnt.exe” /min /nosplash</p>
<p>这样，下次启动不会出现了</p>
]]></content:encoded>
			<wfw:commentRss>http://e200.net/archives/120/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安装Windows 7时不创建100M分区的方法</title>
		<link>http://e200.net/archives/113</link>
		<comments>http://e200.net/archives/113#comments</comments>
		<pubDate>Sat, 27 Feb 2010 09:09:25 +0000</pubDate>
		<dc:creator>米糊排骨</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[主分区]]></category>
		<category><![CDATA[保留分区]]></category>

		<guid isPermaLink="false">http://e200.net/?p=113</guid>
		<description><![CDATA[摘自：http://www.114dn.com/pc/os/win/2009/1124/246.html 用过windows7 的朋友知道，在安装windows 7 时，如果你重新分区的说话，系统会自动创建100M分区，用于存放boot文件夹内的一些启动文件，虽然只是一个100m 的小分区，但是有了它会很麻烦，比如用一些软件的时候会分区判断不准确，比如一些激活软件。其它安装win7让它不创建此分区的方法也很简单，这里就和大家简介讲讲！ 1，进入安装界面后到选择驱动器面板时，点击 高级选项，随便设置大小 2，保留那个100m分区，删除100M分区下面的那个新建区 3，鼠标点击100M分区后，选择扩展此分区，大小设置成C盘的大小。 4，你就可以正常安装win7了，你安装完后看看，是不是没有这个分区了。 这种方式在我的Dell Vostro 220s上是不成功的，如果只有一个系统分区的情况下，系统安装会终止在completing installation，然后死机，偶尔成功安装但是也会时常报错，所以不建议这种安装方式。 能否在已经安装了Win 7后删除这个分区呢？网上收集以下两种方法： 方法一： 以下文章摘自：http://www.webjx.com/os/windows-15363.html 如何删除Win7创建的200M隐藏分区? 　　答：安装完Windows 7的网友会发现，系统会自动划出一个分区，大小为200MB左右。这是个隐藏的分区，要删除它是比较麻烦的，如果贸然使用DM等分区工具来删除，会损坏硬盘的分区表，导致其他分区消失(不显示盘符了)。即使是使用Windows 7自带的工具来删除，也会导致硬盘分区表处于错误状态，出现丢失文件的问题。 　　要想删除这个200MB的隐藏分区，正确的做法，请按照下面的步骤： 　　1、使用带有分区工具的WinPE启动系统，一定要使用光盘或U盘上的WinPE启动，不要使用安装在硬盘的WinPE启动。 　　2、使用分区工具如WINPM，将200MB的隐藏分区删除，然后将这个删除的分区合并到别的分区去。接着把Windows 7所在的安装分区如C盘设置为活动分区。 　　3、单击“开始”菜单，选“程序→命令提示符”，输入“c:\windows\system32&#62;bcdboot c:\windows /s c:”并回车，修复Windows 7的引导启动。 　　4、重新启动电脑进入Windows 7，问题已经解决了。 　　提示：在安装Windows 7时不要删除硬盘已有的分区，也不要创建新的分区，一定要选择现有的分区来安装，只有这样才能避免Windows 7自动创建的200M隐藏分区。如果是新硬盘，可以使用别的Windows系统或分区工具来把硬盘分好区。最好使用别的Windows系统安装分区，分好区后就可以退出安装并重新启动，转而使用Windows 7启动安装。 方法二： 1、在Windows 7环境下，使用diskpart先把隐藏分区设置为非活动状态inactive 2、然后把Windows 7的系统盘（一般是C盘）激活active， 3、再运行C:\windows\system32\bcdboot.exe C:\windows /s C:命令，该命令目的是重新修复C盘的引导记录和相关文件，生成boot目录及语言包、BCD等文件和根目录下的bootmgr启动文件 4、然后删除隐藏分区。 我试过第二种方法，貌似可以正常工作，不过由于浪费了100M的硬件空间，无法实现合并空间，有些可惜，这种方法不太实用。]]></description>
			<content:encoded><![CDATA[<p>摘自：http://www.114dn.com/pc/os/win/2009/1124/246.html<br />
用过windows7 的朋友知道，在安装windows 7 时，如果你重新分区的说话，系统会自动创建100M分区，用于存放boot文件夹内的一些启动文件，虽然只是一个100m 的小分区，但是有了它会很麻烦，比如用一些软件的时候会分区判断不准确，比如一些激活软件。其它安装win7让它不创建此分区的方法也很简单，这里就和大家简介讲讲！</p>
<p>1，进入安装界面后到选择驱动器面板时，点击 高级选项，随便设置大小<br />
2，保留那个100m分区，删除100M分区下面的那个新建区<br />
3，鼠标点击100M分区后，选择扩展此分区，大小设置成C盘的大小。<br />
4，你就可以正常安装win7了，你安装完后看看，是不是没有这个分区了。</p>
<p><span style="color: red"><strong>这种方式在我的Dell Vostro 220s上是不成功的，如果只有一个系统分区的情况下，系统安装会终止在completing installation，然后死机，偶尔成功安装但是也会时常报错，所以不建议这种安装方式。<br />
能否在已经安装了Win 7后删除这个分区呢？网上收集以下两种方法：<br />
</strong></span><span id="more-113"></span><br />
方法一：<br />
以下文章摘自：http://www.webjx.com/os/windows-15363.html<br />
如何删除Win7创建的200M隐藏分区?<br />
　　答：安装完Windows 7的网友会发现，系统会自动划出一个分区，大小为200MB左右。这是个隐藏的分区，要删除它是比较麻烦的，如果贸然使用DM等分区工具来删除，会损坏硬盘的分区表，导致其他分区消失(不显示盘符了)。即使是使用Windows 7自带的工具来删除，也会导致硬盘分区表处于错误状态，出现丢失文件的问题。<br />
　　要想删除这个200MB的隐藏分区，正确的做法，请按照下面的步骤：<br />
　　1、使用带有分区工具的WinPE启动系统，一定要使用光盘或U盘上的WinPE启动，不要使用安装在硬盘的WinPE启动。<br />
　　2、使用分区工具如WINPM，将200MB的隐藏分区删除，然后将这个删除的分区合并到别的分区去。接着把Windows 7所在的安装分区如C盘设置为活动分区。<br />
　　3、单击“开始”菜单，选“程序→命令提示符”，输入“c:\windows\system32&gt;bcdboot c:\windows /s c:”并回车，修复Windows 7的引导启动。<br />
　　4、重新启动电脑进入Windows 7，问题已经解决了。<br />
　　提示：在安装Windows 7时不要删除硬盘已有的分区，也不要创建新的分区，一定要选择现有的分区来安装，只有这样才能避免Windows 7自动创建的200M隐藏分区。如果是新硬盘，可以使用别的Windows系统或分区工具来把硬盘分好区。最好使用别的Windows系统安装分区，分好区后就可以退出安装并重新启动，转而使用Windows 7启动安装。</p>
<p>方法二：<br />
1、在Windows 7环境下，使用diskpart先把隐藏分区设置为非活动状态inactive<br />
2、然后把Windows 7的系统盘（一般是C盘）激活active，<br />
3、再运行C:\windows\system32\bcdboot.exe C:\windows /s C:命令，该命令目的是重新修复C盘的引导记录和相关文件，生成boot目录及语言包、BCD等文件和根目录下的bootmgr启动文件<br />
4、然后删除隐藏分区。</p>
<p><span style="color: #993300"><strong><span style="color: #ff0000">我试过第二种方法，貌似可以正常工作，不过由于浪费了100M的硬件空间，无法实现合并空间，有些可惜，这种方法不太实用</span>。</strong></span></p>
]]></content:encoded>
			<wfw:commentRss>http://e200.net/archives/113/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress 首页显示日志摘要</title>
		<link>http://e200.net/archives/25</link>
		<comments>http://e200.net/archives/25#comments</comments>
		<pubDate>Wed, 24 Feb 2010 16:12:32 +0000</pubDate>
		<dc:creator>米糊排骨</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[摘要]]></category>

		<guid isPermaLink="false">http://e200.net/?p=25</guid>
		<description><![CDATA[刚刚安装WordPress系统，刚刚发了一个日志就发现了问题，在首页里中显示的是日志的整篇文章，而不是日志的摘要信息，后台好像没有找到相关的设置选项，只好求助全能的Google了，终于找到了两篇文章介绍如何解决这个问题的，介绍的比较详细，一篇是“<a href="http://www.williamlong.info/archives/1031.html">在WordPress首页和目录页显示摘要的方法</a>”，另外一篇是“<a href="http://www.keephelp.com/wordpress-theme/wordpress-summary/">WordPress 首页显示摘要</a>”，我节选了部分内容。<!--more-->]]></description>
			<content:encoded><![CDATA[<p>刚刚安装WordPress系统，刚刚发了一个日志就发现了问题，在首页里中显示的是日志的整篇文章，而不是日志的摘要信息，后台好像没有找到相关的设置选项，只好求助全能的Google了，终于找到了两篇文章介绍如何解决这个问题的，介绍的比较详细，一篇是“<a href="http://www.williamlong.info/archives/1031.html">在WordPress首页和目录页显示摘要的方法</a>”，另外一篇是“<a href="http://www.keephelp.com/wordpress-theme/wordpress-summary/">WordPress 首页显示摘要</a>”，我节选了部分内容摘抄如下：</p>
<p>在WordPress系统中，默认的首页和目录页使用的书全文输出，这对于文章内容较长的博客来说很不方便，下面介绍这个方法，可以实现在WordPress首页和目录页显示摘要而非全文。<br />
<span id="more-25"></span></p>
<p><strong>1、使用the_excerpt标签</strong></p>
<p style="padding-left: 30px"><strong> </strong><br />
优点：一劳永逸直接把想要的部分来做摘要<br />
缺点：需要改动模版，而且显示的是纯文本。</p>
<p style="padding-left: 30px">使用方法：</p>
<p>首先找到wp-content/themes下你使用的模板目录，查找目录中的文件，如果有home.php则修改home.php，没有的话就修改index.php文件(即wp-contant/themes/你的模版/index.php 或者home.php) 。</p>
<p>找到类似</p>
<pre>&lt;?php the_content(__('(more…)')); ?&gt;</pre>
<p>或</p>
<pre>&lt;?php the_content(); ?&gt;</pre>
<p>像在我的模板中index.php文件中找到</p>
<pre>&lt;?php the_content(__('Read more...', 'elegantbox')); ?&gt;</pre>
<p>我把这行修改为:</p>
<pre>&lt;?php if(!is_single()) { the_excerpt(); } else {
     the_content(__('Read more...', 'elegantbox'));} ?&gt;</pre>
<p>现在你的wordpress，除非打开单个post，其他情况下都是显示摘要。</p>
<p><strong>2、使用more标签</strong></p>
<p style="padding-left: 30px">优点：方法比较正规不需要改动模版</p>
<p style="padding-left: 30px">缺点：每次都要加一下这个东西，不灵活只能一刀切。</p>
<p style="padding-left: 30px">在你需要截断的地方(就是你的编辑框)加上&lt;!–more–&gt;标志</p>
<p style="padding-left: 30px">
<p><strong>使用效果：</strong></p>
<p><strong>第一种方法确实简单有效，不过在首页的显示结果里只有摘要内容，而且没有“Read More”的提示，我觉得有点不大习惯，对于阅读者来说如果没有“Read More”提示的话，可能不知道文章是否还有更详细的内容，所以我又改回使用themes原版的index.php文件，采用第二种方式，就是在日志内容中添加&lt;!&#8211;more&#8211;&gt;标志，这样相对灵活一些，萝卜青菜各有所爱，就看你自已喜欢哪种方式了。</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://e200.net/archives/25/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

