← Kỹ sư mạng← Network Engineer
Kỹ sư mạngNetwork Engineer19 Th7, 2026Jul 19, 202626 phút đọc24 min read

Công cụ & Xử lý sự cốTools & Troubleshooting

Thuộc bộ kiến thức Network Engineer Roadmap.

Tổng quan

Troubleshooting (xử lý sự cố) là kỹ năng giá trị nhất của một network engineer. Mạng thường hỏng theo những cách mơ hồ và khó chịu — người dùng nói “internet chậm” hoặc “tôi không vào được app,” và việc của bạn là biến một triệu chứng mơ hồ thành một root cause chính xác. Khác biệt giữa engineer junior và senior hiếm khi nằm ở việc biết thêm một câu lệnh; nó nằm ở phương pháp. Một engineer senior đặt ra một hypothesis (giả thuyết), test nó với chi phí rẻ nhất, và loại bỏ cả một nhóm nguyên nhân sau mỗi bước. Một engineer junior chạy ping mười lần rồi cầu may.

Note này cố tình hands-on. Nó ghép một phương pháp có cấu trúc (cách tư duy) với bộ công cụ chuẩn (cái để chạy) và một loạt bảng triệu chứng → nguyên nhân → công cụ (khi nào dùng gì). Các công cụ chia thành vài nhóm:

NhómCông cụTrả lời câu hỏi
Connectivityping, traceroute/tracert, mtrPacket có tới đích không, và chết ở đâu?
Name resolutiondig, nslookup, hostDNS có trả về đúng kết quả không?
Trạng thái localip, ifconfig, ipconfig, ss, netstat, arpHost này nghĩ mạng của nó trông như thế nào?
Discovery & scannmap, arp-scanCó những host và service nào trên segment này?
Throughputiperf3, speedtestThực tế ta có bao nhiêu bandwidth?
Packet analysistcpdump, WiresharkThực sự có gì trên dây, từng byte một?
Lab & mô phỏngPacket Tracer, GNS3, EVE-NGTái hiện và luyện tập mà không đụng vào production.

Mọi thứ ở đây dựa trên mô hình phân lớp trong ./03-network-models-and-layers.md và các protocol trong ./06-core-protocols.md. Troubleshooting và monitoring là hai mặt của một đồng xu — monitoring (./14-monitoring-and-observability.md) cho bạn biết thứ gì đó sai; troubleshooting cho bạn biết tại sao.

Kiến thức nền tảng

Một phương pháp có cấu trúc

Mục tiêu của phương pháp là làm cho tiến độ được đảm bảo thay vì may rủi. Mọi cách tiếp cận tốt đều đi qua stack OSI/TCP-IP theo một thứ tự nào đó, bởi vì lỗi ở lớp thấp làm mọi lớp phía trên nó cũng hỏng theo. Không có ích gì khi debug HTTP nếu dây mạng bị rút.

Vòng lặp phổ quát là: isolate → hypothesize → test → fix → verify (cô lập → giả thuyết → kiểm chứng → sửa → xác minh).

  1. Isolate. Thu hẹp phạm vi. Một host hay tất cả host? Một site hay cả LAN? Một application hay toàn bộ traffic? Một chiều hay cả hai chiều? Tái hiện được thì càng tốt. “Từ laptop của tôi thì được nhưng từ server thì không” hữu ích gấp trăm lần “nó hỏng.”
  2. Hypothesize. Nêu một phỏng đoán có thể bác bỏ được: “DNS đang resolve ra IP cũ,” “default gateway không reachable,” “có MTU mismatch trên tunnel.” Một hypothesis mà bạn không test được bằng một câu lệnh thì quá mơ hồ.
  3. Test. Chạy câu lệnh rẻ nhất để xác nhận hoặc bác bỏ hypothesis. Một lệnh ping 8.8.8.8 phân biệt ngay lập tức giữa “mất connectivity” và “DNS hỏng.”
  4. Fix. Thay đổi mỗi lần một thứ. Đổi ba thứ rồi thấy nó chạy thì chẳng học được gì và có thể đã che mất lỗi thật.
  5. Verify. Xác nhận từ góc nhìn của người dùng, không chỉ của bạn. Rồi kiểm tra bạn không làm hỏng thứ khác. Ghi lại root cause.

Ba cách đi qua các lớp

Cách tiếp cậnCách làmTốt nhất khi
Bottom-upBắt đầu ở Layer 1 (dây, link) rồi đi lên: link → IP → transport → application.Bạn nghi lỗi vật lý/hạ tầng, hoặc không biết lỗi ở đâu. Kỹ nhưng chậm.
Top-downBắt đầu ở application rồi đi xuống: app chạy không? HTTP? TLS? TCP? IP?Người dùng báo lỗi application và các lớp thấp có lẽ ổn (ví dụ chỉ một website chết).
Divide-and-conquerBắt đầu ở giữa (thường là Layer 3 — ping được đích không?) rồi nhảy lên hoặc xuống tùy kết quả.Bạn có kinh nghiệm và một linh cảm. Cách nhanh nhất trong tay người thạo.

Một lượt đi bottom-up cụ thể:

# L1/L2 — link có UP không và có địa chỉ chưa?
ip link show                 # state UP? Có carrier không?
ip addr show                 # có địa chỉ IPv4/IPv6 chưa?

# L3 — tới được gateway chưa, rồi internet theo IP?
ip route show                # có default route không?
ping -c 3 192.168.1.1        # default gateway (reachability trong LAN)
ping -c 3 8.8.8.8            # một IP public (routing + internet, không DNS)

# Cỡ L7 — name resolution có chạy không?
dig +short example.com       # DNS có trả về kết quả không?
ping -c 3 example.com        # end-to-end theo tên

# L7 — service thực sự có phản hồi không?
curl -I https://example.com  # dòng status HTTP và headers

Nếu mọi bước đều pass cho đến dig, bạn đã chứng minh Layer 1–3 khỏe mạnh và lỗi là ở DNS. Đó là sức mạnh của việc đi qua stack: mỗi test pass loại bỏ vĩnh viễn một lớp.

”Is it DNS? It’s always DNS.”

Câu đùa này tồn tại vì DNS nằm giữa một mạng đang chạy và một application đang chạy, nên lỗi DNS đội lốt thành đủ thứ lỗi khác. Test tức thì để tách DNS khỏi connectivity:

ping -c 3 8.8.8.8            # được?    -> IP connectivity ỔN
ping -c 3 google.com        # thất bại? -> vấn đề là name resolution (DNS)

Nếu ping IP được nhưng ping tên thất bại, đừng nhìn routing với dây nữa — nhảy thẳng sang dig.

Đọc exit code và làm việc có hệ thống

Phần lớn công cụ trả về 0 khi thành công và khác 0 khi thất bại, nên bạn có thể script các bước kiểm tra. Nhưng quan trọng hơn: mỗi lần thay đổi một biến, ghi chép lại những gì đã thử và đã thấy, và luôn test cả hai chiều của một kết nối — asymmetric routing và firewall rule một chiều là những cái bẫy kinh điển.

Khái niệm chính

Công cụ connectivity

ping — host có reachable không (ICMP)?

ping gửi các gói ICMP Echo Request và đo thời gian các Echo Reply. Nó trả lời hai câu hỏi cùng lúc: reachability (reply có về không?) và latency (mất bao lâu?).

ping -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=12.3 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=11.9 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=118 time=12.1 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=118 time=12.0 ms

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 11.9/12.0/12.3/0.15 ms

Cách đọc:

Các flag hữu ích:

ping -c 4 -i 0.2 8.8.8.8         # gửi mỗi 0.2s (lấy mẫu nhanh hơn)
ping -c 4 -s 1472 -M do 8.8.8.8  # payload 1472 byte, don't fragment (test MTU, xem bên dưới)
ping -c 4 -I eth0 8.8.8.8        # ép source interface
ping6 -c 4 2001:4860:4860::8888  # ICMPv6 tới địa chỉ v6

Trên Windows: ping -n 4 8.8.8.8 (-n = số lần, -t = ping đến khi Ctrl-C, -l = kích thước, -f = don’t fragment).

traceroute / tracert — packet đi đâu và chết ở đâu?

traceroute phơi bày đường đi từng hop bằng cách gửi packet với giá trị TTL tăng dần; mỗi router giảm TTL về 0 sẽ gửi lại thông báo “Time Exceeded,” tự lộ diện.

traceroute -n google.com
traceroute to google.com (142.250.x.x), 30 hops max, 60 byte packets
 1  192.168.1.1      0.5 ms  0.4 ms  0.4 ms
 2  10.20.0.1        8.1 ms  8.0 ms  8.2 ms
 3  100.64.0.1      11.0 ms 10.9 ms 11.1 ms
 4  * * *
 5  142.250.x.x     12.4 ms 12.3 ms 12.5 ms

Cách đọc:

Linux mặc định dùng probe UDP; thêm -I cho ICMP hoặc -T cho TCP (traceroute -T -p 443 example.com), rất giá trị khi firewall chặn UDP/ICMP nhưng cho phép TCP port của app. tracert của Windows mặc định dùng ICMP.

mtr — traceroute + ping, liên tục

mtr kết hợp tracerouteping: nó probe lặp lại mọi hop và hiển thị bảng loss/latency từng hop cập nhật liên tục. Đây là công cụ tốt nhất để chẩn đoán loss không liên tục (intermittent)hop nào gây latency.

mtr -rwzbc 100 google.com     # chế độ report: 100 chu kỳ, wide, hiện ASN
HOST: myhost                       Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. AS??? 192.168.1.1               0.0%   100    0.4   0.5   0.3   1.2   0.1
 2. AS1234 10.20.0.1                0.0%   100    8.1   8.3   7.9  10.2   0.4
 3. AS5678 100.64.0.1               2.0%   100   11.0  11.4  10.8  25.1   1.9
 4. AS15169 142.250.x.x             0.0%   100   12.4  12.6  12.1  14.0   0.3

Điểm mấu chốt: loss xuất hiện ở một hop và tiếp tục đến hop cuối là loss thật; loss xuất hiện ở một hop giữa nhưng 0% ở đích chỉ là router đó ưu tiên thấp cho ICMP và có thể bỏ qua. Trong ví dụ trên, hop 3 hiện 2% nhưng hop 4 hiện 0% — vậy “loss” chỉ mang tính hình thức, đường đi thực ra sạch.

Công cụ DNS

Xem ./06-core-protocols.md để hiểu DNS hoạt động ra sao; ở đây ta tập trung vào các lệnh chẩn đoán.

dig — công cụ DNS của dân chuyên

dig example.com A
;; QUESTION SECTION:
;example.com.                   IN      A

;; ANSWER SECTION:
example.com.            3600    IN      A       93.184.216.34

;; Query time: 14 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)

Đọc ANSWER SECTION để lấy record và TTL của nó (ở đây 3600s). SERVER cho biết resolver nào đã trả lời — cực kỳ quan trọng khi bạn nghi đang dùng sai resolver.

dig +short example.com               # chỉ kết quả, thân thiện với script
dig +trace example.com               # đi từ root -> TLD -> authoritative (tìm nơi resolution gãy)
dig @1.1.1.1 example.com             # query một resolver CỤ THỂ (bỏ qua resolver local)
dig @8.8.8.8 example.com +short      # đối chiếu: resolver khác có đồng ý không?
dig example.com MX                   # bản ghi mail
dig example.com NS                   # nameserver
dig example.com TXT                  # bản ghi SPF/DKIM/xác minh
dig -x 8.8.8.8                       # reverse lookup (PTR)
dig example.com +norecurse          # hỏi xem server có cache sẵn không (kiểm tra authoritative)

Chẩn đoán DNS hữu ích nhất: query hai resolver và so sánh. Nếu dig @1.1.1.1dig @8.8.8.8 khác nhau, bạn có cache cũ hoặc vấn đề propagation. dig +trace sau đó chỉ ra chính xác nameserver nào trong chuỗi delegation trả về sai.

nslookup — có ở mọi nơi, kể cả Windows

nslookup example.com                 # lookup A cơ bản
nslookup example.com 8.8.8.8         # dùng server cụ thể
nslookup -type=MX example.com        # chỉ định loại record

nslookup có sẵn trên Windows và macOS/Linux. Nó ít script-friendly hơn dig và định dạng output vụng hơn, nhưng luôn có mặt.

host — nhanh và gọn

host example.com                     # A, AAAA, và MX mỗi loại một dòng
host -t NS example.com               # nameserver
host 93.184.216.34                   # reverse lookup

Công cụ interface & socket — host này nghĩ gì?

