免费注册 查看新帖 |

Chinaunix

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

conntrack命令安装分享 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-09-08 16:46 |只看该作者 |倒序浏览
conntrack命令安装分享




在论坛中看到一个帖子关于ip_conntrack参数相关的,后来打开了个关于man命令conntrack的连接。
在此分享,如对你有一点帮主也是一点荣幸

http://linux.die.net/man/8/conntrack    man连接地址

正文:
  系统   centos5.6  64位
  安装包相关:
      yum -y install bison
      yum -y install flex
      wget http://netfilter.org/projects/li ... tlink-1.0.0.tar.bz2
      wget http://netfilter.org/projects/li ... track-0.9.1.tar.bz2
      wget http://www.netfilter.org/project ... tools-1.0.0.tar.bz2
      安装conntrack-tools工具需要,前两个库文件支持较高,centos5.6的默认是0.4的版本,所以需要重新编译。

      安装libnfnetlink、libnetfilter_conntrack进入包后执行可直接编译安装
      #./configuer && make && make install
      文件会安装到/usr/local/include/,直接编译conntrack-tools会出现库文件找不到的问题,如果系统有默认安装libnfnetlink和libnfnetlink-devel,可使用yum删除。
     为了识别新的库文件需要进行目录调整(修改ld.so.conf和设置了库的变量也没有生效,只能采取强硬的cp和mv方式了)
     最终结果为:
         /usr/include/libnetfilter_conntrack/
         /usr/include/libnfnetlink/
         /usr/lib64/libnetfilter_conntrack.la
         /usr/lib64/libnetfilter_conntrack.so
         /usr/lib64/libnetfilter_conntrack.so.3
         /usr/lib64/libnetfilter_conntrack.so.3.1.3
         /usr/lib64/pkgconfig/libnetfilter_conntrack.pc
         /usr/lib64/pkgconfig/libnfnetlink.pc

       以上库文件准备完毕,安装conntrack-tools
       #./configure --prefix=/usr/local/conntrack && make && make install    安装完成

       具体使用的话,各位自己看man配置研究吧,我也研究所以没有示例
      
# ./conntrack -h

Command line interface for the connection tracking system. Version 1.0.0

Usage: ./conntrack [commands] [options]



Commands:

  -L [table] [options]          List conntrack or expectation table

  -G [table] parameters         Get conntrack or expectation

  -D [table] parameters         Delete conntrack or expectation

  -I [table] parameters         Create a conntrack or expectation

  -U [table] parameters         Update a conntrack

  -E [table] [options]          Show events

  -F [table]                    Flush table

  -C [table]                    Show counter

  -S                            Show statistics



Tables: conntrack, expect



Conntrack parameters and options:

  -n, --src-nat ip                      source NAT ip

  -g, --dst-nat ip                      destination NAT ip

  -j, --any-nat ip                      source or destination NAT ip

  -m, --mark mark                       Set mark

  -c, --secmark secmark                 Set selinux secmark

  -e, --event-mask eventmask            Event mask, eg. NEW,DESTROY

  -z, --zero                            Zero counters while listing

  -o, --output type[,...]               Output format, eg. xml



Expectation parameters and options:

  --tuple-src ip        Source address in expect tuple

  --tuple-dst ip        Destination address in expect tuple

  --mask-src ip         Source mask address

  --mask-dst ip         Destination mask address



Common parameters and options:

  -s, --orig-src ip             Source address from original direction

  -d, --orig-dst ip             Destination address from original direction

  -r, --reply-src ip            Source addres from reply direction

  -q, --reply-dst ip            Destination address from reply direction

  -p, --protonum proto          Layer 4 Protocol, eg. 'tcp'

  -f, --family proto            Layer 3 Protocol, eg. 'ipv6'

  -t, --timeout timeout         Set timeout

  -u, --status status           Set status, eg. ASSURED

  -w, --zone value              Set conntrack zone

  -b, --buffer-size             Netlink socket buffer size
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP