b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

linux netfilter_netfilter_netfilter 热点锁

电脑杂谈  发布时间:2017-02-27 02:09:07  来源:网络整理

标签:netfilter/layer7

netfilter/layer7

整体步骤如下:

一、需要使用的软件

内核源码:linux-2.6.28.10.tar.gz

iptables版本:iptables-1.4.3.tar.bz2

netfilter的应用层补丁:netfilter-layer7-v2.22.tar.gz (要将某些功能编译进内核)

layer7版本:l7-protocols-2009-05-28.tar.gz 这个软件里面包含了各种协议(应用层)的匹配模式。他们存放在/root/l7-protocols-2009-05-28/protocols这个目录下,文件后缀以.pat结尾。

二、编译内核,并给内核打上netfilter-layer7这个补丁

# tar zxvf linux-2.6.28.10.tar.gz -C /usr/src

# tar zxvf netfilter-layer7-v2.22.tar.gz -C /usr/src

# cd /usr/src

# ln –s linux-2.6.28.10 linux

# cd /usr/src/linux/

# patch -p1 < ../netfilter-layer7-v2.22/kernel-2.6.25-2.6.28-layer7-2.22.patch

为了提高编译的成功率,我们将当前内核的config文件,复制到/usr/src/linux/下并重命名为.config

# cp /boot/config-2.6.18-164.el5 /usr/src/linux/.config

# make menuconfig

并将以下内容编译成内核模块或者编译进内核

Networking support → Networking Options →Network packet filtering framework →Core Netfilter Configuration

<M> Netfilter connection tracking support

<M> “layer7” match support

<M> “string” match support

netfilter 热点锁_netfilter_linux netfilter

<M> “time” match support

<M> “iprange” match support

<M> “connlimit” match support

<M> “state” match support

<M> “conntrack” connection match support

<M> “mac” address match support

<M> "multiport" Multiple port match support

Networking support → Networking Options →Network packet filtering framework → IP: Netfilter Configuration

<M> IPv4 connection tracking support (required for NAT)

<M> Full NAT

<M> MASQUERADE target support

<M> NETMAP target support

<M> REDIRECT target support

执行如下命令安装模块

# make

# make modules_install

# make install

三、编译安装iptables使其支持layer7应用层协议(例如QQ、迅雷等等)

在编译安装之前我们可以将之前的iptables的启动脚本复制在/tmp目录下,供以后使用

也可以将将/etc/sysconfig/iptables保存下来,供以后使用

# cp /etc/init.d/iptables /tmp/iptables

# cp /etc/sysconfig/iptables /tmp/iptables.rule

# rpm -e iptables-ipv6 iptables iptstate --nodeps

# tar jxvf iptables-1.4.6.tar.bz2 –C /usr/src

# cd /usr/src/iptables-1.4.6

# cp ../netfilter-layer7-v2.22/iptables-1.4.3forward-for-kernel-2.6.20forward/libxt_layer7.* ./extensions/

# ./configure --prefix=/usr --with-ksource=/usr/src/linux (指定linux源码位置)

# make

# make install

四、安装layer7软件(里面包含了各种应用层协议及其匹配模式)

# tar zxvf l7-protocols-2009-05-28.tar.gz

# cd l7-protocols-2009-05-28

# make install

#mv /tmp/iptables /etc/init.d/

#vim /etc/init.d/iptables

在这个脚本之中将之前使用到的iptables的二进制文件路径修改为/usr/sbin/iptables

#service iptables start

经过上述步骤就可以让netfilter和iptables支持过滤应用层协议了。

过滤layer7应用层协议的iptables的语法如下:

iptables [-t TABLES] COMMAND CHAIN 匹配条件 -m layer7 --l7proto 应用层协议 -j 处理动作

例如:禁止192.168.10.0/24这个网段内的用户登入qq

#iptables -A FORWARD -s 192.168.10.0/24 -m layer7 --l7proto qq -j DROP

在这里补充一个基于时间的扩展,刚刚在编译内核的时候把这个功能编译成了模块。netfilternetfilter因此,在这里我们可以使用基于时间的扩展来限制某些应用

-m time --datestart YYYY[-MM[-DD[Thh[:mm[:ss]]]]] --datestop YYYY[-MM[-DD[Thh[:mm[:ss]]]]]

###这个是表示日期型的限制

-m time --timestart hh:mm[:ss] --timestop hh:mm[:ss]

###这个是表示每天的某个阶段作出限制


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-34717-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      热点图片
      拼命载入中...