redhat6 iptables 内核升级

[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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值