1
2
3
4
|
wget http:
//www
.kernel.org
/pub/linux/kernel/v2
.6
/linux-2
.6.28.
tar
.bz2
wget http:
//netfilter
.org
/projects/iptables/files/iptables-1
.4.7.
tar
.bz2
wget http:
//downloads
.sourceforge.net
/project/l7-filter/Protocol
%20definitions
/2009-05-28/l7-protocols-2009-05-28
.
tar
.gz?use_mirror=nchc
wget http:
//downloads
.sourceforge.net
/project/l7-filter/l7-filter
%20kernel%20version
/2
.22
/netfilter-layer7-v2
.22.
tar
.gz?use_mirror=nchc
|
1
2
3
4
|
tar
jxvf linux-2.6.28.
tar
.bz2 -C
/usr/src
tar
jxvf iptables-1.4.7.
tar
.bz2 -C
/usr/src
tar
zxvf l7-protocols-2009-05-28.
tar
.gz -C
/usr/src
tar
zxvf netfilter-layer7-v2.22.
tar
.gz -C
/usr/src
|
1
|
rpm -e --nodeps `rpm -qa |
grep
iptables`
|
1
2
3
4
5
6
7
8
9
10
|
General setup ---
Prompt for development and/or incomplete code/drivers 必选
Networking ---
Networking options ---
Network packet filtering framework (Netfilter) ---
Core Netfilter Configuration --- 该项下的所有项目建议都选上
Layer 7 debugging output 必选
IP: Netfilter Configuration --- 必选
|
1
2
|
cd
/usr/src/linux-2
.6.28/
patch -p1 <
/usr/src/netfilter-layer7-v2
.22
/kernel-2
.6.25-2.6.28-layer7-2.22.patch
|
1
2
3
4
|
make
menuconfig
make
make
modules_install
make
install
|
1
|
vi
/etc/grup
.conf
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)
/grub/splash
.xpm.gz
hiddenmenu
title CentOS (2.6.28)
root (hd0,0)
kernel
/vmlinuz-2
.6.28 ro root=
/dev/VolGroup00/LogVol00
initrd
/initrd-2
.6.28.img
title CentOS (2.6.18-164.el5)
root (hd0,0)
kernel
/vmlinuz-2
.6.18-164.el5 ro root=
/dev/VolGroup00/LogVol00
initrd
/initrd-2
.6.18-164.el5.img
|
1
2
3
4
5
6
7
|
cd
iptables-1.4.7/
cp
/usr/src/netfilter-layer7-v2
.22
/iptables-1
.4.3forward-
for
-kernel-2.6.20forward/* extensions/
.
/configure
--with-ksource=
/usr/src/linux-2
.6.28/
cp
/usr/src/netfilter-layer7-v2
.22
/iptables-1
.4.3forward-
for
-kernel-2.6.20forward/*.* extensions/
.
/configure
--with-ksource=
/usr/src/linux-2
.6.28
make
make
install
|
1
2
|
cd
l7-protocols-2009-05-28/
make
install
|
1
2
|
iptables -V
iptables -m layer7 –help
|
1
2
3
4
5
6
7
|
iptables -t mangle -I PREROUTING -m layer7 --l7proto edonkey -j DROP
iptables -t mangle -I PREROUTING -m layer7 --l7proto bittorrent -j DROP
iptables -t mangle -I PREROUTING -m layer7 --l7proto qq -j DROP
iptables -t mangle -I PREROUTING -m layer7 --l7proto msnmessenger -j DROP
iptables -t mangle -I PREROUTING -m layer7 --l7proto xunlei -j DROP
iptables -t mangle -I PREROUTING -m layer7 --l7proto kugoo -j DROP
iptables -t mangle -I PREROUTING -m layer7 --l7proto yahoo -j DROP
|