Use l7filter in Linux to block thunder, QQ, and MSN

Source: Internet
Author: User
Article Title: block thunder, QQ, and MSN using l7filter in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

CentOS 1, 5.2----------------------------------------------------- The most stable linux Server

Linux-2.6.19.tar.gz------------------------------------------ 2.6.19 Kernel

Iptables-1.4.1.1.tar.gz-------------------------------------- Iptables main program

Netfilter-layer7-v2.21.tar.gz------------------------------ L7filter main program

L7-protocols-2008-12-18.tar.gz-------------------------- Block protocol script of l7filter


Websites related to l7filter:

Http://l7-filter.sourceforge.net/protocols

Http://sourceforge.net/projects/l7-filter/

Http://protocolinfo.org/wiki/Main_Page


The README file in zookeeper netfilter-layer7-v2.21.tar.gz to determine the kernel version.

Iptables-1.4-for-kernel-2.6.20forward-layer7-[l7-filter version]. patch

Forward indicates that the kernel version is 2.6.20 or later.

Iptables-1.3-for-kernel-pre2.6.20-layer7-[l7-filter version]. patch

Pre indicates that earlier kernel versions earlier than 2.6.20 are supported, including version 2.4.


We choose

Kernel Patch: kernel-2.6.25-2.6.28-layer7-2.21.patch

Iptables patches are: iptables-1.4.1.1-for-kernel-2.6.20forward

Kernel version selected as: linux-2.6.27

Iptables selected as: iptables-1.4.1.1.tar


1. patch the kernel and iptables with l7filter
1.1 install gcc
Use custom software when installing CentOS5.2, select "based" and cancel all other selections for basic installation. After installation is complete, go to the system and first install GCC.

# Rpm-ivhukernel-headers-2.6.18-92.el5.i386.rpm

# Rpm-ivhuglibc-headers-2.5-24.i386.rpm

# Rpm-ivhuglibc-devel-2.5-24.i386.rpm

# Rpm-ivhulibgomp-4.1.2-42.el5.i386.rpm

# Rpm-ivhucpp-4.1.2-42.el5.i386.rpm

# Rpm-ivhugcc-4.1.2-42.el5.i386.rpm

Check the GCC version:

# Gcc-v

Gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)

Check the current kernel version:

# Uname-r

2.6.19-default

You also need to install the following RPM package, which is required when # make menuconfig; otherwise, an error is returned:

# Rpm-ivhuncurses-devel-5.5-24.20060715.i386.rpm

1.2 patch the kernel
Decompress l7filter:

# Tar zxvf netfilter-layer7-v2.21.tar.gz

Patch the kernel with l7filter:

# Tar zxvf linux-2.6.27.tar.gz

# Cd linux-2.6.27

# Patch-p1 <../netfilter-layer7-v2.21/kernel-2.6.25-2.6.28-layer7-2.21.patch

You also need to modify the following files; otherwise, an error occurs during compilation:

# Vi scripts/kconfig/mconf. c

Comment out the static struct menu * current_menu; line,

And add the struct menu * current_menu; as follows:

// Static struct menu * current_menu;

Struct menu * current_menu;

Copy the previous configuration file to the current kernel directory to inherit the original configuration:

# Cp/boot/config-2.6.18-92.el5./. config

# Make mrproper @ Delete unnecessary files and directories, not required for the first kernel Compilation

# Make clean @ Delete unnecessary modules and files

# Make menuconfig @ text menu-based configuration interface, which is recommended for character Terminals

When you select the corresponding configuration, there are three options, which represent the following meanings:
Y -- compile this function into the kernel
N -- do not compile this function into the kernel
M -- compile this function into a module that can be dynamically inserted into the kernel as needed

Networking support ---> Networking options ---> Network packet filtering framework (Netfilter) ---> Core Netfilter Configuration --->

Select the following two rows:

"Layer7" match support

[*] Layer 7 debugging output

As shown in:

 

500) this. width = 500; "border = 0 twffan =" done ">

[1] [2] [3] [4] Next page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.