范先生
工程师 / 中科院
在fedora2 core kernel-2.6.5-1.358
需要文件 iptables-1.3.3.tar.bz2, netfilter-layer7-v2.1.tar.gz ,l7-protocols-2006-03-13.tar.gz
下面是具体安装l7_filter的过程与测试
6 tar -zxvf netfilter-layer7-v2.1.tar.gz -C /usr/src/
7 tar -zxvf l7-protocols-2006-03-13.tar.gz -C /usr/src/
8 ls
9 tar -jxvf iptables-1.3.3.tar.bz2 -C /usr/src/
10 ls
11 cd /usr/src/
12 ls
14 ln -s linux-2.6.5-1.358 linux
15 ls
16 cd linux
17 make xconfig
18 patch -p1 < ../netfilter-layer7-v2.1/for_older_kernels/kernel-2.6.0-2.6.8.1-layer7-0.9.2.patch
19 make xconfig
20 make bzImage
21 make modules
22 make modules_install
23 ls /lib/modules/2.6.5-1.358custom/kernel/net/ipv4/netfilter/
24 make install
25 cat /boot/grub/grub.conf
26 reboot
27 cd /usr/src/
28 ls
29 cd iptables-1.3.3/
30 ls
31 patch -p1 < ../netfilter-layer7-v2.1/iptables-layer7-2.1.patch
32 chmod +x extensions/.layer7-test
33 make KERNEL_DIR=/usr/src/linux
34 vi /usr/src/linux/include/linux/config.h(注释掉产生错误的代码
/*
#if !defined (__KERNEL__) && !defined(__KERNGLUE__)
#error including kernel header in userspace; use the glibc headers instead!
#endif
*/
保存推出vi编辑器)
35 make KERNEL_DIR=/usr/src/linux
36 make install KERNEL_DIR=/usr/src/linux
37 cd ../l7-protocols-2006-03-13/
38 ls
39 make install
40 lsmod
41 depmod -a
42 iptables -vnL
43 iptables -F
44 iptables -vnL
45 iptables -vnL -t mangle
46 iptables -vnL -t nat
47 iptables -t mangle -A INPUT -m layer7 --l7proto http -j ACCEPT
48 iptables -vnL -t MANGLE
49 iptables -vnL -t mangle
57 iptables -V
58 ftp 192.168.1.133
59 iptables -F -t mangle
60 iptables -vnL -t mangle
61 iptables -t mangle -A INPUT -m layer7 --l7proto http -j DROP
62 iptables -vnL
63 iptables -vnL -t mangle
64 ftp 192.168.1.133
65 ifconfig
66 iptables -t mangle -A INPUT -m layer7 --l7proto ftp -j DROP
67 ftp 192.168.1.133
68 iptables -vnL -t mangle
70 iptables -F -t mangle
71 iptables -vnL -t mangle
72 iptables -t mangle -A INPUT -m layer7 --l7proto ftp -j DROP
73 iptables -t mangle -A INPUT -m layer7 --l7proto yahoo -j DROP
2006年4月19日