This article Iptables-layer7 part of the distance on the blog for some time, mainly the two-day weekend house in the bedroom, bedroom and wood has air-conditioning, the idea of adding layer7 function to add kernel module, recompile kernel, that long wait ... I feel irritable ... So I was lazy for two days ...
Here again nonsense, we have determined to learn Linux children's shoes can pay attention to the next http://mageedu.blog.51cto.com/own look, strong do not need to explain
Don't pull that off. Get to the point.
To enable iptables to implement the application layer of the worry, first of all, the kernel and the application layer of the Iptables definition tool on the Layer7 patch, so that it can implement the application layer of different applications of the characteristics of the packet matching.
So one has to patch the kernel again and load the Layer7-related modules when the kernel is recompiled.
Second, uninstall the application layer's rule definition tool iptables and download the iptables source code recompile installation
This enables the Layer7 module to be supported at both the kernel layer and the user layer, and to implement the rule matching for different application layer protocols in the actual application, it is also necessary to download the installation rule definition package
To sum up, to add the Layer7 layer in the iptables, you need the following stuff
1.layer7 Patch
2. Protocol Matching Package
3.iptables of source code
4.linux Kernel Source
Next, start the concrete implementation process
First look at my current kernel version (centos6.2 system)
First go to the website to download the most and my version of the closest to the kernel source code
http://www.kernel.org/
I downloaded the linux-2.6.32.59 package, you can specifically download the corresponding source package according to their actual situation
Iptables Source Code
ftp://ftp.netfilter.org/pub/iptables/
Layer7 patches and matching rules, attention to patch packs
http://sourceforge.net/
These packages I package into a provide for everyone to download (kernel source is larger, there is a need or download it yourself)
First add Layer7 patches to the Linux kernel (layer7 patch has 2, one is the kernel patch, the other is the user space iptables program patch), recompile the kernel
Step1: core patch, recompile kernel
Unpack the kernel source code
[Root@localhost ~]# tar-xf linux-2.6.32.59.tar.bz2-c/usr/src/
CD Past
[Root@localhost ~]# CD!$
Create a soft connection
[Root@localhost src]# LN-SV Linux-2.6.32.59/linux
"Linux"-> "Linux-2.6.32.59/"
Unzip the patch package
[Root@localhost ~]# tar-xf netfilter-layer7-v2.22.tar.gz-c/usr/src/
Patch the kernel source code
[Root@localhost src]# Cd/usr/src/linux
[Root@localhost src]# Patch-p1 < /usr/src/netfilter-layer7-v2.22/kernel-2.6.25-2.6.28-layer7-2.22.patch
Configure the kernel compile file (I used the. config profile of the original installation system to modify it)
[root@localhost linux]# cp/boot/config-2.6.32-220.el6.i686. config
[Root@localhost linux]# make Menuconfig #确保已经安装开发环境
Open Network-related support