‹ 首页

network-tools

@chaterm · 收录于 1 周前

Linux network tools and diagnostics

适合你,如果需要用命令行诊断网络连接或配置网络接口。

/ 下载安装
network-tools.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add chaterm/terminal-skills/network-tools
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- chaterm/terminal-skills/network-tools
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify chaterm/terminal-skills/network-tools
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
48GitHub stars
~1K上下文体积 · 单文件
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · Apache-2.0 · 464c295

Network Tools and Diagnostics

Overview

Linux network diagnostics, port scanning, traffic analysis and other tool usage skills.

Network Configuration
View Configuration
# IP address
ip addr
ip a
ifconfig                            # Legacy command

# Routing table
ip route
route -n
netstat -rn

# DNS configuration
cat /etc/resolv.conf
systemd-resolve --status
Configure Network
# Temporary IP configuration
ip addr add 192.168.1.100/24 dev eth0
ip addr del 192.168.1.100/24 dev eth0

# Enable/Disable interface
ip link set eth0 up
ip link set eth0 down

# Add route
ip route add 10.0.0.0/8 via 192.168.1.1
ip route del 10.0.0.0/8
Connectivity Testing
ping
ping hostname
ping -c 4 hostname                  # Send 4 packets
ping -i 0.2 hostname                # 0.2 second interval
ping -s 1000 hostname               # Specify packet size
traceroute
traceroute hostname
traceroute -n hostname              # Don't resolve hostnames
traceroute -T hostname              # Use TCP
mtr hostname                        # Real-time trace
DNS Query
nslookup hostname
dig hostname
dig +short hostname
dig @8.8.8.8 hostname               # Specify DNS server
host hostname
Ports and Connections
ss Command (Recommended)
# Listening ports
ss -tlnp                            # TCP listening
ss -ulnp                            # UDP listening
ss -tlnp | grep :80

# All connections
ss -tanp                            # TCP connections
ss -s                               # Statistics

# Filter
ss -t state established
ss -t dst 192.168.1.1
ss -t sport = :80
netstat Command
netstat -tlnp                       # TCP listening
netstat -ulnp                       # UDP listening
netstat -anp                        # All connections
netstat -s                          # Statistics
lsof Network
lsof -i                             # All network connections
lsof -i :80                         # Specific port
lsof -i tcp                         # TCP connections
lsof -i @192.168.1.1                # Specific host
HTTP Tools
curl
# Basic request
curl http://example.com
curl -I http://example.com          # Headers only
curl -v http://example.com          # Verbose output

# POST request
curl -X POST -d "data=value" http://example.com
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' http://example.com

# Download
curl -O http://example.com/file.zip
curl -o output.zip http://example.com/file.zip

# Authentication
curl -u user:pass http://example.com
curl -H "Authorization: Bearer token" http://example.com
wget
wget http://example.com/file.zip
wget -c http://example.com/file.zip # Resume download
wget -r http://example.com          # Recursive download
wget --mirror http://example.com    # Mirror site
Packet Capture
tcpdump
# Basic capture
tcpdump -i eth0
tcpdump -i any

# Filter
tcpdump -i eth0 port 80
tcpdump -i eth0 host 192.168.1.1
tcpdump -i eth0 'tcp port 80 and host 192.168.1.1'

# Save/Read
tcpdump -i eth0 -w capture.pcap
tcpdump -r capture.pcap

# Display content
tcpdump -i eth0 -A port 80          # ASCII
tcpdump -i eth0 -X port 80          # Hexadecimal
Traffic Monitoring
# Real-time traffic
iftop
iftop -i eth0

# By process
nethogs
nethogs eth0

# Bandwidth test
iperf3 -s                           # Server
iperf3 -c server_ip                 # Client
Common Scenarios
Scenario 1: Troubleshoot Port Usage
# Check port usage
ss -tlnp | grep :8080
lsof -i :8080

# Find process and handle
kill -9 PID
# Or
fuser -k 8080/tcp
Scenario 2: Test Service Connectivity
# TCP port test
nc -zv hostname 80
telnet hostname 80

# HTTP service test
curl -I http://hostname
curl -w "HTTP Code: %{http_code}\nTime: %{time_total}s\n" -o /dev/null -s http://hostname
Scenario 3: Network Performance Diagnosis
# Latency test
ping -c 100 hostname | tail -1

# Route analysis
mtr --report hostname

# Bandwidth test
iperf3 -c server -t 30
Troubleshooting

| Problem | Solution | |---------|----------| | Network unreachable | ping, traceroute, check routing | | DNS resolution failed | dig, nslookup, check resolv.conf | | Port unreachable | ss -tlnp, check firewall | | Connection timeout | mtr, tcpdump packet capture | | Insufficient bandwidth | iftop, iperf3 test |

按 Apache-2.0 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。