ip (Linux, hiện đại) / ifconfig (cũ) / ipconfig (Windows)

ip addr show                # tất cả interface, địa chỉ, trạng thái (thay cho ifconfig -a)
ip -br addr                 # tóm tắt gọn mỗi interface một dòng
ip link show               # trạng thái L2, MAC, MTU, UP/DOWN
ip route show              # bảng routing; tìm dòng 'default via'
ip neigh show              # bảng ARP/neighbor (thay cho arp -a)
ip -s link show eth0       # thống kê interface: RX/TX errors, drops

Output gọn của ip -br addr lý tưởng để liếc nhanh:

lo               UNKNOWN        127.0.0.1/8 ::1/128
eth0             UP             192.168.1.42/24 fe80::.../64

Kiểm tra: interface kẹt DOWN, thiếu IP (DHCP thất bại), địa chỉ 169.254.x.x (APIPA — DHCP thất bại, không server nào trả lời), hoặc thiếu route default.

Trên Windows:

ipconfig /all           # cấu hình đầy đủ: IP, mask, gateway, DNS, MAC, DHCP lease
ipconfig /release       # bỏ DHCP lease
ipconfig /renew         # xin lease mới
ipconfig /flushdns      # xóa cache resolver (sửa DNS cũ trên client)
ipconfig /displaydns    # hiện các entry DNS đã cache

ipconfig /flushdns là cách sửa tương đương trên Windows khi client cứ resolve một tên ra IP cũ.

ss / netstat — socket và port đang lắng nghe

ss là bản thay thế hiện đại, nhanh hơn cho netstat.

ss -tulpn        # socket TCP+UDP đang LISTEN kèm process sở hữu và port
ss -tan          # tất cả socket TCP kèm state (không resolve tên)
ss -tn state established           # chỉ kết nối established
ss -tn dst 10.0.0.5                 # kết nối tới một host cụ thể
ss -s                              # tóm tắt số lượng theo state
Netid State   Recv-Q Send-Q Local Address:Port  Peer Address:Port  Process
tcp   LISTEN  0      128    0.0.0.0:22           0.0.0.0:*          users:(("sshd",pid=812,fd=3))
tcp   ESTAB   0      0      192.168.1.42:22      192.168.1.10:53344 users:(("sshd",pid=1099,fd=4))

Dùng nó để trả lời “service của tôi có thực sự đang lắng nghe không?” (tìm LISTEN trên port kỳ vọng) và “ai đang kết nối?” Để ý các TCP state: nhiều socket kẹt ở SYN-SENT nghĩa là đầu xa không trả lời (firewall/down); nhiều TIME-WAIT thường là bình thường; nhiều CLOSE-WAIT nghĩa là app local không đóng socket (lỗi app).

Tương đương Windows: netstat -ano (-o hiện PID; đối chiếu với Task Manager).

arp — ánh xạ MAC ↔ IP trên segment local

ip neigh show          # Linux hiện đại
arp -a                 # truyền thống, cũng có trên Windows/macOS
192.168.1.1 dev eth0 lladdr aa:bb:cc:dd:ee:ff REACHABLE
192.168.1.10 dev eth0 lladdr 11:22:33:44:55:66 STALE

Hai thiết bị hiện cùng một MAC cho các IP khác nhau, hoặc IP gateway mà MAC cứ đổi, chỉ ra IP conflict hoặc ARP spoofing. INCOMPLETE cạnh một neighbor nghĩa là ARP không nhận được reply — host tắt hoặc ở VLAN khác.

Scanning & discovery

Chỉ dùng khi được ủy quyền. Port scan các mạng bạn không sở hữu hoặc không có văn bản cho phép test là bất hợp pháp ở nhiều nơi và vi phạm hầu hết chính sách sử dụng. Chỉ scan lab của bạn hoặc hệ thống bạn được phép đánh giá rõ ràng.

nmap — discovery host và service

# Chỉ discovery host (ping sweep) — ai còn sống trên subnet này?
nmap -sn 192.168.1.0/24
Nmap scan report for 192.168.1.1
Host is up (0.0012s latency).
Nmap scan report for 192.168.1.42
Host is up (0.00030s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 2.11 seconds
# Các TCP port phổ biến trên một host
nmap 192.168.1.10

# Phát hiện service + version trên các port cụ thể
nmap -sV -p 22,80,443 192.168.1.10

# Nhanh top-100 port, không DNS, timing aggressive
nmap -F -n -T4 192.168.1.10

# Phát hiện OS (cần root/admin)
sudo nmap -O 192.168.1.10

# Scan UDP (chậm — nhiều service không reply)
sudo nmap -sU -p 53,123,161 192.168.1.10

Cách đọc: mỗi port mở hiện PORT STATE SERVICE VERSION. open = có gì đó đang lắng nghe; filtered = firewall đang drop probe (không trả lời); closed = host sống nhưng không có gì lắng nghe ở đó. -sV lấy banner để xác định phần mềm và version chính xác — vô giá cho câu “cái hộp bí ẩn kia đang chạy gì?”

Throughput: iperf3speedtest

speedtest đo download/upload internet của bạn tới một server công cộng:

speedtest              # speedtest-cli hoặc client Ookla chính thức

iperf3 đo throughput giữa hai host bạn kiểm soát — công cụ thật để test LAN, link WAN, hoặc VPN tunnel. Chạy server một đầu và client đầu kia:

# Trên server (đích):
iperf3 -s

# Trên client (nguồn):
iperf3 -c 10.0.0.5                 # throughput TCP trong 10 giây
iperf3 -c 10.0.0.5 -t 30 -P 4      # 30s, 4 luồng song song (làm bão hòa link)
iperf3 -c 10.0.0.5 -R             # đảo chiều: đo download thay vì upload
iperf3 -c 10.0.0.5 -u -b 100M      # UDP ở 100 Mbit/s — báo cáo jitter và loss
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  1.10 GBytes   943 Mbits/sec   0    sender
[  5]   0.00-10.00  sec  1.09 GBytes   940 Mbits/sec        receiver

943 Mbits/sec trên link “gigabit” là khỏe (overhead chiếm phần còn lại). Số Retr (retransmit) cao báo hiệu loss hoặc nghẽn cổ chai. Chế độ UDP là cách đo jitter và packet loss cho việc lập kế hoạch VoIP/video.

Packet analysis

Khi công cụ ở lớp cao mâu thuẫn với thực tế, hãy capture chính các packet. Cả tcpdump và Wireshark đều dùng chung engine libpcap và cùng cú pháp capture filter (BPF); Wireshark thêm ngôn ngữ display filter phong phú hơn nhiều và một GUI.

Capture filter vs display filter

Capture filter (BPF)Display filter (Wireshark)
Áp dụng khi nàoTrước khi capture — quyết định cái gì được ghiSau khi capture — quyết định cái gì được hiện
Cú pháphost 10.0.0.5 and port 443ip.addr == 10.0.0.5 && tcp.port == 443
Dùng bởitcpdump, ô “Capture” của Wiresharkthanh “Display filter” của Wireshark
Mục đíchGiảm khối lượng trên link bậnĐào sâu vào một capture có sẵn

Nguyên tắc: dùng capture filter để giữ file nhỏ trên interface bận; dùng display filter để khám phá cái đã capture. Đừng lọc quá tay lúc capture — không thể khôi phục cái bạn đã không ghi.

tcpdump — capture từ CLI

sudo tcpdump -i eth0 -n host 8.8.8.8            # traffic tới/từ một host, không DNS
sudo tcpdump -i eth0 -n port 53                  # tất cả DNS
sudo tcpdump -i eth0 -n 'tcp port 443 and host 10.0.0.5'
sudo tcpdump -i any -n icmp                       # ping trên mọi interface
sudo tcpdump -i eth0 -nn -c 100 -w capture.pcap   # ghi 100 packet ra file cho Wireshark
sudo tcpdump -i eth0 -A -s0 port 80               # in payload dạng ASCII (HTTP plaintext)
sudo tcpdump -r capture.pcap 'tcp port 443'       # đọc và lọc một file có sẵn

Một TCP handshake trong output của tcpdump trông như thế này:

10:00:01.100 IP 10.0.0.10.53344 > 10.0.0.5.443: Flags [S],  seq 100, win 64240   # SYN
10:00:01.112 IP 10.0.0.5.443 > 10.0.0.10.53344: Flags [S.], seq 900, ack 101      # SYN-ACK
10:00:01.112 IP 10.0.0.10.53344 > 10.0.0.5.443: Flags [.],  ack 901               # ACK

[S] = SYN, [S.] = SYN-ACK, [.] = ACK, [P.] = PSH+ACK (data), [F.] = FIN, [R] = RST. Thấy một SYNkhôngSYN-ACK đáp lại nghĩa là server không trả lời — firewall hoặc service down. Một SYN bị đáp bằng [R] (RST) nghĩa là port đóng / bị từ chối chủ động.

Wireshark — GUI phân tích

Wireshark decode hàng trăm protocol và cho bạn theo dõi một cuộc hội thoại trực quan. Các display filter thiết yếu:

ip.addr == 10.0.0.5                     # mọi packet tới/từ IP này
tcp.port == 443                         # TCP port này
dns                                     # chỉ DNS
http.request                            # chỉ HTTP request
tcp.flags.syn == 1 && tcp.flags.ack == 0   # các SYN (nỗ lực kết nối)
tcp.analysis.retransmission             # retransmit do Wireshark đánh dấu (loss!)
tcp.analysis.zero_window                # bên nhận bảo bên gửi dừng (nghẽn flow-control)
tcp.stream eq 0                         # cô lập trọn một cuộc hội thoại TCP
frame contains "password"               # tìm một chuỗi byte trong payload

Right-click một packet → Follow → TCP Stream để xem trọn một cuộc hội thoại được ráp lại. Statistics → Conversations xếp hạng ai nói nhiều nhất (tìm kẻ ngốn bandwidth). Statistics → I/O Graph vẽ throughput theo thời gian. Khi thấy tcp.analysis.retransmission chồng chất, bạn có packet loss thật — đối chiếu với hop trong mtr bị loss.

Network simulator & lab

Luyện tập và tái hiện lỗi mà không mạo hiểm production. Mỗi công cụ đánh đổi độ trung thực lấy độ nặng:

Công cụLà gìChạyTốt nhất cho
Cisco Packet TracerSimulator miễn phí của Cisco (xấp xỉ hành vi thiết bị, không phải firmware thật)Nhẹ, chạy được trên laptopHọc nền tảng, ôn CCNA, phác nhanh topology
GNS3Emulator chạy image thiết bị thật (IOS, và qua Docker/QEMU: router, firewall, Linux)Nặng hơn; có thể dùng VM từ xaLab đa hãng thực tế, kiểm chứng config trước khi triển khai
EVE-NGNền tảng emulation đa hãng chạy trên web, image thật, dễ lab đa người dùngChạy trên server/VMLab nhóm, topology lớn, ôn chứng chỉ (CCNP/CCIE, security)

Nguyên tắc: Packet Tracer để học khái niệm với chi phí rẻ, GNS3 khi cần hành vi firmware thật trên máy của mình, EVE-NG cho lab dùng chung, quy mô lớn, hoặc đa hãng.

Sự cố thường gặp: triệu chứng → nguyên nhân → công cụ

Triệu chứngNguyên nhân khả dĩCông cụ / lệnh để xác nhận
Mất connectivity hoàn toànLink down, không có DHCP lease, không có default route, sai VLANip link, ip addr (169.254 = APIPA/không DHCP), ip route (thiếu default), ping gateway
Ping IP được nhưng ping tên khôngDNS sai/down, sai resolver, cache cũping 8.8.8.8 (được) vs ping name (thất bại); dig @1.1.1.1 name; ipconfig /flushdns
Rớt không liên tục (intermittent)Dây lỏng, nhiễu Wi-Fi, duplex mismatch, hop quá tảimtr -rwc 500 dest (tìm hop bị loss), ip -s link (RX/TX errors), kiểm tra error trên port switch
Latency caoNghẽn, bufferbloat, sai đường/routing, server ở xamtr/traceroute (định vị hop chậm), ping khi có tải, iperf3
Throughput thấpDuplex mismatch, link bão hòa, window nhỏ, vấn đề MTUiperf3 -c host -P4, ethtool eth0 (speed/duplex), ip -s link (errors)
Lỗi DNSResolver hỏng, record hết hạn, lệch split-horizondig +trace name, so sánh dig @1.1.1.1 vs @8.8.8.8, dig name +norecurse ở authoritative
Duplex mismatchMột bên auto, bên kia bị ép (half vs full)ethtool eth0 cả hai đầu; triệu chứng là late collision + throughput thấp dù link vẫn up
MTU mismatch / phân mảnhOverhead tunnel/VPN, jumbo frame chỉ bật một bênping -M do -s 1472 dest (thất bại nếu MTU < 1500); giảm kích thước đến khi pass để tìm path MTU
IP conflictHai host trùng static IP, hoặc static đè lên dải DHCParp -a (một IP nhảy MAC), event “address conflict” của OS, arping <ip>
VLAN / trunk cấu hình saiAccess port sai VLAN, trunk thiếu VLAN được phép, native VLAN lệchTrên switch show vlan, show interfaces trunk; triệu chứng: host cùng switch không nói chuyện được, hoặc chỉ chạy trên một VLAN
Traffic bất đối xứng / một chiềuFirewall rule một chiều, asymmetric routingtcpdump cả hai đầu (thấy SYN đi ra nhưng không có SYN-ACK về), kiểm tra log firewall

Chẩn đoán MTU mismatch (ví dụ thực hành)

Vấn đề MTU rất ranh mãnh: packet nhỏ (ping, DNS, phần đầu của một phiên TCP) chạy được, nhưng transfer lớn thì treo. Tìm path MTU bằng ping don’t-fragment và giảm dần đến khi pass:

ping -M do -s 1472 -c 2 example.com   # 1472 payload + 28 header = 1500 (Ethernet chuẩn)
# Nếu nhận: "Frag needed and DF set (mtu = 1420)" -> path MTU là 1420, không phải 1500
ping -M do -s 1392 -c 2 example.com   # 1392 + 28 = 1420, giờ sẽ thành công

Giá trị -s lớn nhất thành công, cộng 28, là path MTU của bạn. Cách sửa phổ biến trên link VPN/PPPoE là giảm MTU của interface hoặc clamp TCP MSS.

Bảng tra nhanh câu lệnh (Linux ↔ Windows)

Tác vụLinuxWindows
Reachabilityping -c 4 hostping -n 4 host
Ping liên tụcping hostping -t host
Trace đường đitraceroute host / mtr hosttracert host / pathping host
Cấu hình interfaceip addr / ifconfigipconfig /all
Bảng routingip routeroute print / netstat -r
Bảng ARP / neighborip neigh / arp -aarp -a
Port đang lắng nghess -tulpnnetstat -ano
Lookup DNSdig / host / nslookupnslookup
Xóa cache DNSsudo systemd-resolve --flush-cachesipconfig /flushdns
Renew DHCP leasesudo dhclient -r && sudo dhclientipconfig /release + /renew
Packet capturesudo tcpdump -i eth0Wireshark / pktmon
Scan port/hostnmapnmap (hoặc Test-NetConnection)
Test một TCP portnc -zv host 443Test-NetConnection host -Port 443
Throughput testiperf3iperf3.exe
Thống kê interfaceip -s link / ethtool eth0netstat -e / Get-NetAdapterStatistics

Best Practices

Tài liệu tham khảo

Part of the Network Engineer Roadmap knowledge base.

Overview

Troubleshooting is the single most valuable skill a network engineer has. Networks fail in messy, ambiguous ways — a user says “the internet is slow” or “I can’t reach the app,” and it is your job to turn that vague symptom into a precise root cause. The difference between a junior and a senior engineer is rarely knowledge of one more command; it is method. A senior engineer forms a hypothesis, tests it cheaply, and eliminates whole classes of problems with each step. A junior engineer runs ping a dozen times and hopes.

This note is deliberately hands-on. It pairs a structured methodology (how to think) with the standard toolset (what to run) and a set of symptom → cause → tool tables (what to reach for when). The tools split into a few families:

FamilyToolsAnswers the question
Connectivityping, traceroute/tracert, mtrCan packets reach the destination, and where do they die?
Name resolutiondig, nslookup, hostIs DNS returning the right answer?
Local stateip, ifconfig, ipconfig, ss, netstat, arpWhat does this host think its network looks like?
Discovery & scannmap, arp-scanWhat hosts and services exist on this segment?
Throughputiperf3, speedtestHow much bandwidth do we actually get?
Packet analysistcpdump, WiresharkWhat is actually on the wire, byte for byte?
Labs & simulationPacket Tracer, GNS3, EVE-NGReproduce and practice without touching production.

Everything here builds on the layering model in ./03-network-models-and-layers.md and the protocols in ./06-core-protocols.md. Troubleshooting and monitoring are two sides of one coin — monitoring (./14-monitoring-and-observability.md) tells you that something is wrong; troubleshooting tells you why.

Fundamentals

A structured methodology

The goal of a method is to make progress guaranteed rather than lucky. Every good approach walks the OSI/TCP-IP stack in some order, because a failure at a lower layer makes everything above it fail too. There is no point debugging HTTP if the cable is unplugged.

The universal loop is: isolate → hypothesize → test → fix → verify.

  1. Isolate. Narrow the scope. Is it one host or all hosts? One site or the LAN? One application or all traffic? One direction or both? Reproduce it if you can. “Works from my laptop but not the server” is a hundred times more useful than “it’s broken.”
  2. Hypothesize. State a falsifiable guess: “DNS is resolving to a stale IP,” “the default gateway is unreachable,” “there’s an MTU mismatch on the tunnel.” A hypothesis you can’t test with one command is too vague.
  3. Test. Run the cheapest command that confirms or kills the hypothesis. A single ping 8.8.8.8 distinguishes “no connectivity” from “DNS broken” instantly.
  4. Fix. Make one change at a time. Changing three things and seeing it work teaches you nothing and may have masked the real fault.
  5. Verify. Confirm from the user’s perspective, not just yours. Then confirm you didn’t break something else. Document the root cause.

Three ways to walk the layers

ApproachHow it worksBest when
Bottom-upStart at Layer 1 (cable, link) and climb: link → IP → transport → application.You suspect a physical or infrastructure fault, or you have no idea where it is. Thorough but slow.
Top-downStart at the application and descend: does the app work? HTTP? TLS? TCP? IP?The user reports an application problem and lower layers are probably fine (e.g. one website is down).
Divide-and-conquerStart in the middle (usually Layer 3 — can you ping the destination?) and jump up or down based on the result.You have experience and a hunch. The fastest method in skilled hands.

A concrete bottom-up walk:

# L1/L2 — is the link up and do we have an address?
ip link show                 # state UP? Any carrier?
ip addr show                 # do we have an IPv4/IPv6 address?

# L3 — can we reach the gateway, then the internet by IP?
ip route show                # is there a default route?
ping -c 3 192.168.1.1        # the default gateway (LAN reachability)
ping -c 3 8.8.8.8            # a public IP (routing + internet, no DNS)

# L7-ish — is name resolution working?
dig +short example.com       # does DNS return an answer?
ping -c 3 example.com        # end-to-end by name

# L7 — does the actual service respond?
curl -I https://example.com  # HTTP status line and headers

If every step passes until dig, you have proven Layers 1–3 are healthy and the fault is DNS. That is the power of walking the stack: each passing test permanently rules out a layer.

”Is it DNS? It’s always DNS.”

The running joke exists because DNS sits between a working network and a working application, so DNS faults masquerade as everything else. The instant test that separates DNS from connectivity:

ping -c 3 8.8.8.8            # works?  -> IP connectivity is FINE
ping -c 3 google.com        # fails?  -> the problem is name resolution (DNS)

If pinging an IP works but pinging a name fails, stop looking at routing and cables — go straight to dig.

Reading exit codes and being systematic

Most tools return 0 on success and non-zero on failure, so you can script checks. But more importantly: change one variable at a time, keep a scratch log of what you tried and what you saw, and always test both directions of a connection — asymmetric routing and one-way firewall rules are classic traps.

Key Concepts

Connectivity tools

ping — is the host reachable (ICMP)?

ping sends ICMP Echo Request packets and times the Echo Replies. It answers two questions at once: reachability (do replies come back?) and latency (how long do they take?).

ping -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=12.3 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=11.9 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=118 time=12.1 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=118 time=12.0 ms

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 11.9/12.0/12.3/0.15 ms

How to read it:

Useful flags:

ping -c 4 -i 0.2 8.8.8.8         # send every 0.2s (faster sampling)
ping -c 4 -s 1472 -M do 8.8.8.8  # 1472-byte payload, don't fragment (MTU test, see below)
ping -c 4 -I eth0 8.8.8.8        # force a source interface
ping6 -c 4 2001:4860:4860::8888  # ICMPv6 to a v6 address

On Windows: ping -n 4 8.8.8.8 (-n = count, -t = ping until Ctrl-C, -l = size, -f = don’t fragment).

traceroute / tracert — where does the packet go, and where does it die?

traceroute reveals the path hop by hop by sending packets with increasing TTL values; each router that decrements TTL to 0 sends back a “Time Exceeded” message, revealing itself.

traceroute -n google.com
traceroute to google.com (142.250.x.x), 30 hops max, 60 byte packets
 1  192.168.1.1      0.5 ms  0.4 ms  0.4 ms
 2  10.20.0.1        8.1 ms  8.0 ms  8.2 ms
 3  100.64.0.1      11.0 ms 10.9 ms 11.1 ms
 4  * * *
 5  142.250.x.x     12.4 ms 12.3 ms 12.5 ms

How to read it:

Linux uses UDP probes by default; add -I for ICMP or -T for TCP (traceroute -T -p 443 example.com), which is invaluable when firewalls block UDP/ICMP but allow the app’s TCP port. Windows tracert uses ICMP by default.

mtr — traceroute + ping, continuously

mtr combines traceroute and ping: it repeatedly probes every hop and shows a live-updating table of loss and latency per hop. It is the best tool for diagnosing intermittent loss and which hop introduces latency.

mtr -rwzbc 100 google.com     # report mode: 100 cycles, wide, show ASN
HOST: myhost                       Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. AS??? 192.168.1.1               0.0%   100    0.4   0.5   0.3   1.2   0.1
 2. AS1234 10.20.0.1                0.0%   100    8.1   8.3   7.9  10.2   0.4
 3. AS5678 100.64.0.1               2.0%   100   11.0  11.4  10.8  25.1   1.9
 4. AS15169 142.250.x.x             0.0%   100   12.4  12.6  12.1  14.0   0.3

Key insight: loss that appears at one hop and continues to the final hop is real loss; loss that appears at a middle hop but is 0% at the destination is just that router deprioritizing ICMP and can be ignored. In the example above, hop 3 shows 2% but hop 4 shows 0% — so the “loss” is cosmetic, the path is actually clean.

DNS tools

See ./06-core-protocols.md for how DNS works; here we focus on the diagnostic commands.

dig — the professional’s DNS tool

dig example.com A
;; QUESTION SECTION:
;example.com.                   IN      A

;; ANSWER SECTION:
example.com.            3600    IN      A       93.184.216.34

;; Query time: 14 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)

Read the ANSWER SECTION for the record and its TTL (here 3600s). SERVER tells you which resolver answered — critical when you suspect the wrong resolver is in use.

dig +short example.com               # just the answer, script-friendly
dig +trace example.com               # walk from root -> TLD -> authoritative (find where resolution breaks)
dig @1.1.1.1 example.com             # query a SPECIFIC resolver (bypass local one)
dig @8.8.8.8 example.com +short      # cross-check: does another resolver agree?
dig example.com MX                   # mail records
dig example.com NS                   # nameservers
dig example.com TXT                  # SPF/DKIM/verification records
dig -x 8.8.8.8                       # reverse lookup (PTR)
dig example.com +norecurse          # ask if the server has it cached (authoritative check)

The single most useful DNS diagnostic: query two resolvers and compare. If dig @1.1.1.1 and dig @8.8.8.8 disagree, you have a stale cache or a propagation issue. dig +trace then shows exactly which nameserver in the delegation chain returns the wrong answer.

nslookup — everywhere, including Windows

nslookup example.com                 # basic A lookup
nslookup example.com 8.8.8.8         # use a specific server
nslookup -type=MX example.com        # specify record type

nslookup ships on Windows and macOS/Linux by default. It is less scriptable than dig and its output format is clunkier, but it is always available.

host — quick and terse

host example.com                     # A, AAAA, and MX in one line each
host -t NS example.com               # nameservers
host 93.184.216.34                   # reverse lookup

Interface & socket tools — what does this host think?

ip (Linux, modern) / ifconfig (legacy) / ipconfig (Windows)

ip addr show                # all interfaces, addresses, state (replaces ifconfig -a)
ip -br addr                 # brief one-line-per-interface summary
ip link show               # L2 state, MAC, MTU, UP/DOWN
ip route show              # the routing table; look for a 'default via' line
ip neigh show              # the ARP/neighbor table (replaces arp -a)
ip -s link show eth0       # interface statistics: RX/TX errors, drops

The ip -br addr brief output is ideal for a quick glance:

lo               UNKNOWN        127.0.0.1/8 ::1/128
eth0             UP             192.168.1.42/24 fe80::.../64

Check for: an interface stuck DOWN, a missing IP (DHCP failed), a 169.254.x.x address (APIPA — DHCP failed, no server answered), or the absence of a default route.

On Windows:

ipconfig /all           # full config: IP, mask, gateway, DNS, MAC, DHCP lease
ipconfig /release       # drop the DHCP lease
ipconfig /renew         # request a new lease
ipconfig /flushdns      # clear the resolver cache (fixes stale DNS on the client)
ipconfig /displaydns    # show cached DNS entries

