免费注册 查看新帖 |

Chinaunix

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

如何在程序中获得Iptables规则表中每条的数据包计数信息? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-01-27 21:29 |只看该作者 |倒序浏览
不知道iptable -L获得规则相关信息存储在内核空间哪儿?

我现在想获取到用户空间,特别是获取每条规则的过滤数据包信息

麻烦各位提示一下。

因为我没时间去研究netfilter-iptables框架机制。。。

论坛徽章:
0
2 [报告]
发表于 2005-01-27 22:33 |只看该作者

如何在程序中获得Iptables规则表中每条的数据包计数信息?

iptables -vL (-t xxx)
iptables -vnL (-t xxx)

论坛徽章:
0
3 [报告]
发表于 2005-01-27 22:42 |只看该作者

如何在程序中获得Iptables规则表中每条的数据包计数信息?

-t xxx 表示什么意思

我是在要在程序中获得这些信息

iptables -vL 可以获得输出在控制台

难道去分析其输出结果?

论坛徽章:
0
4 [报告]
发表于 2005-01-28 01:10 |只看该作者

如何在程序中获得Iptables规则表中每条的数据包计数信息?

man iptables
       -t, --table table
              This  option  specifies the packet matching table which the com-
              mand should operate on.  If the kernel is configured with  auto-
              matic module loading, an attempt will be made to load the appro-
              priate module for that table if it is not already there.

              The tables are as follows:

              filter:
                  This is the default table (if no -t option is  passed).   It
                  contains  the built-in chains INPUT (for packets coming into
                  the box itself), FORWARD (for packets being  routed  through
                  the box), and OUTPUT (for locally-generated packets).

              nat:
                  This  table  is  consulted  when a packet that creates a new
                  connection is encountered.  It consists of three  built-ins:
                  PREROUTING  (for  altering packets as soon as they come in),
                  OUTPUT (for altering locally-generated packets before  rout-
                  ing),  and  POSTROUTING  (for  altering  packets as they are
                  about to go out).

              mangle:
                  This table is used for specialized packet alteration.  Until
                  kernel  2.4.17  it  had two built-in chains: PREROUTING (for
                  altering incoming packets before routing)  and  OUTPUT  (for
                  altering  locally-generated  packets before routing).  Since
                  kernel 2.4.18, three other built-in  chains  are  also  sup-
                  ported: INPUT (for packets coming into the box itself), FOR-
                  WARD (for altering packets being routed  through  the  box),
                  and  POSTROUTING  (for altering packets as they are about to
                  go out).


如果你要在程序里获得这些信息,就写个程序去获得啊,比如shell什么的

论坛徽章:
0
5 [报告]
发表于 2005-01-28 09:46 |只看该作者

如何在程序中获得Iptables规则表中每条的数据包计数信息?

完全听不懂

论坛徽章:
0
6 [报告]
发表于 2005-01-28 22:33 |只看该作者

如何在程序中获得Iptables规则表中每条的数据包计数信息?

platinum版主还是没有回答我的问题啊?

你的意思还是说要我去分析通过iptables 接口命令

读出来的数据呢

不过这的确也是一种思路

论坛徽章:
0
7 [报告]
发表于 2005-08-04 09:53 |只看该作者

如何在程序中获得Iptables规则表中每条的数据包计数信息?

iptables -vL >; outfile.temp
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP