📄 linuxbyte.htm
字号:
href="http://netfilter.samba.org/" target=_blank><A
href="http://netfilter.samba.org/"
target=_blank>http://netfilter.samba.org/</A></A>,下载可以找到的
iptables.tar.gz 的最新版本(目前是
iptables-1.1.2.tar.gz)。然后,输入以下命令来安装它(为简便起见,省略了输出): <BR><BR><BR># tar
xzvf iptables-1.1.2.tar.gz <BR># cd iptables-1.1.2 <BR># make <BR># make
install <BR><BR>内核配置,第 1 部分 <BR><BR>安装之后,应该有一个 "iptables" 命令可供使用,还有一个方便的
iptables 帮助页面("man iptables")。好;现在只需要确保已在内核中构建了必需的功能。本教程假设您编译自己的内核。进入
/usr/src/linux,输入 "make menuconfig" 或 "make xconfig";我们将启用一些内核网络功能。
<BR><BR>内核配置,第 2 部分 <BR><BR><BR>在 "Networking options" 部分中,确保至少启用了以下选项:
<BR><BR><BR><*> Packet socket <BR>[*] Network packet filtering
(replaces ipchains) <BR><*> Unix domain sockets <BR>[*] TCP/IP
networking <BR>[*] IP: advanced router <BR>[*] IP: policy routing
<BR>[*] IP: use netfilter MARK value as routing key <BR>[*] IP: fast
network address translation <BR>[*] IP: use TOS value as routing key
<BR><BR>然后,在 "IP: Netfilter Configuration --->"
菜单中,启用每个选项,这样我们就拥有了完整的 netfilter 功能。虽然我们不会使用所有 netfilter
功能,但最好启用它们,这样您可以在以后进行一些实验。 <BR><BR><BR>内核配置,第 3 部分
<BR><BR><BR>"Networking options" 类别下有一个网络选项不应该启用:明确拥塞通知。让这个选项保留禁用状态:
<BR><BR><BR>[ ] IP: TCP Explicit Congestion Notification support
<BR><BR>如果启用了这个选项,那么 Linux 机器将不能继续与 8% 的因特网进行网络通信。启用 ECN 时,Linux
机器发送出的一些包将会设置 ECN 位;不过,这个位会使许多网际路由器感到困惑,因此一定要禁用 ECN。
<BR><BR>好,现在已根据我们的需要正确配置了内核,编译一个新的内核,安装它,然后重新引导。现在开始使用 netfilter :)
<BR><BR><BR>防火墙设计基础 <BR><BR><BR>在创建防火墙时,"iptables"
命令是我们的朋友。我们使用它与内核中的网络包过滤规则进行交互。我们将使用 "iptables"
命令来新建规则、列出现有规则、刷新规则和设置缺省包处理策略。这就意味着要创建防火墙,需要输入一系列 iptables
命令,这就是我们首先要讨论的内容(此时请别输入此命令!)…… <BR><BR># iptables -P INPUT DROP
<BR><BR>您现在看到的是一个几乎“完美”的防火墙。如果输入此命令,您将会得到难以置信的完美保护,它可以防止任何形式的进入恶意攻击。那是因为此命令告诉内核删除所有进入网络包。虽然这个防火墙非常安全,但它有点傻。但在继续讨论之前,让我们研究一下此命令是如何执行操作的。
<BR><BR>设置链策略 <BR><BR>"iptables -P" 命令用于为包过滤规则链设置缺省策略。在本示例中,iptables -P
用于为 INPUT 链设置缺省策略,INPUT 是一个内置链,包括了应用于每个进入包的规则。通过将缺省策略设置成
DROP,告诉内核应该删除(即,废弃)到达 INPUT 规则链末端的任意包。而且,由于我们还没有对 INPUT
链添加任何规则,因此所有包都会到达此链的末端,而且所有包都会被删除。
<BR><BR>再次声明,这个命令本身根本没有用。但是,它演示了一个很好的防火墙设计策略。我们从缺省情况下删除所有包开始,然后逐步开放防火墙,这样它将会满足我们的需要。这种做法可以确保防火墙会尽可能安全。
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<DIV align=right>发布人:netbull 来自:IBM developerWorks
中国 </DIV><BR></UL><IMG src="linuxbyte.files/line.jpg"><BR>
<FORM action=post.php?skin=reart&ID=2584 method=post>
<UL>-- 发表评论 --<BR> 昵称:<INPUT name=name> Email:<INPUT
name=email><BR> 内容:<BR><TEXTAREA name=content rows=5 cols=56></TEXTAREA><BR> <INPUT type=submit value=确定回复> <INPUT type=reset value=清除></UL></FORM><IMG
src="linuxbyte.files/line.jpg"><BR>
<UL>
<LI>以下是对此文的评论:<BR><BR></LI></UL></TD><!--第三列-->
<TD vAlign=top align=left width="25%"> <IMG
src="linuxbyte.files/online.jpg" border=0>
<UL>
<LI><A href="http://www.linuxbyte.net/addnews.php"
target=_blank>新闻发布</A><BR><BR>
<LI><A href="http://www.linuxbyte.net/addart.php"
target=_blank>文献发布</A><BR><BR>
<LI><A href="http://www.linuxbyte.net/addsoft.php"
target=_blank>软件发布</A><BR><BR>
<LI><A href="http://www.linuxbyte.net/manger.php"
target=_blank>软件管理</A><BR></LI></UL><IMG height=5
src="linuxbyte.files/tabledi2.jpg" width="100%"><!--下载排行--> <IMG
src="linuxbyte.files/download.jpg" border=0> <BR> <A
href="http://www.linuxbyte.net/view.php?skin=soft&id=676">Red Hat
Linux</A> (81310)<BR> <A
href="http://www.linuxbyte.net/view.php?skin=soft&id=219">Oracle9i
Enterprise</A> (40539)<BR> <A
href="http://www.linuxbyte.net/view.php?skin=soft&id=93">星际译王1.31版</A> (37768)<BR> <A
href="http://www.linuxbyte.net/view.php?skin=soft&id=785">kylix</A> (36517)<BR> <A
href="http://www.linuxbyte.net/view.php?skin=soft&id=1642">Lindows OS
4.5</A> (29611)<BR> <A
href="http://www.linuxbyte.net/view.php?skin=soft&id=287">AOL
server</A> (27385)<BR> <A
href="http://www.linuxbyte.net/view.php?skin=soft&id=969">RedHat
中文环境</A> (26129)<BR> <A
href="http://www.linuxbyte.net/view.php?skin=soft&id=647">Chinput</A> (24366)<BR> <A
href="http://www.linuxbyte.net/view.php?skin=soft&id=1041">中软Linux</A> (21924)<BR> <A
href="http://www.linuxbyte.net/view.php?skin=soft&id=946">RedHat Linux
7.1正式</A> (21608)<BR><IMG height=5 src="linuxbyte.files/tabledi2.jpg"
width="100%"> <!--文摘分类--> <IMG src="linuxbyte.files/artstyle.jpg"
border=0> <BR> <A
href="http://www.linuxbyte.net/arttype.php?dno=1">内核分析</A><BR> <A
href="http://www.linuxbyte.net/arttype.php?dno=2">网络技术及应用</A><BR> <A
href="http://www.linuxbyte.net/arttype.php?dno=3">应用编程</A><BR> <A
href="http://www.linuxbyte.net/arttype.php?dno=4">硬件应用</A><BR> <A
href="http://www.linuxbyte.net/arttype.php?dno=5">软件应用</A><BR> <A
href="http://www.linuxbyte.net/arttype.php?dno=6">系统管理</A><BR> <A
href="http://www.linuxbyte.net/arttype.php?dno=7">数据库应用</A><BR> <A
href="http://www.linuxbyte.net/arttype.php?dno=8">系统安全</A><BR> <A
href="http://www.linuxbyte.net/arttype.php?dno=9">Linux中文化</A><BR> <A
href="http://www.linuxbyte.net/arttype.php?dno=10">市场与观点</A><BR><IMG
height=5 src="linuxbyte.files/tabledi2.jpg" width="100%">
<BR><!--合作伙伴--> <IMG src="linuxbyte.files/friends.jpg" border=0>
<BR> <A href="http://www.5ilinux.com/"
target=_blank>我爱linux</A><BR> <A
href="http://www.heblinux.org/"
target=_blank>河北LINUX协会</A><BR> <A
href="http://www.xteamlinux.com.cn/"
target=_blank>冲浪软件下载中心</A><BR> <A
href="http://cosoft.org.cn/html/"
target=_blank>共创联盟</A><BR> <A
href="http://www.coventive.com.cn/"
target=_blank>XLinux</A><BR> <A
href="http://www.it365.net/"
target=_blank>诺金软件电脑网络</A><BR> <A
href="http://www.ch2000.com.cn/"
target=_blank>中文2000软件</A><BR> <A
href="http://www.csuu.com/"
target=_blank>中国Unix联盟</A><BR> <A
href="http://freewares.cn/"
target=_blank>自由软件在中国</A><BR> <A
href="http://www.pconline.com.cn/pcedu"
target=_blank>太平洋电脑信息网</A><BR> <A
href="http://www.linuxaid.com.cn/"
target=_blank>LinuxAid</A><BR> <A
href="http://www.cosoft.org.cn/"
target=_blank>共创软件联盟</A><BR> <A
href="http://wsdn.org/"
target=_blank>WEB程序开发网络</A><BR> <A
href="http://linux.softhouse.com.cn/"
target=_blank>软件屋Linux之家</A><BR> <A
href="http://ljb.vpnet.cn/"
target=_blank>随意网络</A><BR> <A
href="http://linux.ccidnet.com/"
target=_blank>赛迪网Linux专区</A><BR></TD></TR></TBODY></TABLE>
<CENTER>Completed in 0.0464599132538 seconds</CENTER>
<CENTER>COPYRIGHT 2002-2003 <FONT color=#9b2626>LinuxByte.net</FONT> <A
href="mailto:oneteam@mail.linuxbyte.net">联系本站</A></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -