免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2053 | 回复: 7
打印 上一主题 下一主题

iptables 增加模块后 出现问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-04-16 10:50 |只看该作者 |倒序浏览
想增加random  connlimit  两个模块.

现在已经编译成模块,已经cp到/lib/modules/2.4.20-8/kernel/net/ipv4/netfilter/目录下.

现在iptables -L 就出现下边问题.大概什么版本不对.

[root@localhost root]# /sbin/iptables -L
/lib/modules/2.4.20-8/kernel/net/ipv4/netfilter/ip_tables.o: kernel-module version mismatch
        /lib/modules/2.4.20-8/kernel/net/ipv4/netfilter/ip_tables.o was compiled for kernel version 2.4.20-8custom
        while this kernel is version 2.4.20-8.
/lib/modules/2.4.20-8/kernel/net/ipv4/netfilter/ip_tables.o: insmod /lib/modules/2.4.20-8/kernel/net/ipv4/netfilter/ip_tables.o failed
/lib/modules/2.4.20-8/kernel/net/ipv4/netfilter/ip_tables.o: insmod ip_tables failed
iptables v1.3.1: can't initialize iptables table `filter': iptables who? (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
[root@localhost root]# /sbin/iptables -V
iptables v1.3.1

怎么解决???

论坛徽章:
0
2 [报告]
发表于 2009-04-16 13:10 |只看该作者

回复 #1 prettyiceii 的帖子

connlimit 这个在rhel 5下是可以不编译内核的
random 要编译内核

论坛徽章:
0
3 [报告]
发表于 2009-04-16 13:25 |只看该作者
原帖由 kns1024wh 于 2009-4-16 13:10 发表
connlimit 这个在rhel 5下是可以不编译内核的
random 要编译内核



楼上的老兄,谢谢关注.内核已经遍好,现在的问题是出现了上边的东西.我是问怎么解决这些东西..

论坛徽章:
0
4 [报告]
发表于 2009-04-16 13:36 |只看该作者
想增加random  connlimit  两个模块
现在好像那个站停了,不能./runme --download
需要自己去下载那个模块

论坛徽章:
0
5 [报告]
发表于 2009-04-16 13:58 |只看该作者
原帖由 loveradmin 于 2009-4-16 13:36 发表
想增加random  connlimit  两个模块
现在好像那个站停了,不能./runme --download
需要自己去下载那个模块



你可以下个补丁.ftp://ftp.netfilter.org/pub/patch-o-matic-ng/snapshot/

试试,也许你就可以成功.之后告诉我你的步骤,嘿嘿,学习学习.

论坛徽章:
0
6 [报告]
发表于 2009-04-16 16:13 |只看该作者
已经解决.


更正一下关于random的规则写法,有些网页上说的错误.

-m random --random-average   是语法错了.

应该是
-m random --average



因为实验条件限制:所以在自己的机器上只能这样配规则.


iptables -A INPUT -s 192.168.0.72 -p icmp -m random --average 90 -j DROP

让来自0.72的icmp协议的包平均90%的丢掉.


理想化,本机72  每ping 10 个包,丢9个.

结果,
[root@server root]# ping 192.168.0.172
PING 192.168.0.172 (192.168.0.172) 56(84) bytes of data.
64 bytes from 192.168.0.172: icmp_seq=15 ttl=64 time=3.89 ms
64 bytes from 192.168.0.172: icmp_seq=22 ttl=64 time=0.303 ms
64 bytes from 192.168.0.172: icmp_seq=25 ttl=64 time=0.297 ms
64 bytes from 192.168.0.172: icmp_seq=27 ttl=64 time=0.293 ms
64 bytes from 192.168.0.172: icmp_seq=28 ttl=64 time=0.303 ms
64 bytes from 192.168.0.172: icmp_seq=35 ttl=64 time=0.295 ms
64 bytes from 192.168.0.172: icmp_seq=41 ttl=64 time=0.314 ms
64 bytes from 192.168.0.172: icmp_seq=48 ttl=64 time=0.310 ms
64 bytes from 192.168.0.172: icmp_seq=60 ttl=64 time=0.263 ms
64 bytes from 192.168.0.172: icmp_seq=65 ttl=64 time=0.345 ms
64 bytes from 192.168.0.172: icmp_seq=68 ttl=64 time=0.358 ms

--- 192.168.0.172 ping statistics ---
72 packets transmitted, 11 received, 84% packet loss, time 71022msrtt min/avg/max/mdev = 0.263/0.634/3.893/1.030 ms


可能是我的发包数还没到一定量.


总之,还是很成功的.

[ 本帖最后由 prettyiceii 于 2009-4-16 23:22 编辑 ]

论坛徽章:
0
7 [报告]
发表于 2009-04-16 17:51 |只看该作者
原帖由 prettyiceii 于 2009-4-16 16:13 发表
已经解决.


更正一下关于random的规则写法,有些网页上说的错误.

-m random --random-average   是语法错了.

应该是
-m random --average



因为实验条件限制:所以在自己的机器上只能这样配规则 ...


学习你的经验!!!谢谢分享!

论坛徽章:
0
8 [报告]
发表于 2009-04-16 18:01 |只看该作者
原帖由 prettyiceii 于 2009-4-16 16:13 发表
已经解决.


怎么解决的?
LZ貌似没写解决方法吧?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP