Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)280k · #366

network-interface-health

Skill này làm gì

Công cụ này giúp xác định các vấn đề với kết nối mạng, như cáp, cổng thiết bị hoặc cấu hình sai. Nó phân tích lỗi và hiệu suất giao diện mạng để tìm nguyên nhân gây chậm hoặc mất kết nối.

Khi nào nên dùng

  • ✓Khi internet chậm hoặc hay bị rớt.
  • ✓Khi một thiết bị mạng (bộ định tuyến, switch) báo nhiều lỗi.
  • ✓Trước khi thay cáp hoặc linh kiện, để chắc chắn đó là nguyên nhân.

Liên kết skill

https://github.com/affaan-m/ECC/blob/main/skills/network-interface-health/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/affaan-m/ECC/blob/main/skills/network-interface-health/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Kết nối của tôi đang có vấn đề, bạn có thể kiểm tra tình trạng giao diện mạng không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ thu thập thông tin lưu lượng mạng và so sánh số lượng lỗi theo thời gian. Nó cũng kiểm tra các thiết lập như tốc độ và chế độ song công để tìm điểm không nhất quán.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Network Interface Health

Use this skill when a network symptom might be caused by a physical link, switch port, cable, transceiver, duplex setting, or congested interface.

When to Use

  • A host or VLAN has packet loss, latency spikes, or intermittent reachability.
  • A switch or router interface shows CRCs, runts, giants, drops, resets, or flaps.
  • You need to compare both ends of a link before replacing hardware.
  • A change window needs before/after interface counter evidence.
  • Monitoring reports rising ifInErrors, ifOutErrors, or ifOutDiscards.

How It Works

Interface counters are evidence, but the trend matters more than the absolute number. Capture a baseline, wait a measurement interval, capture again, then compare increments.

show interfaces <interface>
show interfaces <interface> status
show logging | include <interface>|changed state|line protocol

On Linux hosts:

ip -s link show <interface>
ethtool <interface>
ethtool -S <interface>

Counter Reference

Counter Meaning Common cause
CRC Received frame checksum failed Bad cable, dirty fiber, bad optic, duplex mismatch
input errors Aggregate receive-side errors Check sub-counters before concluding
runts Frames below minimum Ethernet size Duplex mismatch, collision domain, faulty NIC
giants Frames larger than expected MTU MTU mismatch or jumbo-frame boundary
input drops Device could not accept inbound packets Burst, oversubscription, CPU path, queue pressure
output drops Egress queue discarded packets Congestion, QoS policy, undersized uplink
resets Interface hardware reset Flapping, keepalive, driver, optic, power
collisions Ethernet collision counter Half duplex or negotiation mismatch

Diagnosis Flow

CRCs Or Input Errors

  1. Confirm counters are incrementing, not just historical.
  2. Check both ends of the link. Receive-side errors usually point to the signal arriving on that side, not necessarily the port reporting the error.
  3. Replace patch cable or clean/replace fiber and optics.
  4. Confirm speed/duplex settings match on both sides.
  5. Check logs for flap events around the same timestamp.

Drops

  1. Separate input drops from output drops.
  2. Compare interface rate against capacity.
  3. Check QoS policy, queue counters, and whether the link is an oversubscribed uplink.
  4. Treat queue tuning as secondary. First prove whether the link is congested.

Duplex And Speed

Prefer auto-negotiation on modern Ethernet links when both sides support it. If one side must be fixed, configure both sides explicitly and document why. Never mix fixed speed/duplex on one side with auto on the other.

show interfaces <interface> | include duplex|speed

Safe Parser Example

Slice each interface block from one header to the next. Do not use an arbitrary character window; large interface blocks can cause counters to be missed or assigned to the wrong port.

import re
from typing import Any

HEADER_RE = re.compile(
    r"^(?P<name>\S+) is (?P<status>(?:administratively )?down|up), "
    r"line protocol is (?P<protocol>up|down)",
    re.I | re.M,
)
ERROR_RE = re.compile(r"(?P<input>\d+) input errors, (?P<crc>\d+) CRC", re.I)
DROP_RE = re.compile(r"(?P<output>\d+) output errors", re.I)
DUPLEX_RE = re.compile(r"(?P<duplex>Full|Half|Auto)-duplex,\s+(?P<speed>[^,]+)", re.I)

def parse_show_interfaces(raw: str) -> list[dict[str, Any]]:
    headers = list(HEADER_RE.finditer(raw))
    interfaces = []
    for index, header in enumerate(headers):
        end = headers[index + 1].start() if index + 1 < len(headers) else len(raw)
        block = raw[header.start():end]
        errors = ERROR_RE.search(block)
        drops = DROP_RE.search(block)
        duplex = DUPLEX_RE.search(block)
        interfaces.append({
            "name": header.group("name"),
            "status": header.group("status"),
            "protocol": header.group("protocol"),
            "duplex": duplex.group("duplex") if duplex else "unknown",
            "speed": duplex.group("speed").strip() if duplex else "unknown",
            "input_errors": int(errors.group("input")) if errors else 0,
            "crc_errors": int(errors.group("crc")) if errors else 0,
            "output_errors": int(drops.group("output")) if drops else 0,
        })
    return interfaces

Examples

CRCs On One Switch Port

…

Câu hỏi thường gặp

“CRC errors” là gì?

Đây là lỗi trong kiểm tra tính toàn vẹn của dữ liệu nhận được, thường do cáp hỏng, đầu nối cáp quang bẩn hoặc lỗi thiết bị.

“Flapping” nghĩa là gì?

Đó là khi kết nối mạng liên tục rớt rồi kết nối lại nhanh chóng, cho thấy một vấn đề không ổn định.

Có nên xóa bộ đếm lỗi không?

Chỉ xóa bộ đếm sau khi đã ghi lại giá trị hiện tại làm mốc. Xóa mà không ghi lại có thể làm mất thông tin chẩn đoán quan trọng.

Chi tiết

Mô tả gốc của tác giả

Diagnose interface errors, drops, CRCs, duplex mismatches, flapping, speed negotiation issues, and counter trends on routers, switches, and Linux hosts. Use when an interface shows errors, drops, CRCs, flapping, or a duplex or speed mismatch.

repo: affaan-m/ECC

Độ phổ biến

Sao GitHub
280k
Vị trí xếp hạng
#366
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự