Is there a way to get stats for an interface's IPv4 and IPv6 traffic from the command line?
-
I'd like to be able to get stats (bytes sent, bytes received) for a specific interface, broken out by IPv4 and IPv6, ideally from the command line. Is thsi possible?
I looked at netstat -I <ifname> -b but the counters don't tie up at all, other than for the <Link#n> stats, which of course include IPv4, IPv6 and other stuff, so not suitable for my needs.
-
stephenw10 Netgate Administratorlast edited by stephenw10 Jan 27, 2024, 10:57 PM Jan 27, 2024, 10:55 PM
Try for example:
[23.09.1-RELEASE][admin@fw1.stevew.lan]/root: pfctl -vvsI -i mvneta0 mvneta0 Cleared: Sun Jan 14 00:06:06 2024 References: 54 In4/Pass: [ Packets: 84261748 Bytes: 6404497380 ] In4/Block: [ Packets: 2473281 Bytes: 85666362 ] Out4/Pass: [ Packets: 116590050 Bytes: 38322442341 ] Out4/Block: [ Packets: 0 Bytes: 0 ] In6/Pass: [ Packets: 2472 Bytes: 180432 ] In6/Block: [ Packets: 120773 Bytes: 14138739 ] Out6/Pass: [ Packets: 2651156 Bytes: 1375467130 ] Out6/Block: [ Packets: 0 Bytes: 0 ]
Of course that only works for traffic pf sees.
Steve
-
@stephenw10 Thanks! I think this may work for what I need. I will experiment...
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.