ipconfig /flushdns is the Windows equivalent fix when a client keeps resolving a name to an old IP.

ss / netstat — sockets and listening ports

ss is the modern, faster replacement for netstat.

ss -tulpn        # TCP+UDP listening sockets with the owning process and port
ss -tan          # all TCP sockets with state (no name resolution)
ss -tn state established           # only established connections
ss -tn dst 10.0.0.5                 # connections to a specific host
ss -s                              # summary counts by state
Netid State   Recv-Q Send-Q Local Address:Port  Peer Address:Port  Process
tcp   LISTEN  0      128    0.0.0.0:22           0.0.0.0:*          users:(("sshd",pid=812,fd=3))
tcp   ESTAB   0      0      192.168.1.42:22      192.168.1.10:53344 users:(("sshd",pid=1099,fd=4))

Use this to answer “is my service actually listening?” (look for LISTEN on the expected port) and “who is connected?” Watch TCP states: many sockets stuck in SYN-SENT means the far end isn’t answering (firewall/down); many in TIME-WAIT is usually normal churn; many in CLOSE-WAIT means the local app isn’t closing sockets (an app bug).

Windows equivalent: netstat -ano (the -o shows the PID; cross-reference with Task Manager).

arp — MAC ↔ IP mapping on the local segment

ip neigh show          # modern Linux
arp -a                 # traditional, also on Windows/macOS
192.168.1.1 dev eth0 lladdr aa:bb:cc:dd:ee:ff REACHABLE
192.168.1.10 dev eth0 lladdr 11:22:33:44:55:66 STALE

Two devices showing the same MAC for different IPs, or a gateway IP whose MAC keeps changing, points to an IP conflict or ARP spoofing. INCOMPLETE next to a neighbor means ARP got no reply — the host is off or on a different VLAN.

Scanning & discovery

Authorized use only. Port scanning networks you do not own or lack written permission to test is illegal in many jurisdictions and against most acceptable-use policies. Scan only your own lab or systems you are explicitly authorized to assess.

nmap — host and service discovery

