忘记密码   免费注册 查看新帖 | 论坛精华区
ChinaUnix.net
  平台论坛 博客 微博 读书 人才 精华 文库 自测 | 频道操作系统 开发 数据库 存储 服务器 网络 IT新闻 Linux 下载 Power用户组
最近访问板块 发新帖
查看: 15699 | 回复: 42

centos 5.4+Layer7封qq、msn和p2p下载 [复制链接]
更多

帖子
51
主题
7
精华
0
可用积分
100
专家积分
0
在线时间
82 小时
注册时间
2010-03-07
最后登录
2011-04-19
论坛徽章:
0
发表于 2010-03-12 19:20:32 |显示全部楼层
本帖最后由 eric_mg 于 2010-03-23 14:25 编辑

一、安装前准备

1.所需要软件包
  linux-2.6.28.tar.gz                  http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.28.tar.gz
  iptables-1.4.3.2.tar.bz2         [url]http://netfilter.org/projects/iptables/files/iptables-1.4.3.2.tar.bz2[/url]
  netfilter-layer7-v2.22.tar.gz   http://sourceforge.net/projects/l7-filter/files/l7-filter%20kernel%20version/2.22/netfilter-layer7-v2.22.tar.gz/download
  l7-protocols-2009-05-28.tar.gz  http://sourceforge.net/projects/l7-filter/files/Protocol%20definitions/2009-05-28/l7-protocols-2009-05-28.tar.gz/download

2.把以上内核和软件包解压到/usr/src下(这个是我个人的习惯)
  tar -zxvf linux-2.6.28.tar.gz -C /usr/src
  tar -zxvf netfilter-layer7-v2.22.tar.gz -C /usr/src
  tar -zxvf l7-protocols-2009-05-28.tar.gz -C /usr/src
  tar -jxvf iptables-1.4.3.2.tar.bz2 -C /usr/src

3.卸载系统自带的iptables
  rpm -qa | grep iptables   列出已安装的iptables包
  rpm -e --nodeps  ~~
  
二、安装layer7

1.给新内核安装layer7补丁
  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

2.编译新内核

2.1修改内核配置项
   make oldconfig 全部保持默认
   make menuconfig
   General setup  --->
      Prompt for development and/or incomplete code/drivers  必选
   Networking  --->
       Networking options  --->
            Network packet filtering framework (Netfilter)  --->
                 Core Netfilter Configuration  --->   该项下的所有项目建议都选
                      <M> Netfilter connection tracking support  这个项目必需选上,下面才会出现layer7的选项
                            <M>   "layer7" match support         必选                              
                                  Layer 7 debugging output   必选   
        IP: Netfilter Configuration  --->    该项下的所有项目必需都选上

2.2编译并安装新内核
   make
   make modules_install
   make install

2.3 设置新内核为默认启动的内核,如果是远程连接服务器,必须要修改这项,否则重启后默认加载旧的kernel
   vim /boot/gurb/gurb.conf

default=1     把1改为0
timeout=15    设置等候时间
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.28)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.28 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.28.img
title CentOS (2.6.18-164.el5)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-164.el5.img
保存退出
reboot

3.编译安装iptables并支持layer7
  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
4.安装l7协议
cd /usr/src/iptables-1.4.3.2/l7-protocols-2009-05-28
make install

5.测试
  iptables -V
  回显:
  iptables v1.4.3.2

  iptables -m layer7 --help
  回显:
  Usage: iptables -[AD] chain rule-specification [options]
       iptables -I chain [rulenum] rule-specification [options]
       iptables -R chain rulenum rule-specification [options]
       iptables -D chain rulenum [options]
       iptables -[LS] [chain [rulenum]] [options]
       iptables -[FZ] [chain] [options]
       iptables -[NX] chain
       iptables -E old-chain-name new-chain-name
       iptables -P chain target [options]
       iptables -h (print this help information)

Commands:
Either long or short options are allowed.
  --append  -A chain            Append to chain
  --delete  -D chain            Delete matching rule from chain
  --delete  -D chain rulenum
                                Delete rule rulenum (1 = first) from chain
  --insert  -I chain [rulenum]
                                Insert in chain as rulenum (default 1=first)
  --replace -R chain rulenum
                                Replace rule rulenum (1 = first) in chain
  --list    -L [chain [rulenum]]
                                List the rules in a chain or all chains
  --list-rules -S [chain [rulenum]]
                                Print the rules in a chain or all chains
  --flush   -F [chain]          Delete all rules in  chain or all chains
  --zero    -Z [chain]          Zero counters in chain or all chains
  --new     -N chain            Create a new user-defined chain
  --delete-chain
            -X [chain]          Delete a user-defined chain
  --policy  -P chain target
                                Change policy on chain to target
  --rename-chain
            -E old-chain new-chain
                                Change chain name, (moving any references)
Options:
[!] --proto     -p proto        protocol: by number or name, eg. `tcp'
[!] --source    -s address[/mask]
                                source specification
[!] --destination -d address[/mask]
                                destination specification
[!] --in-interface -i input name[+]
                                network interface name ([+] for wildcard)
--jump -j target
                                target for rule (may load target extension)
  --goto      -g chain
                              jump to chain with no return
  --match       -m match
                                extended match (may load extension)
  --numeric     -n              numeric output of addresses and ports
[!] --out-interface -o output name[+]
                                network interface name ([+] for wildcard)
  --table       -t table        table to manipulate (default: `filter')
  --verbose     -v              verbose mode
  --line-numbers                print line numbers when listing
  --exact       -x              expand numbers (display exact values)
[!] --fragment  -f              match second or further fragments only
  --modprobe=<command>          try to insert modules using this command
  --set-counters PKTS BYTES     set the counter during insert/append
[!] --version   -V              print package version.

layer7 match options:
    --l7dir <directory> : Look for patterns here instead of /etc/l7-protocols/
                          (--l7dir must be specified before --l7proto if used)
[!] --l7proto <name>: Match named protocol using /etc/l7-protocols/.../name.pat

至此安装过程完全完成

帖子
51
主题
7
精华
0
可用积分
100
专家积分
0
在线时间
82 小时
注册时间
2010-03-07
最后登录
2011-04-19
论坛徽章:
0
发表于 2010-03-12 19:22:14 |显示全部楼层
回复 1# eric_mg

自已沙发{:2_165:}

Rank: 7Rank: 7Rank: 7

帖子
2940
主题
50
精华
1
可用积分
13775
专家积分
30
在线时间
456 小时
注册时间
2007-10-21
最后登录
2011-01-24
论坛徽章:
0
发表于 2010-03-12 23:02:32 |显示全部楼层
很好,支持!
TNND,把知识都交出来!
人生的转折

Rank: 8Rank: 8

帖子
36723
主题
717
精华
111
可用积分
78842
专家积分
599
在线时间
816 小时
注册时间
2002-11-02
最后登录
2012-02-09
论坛徽章:
0
发表于 2010-03-13 08:30:35 |显示全部楼层
感谢楼主分享
当我们在为生活而疲惫奔波的时候
生活却渐渐离我们远去
find our way, find our style

Platinum's BLog
http://platinum.cublog.cn

我的微博
http://weibo.com/bjpt
男性it民工

Rank: 8Rank: 8

帖子
33272
主题
152
精华
3
可用积分
107486
专家积分
563
在线时间
7048 小时
注册时间
2001-12-24
最后登录
2012-02-09
论坛徽章:
0
发表于 2010-03-13 09:02:26 |显示全部楼层
写的不错,先收藏了
好读书,不求甚解;每有会意,便欣然忘食
宝剑锋从磨砺出,梅花香自苦寒来!!!

帖子
5510
主题
452
精华
1
可用积分
28
专家积分
7
在线时间
628 小时
注册时间
2008-11-02
最后登录
2011-11-17
论坛徽章:
0
发表于 2010-03-13 16:31:04 |显示全部楼层
封qq、msn和p2p下载 在哪
一直在努力,一直在进步!!

帖子
51
主题
7
精华
0
可用积分
100
专家积分
0
在线时间
82 小时
注册时间
2010-03-07
最后登录
2011-04-19
论坛徽章:
0
发表于 2010-03-13 18:02:24 |显示全部楼层
封qq、msn和p2p下载 在哪
aaaaa5aa 发表于 2010-03-13 16:31



linux-2.6.28.tar.gz                     http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.28.tar.gz
iptables-1.4.3.2.tar.bz2              http://netfilter.org/projects/ip ... les-1.4.3.2.tar.bz2
netfilter-layer7-v2.22.tar.gz        http://sourceforge.net/projects/ ... .22.tar.gz/download
l7-protocols-2009-05-28.tar.gz  http://sourceforge.net/projects/ ... -28.tar.gz/download

帖子
5510
主题
452
精华
1
可用积分
28
专家积分
7
在线时间
628 小时
注册时间
2008-11-02
最后登录
2011-11-17
论坛徽章:
0
发表于 2010-03-13 23:47:38 |显示全部楼层
嗯,知道了
一直在努力,一直在进步!!

Rank: 2

帖子
434
主题
27
精华
0
可用积分
1115
专家积分
0
在线时间
137 小时
注册时间
2008-08-10
最后登录
2012-01-18
论坛徽章:
0
发表于 2010-03-15 08:54:26 |显示全部楼层
还没看,但应该用得上,收藏
Lost Jenova

帖子
13
主题
0
精华
0
可用积分
26
专家积分
0
在线时间
3 小时
注册时间
2010-03-07
最后登录
2010-04-19
论坛徽章:
0
发表于 2010-03-15 14:37:56 |显示全部楼层
楼主很强大。。先收藏。。慢慢学习
一双玉臂千夫枕,半点朱唇万客尝’
您需要登录后才可以回帖 登录 | 注册

北京皓辰网域网络信息技术有限公司. 版权所有 京ICP证:060528号 北京市公安局海淀分局网监中心备案编号:1101082001
广播电视节目制作经营许可证(京) 字第1234号 中国互联网协会会员  联系我们:
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP