iptables之三:基于iptables实现7层访问过滤

3、进入内核源码目录,为其打上layer7补丁

4、以本地内核配置文件为模板,编译内核

[root@nmshuishui linux]# cp /boot/config-2.6.32-358.el6.x86_64 .config[root@nmshuishui linux]# make menuconfig

(1)装载核心配置模块layer7

Networking support—>Networking options—>Network packet filtering framework(Netfilter)—>core Netfilter Configuration—>”layer7″ match support

(2)开启连接追踪

Networking support—>Networking options—>Network packet filtering framework(Netfilter)—>core Netfilter Configuration—>Netfilter connection tracking support

(3)开启IPv4的NAT连接追踪功能

Networking support—>Networking options—>Network packet filtering framework(Netfilter)—>IP:Netfilter Configuration—>IPv4 connection tracking support (required for NAT)

(4)取消模块签名认证

redhat的签名认证,是一种反盗版机制,如果不取消,则拒绝编译

Enable loadable module support—>Module signature verification(EXPERIMENTAL)

(5)关闭内核签名检查

Cryptographic API—>In-kernel signature checker(EXPERIMENTAL)

(6)保存退出

5、编译并安装内核

# make -j 4# make modules_install# make install

经过漫长的两个小时的编译,居然还没有编译完事,端起来电脑看,屏幕一直在滚动,终于发现了它好像一直就在那一个页面循环啊!

又经过了漫长的一夜的等待,回头一看,居然又报错了,真是天理难容啊!

貌似是在说磁盘空间不足的问题,那就使用df -h查查看吧

果然是100%了,,哎,又没做LVM,看来只能重做个系统了,给根分大点,再重新来一次。

又经过漫长的一上午的艰苦等待,还是没有成功,居然又给报了一个错,说是找不到IPv4连接追踪模块?(气的忘截图了)突然想起来那我会编译的时候是直接编译到内核了,看来不行,那就改成模块方式(上面步骤中已经改正),再来!……又过了好久好久 终于OK了!

6、重启系统,启用新内核

7、编译iptables

(1)为iptables打补丁

现在虽然内核支持layer7了,但是iptables并不支持layer7命令,所以我们还需要编译iptables,为iptables打补丁,让其能够支持layer7命令

# tar xf iptables-1.4.20.tar.gz

(2)备份iptables的服务脚本及配置文件

(3)卸载iptables

rpm -e iptables iptables-ipv6 –nodeps

(4)编译安装iptables

./configure –prefix=/usr –with-ksource=/usr/src/linux

编译时可能会出现这样一个界面,直接略过

(5)make && make install

(6)为编译安装的iptables提供脚本及配置文件

cp /root/app/iptables /etc/rc.d/init.dcp /root/app/iptables-config /etc/sysconfig/

8、为layer7模块提供其所识别的协议的特征码

# tar zxvf l7-protocols-2009-05-28.tar.gz# cd l7-protocols-2009-05-28# make install

本文出自 “nmshuishui的博客” 博客,请务必保留此出处

开始的时侯,我们就知道,总会有终结。

iptables之三:基于iptables实现7层访问过滤

相关文章:

你感兴趣的文章:

标签云: