Linux network issues
Choose either the basic analysis with low overhead to check for a few common issues or advanced analysis with higher overhead for deeper diagnostics.
Basic analysis
The following data gathering has trivial performance overhead and is completely safe to do in production.
- If a browser client is involved, start a HAR file collection in the browser if possible.
- Reproduce the problem
- Gather the following on all sides of the suspect conversation(s)
during the suspected problem (set
TARGETto the relevant destination host or IP):TARGET=... netstat -s > diag_netstat_s_$(hostname)_$(date +%Y%m%d_%H%M%S).txt 2>&1 netstat -i > diag_netstat_i_$(hostname)_$(date +%Y%m%d_%H%M%S).txt 2>&1 netstat -antop > diag_netstat_antop_$(hostname)_$(date +%Y%m%d_%H%M%S).txt 2>&1 cat /proc/net/dev /proc/net/snmp* /proc/net/netstat /proc/net/tcp* /proc/net/udp* /proc/net/if_inet6 /sys/fs/cgroup/cpu.stat /sys/fs/cgroup/cpu/*/*/cpu.stat > diag_proc_$(hostname)_$(date +%Y%m%d_%H%M%S).txt 2>&1 vmstat -tn 2 2 > diag_vmstat_$(hostname)_$(date +%Y%m%d_%H%M%S).txt 2>&1 ping -c 10 -n $TARGET > diag_ping_$(hostname)_$(date +%Y%m%d_%H%M%S).txt 2>&1 mtr --report-wide --show-ips --aslookup --report-cycles 10 $TARGET > diag_mtr_$(hostname)_$(date +%Y%m%d_%H%M%S).txt 2>&1 - After the above commands complete, wait 30 seconds
- Gather another set of everything in step 3 above
- Upload all the
diag*files, HAR files if gathered, and describe the approximate time of the issue and all related IP addresses, ports, and whether communication is TCP or UDP.
Advanced analysis
The following data gathering may have some performance overhead:
- Start network
trace, ideally on all sides of the conversation(s) at the same time:
- If traffic is encrypted, then only gather packet headers with
-s 100. SetINTERFACEto the relevant network interface name (or useanyalthough this can cause issues).-Cis maximum size per file in MB and-Wis maximum files, so this example is up to a 10GB rolling collection:INTERFACE=... sudo sh -c "date >> diag_nohup_$(hostname).txt && (nohup tcpdump -nn -v -i $INTERFACE -B 4096 -s 100 -C 1024 -W 10 -Z root -w diag_capture_$(hostname)_$(date +%Y%m%d_%H%M%S).pcap >> diag_nohup_$(hostname).txt 2>&1 &) && sleep 3 && cat diag_nohup_$(hostname).txt" - If traffic is not encrypted and overhead is acceptable, capture
entire packets with
-s 0. Replace $INTERFACE with the relevant network interface name (or useanyalthough this can cause issues).-Cis maximum size per file in MB and-Wis maximum files, so this example is up to a 10GB rolling collection:INTERFACE=... sudo sh -c "date >> diag_nohup_$(hostname).txt && (nohup tcpdump -nn -v -i $INTERFACE -B 4096 -s 0 -C 1024 -W 10 -Z root -w diag_capture_$(hostname)_$(date +%Y%m%d_%H%M%S).pcap >> diag_nohup_$(hostname).txt 2>&1 &) && sleep 3 && cat diag_nohup_$(hostname).txt" - For an OpenShift pod, perform the above using nsenter.
- If traffic is encrypted, then only gather packet headers with
- If a browser client is involved, start a HAR file collection in the browser if possible.
- Reproduce the problem
- Stop network trace:
sudo pkill -INT -f diag_capture - Upload all the
diag*files, HAR files if gathered, and describe the approximate time of the issue and all related IP addresses, ports, and whether communication is TCP or UDP.
Analysis
Common things to check for:
- TCP:
- Increases in "segments retransmitted" relative to "segments sent
out". The retransmission
percentage is
(segments retransmitted / (segments sent out + segments retransmitted)) * 100. In general, a retransmission rate greater than ~1% for LAN traffic is concerning.Tcp: 5863279049 segments sent out 447776 segments retransmitted
- Increases in "segments retransmitted" relative to "segments sent
out". The retransmission
percentage is
- UDP:
- Increases in "receive buffer
errors" relative to "packets received":
Udp: 191344993 packets received 61085 packet receive errors 61085 receive buffer errors - Increases in "send buffer errors":
Udp: 368 send buffer errors
- Increases in "receive buffer
errors" relative to "packets received":