Linux系统使用iptables统计端口流量

2023-11-27 0 990

Linux系统中如何使用iptables统计ip/端口流量?本篇教程主要为大家分享一下linux下使用iptables统计ip/端口流量的具体方法, 有需要的小伙伴可以参考一下。

1.添加ip/端口的流量统计

 入网流量:

 iptables -A INPUT -d 0.0.0.0 -p tcp --dport 8087

 出网流量:

 iptables -A OUTPUT -s 172.12.5.25 -p tcp --sport 8283

2.查看流量统计信息

 iptables -L -v -n -x

 结果示例:

 Chain INPUT (policy ACCEPT 29059 packets, 7794993 bytes)
     pkts      bytes target     prot opt in     out     source               destination
      327    17894            tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:8087
 
 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
     pkts      bytes target     prot opt in     out     source               destination
 
 Chain OUTPUT (policy ACCEPT 29511 packets, 8006178 bytes)
     pkts      bytes target     prot opt in     out     source               destination

3.删除统计

 iptables -D INPUT -d 0.0.0.0 -p tcp --dport 8087

以上就是良许教程网为各位朋友分享的Linux系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多干货等着你!

本文来源:www.lxlinux.net/1622.html,若引用不当,请联系修改。

相关文章

猜你喜欢
官方客服团队

为您解决烦忧 - 24小时在线 专业服务

  • 0 +

    访问总数

  • 0 +

    会员总数

  • 0 +

    文章总数

  • 0 +

    今日发布

  • 0 +

    本周发布

  • 4975 +

    运行天数

你的前景,远超我们想象