V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Astralis
V2EX  ›  服务器

求问 CentOS7 上有什么办法能够统计每个端口的流量?

  •  
  •   Astralis · Jan 22, 2017 · 7537 views
    This topic created in 3384 days ago, the information mentioned may be changed or developed.
    以前用 6.5 的时候可以用 iptables 统计端口流量,现在换成 7.2 了,所以 iptables 用不了了,防火墙变成 firewalld 了,网上给的方法基本上都是自己再装一个 iptables 然后把 firewalld 停掉,按理说系统升级更换了防火墙应该不会把功能彻底从系统里砍掉吧, firewalld 真的没有办法统计端口产生的流量吗?现在只能用 vnstat 来统计网卡的全部流量,想知道单个端口产生了多少流量根本没办法看啊
    Supplement 1  ·  Jan 22, 2017
    补充一下,我需要是那种能够在后台监控的,想看的时候能调出来看看程序运行期间指定端口的流量
    11 replies    2017-07-13 04:02:15 +08:00
    lydasia
        1
    lydasia  
       Jan 22, 2017
    iptables?
    lydasia
        2
    lydasia  
       Jan 22, 2017
    哦不好意思没仔细看。。
    zzwangsh
        3
    zzwangsh  
       Jan 22, 2017
    nethogs
    Astralis
        4
    Astralis  
    OP
       Jan 22, 2017
    @zzwangsh 这个是只能看实时的吗?我想要那种添加了统计以后就可以不管了的,然后偶尔想看端口用了多少流量的时候能调出来看哪些端口占用的流量最多的
    xdz0611
        5
    xdz0611  
       Jan 22, 2017
    iptables 可以用的噢 楼主.你可以搜一下在 7 下面怎么用 iptables
    Astralis
        6
    Astralis  
    OP
       Jan 22, 2017
    @xdz0611 。。。仔细看内容好么,我知道可以用啊
    19k
        7
    19k  
       Jan 22, 2017
    iftop
    你看看符合你要求么?
    CloudnuY
        8
    CloudnuY  
       Jan 22, 2017 via iPhone
    做 ss 服务器用?
    wu360463231
        9
    wu360463231  
       Jan 22, 2017
    systemctl stop firewalld
    systemctl mask firewalld
    yum install -y iptables iptables-services policycoreutils -y
    systemctl enable iptables.service
    systemctl start iptables.service

    停用 firewalld 装个 iptables 就 OK 了
    mingl0280
        10
    mingl0280  
       Apr 5, 2017 via Android
    vnstat
    7blW5Kcai534HdX1
        11
    7blW5Kcai534HdX1  
       Jul 13, 2017
    我正好也碰到这个问题,暂时用 iptables 在解决,然后准备换成 iptraf-ng 来试试,还在尝试看他能不能支持端口统计,vnstat 似乎无法端口统计,iftop 用作端口统计的话有点。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4529 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 00:13 · PVG 08:13 · LAX 17:13 · JFK 20:13
    ♥ Do have faith in what you're doing.