Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question
Tag: networking
Linux: retrieve per-interface sent/received packet counters (ethernet, ipv4, ipv6)
On Linux, how can I (programmatically) retrieve the following counters on a per-interface basis: Sent/received ethernet frames, Sent/received IPv4 packets, Sent/received IPv6 packets. Answer You should be able to do this using iptables rules and packet counters, e.g. And to view the stats, parse the output of these: You should also look up the -Z flag for when you want