为内核选择新添加的模块 # cd /usr/src/linux-2.6.9 # make menuconfig 路径:Device Drivers ---> Networking support ---> Networking options ---> Network packet filtering (replaces ipchains) ---> IP: Netfilter Configuration ---> 新加入的模块都在这里 选中新加入的模块 Layer 7 match support (EXPERIMENTAL) [ ] Layer 7 debugging output (NEW) (这个debug 就不要选啦) (2048) Buffer size for application layer data (NEW) 保存退出
编译netfilter模块 # cd /usr/src/linux-2.6.9 # make modules_prepare # make M=net/ipv4/netfilter 编译完成netfilter模块后拷贝编译完成的模块到当前系统netfilter中(注CentOS所有版的cp –f 这个选项都失效 手动Y回车吧 汗~) # cp -f /usr/src/linux-2.6.9/net/ipv4/netfilter/*.ko /lib/modules/2.6.9-42.EL/kernel/net/ipv4/netfilter/ # chmod +x /lib/modules/2.6.9-42.EL/kernel/net/ipv4/netfilter/*.ko # depmod -a 安装l7协议 # cd /usr/src/l7-protocols-2006-10-18 # make install 安装新的 iptables (这个注释不明白是什么意思) # vi /usr/src/linux-2.6.9/include/linux/config.h 用 // 把下面的中间三行注释掉
#include //#if !defined (__KERNEL__) && !defined(__KERNGLUE__) //#error including kernel header in userspace; use the glibc headers instead! //#endif #endif 保存退出
# cd /usr/src/iptables-1.3.5 # export KERNEL_DIR=/usr/src/linux-2.6.9 # export IPTABLES_DIR=/usr/src/iptables-1.3.5 保证有这两个环境变量存在(前面我们已经做过,可用 echo $ KERNEL_DIR和echo $ IPTABLES_DIR 查看目录设置是否正确)然后安装 # make BINDIR=/sbin LIBDIR=/lib MANDIR=/usr/share/man install 更新ipp2p模块,使他支持更多的协议 # cd /usr/src/ipp2p-0.8.2 # make 备份原模块 # cp /lib/iptables/libipt_ipp2p.so / # cp /usr/src/ipp2p-0.8.2/libipt_ipp2p.so /lib/iptables
安装白金写的域名模块 [root@ES-vcmres patchlets]# cd domain-0.0.2/ [root@ES-vcmres domain-0.0.2]# ls ChangeLog ipt_domain.c ipt_domain.o libipt_domain.o Makefile INSTALL ipt_domain.h libipt_domain.c libipt_domain.so tags
[root@ES-vcmres domain-0.0.2]# make make -C /lib/modules/2.6.9-42.EL/build SUBDIRS=/usr/src/patch-o-matic-ng-20060509/patchlets/domain-0.0.2 modules make[1]: Entering directory `/usr/src/kernels/2.6.9-42.EL-i686' CC [M] /usr/src/patch-o-matic-ng-20060509/patchlets/domain-0.0.2/ipt_domain.o Building modules, stage 2. MODPOST CC /usr/src/patch-o-matic-ng-20060509/patchlets/domain-0.0.2/ipt_domain.mod.o LD [M] /usr/src/patch-o-matic-ng-20060509/patchlets/domain-0.0.2/ipt_domain.ko make[1]: Leaving directory `/usr/src/kernels/2.6.9-42.EL-i686'
[root@ES-vcmres domain-0.0.2]# make install cp -rf libipt_domain.so /lib/iptables/ cp -rf ipt_domain.ko /lib/modules/`uname -r`/kernel/net/ipv4/netfilter/ depmod -a
安装白金写的多IP模块 [root@ES-vcmres patchlets]# cd multiip/ [root@ES-vcmres multiip]# ls INSTALL ipt_multiip.h libipt_multiip.c libipt_multiip.so ipt_multiip.c ipt_multiip.o libipt_multiip.o Makefile
[root@ES-vcmres multiip]# make make -C /lib/modules/2.6.9-42.EL/build SUBDIRS=/usr/src/patch-o-matic-ng-20060509/patchlets/multiip modules make[1]: Entering directory `/usr/src/kernels/2.6.9-42.EL-i686' CC [M] /usr/src/patch-o-matic-ng-20060509/patchlets/multiip/ipt_multiip.o Building modules, stage 2. MODPOST CC /usr/src/patch-o-matic-ng-20060509/patchlets/multiip/ipt_multiip.mod.o LD [M] /usr/src/patch-o-matic-ng-20060509/patchlets/multiip/ipt_multiip.ko make[1]: Leaving directory `/usr/src/kernels/2.6.9-42.EL-i686'
[root@ES-vcmres multiip]# make install cp -rf libipt_multiip.so /lib/iptables/ cp -rf ipt_multiip.ko /lib/modules/`uname -r`/kernel/net/ipv4/netfilter/ [root@ES-vcmres multiip]# depmod -a
更新modules.dep # depmod -a 当出现错误时可以把出错的删除. 例如:rm -rf /lib/modules/2.4.21-47.EL/kernel/net/ipv4/netfilter/ipchains_core.o depmod: *** Unresolved symbols in /lib/modules/2.4.21-47.EL/kernel/net/ipv4/netfilter/ipchains_core.o depmod: *** Unresolved symbols in /lib/modules/2.4.21-47.EL/kernel/net/ipv4/netfilter/ipfwadm_core.o 直到再执行 depmod -a 不在出错
编译安装新的iptables # cd /usr/src/iptables-1.3.5 # export KERNEL_DIR=/usr/src/linux-2.4 # export IPTABLES_DIR=/usr/src/iptables-1.3.5 # chmod +x extensions/.ipp2p-test # make BINDIR=/sbin LIBDIR=/lib MANDIR=/usr/share/man install
安装l7-filter协议: cd /usr/src/l7-protocols-2006-10-18 make install
更新ipp2p模块,使他支持更多的协议 # cd /usr/src/ipp2p-0.8.2 # make 备份 # cp /lib/iptables/libipt_ipp2p.so / # cp /usr/src/ipp2p-0.8.2/libipt_ipp2p.so /lib/iptables/ # make && make install # make && make install # depmod -a