How to Monitor Ethernet Traffic Linux Like an SRE
At 3 a.m., an alert reports high database latency. The host's interface graphs look ordinary, byte counters are moving, and no obvious link error appears in the dashboard. Yet the application is failing. The problem may not be bandwidth saturation at all. It may be a burst of broadcasts, malformed ARP behavior, retransmissions, or a workload hidden behind a shared bridge.
That's why reliable Linux traffic inspection needs more than a single command. Counter-based tools explain how much traffic crossed an interface, packet capture shows what those frames contain, and eBPF telemetry can aggregate selected kernel events without retaining full packet payloads. Its overhead depends on the probe and workload. The right choice depends on the incident question, the traffic rate, and how much overhead the host can tolerate.
Table of Contents
- The 3 a.m. Interface Mystery
- Prerequisites and Picking the Right Interface
- Capturing Packets With tcpdump and tshark
- Counters, Statistics and Live Bandwidth Tools
- When Capture Is the Wrong Tool eBPF and Kernel Telemetry
- Continuous Ethernet Monitoring and Alerting
- Picking the Right Tool for the Job
The 3 a.m. Interface Mystery
Consider an illustrative incident: ip -s link show dev eth0 reports no obvious error growth, while database connections stall. This is a diagnostic scenario, not a reported customer incident.
The missing evidence may be at layer two, in TCP behavior, or outside the network. Aggregate counters cannot distinguish ordinary application data from repeated ARP requests. A packet capture can support a hypothesis, but does not by itself establish causation.
If a short capture shows repeated ARP requests, compare packet rates, affected endpoints and host CPU/interrupt activity before blaming a broadcast storm. A small byte rate does not rule out a high packet rate; equally, seeing ARP does not prove it caused database latency.
What counters miss
Packet capture preserves details that sampled or aggregate telemetry discards:
- MAC-level behavior, including Ethernet frame sender and destination addresses.
- Broadcast and multicast patterns, which can indicate storms or misconfigured services.
- ARP activity, including repeated requests that produce little useful application-level signal.
- Protocol symptoms, such as TCP retransmissions, resets, and failed handshakes.
- VLAN context, which matters when logical networks share one physical interface.
For device-side history, prefer 64-bit IF-MIB octet counters such as ifHCInOctets and ifHCOutOctets where supported. Track counter discontinuities and interface identity before calculating rates. The IF-MIB specification defines the relevant counters; they describe volume and state, not individual application requests.
Practical rule: Use counters to identify an unhealthy interface. Use packets to test a specific hypothesis.
Production monitoring needs both layers, plus a clear boundary for eBPF. Continuous counters supply inexpensive history and alerting. Targeted capture provides incident evidence, but packet capture can become expensive at high rates because selected captured frames are copied or exposed to userspace. An eBPF program can aggregate selected events in the kernel; benchmark its overhead rather than assuming it is cheaper for every workload. No single approach answers every question. Capture explains content, counters show sustained volume, and eBPF helps monitor production behavior without turning an investigation into another outage.
Prerequisites and Picking the Right Interface
Capture commands fail for simple reasons before they fail for interesting ones. tcpdump and tshark generally need root privileges or suitable capabilities, especially CAP_NET_RAW and CAP_NET_ADMIN. On Debian-family systems, a restricted capture setup may also place the operator in the wireshark group, but group membership alone doesn't guarantee access to every interface or namespace.
Capture privileges depend on the package configuration. Wireshark/TShark commonly delegate capture to dumpcap; inspecting only the tshark executable can miss that arrangement. Check installed executables without changing their permissions:
id
for tool in tcpdump dumpcap; do
if path=$(command -v "$tool"); then
getcap "$path"
fi
done
getcap itself must be installed; use your distribution’s documented restricted-capture setup. Do not grant broad capabilities merely to make a command succeed.
If the tools aren't installed, use the distribution's package manager and follow the local security policy. Avoid making packet capture permanently run as root when a narrower capability or controlled administrative workflow is sufficient.
Find the interface that carries the traffic
Interface names aren't interchangeable. A physical NIC may appear as eth0, ens5, or eno1; a bonded device may be bond0; a bridge may represent the path used by virtual machines. Start with compact listings:
ip -o link show
ip -br addr
The address listing helps identify where the relevant service is attached. The link listing shows devices that may not carry an IP address, including lower-level members of a bond or bridge. For a physical port, ethtool --identify can blink the corresponding hardware indicator when the driver supports it:
sudo ethtool --identify ens5 10
Loopback traffic requires -i lo. VLAN subinterfaces need the VLAN device or an appropriate parent capture. When the path is uncertain, -i any offers a broad first look within the current network namespace. On Linux it normally uses a cooked link-layer format, not raw Ethernet headers, and can show the same path at multiple interfaces. Use a specific Ethernet interface when investigating MAC addresses or VLAN visibility. Container traffic may live in another network namespace, so the host operator may need nsenter against the relevant process before inspecting its interfaces.
Finish with a small sanity check rather than launching a large capture immediately:
sudo tcpdump -i eth0 -c 5 -nn
If that returns nothing, the result may be correct, or the selected interface may be wrong. Confirm the path before changing filters.
Capturing Packets With tcpdump and tshark
tcpdump is most useful when the capture filter reflects a concrete incident question. A focused capture keeps files manageable and avoids collecting unrelated payloads:
umask 077
sudo timeout 30 tcpdump -i eth0 -nn -s 128 -c 10000 \
-w capture.pcap \
'host 10.0.0.5 and port 443'
The -nn option avoids name/service lookups; -s 128 bounds each captured packet, and -c plus GNU timeout bounds the run. This first pass is for headers: truncation can omit DNS or TLS details, so increase the snap length deliberately if the question requires it. A timeout exit code of 124 means the time limit was reached, not necessarily that capture failed. Review tcpdump’s captured/dropped counts, file ownership and permissions.
Ethernet filters are valuable when the symptom looks like a switching or addressing problem:
sudo tcpdump -i eth0 -nn \
'ether src host aa:bb:cc:dd:ee:ff'
sudo tcpdump -i eth0 -nn \
'ether broadcast or ether multicast'
sudo tcpdump -i eth0 -nn \
'vlan 100'
ARP and broadcast filters are particularly useful for suspected storms:
sudo tcpdump -i eth0 -nn \
'arp and broadcast'
Promiscuous mode lets a capture see frames that aren't addressed to the host, subject to the switch and virtualization path. It does not make a switched network deliver other hosts’ unicast frames; a correctly configured mirror port or TAP may be needed. Offloads and VLAN stripping can also change what a host capture shows. It isn't the same as wireless monitor mode. Monitor mode is a wireless-driver capability used to receive raw 802.11 frames, and standard Ethernet capture with tcpdump doesn't provide it.
Use tshark for repeatable dissection
Once a capture exists, tshark can apply display filters without collecting another file:
tshark -r capture.pcap \
-Y 'tcp.analysis.retransmission'
tshark -r capture.pcap \
-Y 'tcp.flags.reset == 1'
tshark -r capture.pcap \
-Y 'tls.handshake'
tshark -r capture.pcap \
-Y 'dns.time > 1'
Display filters operate after capture, so they differ from the BPF expressions used by tcpdump. A useful workflow is to retain a narrowly scoped original file, then create a smaller evidence package:
tshark -r capture.pcap \
-Y 'tcp.analysis.retransmission or tcp.flags.reset == 1' \
-w transport-symptoms.pcap
Operators can open the resulting file in Wireshark for stream reconstruction, protocol inspection, and visual analysis. tshark also supports field extraction and I/O analysis, which makes it easier to turn a one-off investigation into a repeatable incident procedure. Guidance on selecting between command-line monitors and deeper inspection is available in this Linux network traffic monitoring guide.
Packet capture has a hard operational boundary. A pcap may contain credentials, tokens, personal data, or application payloads, even when the original filter looked harmless. Store files with restrictive permissions, define retention, encrypt transfers, and delete them when the investigation no longer requires them.
Counters, Statistics and Live Bandwidth Tools
Counter tools answer questions quickly without retaining packet content. Start with the kernel's interface view:
ip -s link show dev eth0
The output separates receive and transmit totals and exposes packet, byte, error, drop, and related fields. For a more detailed view, repeat the statistics flag:
ip -s -s link show dev eth0
These are cumulative counters. A rising number isn't itself an incident. The useful signal is the change over an interval, correlated with service behavior and link capacity.
ethtool -S moves closer to the NIC and its driver:
sudo ethtool -S eth0
Names vary by driver, but fields such as rx_bytes, tx_errors, rx_dropped, rx_missed, and rx_fifo can separate a kernel-level symptom from a hardware or receive-queue problem. The Linux telemetry model deliberately combines kernel counters, protocol views, and driver statistics, so one command should never be treated as the complete state of the interface (Linux kernel interface statistics).
Match each tool to the incident question
For trend sampling, sar -n DEV 1 reports interface deltas at a regular interval. nicstat provides another compact view of throughput and interface errors. These tools are better for observing movement than for explaining packet contents.
iftop shows active host-to-host flows and is useful when an operator needs to identify the current bandwidth consumer. nethogs shifts the question from remote endpoint to local process, although attribution can become ambiguous with containers, namespaces, and shared proxy processes.
| Tool | Operational Question | Sample Output |
|---|---|---|
ip -s link |
Is the interface accumulating bytes, errors, or drops? | RX, TX, packet totals, errors, drops |
ethtool -S |
Is the NIC or driver reporting a receive or transmit problem? | Driver-specific queue and hardware counters |
sar -n DEV 1 |
How are interface deltas changing over time? | Per-interval receive and transmit rates |
iftop |
Which remote hosts or flows consume bandwidth now? | Live endpoint pairs and directional rates |
nethogs |
Which local process is generating traffic? | Process-level receive and transmit activity |
A throughput investigation benefits from understanding the distinction between cumulative counters and rate calculations. The practical considerations are outlined in this Linux throughput measurement guide.
iptraf-ng offers an interactive view of local traffic. Like iftop, it complements durable counters rather than replacing history. Packet-based tools observe traffic visible to the selected interface/namespace; they do not automatically report every flow across the network.
When Capture Is the Wrong Tool eBPF and Kernel Telemetry
A broad capture adds copy, formatting and storage work. Its capture filter can run in the kernel; it is inaccurate to imply all filtering necessarily happens in userspace. For high-rate investigations, narrow the filter and duration, watch capture drops and CPU, then decide whether an aggregate probe can answer the question with less data.
eBPF changes the location of the aggregation. A probe can count, classify, or attribute events in the kernel and export compact summaries instead of copying every packet into a userspace analyzer. That doesn't make overhead disappear, and a poorly designed BPF program can still hurt a host, so the probe still needs measured overhead and bounded resource use.
Start with a narrow probe
A simple bpftrace experiment can count receive-hook invocations by interface, provided the kernel, BTF data, permissions, and tracepoint names support the script:
sudo bpftrace -e '
tracepoint:net:netif_receive_skb {
@packets[str(args.name)] = count();
}'
Before using that example, inspect sudo bpftrace -lv tracepoint:net:netif_receive_skb on the target kernel. It counts tracepoint invocations, not guaranteed physical wire packets; offload, aggregation and hook selection affect interpretation. Bound the probe lifetime and map cardinality. See the bpftrace language documentation for tracepoint argument inspection.
BCC supplies a broader toolkit for kernel-assisted tracing. Network-oriented tools such as tcplife can expose connection lifetimes and process context, while other BCC tools can connect system behavior to network symptoms. The exact tool should follow the question, not the novelty of the framework. A low-rate edge host needing packet evidence doesn't need an elaborate BPF pipeline. A busy service requiring sustained, low-overhead attribution may.
Production rule: Capture packets for evidence. Use counters for history. Use eBPF when the act of observing packets would distort the workload.
BPF isn't automatically available everywhere. The program may require a supported kernel, BTF metadata, privileges, and compatible helper functions. Teams should validate probes on a staging kernel and keep a fallback based on ordinary counters. Background on diagnosing adjacent kernel resource problems is available in this memory leak detection guide.
Continuous Ethernet Monitoring and Alerting
A command run during an incident provides a snapshot. Continuous monitoring needs a repeatable collection path, clear retention, and alerts based on changes rather than raw cumulative values. A small systemd service can collect interface counters, while a timer invokes it on a controlled schedule.
For a temporary, size-bounded ring on a GNU/Linux host, prepare a private directory writable by the dedicated capture account, here named pcap. Check the account exists before using this example:
sudo install -d -m 0700 -o pcap -g pcap /var/lib/ethermon
sudo sh -c 'umask 077; exec timeout 300 tcpdump -i eth0 -nn -s 128 -C 20 -W 5 -Z pcap -w /var/lib/ethermon/ring.pcap "host 10.0.0.5 and port 443"'
This keeps roughly five 20 MB files, with a small possible overshoot at rotation, and stops after five minutes. It is not a 24-hour retention guarantee. Do not combine -G, -C and -W and assume they form a bounded hourly ring: the tcpdump manual specifies different interactions, including ignored -W in that combination. Restrict file access and review whether even truncated packets may contain sensitive data.
Export rates, not just totals
Rate calculation uses two cumulative samples and the actual elapsed time:
bits_per_second = (new_bytes - old_bytes) * 8 / elapsed_seconds
For example, an increase of 125,000,000 bytes over 10 seconds is 100,000,000 bit/s, or 100 Mbit/s (decimal). On a 1 Gbit/s full-duplex link that is 10% in that direction; do not add RX and TX and divide by one direction’s capacity. If the counter falls or the interface identity changes, treat the interval as a reset/discontinuity rather than reporting a negative rate. Counter measurements also need not include every on-wire overhead byte.
Use an established collector/exporter when possible. Sending an arbitrary metrics.json to an unspecified URL does not create a supported ingestion integration. Keep the sample timestamp, units, direction and reset behavior with any custom output.
Alert conditions should reflect operational symptoms:
- Receive errors or missed packets: investigate the NIC, driver, queue pressure, or physical path.
- Transmit drops: check egress contention, shaping, queue behavior, and downstream availability.
- Sustained bandwidth pressure: compare the rate with the interface's expected operating envelope and application behavior.
- Broadcast or multicast changes: trigger targeted packet inspection rather than paging on a single noisy sample.
The Fivenines agent provides Linux host and interface telemetry, while SNMP device monitoring covers configured device interfaces. This complements packet capture; it is not a pcap upload or general custom-metrics endpoint.
SNMP remains useful for network devices and interface history. The practical details of MIB-based collection and interface metrics are covered in this SNMP and MIB monitoring guide. A solid setup combines host-side counters with device-side views when the fault could exist anywhere between the server and the switch.
Avoid paging on every short-lived spike. Rate-of-change windows, consecutive evaluations, and maintenance suppression reduce false alarms while preserving context. The page should identify the host, interface, direction, error family, recent rate, and a direct next command, not merely announce that “network traffic is high.”
Picking the Right Tool for the Job
The right Linux command follows the question.
If the question is “Is this link saturated?”, begin with ip -s link, then inspect ethtool -S for driver and NIC evidence. If the question is “Which process is transmitting?”, use nethogs where process attribution is available. If it is “Which remote endpoint is consuming bandwidth?”, use iftop for a live flow view.
A practical incident checklist
- What is happening now? Use
ip -s link,sar -n DEV 1, oriftopfor immediate rates and active flows. - What happened inside the frames? Use a narrowly filtered
tcpdumpcapture, then dissect it withtshark. - How is the problem trending? Export counter deltas to a time-series or monitoring platform rather than relying on terminal snapshots.
- Is this a layer-two issue? Filter for Ethernet broadcast, multicast, ARP, and VLAN traffic.
- Is workload ownership unclear? Inspect namespaces and cgroups, then consider eBPF-based attribution.
- Will observation change the workload? Avoid broad packet capture on a busy bottleneck host and prefer kernel aggregation.
A capture on a heavily loaded server can become a self-inflicted performance problem. Conversely, counters can hide microbursts and cannot explain the contents of a frame. eBPF provides a scalable middle path, but it depends on kernel support, BTF, permissions, and carefully bounded programs.

The operational loop is straightforward: retain low-cost counters continuously, capture selectively when evidence is required, and use eBPF when sustained visibility must survive production load. Centralized dashboards and alerts should preserve the local interface context, so the responder can move from a page to the relevant host, counter, flow, namespace, or packet filter without rebuilding the investigation from scratch.
Fivenines provides centralized infrastructure monitoring for Linux servers and network devices, including interface traffic telemetry, dashboards, and alert routing that can complement command-line inspection. Visit Fivenines to connect local Ethernet visibility with continuous monitoring and actionable incident alerts.