[root@localhost ~]# yum -y install ncurses-devel gcc gcc-c++
[root@localhost ~]# rpm -ivh kernel-2.6.32-431.5.1.el6.src.rpm
[root@localhost ~]# cd rpmbuild/SOURCES
[root@localhost SOURCES]# tar -xf linux-2.6.35.9.tar.bz2 -C /usr/src
[root@localhost SOURCES]# cd
[root@localhost ~]# tar -xf netfilter-layer7-v2.23.tar.gz -C /usr/src
[root@localhost ~]# cd /usr/src
[root@localhost src]# ln -sv linux-2.6.35.9/ linux
“linux” -> “linux-2.6.35.9/”
[root@localhost src]# cd linux
[root@localhost linux]# patch -p1 < …/netfilter-layer7-v2.23/kernel-2.6.32-layer7-2.23.patch
[root@localhost linux]# cp /boot/config-2.6.32-431.el6.x86_64 ./config
[root@localhost linux]# make oldconfig
遇到选择的时候,有y有m 的时候选择y,没有y但是有m 的时候 选择m,一直选择,直到结束。
[root@localhost linux]# make menuconfig
把layer7打成模块,然后exit一下
layer7 去勾选 然后再勾选 喜爱版的dubugging 也是 先去勾选 然后再勾选
回到第一层,选择
[root@localhost linux]# make
[root@localhost linux]# make modules
[root@localhost linux]# make modules_install
[root@localhost linux]# make install
[root@localhost linux]# vim /etc/grub.conf
default=0
[root@localhost linux]# reboot
[root@localhost linux]# uname -r 查看一下内核版本号
做好备份
[root@localhost linux]# cp /etc/init.d/iptables .
[root@localhost linux]# cp /etc/syconfig/iptables-config .
[root@localhost linux]# rpm -qa | grep iptables
[root@localhost linux]# rpm -e iptables-1.4.7-11.el6.x86_64 --nodeps
[root@localhost linux]# tar -jxf iptables-1.4.12.1.tar.bz2 -C /usr/src
[root@localhost linux]# cd /usr/src/iptables-1.4.12.1/
[root@localhost iptables-1.4.12.1]# cp /usr/src/netfilter-layer7-v2.23/iptables-1.4.3forward-for-kernel-2.6.20forward/libxt_layer7.* ./extensions/
[root@localhost iptables-1.4.12.1]# cd extensions/
[root@localhost extensions]# ls layer 可以看到刚才复制的两个文件
[root@localhost extensions]#cd …
[root@localhost iptables-1.4.12.1]# ./configure --prefix=/usr/ --with-ksouce=/usr/src/linux
[root@localhost iptables-1.4.12.1]# make
[root@localhost iptables-1.4.12.1]# make install
[root@localhost iptables-1.4.12.1]# cd
[root@localhost ~]# tar -zxf l7-protocols-2009-05-25.tar.gz
[root@localhost ~]# cd l7-protocols-2009-05-25/
[root@localhost l7-protocols-2009-05-25]# make install
[root@localhost ~]# cd
[root@localhost ~]# mv iptables /etc/init.d/
[root@localhost ~]# cp iptables-config /etc/sysconfig/
[root@localhost ~]# cp /usr/sbin/iptables /sbin
[root@localhost ~]# cp /usr/sbin/iptables-restore /sbin
[root@localhost ~]# cp /usr/sbin/iptables-save /sbin
[root@localhost ~]# /etc/init.d/iptables start
[root@localhost ~]# /etc/init.d/iptables restart
[root@localhost ~]# iptables -t mangle -A POSTROUTING -m layer7 --l7proto qq -j DROP
没有报错,表明iptables已经可以添加七层的qq协议,iptables内核升级成功
[root@localhost ~]# iptables -t mangle -nvL