<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title>meisw's blog</title>
		<link>http://meisw.wdlinux.cn//</link>
		<description>工作,学习,生活,这里将会有一些记录.     备用域名:http://meisw.wdlinux.cn</description>
		<copyright>Copyright (C) 2004 Security Angel Team [S4T] All Rights Reserved.</copyright>
		<generator>SaBlog-X Version 1.6 Build 20080806</generator>
		<lastBuildDate>Sun, 20 Sep 2026 23:57:13 +0000</lastBuildDate>
		<ttl>30</ttl>
		<item>
			<guid>http://meisw.wdlinux.cn//show-1063-1.html</guid>
			<title>有关于ubuntu16.04 vim记忆上次编辑的位置</title>
			<author>admin</author>
			<description><![CDATA[<div>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; overflow-x: auto; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">我们用vim关闭之后重新打开文件，会从第一行重新开始，但我们有时需要记忆上次编辑的内容</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; overflow-x: auto; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">在vim /etc/vim/vimrc 有这一行被注释掉了</p>
</div>
<p>&nbsp;<span style="font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre;">au BufReadPost * </span><span class="hljs-function" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; overflow-wrap: break-word; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre;"><span class="hljs-keyword" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: rgb(198, 120, 221); overflow-wrap: break-word;">if</span> <span class="hljs-title" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: rgb(97, 174, 238); overflow-wrap: break-word;">line</span><span class="hljs-params" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; overflow-wrap: break-word;">(<span class="hljs-string" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: rgb(152, 195, 121); overflow-wrap: break-word;">&quot;'\&quot;&quot;</span>)</span> &gt; 1 &amp;&amp; <span class="hljs-title" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: rgb(97, 174, 238); overflow-wrap: break-word;">line</span><span class="hljs-params" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; overflow-wrap: break-word;">(<span class="hljs-string" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: rgb(152, 195, 121); overflow-wrap: break-word;">&quot;'\&quot;&quot;</span>)</span> &lt;</span><span style="font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre;">= line(</span><span class="hljs-string" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: rgb(152, 195, 121); overflow-wrap: break-word; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre;">&quot;$&quot;</span><span style="font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre;">) | exe </span><span class="hljs-string" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: rgb(152, 195, 121); overflow-wrap: break-word; font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre;">&quot;normal! g'\&quot;&quot;</span><span style="font-family: &quot;Source Code Pro&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Ubuntu Mono&quot;, &quot;Anonymous Pro&quot;, &quot;Droid Sans Mono&quot;, Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, sans-serif; white-space: pre;"> | endif</span></p>]]></description>
			<link>http://meisw.wdlinux.cn//show-1063-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2018-12-03 23:50</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-1061-1.html</guid>
			<title>inotify</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;wget https://codeload.github.com/rvoicilas/inotify-tools/tar.gz/3.20.1</p>
<div>mv 3.20.1 inotify-tools-3.20.1.tar.gz</div>
<div>tar zxvf inotify-tools-3.20.1.tar.gz</div>
<div>cd inotify-tools-3.20.1</div>
<div>./autogen.sh</div>
<div>./configure</div>
<div>make</div>
<div>make install</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>#!/bin/bash</div>
<div>DIR=$1</div>
<div>&nbsp;</div>
<div>inotifywait -mrq -e close_write $DIR | while read FILE</div>
<div>do</div>
<div>&nbsp; /bin/kw.sh</div>
<div>done</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>---------------</div>
<div>#!/bin/bash</div>
<div>DIR=$1</div>
<div>&nbsp;</div>
<div>inotifywait -m -e close_write $DIR --format &quot;%w%f&quot; | while read FILE</div>
<div>do</div>
<div>&nbsp; cat ${FILE} | mail -s &quot;Alarm: $FILE&quot; admin@gmail.com</div>
<div>done</div>]]></description>
			<link>http://meisw.wdlinux.cn//show-1061-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2018-11-07 16:52</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-1021-1.html</guid>
			<title>ubuntu常用操作</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;设置root密码</p>
<div>sudo passwd</div>
<div>&nbsp;</div>
<div>
<p style="margin-bottom: 16px; box-sizing: border-box; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun;">1、vi /etc/network/interfaces</p>
<p style="margin-bottom: 16px; box-sizing: border-box; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun;">添加内容：</p>
<span style="color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;">auto eth0</span><br style="box-sizing: border-box; color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;" />
<span style="color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;">iface eth0 inet static</span><br style="box-sizing: border-box; color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;" />
<span style="color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;">address 192.168.8.100&nbsp;&nbsp; &nbsp;</span><br style="box-sizing: border-box; color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;" />
<span style="color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;">netmask 255.255.255.0</span><br style="box-sizing: border-box; color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;" />
<span style="color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;">gateway 192.168.8.2</span><br style="box-sizing: border-box; color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;" />
<span style="color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;">dns-nameserver 119.29.29.29</span></div>
<div><span style="color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;"><br />
</span></div>
<div><span style="color: rgb(69, 69, 69); font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 16px;"><br />
</span></div>
<div><span style="font-family: Consolas, &quot;Courier New&quot;, Courier, mono, serif; font-size: 12px;">vim&nbsp;/etc/ssh/sshd_config</span></div>
<div>
<ol start="1" style="margin-right: 0px; margin-bottom: 24px; margin-left: 0px; box-sizing: border-box; list-style-position: initial; list-style-image: initial; border-top: none; border-right: 1px solid rgb(231, 229, 220); border-bottom: none; border-left: none; border-image: initial; color: rgb(92, 92, 92); font-family: Consolas, &quot;Courier New&quot;, Courier, mono, serif; font-size: 12px;">
    <li class="alt" style="margin-top: 8px; margin-left: 40px; box-sizing: border-box; list-style-type: decimal; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; color: inherit; line-height: 18px; margin-right: 0px !important; margin-bottom: 0px !important; padding: 0px 3px 0px 10px !important; list-style-position: outside !important;"><span style="margin: 0px; padding: 0px; box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;">#PermitRootLogin&nbsp;without-password&nbsp;&nbsp;</span></li>
    <li class="" style="margin-top: 8px; margin-left: 40px; box-sizing: border-box; list-style-type: decimal; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; background-color: rgb(248, 248, 248); line-height: 18px; margin-right: 0px !important; margin-bottom: 0px !important; padding: 0px 3px 0px 10px !important; list-style-position: outside !important;"><span style="margin: 0px; padding: 0px; box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;">PermitRootLogin&nbsp;yes&nbsp;</span></li>
</ol>
</div>
<div><span style="font-family: Consolas, &quot;Courier New&quot;, Courier, mono, serif; font-size: 12px;"><br />
</span></div>
<div><span style="font-family: Consolas, &quot;Courier New&quot;, Courier, mono, serif; font-size: 12px;">killall命令</span></div>
<div><font face="Consolas, Courier New, Courier, mono, serif"><span style="font-size: 12px;">apt-get install psmisc</span></font></div>
<div><font face="Consolas, Courier New, Courier, mono, serif"><span style="font-size: 12px;"><br />
</span></font></div>
<div><font face="Consolas, Courier New, Courier, mono, serif"><span style="font-size: 12px;"><br />
</span></font></div>
<div><span style="font-family: Consolas, &quot;Courier New&quot;, Courier, mono, serif; font-size: 12px;"><br />
</span></div>]]></description>
			<link>http://meisw.wdlinux.cn//show-1021-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2018-04-19 00:36</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-1016-1.html</guid>
			<title>ubuntu shell兼容问题</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;<span style="color: rgb(69, 83, 83); font-family: &quot;Hiragino Sans GB W3&quot;, &quot;Hiragino Sans GB&quot;, Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px;">dpkg-reconfigure dash</span></p>]]></description>
			<link>http://meisw.wdlinux.cn//show-1016-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2018-02-10 19:09</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-1011-1.html</guid>
			<title>ssh普通用户目录限制根目录</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;Subsystem sftp internal-sftp</p>