# Host discovery only (ping sweep) — who is alive on this subnet?
nmap -sn 192.168.1.0/24
Nmap scan report for 192.168.1.1
Host is up (0.0012s latency).
Nmap scan report for 192.168.1.42
Host is up (0.00030s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 2.11 seconds
# Common TCP ports on one host
nmap 192.168.1.10

# Service + version detection on specific ports
nmap -sV -p 22,80,443 192.168.1.10

# Fast top-100 ports, no DNS, aggressive timing
nmap -F -n -T4 192.168.1.10

# OS detection (needs root/admin)
sudo nmap -O 192.168.1.10

# UDP scan (slow — many services don't reply)
sudo nmap -sU -p 53,123,161 192.168.1.10

Reading it: each open port shows PORT STATE SERVICE VERSION. open = something is listening; filtered = a firewall is dropping probes (no answer); closed = host is up but nothing listens there. -sV grabs banners to identify the exact software and version — invaluable for “what is running on that mystery box?”

Throughput: iperf3 and speedtest

speedtest measures your internet download/upload to a public server:

speedtest              # speedtest-cli or the official Ookla client

iperf3 measures throughput between two hosts you control — the real tool for testing a LAN, WAN link, or VPN tunnel. Run a server on one end and a client on the other:

# On the server (destination):
iperf3 -s

# On the client (source):
iperf3 -c 10.0.0.5                 # TCP throughput for 10 seconds
iperf3 -c 10.0.0.5 -t 30 -P 4      # 30s, 4 parallel streams (saturate the link)
iperf3 -c 10.0.0.5 -R             # reverse: measure download instead of upload
iperf3 -c 10.0.0.5 -u -b 100M      # UDP at 100 Mbit/s — reports jitter and loss
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  1.10 GBytes   943 Mbits/sec   0    sender
[  5]   0.00-10.00  sec  1.09 GBytes   940 Mbits/sec        receiver

943 Mbits/sec on a “gigabit” link is healthy (overhead accounts for the rest). A high Retr (retransmit) count signals loss or a bottleneck. UDP mode is the way to measure jitter and packet loss for VoIP/video planning.

Packet analysis

When higher-level tools disagree with reality, capture the actual packets. Both tcpdump and Wireshark use the same libpcap engine and the same capture-filter syntax (BPF); Wireshark adds a far richer display-filter language and a GUI.

Capture filters vs display filters

Capture filter (BPF)Display filter (Wireshark)
When appliedBefore capture — decides what gets writtenAfter capture — decides what is shown
Syntaxhost 10.0.0.5 and port 443ip.addr == 10.0.0.5 && tcp.port == 443
Used bytcpdump, Wireshark “Capture” boxWireshark “Display filter” bar
PurposeReduce volume on busy linksDrill into an existing capture

Rule of thumb: use a capture filter to keep the file small on a busy interface; use a display filter to explore what you captured. Never over-filter at capture time — you can’t recover what you didn’t record.

tcpdump — capture from the CLI

sudo tcpdump -i eth0 -n host 8.8.8.8            # traffic to/from one host, no DNS
sudo tcpdump -i eth0 -n port 53                  # all DNS
sudo tcpdump -i eth0 -n 'tcp port 443 and host 10.0.0.5'
sudo tcpdump -i any -n icmp                       # pings across all interfaces
sudo tcpdump -i eth0 -nn -c 100 -w capture.pcap   # write 100 packets to a file for Wireshark
sudo tcpdump -i eth0 -A -s0 port 80               # print packet payloads as ASCII (plaintext HTTP)
sudo tcpdump -r capture.pcap 'tcp port 443'       # read and filter an existing file

A TCP handshake in tcpdump output looks like this:

10:00:01.100 IP 10.0.0.10.53344 > 10.0.0.5.443: Flags [S],  seq 100, win 64240   # SYN
10:00:01.112 IP 10.0.0.5.443 > 10.0.0.10.53344: Flags [S.], seq 900, ack 101      # SYN-ACK
10:00:01.112 IP 10.0.0.10.53344 > 10.0.0.5.443: Flags [.],  ack 901               # ACK

[S] = SYN, [S.] = SYN-ACK, [.] = ACK, [P.] = PSH+ACK (data), [F.] = FIN, [R] = RST. Seeing a SYN with no SYN-ACK in reply means the server never answered — firewall or the service is down. A SYN answered by an [R] (RST) means the port is closed / actively refused.

Wireshark — the analysis GUI

Wireshark decodes hundreds of protocols and lets you follow a conversation visually. Essential display filters:

ip.addr == 10.0.0.5                     # any packet to/from this IP
tcp.port == 443                         # this TCP port
dns                                     # only DNS
http.request                            # HTTP requests only
tcp.flags.syn == 1 && tcp.flags.ack == 0   # SYNs (connection attempts)
tcp.analysis.retransmission             # Wireshark-flagged retransmits (loss!)
tcp.analysis.zero_window                # receiver told sender to stop (flow-control stall)
tcp.stream eq 0                         # isolate one whole TCP conversation
frame contains "password"               # find a byte string in payloads

Right-click a packet → Follow → TCP Stream to see an entire conversation reassembled. Statistics → Conversations ranks who is talking the most (find the bandwidth hog). Statistics → I/O Graph plots throughput over time. When you see tcp.analysis.retransmission piling up, you have real packet loss — correlate it with the mtr hop that showed loss.

Network simulators & labs

Practice and reproduce faults without risking production. Each tool trades fidelity for weight:

ToolWhat it isRunsBest for
Cisco Packet TracerCisco’s free simulator (approximates device behavior, not real firmware)Light, laptop-friendlyLearning fundamentals, CCNA study, quick topology sketches
GNS3Emulator that runs real device images (IOS, and via Docker/QEMU: routers, firewalls, Linux)Heavier; can use a remote VMRealistic multi-vendor labs, validating configs before deployment
EVE-NGWeb-based multi-vendor emulation platform, real images, easy multi-user labsServer/VM basedTeam labs, large topologies, certification practice (CCNP/CCIE, security)

Rule of thumb: Packet Tracer to learn concepts cheaply, GNS3 when you need real firmware behavior on your own machine, EVE-NG for shared, large-scale, or multi-vendor labs.

Common issues: symptom → likely cause → tool

SymptomLikely causesTools / commands to confirm
No connectivity at allLink down, no DHCP lease, no default route, wrong VLANip link, ip addr (169.254 = APIPA/no DHCP), ip route (missing default), ping gateway
Can ping IP but not namesDNS misconfigured/down, wrong resolver, stale cacheping 8.8.8.8 (works) vs ping name (fails); dig @1.1.1.1 name; ipconfig /flushdns
Intermittent dropsFlaky cable, Wi-Fi interference, duplex mismatch, overloaded hopmtr -rwc 500 dest (find the lossy hop), ip -s link (RX/TX errors), check switch port errors
High latencyCongestion, bufferbloat, wrong path/routing, distant servermtr/traceroute (locate the slow hop), ping under load, iperf3
Low throughputDuplex mismatch, saturated link, small window, MTU issueiperf3 -c host -P4, ethtool eth0 (speed/duplex), ip -s link (errors)
DNS failuresBad resolver, expired records, split-horizon mismatchdig +trace name, compare dig @1.1.1.1 vs @8.8.8.8, dig name +norecurse at authoritative
Duplex mismatchOne side auto, other side forced (half vs full)ethtool eth0 both ends; symptom is late collisions + low throughput despite link up
MTU mismatch / fragmentationTunnel/VPN overhead, jumbo frames on one side onlyping -M do -s 1472 dest (fails if MTU < 1500); reduce size until it passes to find the path MTU
IP address conflictTwo hosts with the same static IP, or static overlapping DHCParp -a (same IP flapping MACs), OS “address conflict” event, arping <ip>
VLAN / trunk misconfigAccess port in wrong VLAN, trunk missing an allowed VLAN, native VLAN mismatchSwitch show vlan, show interfaces trunk; symptom: same-switch hosts can’t talk, or work only on one VLAN
Asymmetric / one-way trafficFirewall rule one direction, asymmetric routingtcpdump on both ends (see SYN leave but no SYN-ACK return), check firewall logs

Diagnosing an MTU mismatch (worked example)

MTU problems are sneaky: small packets (ping, DNS, the start of a TCP session) work, but large transfers hang. Find the path MTU with a don’t-fragment ping and shrink until it passes:

ping -M do -s 1472 -c 2 example.com   # 1472 payload + 28 header = 1500 (standard Ethernet)
# If you get: "Frag needed and DF set (mtu = 1420)" -> the path MTU is 1420, not 1500
ping -M do -s 1392 -c 2 example.com   # 1392 + 28 = 1420, should now succeed

The largest -s value that succeeds, plus 28, is your path MTU. A common fix on VPN/PPPoE links is lowering the interface MTU or clamping TCP MSS.

Quick command cheat-sheet (Linux ↔ Windows)

TaskLinuxWindows
Reachabilityping -c 4 hostping -n 4 host
Continuous pingping hostping -t host
Trace pathtraceroute host / mtr hosttracert host / pathping host
Interface configip addr / ifconfigipconfig /all
Routing tableip routeroute print / netstat -r
ARP / neighbor tableip neigh / arp -aarp -a
Listening portsss -tulpnnetstat -ano
DNS lookupdig / host / nslookupnslookup
Flush DNS cachesudo systemd-resolve --flush-cachesipconfig /flushdns
Renew DHCP leasesudo dhclient -r && sudo dhclientipconfig /release + /renew
Packet capturesudo tcpdump -i eth0Wireshark / pktmon
Port/host scannmapnmap (or Test-NetConnection)
Test a TCP portnc -zv host 443Test-NetConnection host -Port 443
Throughput testiperf3iperf3.exe
Interface statsip -s link / ethtool eth0netstat -e / Get-NetAdapterStatistics

Best Practices

References