Iptables 加载模块—解决 ./runme –download
在网上收了好多文档大该都是差不多得:但就是到了./runme –download 就也错了。
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
查看内核版本 uname –a
Linux localhost.localdomain 2.6.18-128.el5 #1 SMP Wed Dec 17 11:42:39 EST 2008 i686 athlon i386 GNU/Linux
下载和你查看版本一致的kernel source ,所以我下载了kernel-2.6.18-128.el5.src.rpm版本一定要一致,不然会出现很多错误,然后将其解压,这里需要注意的是下载下来得东西和解压出得东西放得位置,可以有利于以后的步骤,一般是放在/usr/src下。
Rpm –ivh kernel-2.6.18-128.el5.src.rpm
目录下出现kernel-2.6.spec这个文件
解开原码包 rpmbuild –bp --target=$(uname -m) ./kernel-2.6.spec
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
########################################### [100%]
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
执行时出现好多警告,这个只是找不到某个用户名,没有太大关系,也可以用useradd 添加一个goetz用户,就不会出现了。
注:在用这个命令时,可能会没有找此命令,这时就需要安装rpmbuild ,可以在光盘中找到,安装这个得时候我用得是强制安装
Rpm –ivh rpm-build-4.4.2.3-9.el5.i386.rpm --fource --nodeps
安装完成之后命令可以使用了,但是报错,需要安装GCC 、redhat-rpm-config 等东西,这样一个个都安装好后,上面命令才能成功。
完成后出现kernel-2.6.18 下出现config Config.mk linux-2.6.18.i686 vanilla xen
将linux-2.6.18.i686 这个目录复制到/usr/src/下方便以后使用
Cp –a cp -a linux-2.6.18.i686/ /usr/src/
Cd /usr/src/linux-2.6.18.i686
修改MAKEFILE文件
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 18
EXTRAVERSION = -128.el5 ------这个为你系统版本号的-后面的东西
PATCHLEVEL = 6
SUBLEVEL = 18
EXTRAVERSION = -128.el5 ------这个为你系统版本号的-后面的东西
下载用到得软件并解压
tar jxvf patch-o-matic-ng-20080918.tar.bz2
tar jxvf iptables-1.3.8.tar.bz2
tar jxvf iptables-1.3.8.tar.bz2
到刚才解压出来得patch-o-matic-ng-20090918文件夹下
export KERNEL_DIR=/usr/src/linux-2.6.18.i686/ -----设置变量
export IPTABLES_DIR=/usr/src/iptables-1.3.8/
export KERNEL_SRC=/usr/src/linux-2.6.18.i686/
export IPTABLES_SRC=/usr/src/iptables-1.3.8/
./runme –download 到这步的时候出现了错误,要用到得补丁都下载不下来,
export IPTABLES_DIR=/usr/src/iptables-1.3.8/
export KERNEL_SRC=/usr/src/linux-2.6.18.i686/
export IPTABLES_SRC=/usr/src/iptables-1.3.8/
./runme –download 到这步的时候出现了错误,要用到得补丁都下载不下来,
在目录下有SOURCE.LIST文件这个目录中有给出得网址全部都打不开,试过很多方法还是下不来东西,
通过看一些文章后面的步骤,就是生成了几个文件,一个是.ko 和.so 的文件
我就试着将这两个文件下载ipt_time.ko 和 libipt_time.so 文件
分别将它们放在/lib/modules/2.6.18-92.el5/kernel/net/ipv4/netfilter/ipt_time.ko 下
/LIB(大写)/iptables/libipt_time.so ---因为还有个小写/lib目录
用命令insmod /lib/modules/2.6.18-92.el5/kernel/net/ipv4/netfilter/ipt_time.ko
用命令lsmod 查看模块,已经被加载上了,有点心喜,可是还是不能用
一用命令iptables –A INPUT –m time --timestart 7:00 –timestop 19:00 –j ACCEPT
出现了一个错误说是iptables: match `time' v1.3.7 (I'm v1.3.5).
下载IPTABLES 1.3.7 解压后,用命令make install 安装完成之后,IPTBALES 版本成为
[root@localhost iptables]# iptables -V
iptables v1.3.7
用给iptables 定TIME规则成功

搞了好久啊~~~~~!!!!!!!
后续将添加IPP2P CONNLIMIT 等其他功能
转载于:https://blog.51cto.com/haohui/156925