<div>Match User dist</div>
<div>ChrootDirectory /var/www/html</div>
<div>X11Forwarding no</div>
<div>AllowTcpForwarding no</div>
<div>ForceCommand internal-sftp</div>]]></description>
			<link>http://meisw.wdlinux.cn//show-1011-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2018-01-30 13:59</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-979-1.html</guid>
			<title>ubuntu怎样让vim记住文件上次打开的位置</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;进到/etc/vim/vimrc 使用root，添加</p>
<div>au BufReadPost * if line(&quot;'\&quot;&quot;) &gt; 0|if line(&quot;'\&quot;&quot;) &lt;= line(&quot;$&quot;)|exe(&quot;norm '\&quot;&quot;)|else|exe &quot;norm $&quot;|endif|endif</div>
<div>即可</div>
<div>&nbsp;</div>
<div>
<div>if has(&quot;autocmd&quot;)</div>
<div>&nbsp;au BufReadPost * if line(&quot;'\&quot;&quot;) &gt; 1 &amp;&amp; line(&quot;'\&quot;&quot;) &lt;= line(&quot;$&quot;) | exe &quot;normal! g'\&quot;&quot; | endif</div>
<div>endif</div>
</div>]]></description>
			<link>http://meisw.wdlinux.cn//show-979-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2017-11-05 01:32</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-696-1.html</guid>
			<title>ubuntu 系统服务设置 - chkconfig命令</title>
			<author>admin</author>
			<description><![CDATA[<p>安装命令：<br />
sudo apt-get install chkconfig<br />
(可以用sysv-rc-conf代替)<br />
原帖地址：<br />
<a href="http://blog.csdn.net/youyu_buzai/archive/2009/03/04/3956845.aspx">http://blog.csdn.net/youyu_buzai/archive/2009/03/04/3956845.aspx</a></p>
<p>功能说明：检查、设定系统的各种服务。</p>
<p>语法：chkconfig [--add][--del][--list][系统服务]或<br />
chkconfig [--level&lt;等级代号&gt;][系统服务][on/off/reset]</p>
<p>补充说明:这个是redhat公司遵循gpl规则所开发的程序,它可以查询操作系统在每一个执行等级(runlevel)中,会执行哪些系统服务，其中包括各种daemon。<br />
linux os 将操作环境分为以下7个等级:</p>
<p>0:开机(请不要切换到此等级)<br />
1:单人使用者模式的文字界面<br />
2:多人使用者模式的文字界面,不具有网络档案系统(NFS)功能<br />
3:多人使用者模式的文字界面,具有网络档案系统(NFS)功能<br />
4:某些发行版的linux使用此等级进入x windows system<br />
5:某些发行版的linux使用此等级进入x windows system<br />
6:重新启动</p>
<p>参数:&nbsp;&nbsp;&nbsp; --add&nbsp;&nbsp; 新增所指定的系统服务<br />
--del 删除所指定的系统服务<br />
--level 指定该系统服务要在哪个执行等级中开启或关闭<br />
--list&nbsp;&nbsp; 列出当前可从chkconfig指令管理的所有系统服务和等级代号<br />
on/off/reset&nbsp;&nbsp; 在指定的执行登记,开启/关闭/重置该系统服务<br />
chkconfig命令主要用来更新（启动或停止）和查询系统服务的运行级信息。谨记chkconfig不是立即自动禁止或激活一个服务，它只是简单的改变了符号连接。<br />
语法：<br />
&nbsp;&nbsp;&nbsp; chkconfig --list [name]<br />
chkconfig --add name<br />
chkconfig --del name<br />
chkconfig [--level levels] name &lt;on|off|reset&gt;<br />
chkconfig [--level levels] name<br />
&nbsp;&nbsp;&nbsp; chkconfig 没有参数运行时，显示用法。如果加上服务名，那么就检查这个服务是否在当前运行级启动。如果是，返回true，否则返回false。如果在服务名后面指定 了on，off或者reset，那么chkconfi 会改变指定服务的启动信息。on和off分别指服务被启动和停止，reset指重置服务的启动信息，无论有问题的初始化脚本指定了什么。on和off开 关，系统默认只对运行级3，4，5有效，但是reset可以对所有运行级有效。<br />
&nbsp;&nbsp;&nbsp; --level选项可以指定要查看的运行级而不一定是当前运行级。<br />
&nbsp;&nbsp;&nbsp; 需要说明的是，对于每个运行级，只能有一个启动脚本或者停止脚本。当切换运行级时，init不会重新启动已经启动的服务，也不会再次去停止已经停止的服务。<br />
&nbsp;&nbsp;&nbsp; chkconfig --list ：显示所有运行级系统服务的运行状态信息（on或off）。如果指定了name，那么只显示指定的服务在不同运行级的状态。<br />
&nbsp;&nbsp;&nbsp; chkconfig --add name：增加一项新的服务。chkconfig确保每个运行级有一项启动(S)或者杀死(K)入口。如有缺少，则会从缺省的init脚本自动建立。<br />
&nbsp;&nbsp;&nbsp; chkconfig --del name：删除服务，并把相关符号连接从/etc/rc[0-6].d删除。<br />
&nbsp;&nbsp;&nbsp; chkconfig [--level levels] name &lt;on|off|reset&gt;：设置某一服务在指定的运行级是被启动，停止还是重置。例如，要在3，4，5运行级停止nfs服务，则命令如下：<br />
&nbsp;&nbsp;&nbsp; chkconfig --level 345 nfs off<br />
运行级文件：<br />
&nbsp;&nbsp;&nbsp; 每个被chkconfig管理的服务需要在对应的init.d下的脚本加上两行或者更多行的注释。第一行告诉chkconfig缺省启动的运行级以及启动 和停止的优先级。如果某服务缺省不在任何运行级启动，那么使用 - 代替运行级。第二行对服务进行描述，可以用\ 跨行注释。<br />
例如，random.init包含三行：<br />
# chkconfig: 2345 20 80<br />
# description: Saves and restores system entropy pool for \<br />
# higher quality random number generation.<br />
附加介绍一下Linux系统的运行级的概念：<br />
Linux中有多种运行级，常见的就是多用户的2，3，4，5 ，很多人知道5是运行X-Windows的级别，而0就是关机了。运行级的改变可以通过init命令来切换。例如，假设你要维护系统进入单用户状态，那 么，可以使用init1来切换。在Linux的运行级的切换过程中，系统会自动寻找对应运行级的目录/etc/rc[0-6].d下的K和S开头的文件， 按后面的数字顺序，执行这些脚本。对这些脚本的维护，是很繁琐的一件事情，Linux提供了chkconfig命令用来更新和查询不同运行级上的系统服 务。<br />
范例:</p>
<p>1.查看在各种不同的执行等级中,各项服务的状况:<br />
$chkconfig --list</p>
<p>2.列出系统服务vsftpd在各个执行等级的启动情况：<br />
$chkconfig --list vsftpd</p>
<p>3.在执行等级3,5时，关闭vsftpd系统服务：<br />
$chkconfig --level 35 vsftpd off</p>
<p>4.在执行等级2，3，5时，开启 vsftpd系统服务：<br />
$chkconfig --level 235 vsftpd on</p>
<p>5.关闭一些自己不需要的服务 -&gt;<br />
如果没有打印机：<br />
chkconfig --level 235 cups off <br />
如果没有局域网：<br />
chkconfig --level 235 smb off<br />
如果不需要远程用户登录的：<br />
chkconfig --level 235 sshd off<br />
如果不需要定时任务的：<br />
chkconfig --level 235 crond off<br />
如果不需要添加新硬件的：<br />
chkconfig --level 235 kudzu off</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-696-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2012-05-23 17:52</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-695-1.html</guid>
			<title>ubuntu chkconfig undate-rc.d</title>
			<author>admin</author>
			<description><![CDATA[<p>ubuntu 9.10 已经不支持chkconfig 了而用了update-rc.d，</p>
<p>关于 update-rc.d 的一些使用介绍<br />
Debian 的update-rc.d与RH的chkconfig工具相类似。然而chkconfig是一个二进制程序，而update-rc.d是一个Perl脚本。这些工具有不同的命令行选项，但是却执行类似的功能。下表列出了update-rc.d的一些用法。如果要查看完整的信息，我们可以查阅相关的和册页。</p>
<p>命令 功能<br />
update-rc.d -f remove 从所有的运行级别配置目录中是删除指定的服务<br />
update-rc.d start 配置服务在运行级别列表中按指定的顺序启动<br />
update-rc.d stop 配置服务在运行级别列表中指定的顺序停止<br />
update -rc.d与RH的chkconfig之间最大的不同就在于update-rc.d是要设置所以指向/etc/init.d目录下服务脚本的运行级别链接，而chkconfig是要每一个运行级别单独配置服务。从本质上来说，这也就意味着每次我们使用update-rc.d改变一个运行级别，我们就不得不改变所有的。例如，下面的命令序列与命令chkconfig -level 2345 inetd off的作用相同：<br />
$ update-rc.d -f inetd remove<br />
$ update-rc.d inetd stop 20 0 1 2 3 4 5 6 .<br />
第一个命令移除了所有的指向/etc/init.d/inetd服务脚本的运行级别链接，-f标志将会使得update-rc.d即使在inetd脚本本身已经存在的情况仍然进行相应的处理。第二个命令在每一个运行级别创建了一个服务级别为20的停止脚本。例如，这会创建一个 /etc/rc3.d/K20inetd的符号链接来禁止运行级别3中inetd的运行。（在这里我们要注意的是我们要显示的添加reboot与 shutdown运行级别，即0和6,仅管其中所有的服务都会被设置成为&ldquo;stop&ldquo;）。作为另外的一个例子，下面所显示的命令将会在运行级别3到5允许 inetd的运行，而在其他的运行级别中则被禁止：<br />
$ update-rc.d -f inetd remove<br />
$ update-rc.d inetd start 20 3 4 5 . stop 20 0 1 2 6 .<br />
Debian的update-rc.d最初看起来会叫人有一些迷惑，但是旦我们明白，我们就会发现他可以多么出色的完成我们的工作。</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-695-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2012-05-23 17:51</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-694-1.html</guid>
			<title>Ubuntu Linux配置IP地址</title>
			<author>admin</author>
			<description><![CDATA[<p>一、使用命令设置ubuntu的ip地址</p>
<p>1.修改配置文件blacklist.conf禁用IPV6：<br />
sudo vi /etc/modprobe.d/blacklist.conf</p>
<p>2.在文档最后添加 blacklist ipv6，然后查看修改结果：<br />
cat /etc/modprobe.d/blacklist.conf</p>
<p>3.设置IP（设置网卡eth0的IP地址和子网掩码）<br />
sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.0</p>
<p>4.设置网关<br />
sudo route add default gw 192.168.2.254</p>
<p>5.设置DNS 修改/etc/resolv.conf，在其中加入nameserver DNS的地址1 和 nameserver DNS的地址2 完成。</p>
<p>6.重启网络服务（若不行，请重启ubuntu：sudo reboot）：<br />
sudo /etc/init.d/networking restart</p>
<p>7.查看当前IP：<br />
ifconfig</p>
<p>二、直接修改系统配置文件</p>
<p>ubuntu的网络配置文件是：/etc/network/interfaces<br />
打开后里面可设置DHCP或手动设置静态ip。前面auto eth0，让网卡开机自动挂载。<br />
1. 以DHCP方式配置网卡<br />
编辑文件/etc/network/interfaces：<br />
sudo vi /etc/network/interfaces</p>
<p>并用下面的行来替换有关eth0的行：<br />
# The primary network interface - use DHCP to find our address<br />
auto eth0<br />
iface eth0 inet dhcp</p>
<p>用下面的命令使网络设置生效：<br />
sudo /etc/init.d/networking restart</p>
<p>也可以在命令行下直接输入下面的命令来获取地址<br />
sudo dhclient eth0</p>
<p>2. 为网卡配置静态IP地址<br />
编辑文件/etc/network/interfaces：<br />
sudo vi /etc/network/interfaces</p>
<p>并用下面的行来替换有关eth0的行：<br />
# The primary network interface<br />
auto eth0<br />
iface eth0 inet static<br />
address 192.168.2.1<br />
gateway 192.168.2.254<br />
netmask 255.255.255.0<br />
#network 192.168.2.0<br />
#broadcast 192.168.2.255</p>
<p>将上面的ip地址等信息换成你自己就可以了.用下面的命令使网络设置生效：<br />
sudo /etc/init.d/networking restart</p>
<p>3. 设定第二个IP地址(虚拟IP地址)<br />
编辑文件/etc/network/interfaces：<br />
sudo vi /etc/network/interfaces</p>
<p>在该文件中添加如下的行：<br />
auto eth0:1<br />
iface eth0:1 inet static<br />
address x.x.x.x<br />
netmask x.x.x.x<br />
network x.x.x.x<br />
broadcast x.x.x.x<br />
gateway x.x.x.x</p>
<p>根据你的情况填上所有诸如address,netmask,network,broadcast和gateways等信息：<br />
用下面的命令使网络设置生效：<br />
sudo /etc/init.d/networking restart<br />
4. 设置主机名称(hostname)<br />
使用下面的命令来查看当前主机的主机名称：<br />
sudo /bin/hostname</p>
<p>使用下面的命令来设置当前主机的主机名称：<br />
sudo /bin/hostname newname</p>
<p>系统启动时,它会从/etc/hostname来读取主机的名称。</p>
<p>5. 配置DNS<br />
首先，你可以在/etc/hosts中加入一些主机名称和这些主机名称对应的IP地址，这是简单使用本机的静态查询。要访问DNS 服务器来进行查询,需要设置/etc/resolv.conf文件，假设DNS服务器的IP地址是192.168.2.2, 那么/etc/resolv.conf文件的内容应为：<br />
search chotim.com<br />
nameserver 192.168.2.2</p>
<p>6.手动重启网络服务：<br />
sudo /etc/init.d/networking restart</p>
<p>返回结果如下：<br />
*Reconfiguring network interfaces&hellip; [OK]</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-694-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2012-05-23 16:02</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-692-1.html</guid>
			<title>如何在Ubuntu Server版上实施iptables</title>
			<author>admin</author>
			<description><![CDATA[<p><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">摘自http://bbs.163jsp.com/posts/list/367.html</span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">iptables 是一个安装在Ubuntu Server上的默认防火墙。在正常的ubuntu安装过程中，iptables是被安装上了的，但是它默认允许所有的流量(不管防火墙是否是无效的)。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">关于iptables有价值的信息很多，但是大多都描述的很复杂。如果你想做些基本的配置，下面的 How To 很适合你。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆</span><span style="font: 18px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span><strong style="line-height: normal;">基本命令</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">键入：<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -L<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">列出您当前iptables中在规则。如果您是刚刚建立您的服务器，那么可能此时还没有任何规则，而且您应该看到如下：<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Chain INPUT (policy ACCEPT)<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">target prot opt source destination<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Chain FORWARD (policy ACCEPT)<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">target prot opt source destination<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Chain OUTPUT (policy ACCEPT)<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">target prot opt source destination<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆</span><span style="font: 18px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span><strong style="line-height: normal;">允许建立会话</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">我们可以允许建立会话来接受流量：<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆<span class="Apple-converted-space">&nbsp;</span></span><span style="font: 18px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="line-height: normal;">在指定端口上允许入站流量</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">阻断所有流量您也可以启动系统，但是您可能正在通过SSH工作，所有在您阻断其他流量前有必要允许SSH流量。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">为了在22端口号(默认的SSH端口)上的允许流量入站，您可以告诉iptables允许您的网卡接受所有的目的端口为22的TCP流量。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -A INPUT -p tcp -i eth0 --dport ssh -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">特别的，这将向表中追加(-A)INPUT规则，允许目的端口号为SSH的所有流量进入接口(-i) eth0，以便iptables完成跳转(-j)或动作：ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">让我们核对下这些规则：(这里仅显示了少数行，您应该看到更多)<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -L<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Chain INPUT (policy ACCEPT)<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">target prot opt source destination<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT tcp -- anywhere anywhere tcp dpt:ssh<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">现在，让我们允许所有的web流量<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -A INPUT -p tcp -i eth0 --dport 80 -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">检查我们现有的规则<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -L<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Chain INPUT (policy ACCEPT)<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">target prot opt source destination<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT tcp -- anywhere anywhere tcp dpt:ssh<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT tcp -- anywhere anywhere tcp dpt:www<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">我们已经指定SSH和web端口为允许通过的TCP流量，但是因为我们还没阻断任何流量，所以到目前为止所有的流量仍然可以进入。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆<span class="Apple-converted-space">&nbsp;</span></span><span style="font: 18px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="line-height: normal;">阻断流量</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">一旦一条规则对一个包进行了匹配，其他规则不再对这个包有效。因为我们的规则首先允许SSH和WEB流量，所以只要我们阻断所有流量的规则紧跟其後，我们依然能接受我们感兴趣的流量。我们要做的仅仅是把阻断所有流量的规则放在最後，所以我们需要再次用到它。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -A INPUT -j DROP<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -L<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Chain INPUT (policy ACCEPT)<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">target prot opt source destination<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT tcp -- anywhere anywhere tcp dpt:ssh<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT tcp -- anywhere anywhere tcp dpt:www<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">DROP all -- anywhere anywhere<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">因为我们刚才没有指定一个接口或一个协议，所以除了web和ssh流量外其他任何流量都会被阻断。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆<span class="Apple-converted-space">&nbsp;</span></span><span style="font: 18px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="line-height: normal;">编辑 iptables</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">到目前为止我们设置过程中唯一的问题是回环端口(loopbakc)也被阻断了。我们本可以通过指定 -i eth0 来仅仅丢弃eth0上的数据包，但我们也可以为回环端口(loopback)添加一条规则。如果我们追加这条规则，这将太晚了----因为所有的流量已经 被丢弃。我们必须插入这条跪着到第4行。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -I INPUT 4 -i lo -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -L<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Chain INPUT (policy ACCEPT)<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">target prot opt source destination<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT tcp -- anywhere anywhere tcp dpt:ssh<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT tcp -- anywhere anywhere tcp dpt:www<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ACCEPT all -- anywhere anywhere<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">DROP all -- anywhere anywhere<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">最後2行看起来几乎一样，因此我们可以让iptables列的更详细些。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -L -v<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆</span><span style="font: 18px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="line-height: normal;"><span class="Apple-converted-space">&nbsp;</span>日志记录</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">在上面的例子中，所有的流量都不会被记录。如果您愿意在syslog中记录被丢弃的包, 下面将是最快捷的方式:<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -I INPUT 5 -m limit --limit 5/min -j LOG --log-prefix &quot;iptables denied: &quot; --log-level 7<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">看 提示 段获得更多关于logging的ideas.<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆<span class="Apple-converted-space">&nbsp;</span></span><span style="font: 18px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="line-height: normal;">保存 iptables</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">如果您现在要重新启动机器的话，您的iptables配置将会消失。为了不用每次重新启动时敲入这些命令，您可以保存你的配置，让它在系统启动时自动启动。你可以通过iptables-save 和iptables-restore命令来保存配置。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆<span class="Apple-converted-space">&nbsp;</span></span><span style="font: 18px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="line-height: normal;">配置启动时自动加载规则</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">保存您的防火墙股则到一个文件<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables-save &gt; /etc/iptables.up.rules<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">接着修改 /etc/network/interfaces 脚本自动应用这些规则(末行是添加的)<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">auto eth0<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">iface eth0 inet dhcp<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">pre-up iptables-restore &lt; /etc/iptables.up.rules<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">你也可以准备一组规则冰并自动应用它<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">auto eth0<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">iface eth0 inet dhcp<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">pre-up iptables-restore &lt; /etc/iptables.up.rules<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">post-down iptables-restore &lt; /etc/iptables.down.rules<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆</span><span style="font: 18px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="line-height: normal;"><span class="Apple-converted-space">&nbsp;</span>提示</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆<span class="Apple-converted-space">&nbsp;</span></span><strong style="color: rgb(104, 110, 85); text-transform: none; line-height: normal; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 12px; font-style: normal; font-variant: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">如果你要在一个规则基础上手动编辑iptables</strong><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">下面的步骤复习了怎样建立你的防火墙规则，并假定它们相对固定(而且对于大多数人来说它们也应该是)。但是如果你要做许多研究工作，你也许想要你的 iptables在你每次重启时保存一次。你可以在 /etc/network/interfaces 里添加像下面的一行:<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">pre-up iptables-restore &lt; /etc/iptables.up.rules<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">post-down iptables-save &gt; /etc/iptables.up.rules<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">&quot;post-down iptables-save &gt; /etc/iptables.up.rules&quot; 此行将保存规则用于下次启动时使用。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆</span><strong style="color: rgb(104, 110, 85); text-transform: none; line-height: normal; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 12px; font-style: normal; font-variant: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span>用iptables-save/restore来测试规则</strong><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">如果你超出了这个指南来编辑iptables，你可能想利用iptables-save和iptables-restore来编辑和测试你的规则。你可以通过使用你喜爱的文本编辑器(此处为gedit)来打开这些规则文件来完成编辑。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables-save &gt; /etc/iptables.test.rules<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># gedit /etc/iptables.test.rules<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">你会得到一个如下类似的文件(下面是紧接上的例子文件)：<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># Generated by iptables-save v1.3.1 on Sun Apr 23 06:19:53 2006<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">*filter<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">:INPUT ACCEPT [368:102354]<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">:FORWARD ACCEPT [0:0]<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">:OUTPUT ACCEPT [92952:20764374]<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -i eth0 -p tcp -m tcp --dport 80 -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -i lo -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -m limit --limit 5/min -j LOG --log-prefix &quot;iptables denied: &quot; --log-level 7<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -j DROP<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">COMMIT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># Completed on Sun Apr 23 06:19:53 2006<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">注意到这些都是减去iptables命令的iptables语句。随意编辑这些命令、完成後保存它们。然後简单的测试下：<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables-restore &lt; /etc/iptables.test.rules<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">测试完毕後，如果你还没添加iptables-save命令 到 /etc/network/interfaces 里面，记得不要丢失了你的更改：<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables-save &gt; /etc/iptables.up.rules<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆<span class="Apple-converted-space">&nbsp;</span></span><strong style="color: rgb(104, 110, 85); text-transform: none; line-height: normal; text-indent: 0px; letter-spacing: normal; font-family: Arial; font-size: 12px; font-style: normal; font-variant: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">更详细的日志</strong><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">为了在你的syslog中获得更多细节，你可能想创建一个额外的链。下面是个很简短的例子---我的 /etc/iptables.up.rules ,它将展示我是如何设置iptables记录到syslog中的：<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># Generated by iptables-save v1.3.1 on Sun Apr 23 05:32:09 2006<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">*filter<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">:INPUT ACCEPT [273:55355]<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">:FORWARD ACCEPT [0:0]<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">:LOGNDROP - [0:0]<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">:OUTPUT ACCEPT [92376:20668252]<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -i eth0 -p tcp -m tcp --dport 80 -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -i lo -j ACCEPT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A INPUT -j LOGNDROP<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A LOGNDROP -p tcp -m limit --limit 5/min -j LOG --log-prefix &quot;Denied TCP: &quot; --log-level 7<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A LOGNDROP -p udp -m limit --limit 5/min -j LOG --log-prefix &quot;Denied UDP: &quot; --log-level 7<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A LOGNDROP -p icmp -m limit --limit 5/min -j LOG --log-prefix &quot;Denied ICMP: &quot; --log-level 7<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">-A LOGNDROP -j DROP<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">COMMIT<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># Completed on Sun Apr 23 05:32:09 2006<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">请注意 一个名为 LOGNDROP的链在文件顶部。而且，INPUT链底部标准的DROP被替换成了LOGNDROP，同时添加了协议描述so it makes sense looking at the log。最後我们在LOGNDROP链尾部丢弃了这些流量。下面的行告诉我们发生了什么：<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">* --limit 设置记录相同规则到syslog中的次数<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">* --log-prefix &quot;Denied...&quot; 添加一个前缀使得在syslog中查找更easy<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">* --log-level 7 设置syslog的消息级别 (see man syslog for more detail, but you can probably leave this)<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆<span class="Apple-converted-space">&nbsp;</span></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="line-height: normal;">禁用防火墙</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">如果您要临时禁用防火墙，您可以通过下面的命令清空所偶的规则：<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"># iptables -F<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">◆</span><span style="font: 18px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span><strong style="line-height: normal;">轻松配置通过 GUI</strong></span><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">新手可以利用 Firetarter(一个gui工具)---仓库中的可用软件(新立德或apt-get 获得)来配置她或他的iptables规则，而需要命令行知识。请查看指南，尽管...... 配置很简单，但是对于高级用户来说可能远远不能满足。然而它对于大多数的家庭用户来说是足够的...... 。(我)建议您使用firestarter在策略表中将出站配置为 &ldquo;限制&rdquo;，而将您需要的连接类型(如用于http的80、https的443，msn chat的1683等等)加入白名单。您也可以通过它查看进出您计算机的活动连接...... 。防火墙会一直保持下去一旦通过向导配置完毕。拨号用户必须在向导中指定它在拨号时自动启动。<span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">firestarter主页：<span class="Apple-converted-space">&nbsp;</span></span><a class="snap_shots" style="font: 12px/normal Verdana, Arial, Helvetica, sans-serif; color: rgb(42, 100, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" href="http://www.fs-security.com/" target="_blank" rel="nofollow"><font color="#2a6400">http://www.fs-security.com/</font></a><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span>(再次, 仓库源中可用, 不需要编译) 指南:<span class="Apple-converted-space">&nbsp;</span></span><a class="snap_shots" style="font: 12px/normal Verdana, Arial, Helvetica, sans-serif; color: rgb(42, 100, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" href="http://www.fs-security.com/docs/tutorial.php" target="_blank" rel="nofollow"><font color="#2a6400">http://www.fs-security.com/docs/tutorial.php</font></a><span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><span class="Apple-converted-space">&nbsp;</span></span><br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/normal Arial; color: rgb(104, 110, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">个人笔记：不幸运的是，它没有阻断(或询问用户)特定应用/程序的选项......。因此，我的理解是一旦启用了80端口(例如，用于访问网页)，那么任何程序都可以通过80端口连接任何服务器、做任何它想做的事......</span></p>]]></description>
			<link>http://meisw.wdlinux.cn//show-692-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2012-05-23 12:41</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-691-1.html</guid>
			<title>Ubuntu 10.04更新源大全</title>
			<author>admin</author>
			<description><![CDATA[<p><span style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">1.sudo gedit /etc/apt/sources.list</span><br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">编辑你的源列表，将原来的内容全部删除，添加下面列表中最适合你的源（注意不要全部添加），选择一个最合适你的即可，复制到你的列表中，然后保存列表。</span><br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">2.sudo apt-get update 更新源列表信息</span><br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">可以在运行&ldquo;sudo apt-get update &rdquo;时查看一下错误信息，把不能连接的源删除再重新运行&ldquo;sudo apt-get update &rdquo;。</span><br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">3.sudo apt-get upgrade 升 级或者用ubuntu自带的更新管理器升级也可</span><br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Ubuntu 10.04源列表：</span><br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">网易（速度很快）</span></p>
<div class="codetitle" style="font: 12px/16px &quot;Lucida Grande&quot;, Verdana, Helvetica, Arial, sans-serif; margin: 10px 5px 0px; padding: 2px 4px; border: 0px solid rgb(159, 76, 9); color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="margin: 0px; padding: 0px;">代码:</strong></div>
<div class="codecontent" style="font: 12px/16px monospace, &quot;Courier New&quot;; margin: 0px 5px 10px; padding: 5px; border: 1px solid rgb(153, 139, 117); color: rgb(0, 102, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; direction: ltr; orphans: 2; widows: 2; background-color: rgb(250, 250, 250); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">deb http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse<br style="margin: 0px; padding: 0px;" />
deb-src http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse<br style="margin: 0px; padding: 0px;" />
deb http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted</div>
<p><br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">搜狐</span></p>
<div class="codetitle" style="font: 12px/16px &quot;Lucida Grande&quot;, Verdana, Helvetica, Arial, sans-serif; margin: 10px 5px 0px; padding: 2px 4px; border: 0px solid rgb(159, 76, 9); color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="margin: 0px; padding: 0px;">代码:</strong></div>
<div class="codecontent" style="font: 12px/16px monospace, &quot;Courier New&quot;; margin: 0px 5px 10px; padding: 5px; border: 1px solid rgb(153, 139, 117); color: rgb(0, 102, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; direction: ltr; orphans: 2; widows: 2; background-color: rgb(250, 250, 250); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">deb http://mirrors.shlug.org/ubuntu/ lucid main universe restricted multiverse<br style="margin: 0px; padding: 0px;" />
deb-src http://mirrors.shlug.org/ubuntu/ lucid main universe restricted multiverse<br style="margin: 0px; padding: 0px;" />
deb http://mirrors.shlug.org/ubuntu/ lucid-security universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirrors.shlug.org/ubuntu/ lucid-security universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb http://mirrors.shlug.org/ubuntu/ lucid-updates universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb http://mirrors.shlug.org/ubuntu/ lucid-proposed universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirrors.shlug.org/ubuntu/ lucid-proposed universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb http://mirrors.shlug.org/ubuntu/ lucid-backports universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirrors.shlug.org/ubuntu/ lucid-backports universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirrors.shlug.org/ubuntu/ lucid-updates universe main multiverse restricted</div>
<p><br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">SRT Sources</span></p>
<div class="codetitle" style="font: 12px/16px &quot;Lucida Grande&quot;, Verdana, Helvetica, Arial, sans-serif; margin: 10px 5px 0px; padding: 2px 4px; border: 0px solid rgb(159, 76, 9); color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="margin: 0px; padding: 0px;">代码:</strong></div>
<div class="codecontent" style="font: 12px/16px monospace, &quot;Courier New&quot;; margin: 0px 5px 10px; padding: 5px; border: 1px solid rgb(153, 139, 117); color: rgb(0, 102, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; direction: ltr; orphans: 2; widows: 2; background-color: rgb(250, 250, 250); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">deb http://ubuntu.srt.cn/ubuntu/ lucid main restricted universe multiverse<br style="margin: 0px; padding: 0px;" />
deb http://ubuntu.srt.cn/ubuntu/ lucid-security main restricted universe multiverse<br style="margin: 0px; padding: 0px;" />
deb http://ubuntu.srt.cn/ubuntu/ lucid-updates main restricted universe multiverse<br style="margin: 0px; padding: 0px;" />
deb http://ubuntu.srt.cn/ubuntu/ lucid-proposed main restricted universe multiverse<br style="margin: 0px; padding: 0px;" />
deb http://ubuntu.srt.cn/ubuntu/ lucid-backports main restricted universe multiverse<br style="margin: 0px; padding: 0px;" />
deb-src http://ubuntu.srt.cn/ubuntu/ lucid main restricted universe multiverse<br style="margin: 0px; padding: 0px;" />
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-security main restricted universe multiverse<br style="margin: 0px; padding: 0px;" />
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-updates main restricted universe multiverse<br style="margin: 0px; padding: 0px;" />
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-proposed main restricted universe multiverse<br style="margin: 0px; padding: 0px;" />
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-backports main restricted universe multiverse</div>
<p><br style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" />
<span style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">ubuntu官方上海源</span></p>
<div class="codetitle" style="font: 12px/16px &quot;Lucida Grande&quot;, Verdana, Helvetica, Arial, sans-serif; margin: 10px 5px 0px; padding: 2px 4px; border: 0px solid rgb(159, 76, 9); color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong style="margin: 0px; padding: 0px;">代码:</strong></div>
<div class="codecontent" style="font: 12px/16px monospace, &quot;Courier New&quot;; margin: 0px 5px 10px; padding: 5px; border: 1px solid rgb(153, 139, 117); color: rgb(0, 102, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; direction: ltr; orphans: 2; widows: 2; background-color: rgb(250, 250, 250); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">deb http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse<br style="margin: 0px; padding: 0px;" />
deb-src http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse<br style="margin: 0px; padding: 0px;" />
deb http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted<br style="margin: 0px; padding: 0px;" />
deb-src http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted<span class="Apple-converted-space">&nbsp;</span></div>]]></description>
			<link>http://meisw.wdlinux.cn//show-691-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2012-05-22 18:36</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-690-1.html</guid>
			<title>用国内软件源为Ubuntu的apt-get提速</title>
			<author>admin</author>
			<description><![CDATA[<p>刚装好Ubuntu系统之后根据需要还要安装一系列的软件，最省心的办法就是通过apt-get来进行。默认的，apt-get会连接<a href="http://us.archive.ubuntu.com/">http://us.archive.ubuntu.com/</a>，看域名就知道这是一个美国的服务器。身处我们伟大的中华局域网中连美国的服务器当然很慢了。</p>
<p>这个软件源可以通过/etc/apt/sources.list修改，把找到的好软件源放到这个文件中即可从新的软件源安装软件。我以前也是用到了才到处找，今天发现不用那么麻烦，把其中的us.archive替换成cn.archive就可以使用中国的软件源了。</p>
<p>使用vi的替换方法：</p>
<p>vi /etc/apt/sources.list</p>
<p>打开之后依次输入以下命令： <br />
:%s/us.archive/cn.archive/g <br />
回车 <br />
:wq <br />
回车（退出vi）</p>
<p>然后再输入apt-get update更新一下刚才修改的配置文件。以后再安装软件就非常快了。</p>
<p><a href="http://cn.archive.ubuntu.com/">http://cn.archive.ubuntu.com/</a>这个源是SOHU在维护，搜狐还有另外一个域名（mirrors.sohu.com），此外网易也提供了镜像服务（mirrors.163.com）。修改方法是一样的，但是都不如这个直接把us改成cn简单。</p>
<p>感谢搜狐和网易</p>
<p>2011.9.29更新：</p>
<p>经测试搜狐的源（cn.archive.ubuntu.com、mirrors.sohu.com）是联通线路，电信服务器访问超级慢。</p>
<p>网易的源（mirrors.163.com）不知道是什么线路，但电信服务器访问超级快。</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-690-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2012-05-22 18:18</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-689-1.html</guid>
			<title>Ubuntu下的apt-get的使用方法详解</title>
			<author>admin</author>
			<description><![CDATA[<p>apt是一个很完整和先进的软件包管理程序</p>
<p>apt-get update //在修改/etc/apt/sources.list或者/etc/apt/preferences之后运行该命令。此外你需要定期运行这条命令，以确保你的软件列表示最新的。</p>
<p>apt-get install packagename //安装一个新的软件包</p>
<p>apt-get remove packagename&nbsp;&nbsp; //卸载一个已经安装的软件包（但保留了配置文件）</p>
<p>apt-get &ndash;purge remove packagename //卸载一个已安装的软件包（同时删除配置文件）</p>
<p>dpkg &ndash;force-all &ndash;purge packagename //有些软件很难卸载，而且还阻止了别的软件的应用，就可以用这个命令，不过有点冒险</p>
<p>apt-get autoclean apt //会把已安装的和已卸载的软件包都备份在硬盘上，所以需要空间的话，可以让这个命令来删除你删除的软件</p>
<p>apt-get clean //这个命令会把安装的软件备份也删除，不过不会影响软件的使用</p>
<p>apt-get upgrade //更新所有已安装的软件</p>
<p>apt-get dist-upgrade //将系统设计到新版本</p>
<p>atp-cache searching string //在软件列表中搜寻给出的string字符串</p>
<p>dpkg &ndash;l package-name-pattern //列出所有与模式相匹配的软件包。如果你不知道软件包的全名，你可以使用&ldquo;*package-name-pattern*&rdquo;</p>
<p>aptitude //详细查看已安装获可用的软件包。与apt-get类似，aptitude可以通过命令行方式调用，但仅限于某些命令</p>
<p>apt-cache showpkg pkgs //显示软件包信息</p>
<p>apt-cache dumpavail //打印可用软件列表</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-689-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2012-05-22 18:10</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-687-1.html</guid>
			<title>安装sshd</title>
			<author>admin</author>
			<description><![CDATA[<div class="postbody" style="font: 12px/16px &quot;Lucida Grande&quot;, &quot;Trebuchet MS&quot;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(247, 244, 239); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">安装OpenSSH<span class="Apple-converted-space">&nbsp;</span><br style="margin: 0px; padding: 0px;" />
Ubuntu缺省没有安装SSH Server，使用以下命令安装：<span class="Apple-converted-space">&nbsp;</span><br style="margin: 0px; padding: 0px;" />
<br style="margin: 0px; padding: 0px;" />
sudo apt-get install openssh-server openssh-client<span class="Apple-converted-space">&nbsp;</span><br style="margin: 0px; padding: 0px;" />
<br style="margin: 0px; padding: 0px;" />
不过Ubuntu缺省已经安装了ssh client。<span class="Apple-converted-space">&nbsp;</span><br style="margin: 0px; padding: 0px;" />
<br style="margin: 0px; padding: 0px;" />
可以通过编辑 /etc/ssh/sshd_config 文件来配置 OpenSSH<span class="Apple-converted-space">&nbsp;</span><br style="margin: 0px; padding: 0px;" />
udo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original<span class="Apple-converted-space">&nbsp;</span><br style="margin: 0px; padding: 0px;" />
sudo chmod a-w /etc/ssh/sshd_config.original<span class="Apple-converted-space">&nbsp;</span><br style="margin: 0px; padding: 0px;" />
<br style="margin: 0px; padding: 0px;" />
配置完成后重起：<span class="Apple-converted-space">&nbsp;</span><br style="margin: 0px; padding: 0px;" />
sudo /etc/init.d/ssh restart</div>
<p>&nbsp;</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-687-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2012-05-22 11:08</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-592-1.html</guid>
			<title>Ubuntu DNS配置与使用命令设置Ubuntu的ip地址</title>
			<author>admin</author>
			<description><![CDATA[<p>经过长时间学习Ubuntu DNS，你可能会遇到Ubuntu DNS中网络问题，这里将介绍Ubuntu DNS解决网络问题的方法，新装了Ubuntu，虽然使用图形界面明明已经设置好了ip，网关等等，但是不能上网。</p>
<p>一个朋友提醒说，也许是设置的问题，试试命令行的设置。于是搜索了一下怎么设置，结果还真的成功了。具体如下：<br />
1. 检验是否可以连通，就使用ping命令ping 网关开始的时候总是现实unreachable<br />
2. 设置IP sudo ifconfig eth0 133.133.133.190 netmask 255.255.255.0这样就算设置好了网卡eth0的IP地址和子网掩码<br />
3. 设置网关 sudo route add default gw 133.133.133.40<br />
4. ping 网关就可以ping通了<br />
5. 设置Ubuntu DNS 修改/etc/resolv.conf，在其中加入<br />
nameserver DNS的地址1<br />
nameserver DNS的地址2完成。这样设置之后，下次开机时候似乎IP又会发生变化。</p>
<p>一、使用命令设置Ubuntu的ip地址</p>
<p>1. 设置IP sudo ifconfig eth0 203.171.239.155 netmask 255.255.255.224 这样就算设置好了网卡eth0的IP地址和子网掩码<br />
2. 设置网关 sudo route add default gw 203.171.239.129<br />
3. 设置DNS 修改/etc/resolv.conf，在其中加入 nameserver DNS的地址1 nameserver DNS的地址2 完成。不过，这样设置之后，下次开机时候似乎IP又不存在了。</p>
<p>二、直接修改系统配置文件</p>
<p>Ubuntu的网络配置文件是：/etc/network/interfaces<br />
Ubuntu命令行修改网络配置方法/etc/network/interfaces打开后里面可设置DHCP或手动设置静态ip。前面auto eth0，让网卡开机自动挂载.</p>
<p>1. 以DHCP方式配置网卡<br />
编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces.并用下面的行来替换有关eth0的行:</p>
<pre><ol class="dp-xml"><li class="alt"><span><span>#&nbsp;The&nbsp;primary&nbsp;network&nbsp;interface&nbsp;-&nbsp;use&nbsp;DHCP&nbsp;to&nbsp;find&nbsp;our&nbsp;address &nbsp;</span></span></li><li><span>auto&nbsp;eth0 &nbsp;</span></li><li class="alt"><span>iface&nbsp;eth0&nbsp;inet&nbsp;dhcp&nbsp;</span></li></ol></pre>
<p>用下面的命令使网络设置生效:sudo /etc/init.d/networking restart也可以在命令行下直接输入下面的命令来获取地址sudo dhclient eth0</p>
<p>2. 为网卡配置静态IP地址<br />
编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces.并用下面的行来替换有关eth0的行:# The primary network interface</p>
<pre><ol class="dp-xml"><li class="alt"><span><span>auto&nbsp;eth0 &nbsp;</span></span></li><li><span>iface&nbsp;eth0&nbsp;inet&nbsp;static &nbsp;</span></li><li class="alt"><span>address&nbsp;192.168.3.90 &nbsp;</span></li><li><span>gateway&nbsp;192.168.3.1 &nbsp;</span></li><li class="alt"><span>netmask&nbsp;255.255.255.0 &nbsp;</span></li><li><span>#network&nbsp;192.168.3.0 &nbsp;</span></li><li class="alt"><span>#broadcast&nbsp;192.168.3.255&nbsp;</span></li></ol></pre>
<p>将上面的ip地址等信息换成你自己就可以了.用下面的命令使网络设置生效:sudo /etc/init.d/networking restart</p>
<p>3. 设定第二个IP地址(虚拟IP地址)<br />
编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces.在该文件中添加如下的行:</p>
<pre><ol class="dp-xml"><li class="alt"><span><span>auto&nbsp;eth0:1 &nbsp;</span></span></li><li><span>iface&nbsp;eth0:1&nbsp;inet&nbsp;static &nbsp;</span></li><li class="alt"><span>address&nbsp;192.168.1.60 &nbsp;</span></li><li><span>netmask&nbsp;255.255.255.0 &nbsp;</span></li><li class="alt"><span>network&nbsp;x.x.x.x &nbsp;</span></li><li><span>broadcast&nbsp;x.x.x.x &nbsp;</span></li><li class="alt"><span>gateway&nbsp;x.x.x.x&nbsp;</span></li></ol></pre>
<p>根据你的情况填上所有诸如address,netmask,network,broadcast和gateways等信息.用下面的命令使网络设置生效:sudo /etc/init.d/networking restart</p>
<p>4. 设置主机名称(hostname)<br />
使用下面的命令来查看当前主机的主机名称:sudo /bin/hostname<br />
使用下面的命令来设置当前主机的主机名称:sudo /bin/hostname newname<br />
系统启动时,它会从/etc/hostname来读取主机的名称.<br />
关于设置主机名称的更多信息,请访问这里</p>
<p>5. 配置Ubuntu DNS<br />
首先,你可以在/etc/hosts中加入一些主机名称和这些主机名称对应的IP地址,这是简单使用本机的静态查询.要访问Ubuntu DNS 服务器来进行查询,需要设置/etc/resolv.conf文件.假设Ubuntu DNS服务器的IP地址是192.168.3.2, 那么/etc/resolv.conf文件的内容应为:<br />
search test.com<br />
nameserver 192.168.3.2<br />
/etc/network/interfaces<br />
打开后里面可设置DHCP或手动设置静态ip。前面auto eth0，让网卡开机自动挂载.</p>
<p>1. 以DHCP方式配置网卡</p>
<p>编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces并用下面的行来替换有关eth0的行:</p>
<pre><ol class="dp-xml"><li class="alt"><span><span>#&nbsp;The&nbsp;primary&nbsp;network&nbsp;interface&nbsp;-&nbsp;use&nbsp;DHCP&nbsp;to&nbsp;find&nbsp;our&nbsp;address &nbsp;</span></span></li><li><span>auto&nbsp;eth0 &nbsp;</span></li><li class="alt"><span>iface&nbsp;eth0&nbsp;inet&nbsp;dhcp&nbsp;</span></li></ol></pre>
<p>用下面的命令使网络设置生效:sudo /etc/init.d/networking restart也可以在命令行下直接输入下面的命令来获取地址sudo dhclient eth0</p>
<p>2. 为网卡配置静态IP地址<br />
编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces<br />
并用下面的行来替换有关eth0的行:# The primary network interface</p>
<pre><ol class="dp-xml"><li class="alt"><span><span>auto&nbsp;eth0 &nbsp;</span></span></li><li><span>iface&nbsp;eth0&nbsp;inet&nbsp;static &nbsp;</span></li><li class="alt"><span>address&nbsp;192.168.3.90 &nbsp;</span></li><li><span>gateway&nbsp;192.168.3.1 &nbsp;</span></li><li class="alt"><span>netmask&nbsp;255.255.255.0 &nbsp;</span></li><li><span>#network&nbsp;192.168.3.0 &nbsp;</span></li><li class="alt"><span>#broadcast&nbsp;192.168.3.255&nbsp;</span></li></ol></pre>
<p>将上面的ip地址等信息换成你自己就可以了.用下面的命令使网络设置生效:sudo /etc/init.d/networking restart</p>
<p>3. 设定第二个IP地址(虚拟IP地址)<br />
编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces在该文件中添加如下的行:</p>
<pre><ol class="dp-xml"><li class="alt"><span><span>auto&nbsp;eth0:1 &nbsp;</span></span></li><li><span>iface&nbsp;eth0:1&nbsp;inet&nbsp;static &nbsp;</span></li><li class="alt"><span>address&nbsp;192.168.1.60 &nbsp;</span></li><li><span>netmask&nbsp;255.255.255.0 &nbsp;</span></li><li class="alt"><span>network&nbsp;x.x.x.x &nbsp;</span></li><li><span>broadcast&nbsp;x.x.x.x &nbsp;</span></li><li class="alt"><span>gateway&nbsp;x.x.x.x&nbsp;</span></li></ol></pre>
<p>根据你的情况填上所有诸如address,netmask,network,broadcast和gateways等信息.用下面的命令使网络设置生效:sudo /etc/init.d/networking restart</p>
<p>4. 设置主机名称(hostname)<br />
使用下面的命令来查看当前主机的主机名称:sudo /bin/hostname<br />
使用下面的命令来设置当前主机的主机名称:sudo /bin/hostname newname<br />
系统启动时,它会从/etc/hostname来读取主机的名称.关于设置主机名称的更多信息,请访问这里</p>
<p>5. 配置Ubuntu DNS<br />
首先,你可以在/etc/hosts中加入一些主机名称和这些主机名称对应的IP地址,这是简单使用本机的静态查询.要访问Ubuntu DNS 服务器来进行查询,需要设置/etc/resolv.conf文件.假设Ubuntu DNS服务器的IP地址是192.168.3.2, 那么/etc/resolv.conf文件的内容应为:</p>
<pre><ol class="dp-xml"><li class="alt"><span><span>search&nbsp;test.com &nbsp;</span></span></li><li><span>nameserver&nbsp;192.168.3.2&nbsp;</span></li></ol></pre>
<p>解决Ubuntu重启Ubuntu DNS重新设置的问题作者: wynlchae 发布日期: 2008-4-09 查看数: 256 出自: http://www.linuxdiyf.com在Ubuntu下设置静态IP，&ldquo;主菜单&rdquo;，&ldquo;系统&rdquo;，&ldquo;系统管理&rdquo;，&ldquo;网络&rdquo;，在&ldquo;Ubuntu DNS&rdquo;里删掉原来的Ubuntu DNS，填上静态的Ubuntu DNS的服务器，不过这样重启后就恢复，下次开机开得重新设置一次。</p>
<p>先备份：sudo cp /etc/resolv.conf /etc/resolv.conf.bak然后编辑sudo gvim /etc/dhcp3/dhclient.conf将以下行添加到末尾,就是Ubuntu DNS的2个服务器啦prepend domain-name-servers 208.67.222.222,208.67.220.220;#这两个服务器根据自己的Ubuntu DNS填上。</p>
<p>转</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-592-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2011-08-09 09:30</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-443-1.html</guid>
			<title>再谈关于ubuntu的root密码问题</title>
			<author>admin</author>
			<description><![CDATA[<p>如何设定/改变/启用 root 使用者的密码?</p>
<p>　　sudo passwd root</p>
<p>　　为了启用 root 帐号 (也就是 设置一个口令) 使用:</p>
<p>　　sudo passwd root</p>
<p>　　当你使用完毕后屏蔽 root 帐号 使用:</p>
<p>　　sudo passwd -l root</p>
<p>　　这个将锁住 root 帐号.&nbsp;</p>
<p><br />
　　如何在终端机模式下切换到 root 身份?</p>
<p>　　sudo -s -H</p>
<p>　　Password: &lt;在这注明您的密码&gt;缺省禁止 root 的好处包括了以下内容.</p>
<p>　　起初 Ubuntu 团队希望安装尽可能的简单. 不使用 root , 在安装期间的两个用户交互步骤可以省略. (科林&middot;沃森)</p>
<p>　　更进一步, 如果在安装中使用 root, 用户将被要求永远记住他们选择的密码--即使他们很少使用到它. Root 密码经常被对 Unix 安全模型不熟悉的用户忘记. (马特&middot;齐默曼)</p>
<p>　　它防止了缺省登录时 &quot;我能做任何事情&quot; --在较大的变化发生之前，你将被提示输入口令,这可以使你考虑你这样做的结果. 如果你作为 root 登录, 你可以删除一些 &quot;没用的文件夹&quot; 并且不会意识到你正处于错误的目录，那时已经太晚了. 它是在 Unix 下长时间使用 &quot;su-command-^D&quot; 练习的情况下，代替一直呆在 root shell--除非你做严重的系统维护 (那时你仍然可以使用 &quot;sudo su&quot;). (吉姆&middot;奇塔姆 和 安德鲁&middot;索巴拉)</p>
<p>　　Sudo 增加了运行命令的日志记录 (在 /var/log/auth.log). 如果你陷入困境, 你总是可以返回并看见那些运行的命令.</p>
<p>　　安全</p>
<p>　　与传统的 superuser 模型相比，这种方法有不同的利弊，两者都不总是显示优良的.</p>
<p>　　在鼓励使用 root 权限执行一个单独的命令, sudo 好过打开一个 shell:</p>
<p>　　减少使用 root 权限的时间总耗用, 降低了不注意使用 root 执行命令的风险</p>
<p>　　提供了有用的审核痕迹</p>
<p>　　有一个单独的 root 密码 (传统模型) 提供了一层额外的保护，当如果一个管理员的密码被侵害时。</p>
<p>　　无论怎样, 如果管理员 (使用 sudo 或 su 变成 root) 被侵害, 攻击者一般可以通过一次间接的攻击来获得 root。</p>
<p>-----------------------</p>
<p>Ubuntu在默认情况下是不启用root用户的，所以这对于一下对于linux命令不熟悉的用户在进行文件系统管理时不是很方便，例如要在主目录下粘贴一下东西，新建一些文件，当然用命令是很简单的，但也有例外，这就需要启用root用户来进行可视化管理，首先要建立root用户<br />
<font face=""><font style="font-size: 12px">sudo passwd</font><br />
</font>Password: &lt;--- 输入安装时那个用户的密码（新建用户的时候千万不能跳过）<br />
Enter new UNIX password: &lt;--- 新的Root用户密码<br />
Retype new UNIX password: &lt;--- 重复新的Root用户密码<br />
passwd：已成功更新密码<br />
这样就建立一root用户，在只执行这一步时笔者测试就可以用root登录，但有的文章称还要允许root登录，下面就介绍怎样允许root登录允许root登录，<br />
<font face=""><font style="font-size: 12px">如果要允许root登录（不推荐），则这样操作：</font><br />
</font>gksu /usr/sbin/gdmsetup<br />
（或者使用桌面菜单：系统＞系统管理＞登录窗口）<br />
点&ldquo;安全&rdquo;选项页，选择&ldquo;允许本地管理员登录&rdquo;。<br />
注：这一步依赖上一步<br />
<br />
不输入密码直接登录<br />
在论坛上也看见有人抱怨，家中的Ubuntu不能像Window$那样──不用输入密码就能登录。其实同样能做到：<br />
就在上一步的&ldquo;安全&rdquo;选项页中，勾选：<br />
&ldquo;启用自动登录&rdquo;，&ldquo;用户&rdquo;选择</p>
<p>----------------------------</p>
<p>刚入Ubuntu的人（base on debian），大多会因为安装中没有提示root密码而不太清楚为什么会这样。根据Ubuntu的中文文档，总结了本文。</p>
<p>关键词：</p>
<p>如何设定/改变/启用 root 使用者的密码?</p>
<p>sudo passwd root</p>
<p>为了启用 root 帐号 (也就是 设置一个口令) 使用:</p>
<p>sudo passwd root<br />
&nbsp;</p>
<p>当你使用完毕后屏蔽 root 帐号 使用:</p>
<p>sudo passwd -l root</p>
<p>这个将锁住 root 帐号.</p>
<p>如何在终端机模式下切换到 root 身份?</p>
<p>sudo -s -H</p>
<p>Password: &lt;在这注明您的密码&gt;缺省禁止 root 的好处包括了以下内容.</p>
<p>起初 Ubuntu 团队希望安装尽可能的简单. 不使用 root , 在安装期间的两个用户交互步骤可以省略. (科林&middot;沃森)</p>
<p>更进一步, 如果在安装中使用 root, 用户将被要求永远记住他们选择的密码&ndash;即使他们很少使用到它. Root 密码经常被对 Unix 安全模型不熟悉的用户忘记. (马特&middot;齐默曼)</p>
<p>它防止了缺省登录时 &quot;我能做任何事情&quot; &ndash;在较大的变化发生之前，你将被提示输入口令,这可以使你考虑你这样做的结果. 如果你作为 root 登录, 你可以删除一些 &quot;没用的文件夹&quot; 并且不会意识到你正处于错误的目录，那时已经太晚了. 它是在 Unix 下长时间使用 &quot;su-command-^D&quot; 练习的情况下，代替一直呆在 root shell&ndash;除非你做严重的系统维护 (那时你仍然可以使用 &quot;sudo su&quot;). (吉姆&middot;奇塔姆 和 安德鲁&middot;索巴拉)</p>
<p>Sudo 增加了运行命令的日志记录 (在 /var/log/auth.log). 如果你陷入困境, 你总是可以返回并看见那些运行的命令. (安德鲁&middot;Zbikowski)</p>
<p>安全</p>
<p>与传统的 superuser 模型相比，这种方法有不同的利弊，两者都不总是显示优良的.</p>
<p>在鼓励使用 root 权限执行一个单独的命令, sudo 好过打开一个 shell:</p>
<p>减少使用 root 权限的时间总耗用, 降低了不注意使用 root 执行命令的风险</p>
<p>提供了有用的审核痕迹</p>
<p>有一个单独的 root 密码 (传统模型) 提供了一层额外的保护，当如果一个管理员的密码被侵害时。</p>
<p>无论怎样, 如果管理员 (使用 sudo 或 su 变成 root) 被侵害, 攻击者一般可以通过一次间接的攻击来获得 root</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-443-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-38-1.html">ubuntu</category>
			<pubDate>2011-06-20 09:27</pubDate>
		</item>
	</channel>
</rss>
