解压以上文件:
tar -jxvf linux-2.6.28.10.tar.bz2; tar -zxvf l7-protocols-2009-05-10.tar.gz; tar -zxvf netfilter-layer7-v2.21.tar.gz; tar -jxvf iptables-1.4.2.tar.bz2
为了方便,做一个符号链接,并进入新内核源代码目录:
ln -s linux-2.6.28.10 linux
cd linux
接下来进入关键的步骤,为内核选择layer7及相关的模块;
make menuconfig
让新内核读取旧内核的配置:
在出现的菜单选项中选中“Load an Alternate Configuration File”,输入旧内核配置文件的路径/boot/config-2.6.26-2-amd64,然后确认,开始选择内核模块
选项如下:
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
-*- Connection tracking flow accounting
-*- Connection mark tracking support[*] Connection tracking security mark support[*] Connection tracking events (EXPERIMENTAL)
<M> SCTP protocol connection tracking support (EXPERIMENTAL)
<M> UDP-Lite protocol connection tracking support (EXPERIMENTAL)
<M> Amanda backup protocol support
<M> FTP protocol support
<M> H.323 protocol support (EXPERIMENTAL)
<M> IRC protocol support
<M> NetBIOS name service protocol support (EXPERIMENTAL)
<M> PPtP protocol support
<M> SANE protocol support (EXPERIMENTAL)
<M> SIP protocol support (EXPERIMENTAL)
<M> TFTP protocol support
<M> Connection tracking netlink interface (EXPERIMENTAL)
{M} Netfilter Xtables support (required for ip_tables)
<M> "CLASSIFY" target support
<M> "CONNMARK" target support
<M> "DSCP" target support
<M> "MARK" target support
<M> "NFQUEUE" target Support
<M> "NFLOG" target support
<M> "NOTRACK" target support
<M> "TRACE" target support
<M> "TRACE" target support
<M> "SECMARK" target support
<M> "CONNSECMARK" target support
<M> "TCPMSS" target support
<M> "comment" match support
<M> "connbytes" per-connection counter match support
<M> "connlimit" match support"
<M> "connmark" connection mark match support
<M> "conntrack" connection tracking match support
<M> "DCCP" protocol match support
<M> "DCCP" protocol match support
<M> "DSCP" match support
<M> "ESP" match support
<M> "helper" match support
<M> "length" match support
<M> "limit" match support
<M> "mac" address match support
<M> "mark" match support
<M> IPsec "policy" match support
<M> Multiple port match support
<M> "physdev" match support
<M> "pkttype" packet type match support
<M> "quota" match support
<M> "realm" match support
<M> "sctp" protocol match support (EXPERIMENTAL)
<M> "state" match support
<M> "layer7" match support[*] Layer 7 debugging output
<M> "statistic" match support
<M> "string" match support
<M> "tcpmss" match support
<M> "time" match support
<M> "u32" match support
<M> "hashlimit" match support
IP: Netfilter Configuration --->
<M> IPv4 connection tracking support (required for NAT)[*] proc/sysctl compatibility with old connection tracking (NEW
<M> IP Userspace queueing via NETLINK (OBSOLETE)
<M> IP tables support (required for filtering/masq/NAT)
<M> IP range match support
<M> TOS match support
<M> recent match support
<M> ECN match support
<M> AH match support
<M> TTL match support
<M> Owner match support
<M> address type match support
<M> Packet filtering
<M> REJECT target support
<M> LOG target support
<M> ULOG target support
<M> Full NAT (NEW)
<M> MASQUERADE target support
<M> REDIRECT target support
<M> NETMAP target support
<M> SAME target support (OBSOLETE)
<M> Basic SNMP-ALG support (EXPERIMENTAL)
<M> Packet mangling
<M> TOS target support
建议把Core Netfilter Configuration和IP: Netfilter Configuration的所有选项都选中。注意,刚开始时,我一直找不到:<M> "layer7" match support 和[*] Layer 7 debugging output 这两个模块,浪费了很多时间,后来发现是因为这两个模块是属于:<> Netfilter connection tracking support 这个模块,因此得先选择<M> Netfilter connection tracking support 这样下面才有Layer7及相关模块,在内核选项建议把你所有的网卡驱动选中[*],其中time模块就是可以通过iptables可以控制上网的时间等功能,就是时间控制的模块!
退回kernels目录:
cd ..
安装新的内核:
dpkg -i linux-image-2.6.28.10-adm64_2.6.28.10_amd64.deb
(图片8)
这时,会将新内核安装到相应的位置,同时会在/boot/grub/menu.lst增加新内核的条目
为iptables打补丁,并安装之
cd iptables-1.4.2
cp ../netfilter-layer7-v2.21/iptables-1.4.1.1-for-kernel-2.6.20forward/libxt_layer7.* extensions/
./configure --with-ksource=/usr/src/kernels/linux
make
make install
安装通讯定义档
cd /usr/src/kernels/l7-protocols-2009-05-10
make install
(图片9)
看执行的结果就知道,它在做什么了!
这样新的内核都弄好了,iptables也装好了,重启计算机:
shutdown -r now
启动完成后,用命令查看新内核与iptalbes是否安装成功:
uname -a;iptables -V
(图片10)