LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1601|回复: 4

关于iptables 封ip段的问题

[复制链接]
发表于 2007-11-15 21:35:35 | 显示全部楼层 |阅读模式
关于iptables 封ip段的问题
通过IP工具获取了的IP段,想封,该怎么写?
58.87.64.0-58.87.127.255   
59.79.163.0-59.79.163.255   
封知道封,就是IP段如何表示?
58.87.64.0/16 这样16是如何来?
可以直接这样吗iptables  iptables -I INPUT -s 58.87.64.0-58.87.127.255 -j DROP

谢谢大家~~
发表于 2007-11-16 10:03:20 | 显示全部楼层
iptables -I INPUT 1 -s 58.87.64.0/18 -j DROP
回复 支持 反对

使用道具 举报

发表于 2007-11-26 01:23:39 | 显示全部楼层
那封iptables -I INPUT 1 -s 58.87.64.0/12 -j DROP
58.87.*.* 后面是多少12 8 还是!
回复 支持 反对

使用道具 举报

发表于 2007-11-26 08:26:59 | 显示全部楼层
58.87.64.0/12

这个表示法不合理,12表示网络地址的前12个表示网络号
58   00111010
87   01010111
64   01000000

如果用12做网络位的话,那么就是  00111010 01010000 00000000 00000000
58.80.0.0/12
回复 支持 反对

使用道具 举报

发表于 2007-11-26 09:23:12 | 显示全部楼层
iprange
       This matches on a given arbitrary range of IPv4 addresses

       (Please note: This match requires kernel support that might not be available in official Linux kernel sources or Debian's
       packaged Linux kernel sources.  And if support for this match is available for the specific Linux kernel source  version,
       that support might not be enabled in the current Linux kernel binary.)

       [!]--src-range ip-ip
              Match source IP in the specified range.

       [!]--dst-range ip-ip
              Match destination IP in the specified range.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表