network-troubleshooting
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNetwork Troubleshooting
网络故障排除
This skill provides a concise, safety-first decision guide for diagnosing developer network failures. Diagnostics must stay read-only and target-scoped — this is not an automated remediation toolkit.
本技能为诊断开发者网络故障提供简洁、安全优先的决策指南。诊断必须保持只读且限定在目标范围内——这不是自动修复工具包。
Safety Boundaries
安全边界
These boundaries apply to every step of the workflow below and must never be relaxed, even if asked:
- Prefer read-only diagnostics and trusted project-provided diagnostic scripts.
- Use the failing host, URL, registry, or service as the default probe target — do not probe unrelated hosts.
- Ask before probing unrelated external services.
- Never print proxy URLs, credentials, tokens, auth headers, package index URLs, registry hostnames from config, or raw config values in shared output.
- Internal hosts and URLs may be collected for target-scoped local diagnostics, but replace them with placeholders before sharing logs or reports unless the user explicitly approves including them.
- Never dump local configuration from npm, pnpm, yarn, pip, Git, Docker, shell, OS proxy, VPN, or certificate stores.
- Never disable, bypass, or skip TLS or certificate verification (no /
-k, no--insecure, noNODE_TLS_REJECT_UNAUTHORIZED=0), even temporarily "just to test."verify=False - Never change OS networking, DNS, proxy, package manager, Git, Docker, shell, VPN, or trust-store settings without explicit user approval for the exact action being taken.
以下边界适用于下面工作流程的每一步,即使被要求也绝不能放宽:
- 优先使用只读诊断和项目提供的可信诊断脚本。
- 将失败的主机、URL、注册表或服务作为默认探测目标,不要探测无关主机。
- 探测无关外部服务前先询问。
- 切勿在共享输出中打印代理URL、凭据、令牌、认证头、包索引URL、配置中的注册表主机名或原始配置值。
- 内部主机和URL可以收集用于限定目标的本地诊断,但在分享日志或报告前应将其替换为占位符,除非用户明确批准包含它们。
- 切勿从npm、pnpm、yarn、pip、Git、Docker、shell、操作系统代理、VPN或证书存储中导出本地配置。
- 切勿禁用、绕过或跳过TLS或证书验证(不使用 /
-k,不设置--insecure,不设置NODE_TLS_REJECT_UNAUTHORIZED=0),即使是暂时“只是为了测试”。verify=False - 未经用户对具体操作的明确批准,切勿更改操作系统网络、DNS、代理、包管理器、Git、Docker、shell、VPN或信任库设置。
Workflow
工作流程
- Collect — Capture the exact error text, the failing command, the target host/URL/port, OS/shell, proxy/VPN context, and whether the failure affects one target or many.
- Classify — Match the symptom against the error classification table below to form a hypothesis.
- Diagnose — Run only read-only checks scoped to the failing target, starting with the smallest relevant check.
- Explain — Interpret each diagnostic result in plain language before suggesting any fix.
- Advise — Present remediation options as choices; wait for explicit user approval before changing any state.
- Verify — After an approved change, re-run the original failing command or an equivalent target-scoped check.
- 收集 — 捕获确切的错误文本、失败的命令、目标主机/URL/端口、操作系统/shell、代理/VPN上下文,以及故障是影响单个目标还是多个目标。
- 分类 — 将症状与下面的错误分类表进行匹配,形成假设。
- 诊断 — 仅运行限定在失败目标范围内的只读检查,从最小的相关检查开始。
- 解释 — 在建议任何修复之前,用通俗语言解释每个诊断结果。
- 建议 — 将修复选项作为选择呈现;在更改任何状态前等待用户明确批准。
- 验证 — 在批准的更改后,重新运行原始失败命令或等效的目标限定检查。
Error Classification
错误分类
| Error Pattern | Likely Category |
|---|---|
| Target service or port is not listening |
| Connection dropped by target, proxy, firewall, or middlebox |
| Routing, firewall, proxy, or target availability |
| DNS or hostname issue |
| Proxy configuration or proxy authentication |
| TLS certificate or local trust issue |
HTTP | Authorization, IP allowlist, CORS, or policy block |
HTTP | Upstream service, gateway, CDN, or transient server issue |
| Package registry, proxy, DNS, or network path issue |
| Git remote, proxy, DNS, TLS, or network path issue |
| 错误模式 | 可能类别 |
|---|---|
| 目标服务或端口未监听 |
| 连接被目标、代理、防火墙或中间盒丢弃 |
| 路由、防火墙、代理或目标可用性 |
| DNS或主机名问题 |
| 代理配置或代理认证 |
| TLS证书或本地信任问题 |
HTTP | 授权、IP白名单、CORS或策略阻止 |
HTTP | 上游服务、网关、CDN或瞬时服务器问题 |
| 包注册表、代理、DNS或网络路径问题 |
| Git远程、代理、DNS、TLS或网络路径问题 |
Safe Target-Scoped Checks
安全的目标限定检查
Choose the smallest relevant check and explain what it does before running it. Always substitute the specific failing , , and — never a broader or unrelated target.
<target-host><port><path>选择最小的相关检查并在运行前解释其作用。始终替换具体失败的 、 和 — 绝不使用更广泛或不相关的目标。
<target-host><port><path>Connectivity
连通性
Linux/macOS:
bash
ping -c 4 <target-host>
curl -v telnet://<target-host>:<port> --connect-timeout 5Windows PowerShell:
powershell
Test-Connection -ComputerName <target-host> -Count 4
Test-NetConnection -ComputerName <target-host> -Port <port>Linux/macOS:
bash
ping -c 4 <target-host>
curl -v telnet://<target-host>:<port> --connect-timeout 5Windows PowerShell:
powershell
Test-Connection -ComputerName <target-host> -Count 4
Test-NetConnection -ComputerName <target-host> -Port <port>DNS
DNS
Linux/macOS:
bash
nslookup <target-host>
dig <target-host>Windows PowerShell:
powershell
Resolve-DnsName <target-host>Linux/macOS:
bash
nslookup <target-host>
dig <target-host>Windows PowerShell:
powershell
Resolve-DnsName <target-host>HTTP
HTTP
Linux/macOS:
bash
curl -vvv -o /dev/null -w "HTTP %{http_code}\nTime: %{time_total}s\nDNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTLS: %{time_appconnect}s\n" https://<target-host>/<path>
curl -I https://<target-host>/<path>Windows PowerShell:
powershell
$uri = "https://<target-host>/<path>"
try {
$resp = Invoke-WebRequest -Uri $uri -Method Head -TimeoutSec 10
"HTTP status: $([int]$resp.StatusCode)"
} catch [Net.WebException] {
if ($_.Exception.Response) {
"HTTP status: $([int]$_.Exception.Response.StatusCode)"
} else {
"HTTP request failed: $($_.Exception.Message)"
}
}Linux/macOS:
bash
curl -vvv -o /dev/null -w "HTTP %{http_code}\nTime: %{time_total}s\nDNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTLS: %{time_appconnect}s\n" https://<target-host>/<path>
curl -I https://<target-host>/<path>Windows PowerShell:
powershell
$uri = "https://<target-host>/<path>"
try {
$resp = Invoke-WebRequest -Uri $uri -Method Head -TimeoutSec 10
"HTTP status: $([int]$resp.StatusCode)"
} catch [Net.WebException] {
if ($_.Exception.Response) {
"HTTP status: $([int]$_.Exception.Response.StatusCode)"
} else {
"HTTP request failed: $($_.Exception.Message)"
}
}TLS
TLS
Linux/macOS:
bash
openssl s_client -connect <target-host>:<port> -servername <target-host> -showcerts </dev/null
echo | openssl s_client -connect <target-host>:<port> -servername <target-host> 2>/dev/null | openssl x509 -noout -subject -issuer -datesWindows PowerShell — check the certificate and HTTP status separately so a non-2xx response is never mislabeled as a certificate failure:
powershell
try {
$req = [Net.HttpWebRequest]::Create("https://<target-host>:<port>/<path>")
$req.Method = "HEAD"
$req.Timeout = 5000
try {
$resp = $req.GetResponse()
} catch [Net.WebException] {
$resp = $_.Exception.Response
if ($req.ServicePoint.Certificate) {
$cert = $req.ServicePoint.Certificate
"Cert subject: $($cert.Subject)"
"Cert expires: $($cert.GetExpirationDateString())"
}
if ($resp) {
"HTTP status: $([int]$resp.StatusCode) $($resp.StatusDescription)"
$resp.Close()
} else {
"TLS/network error: $($_.Exception.Message)"
}
return
}
$cert = $req.ServicePoint.Certificate
if ($cert) {
"Cert subject: $($cert.Subject)"
"Cert expires: $($cert.GetExpirationDateString())"
}
"HTTP status: $([int]$resp.StatusCode) $($resp.StatusDescription)"
$resp.Close()
} catch {
"TLS/network error: $($_.Exception.Message)"
}Linux/macOS:
bash
openssl s_client -connect <target-host>:<port> -servername <target-host> -showcerts </dev/null
echo | openssl s_client -connect <target-host>:<port> -servername <target-host> 2>/dev/null | openssl x509 -noout -subject -issuer -datesWindows PowerShell — 分别检查证书和HTTP状态,以便非2xx响应永远不会被误标记为证书失败:
powershell
try {
$req = [Net.HttpWebRequest]::Create("https://<target-host>:<port>/<path>")
$req.Method = "HEAD"
$req.Timeout = 5000
try {
$resp = $req.GetResponse()
} catch [Net.WebException] {
$resp = $_.Exception.Response
if ($req.ServicePoint.Certificate) {
$cert = $req.ServicePoint.Certificate
"Cert subject: $($cert.Subject)"
"Cert expires: $($cert.GetExpirationDateString())"
}
if ($resp) {
"HTTP status: $([int]$resp.StatusCode) $($resp.StatusDescription)"
$resp.Close()
} else {
"TLS/network error: $($_.Exception.Message)"
}
return
}
$cert = $req.ServicePoint.Certificate
if ($cert) {
"Cert subject: $($cert.Subject)"
"Cert expires: $($cert.GetExpirationDateString())"
}
"HTTP status: $([int]$resp.StatusCode) $($resp.StatusDescription)"
$resp.Close()
} catch {
"TLS/network error: $($_.Exception.Message)"
}Proxy and Package Managers
代理和包管理器
- Avoid raw config reads for proxy, package manager, Git, Docker, or OS network configuration.
- Report only whether relevant settings appear present when this can be checked without printing values.
- If the available command would print a URL, token, internal hostname, auth header, or full config value, do not run it.
- Only perform package registry probes when the failed operation already targeted that registry, or after the user approves that exact probe target.
- 避免对代理、包管理器、Git、Docker或操作系统网络配置进行原始配置读取。
- 仅在可以不用打印值的情况下检查时,报告相关设置是否存在。
- 如果可用的命令会打印URL、令牌、内部主机名、认证头或完整配置值,则不要运行它。
- 仅在失败操作已经针对该注册表时,或在用户批准该确切探测目标后,才执行包注册表探测。
User-Approved Remediation Options
用户批准的修复选项
Present these as choices for the user to approve — never apply them automatically.
| Diagnosis | Safe Advice |
|---|---|
| Target service is not listening | Check whether the local or remote service is running and whether the expected port is correct. |
| DNS lookup fails | Check the hostname, hosts-file expectations, DNS service status, or approved DNS changes. |
| Proxy appears required or unavailable | Ask whether the user wants to start or adjust the proxy/VPN, then verify only the approved target. |
| TLS certificate expired | Renew or replace the certificate, fix system time, install a trusted local development CA, or update the trust store. Never bypass TLS verification. |
| TLS unknown CA | Import the correct CA into the appropriate trust store after the user confirms the source and scope. |
HTTP | Ask the user to confirm proxy authentication requirements before changing credentials or tool settings. |
HTTP | Check authentication, API key scope, IP allowlist, CORS policy, or service policy. |
HTTP | Treat as upstream or gateway instability; check status pages when approved and retry with backoff. |
| Package install timeout | Discuss approved registry, proxy, or network-path options without printing or changing stored config values. |
| Git network failure | Discuss approved remote URL, proxy, credential, TLS, or network-path options without changing global Git settings automatically. |
| Docker pull failure | Discuss approved registry mirror, proxy, or daemon settings as a user-approved configuration change. |
将这些作为供用户批准的选择呈现——绝不自动应用。
| 诊断 | 安全建议 |
|---|---|
| 目标服务未监听 | 检查本地或远程服务是否在运行,以及期望的端口是否正确。 |
| DNS查找失败 | 检查主机名、hosts文件预期、DNS服务状态,或经批准的DNS更改。 |
| 代理似乎必需或不可用 | 询问用户是否要启动或调整代理/VPN,然后仅验证已批准的目标。 |
| TLS证书过期 | 续期或更换证书,修复系统时间,安装受信任的本地开发CA,或更新信任库。切勿绕过TLS验证。 |
| TLS未知CA | 在用户确认来源和范围后,将正确的CA导入适当的信任库。 |
HTTP | 在更改凭据或工具设置前,询问用户确认代理认证要求。 |
HTTP | 检查认证、API密钥范围、IP白名单、CORS策略或服务策略。 |
HTTP | 视为上游或网关不稳定;在批准时检查状态页面并退避重试。 |
| 包安装超时 | 讨论经批准的注册表、代理或网络路径选项,不打印或更改存储的配置值。 |
| Git网络失败 | 讨论经批准的远程URL、代理、凭据、TLS或网络路径选项,不自动更改全局Git设置。 |
| Docker拉取失败 | 讨论经批准的注册表镜像、代理或守护进程设置作为用户批准的配置更改。 |
Verification
验证
- After any user-approved change, re-run the original failing command whenever possible.
- If a smaller check is needed instead, keep it scoped to the same failing host, URL, registry, or service.
- Always explain what each diagnostic result means before recommending the next step.
- 在任何用户批准的更改后,尽可能重新运行原始失败的命令。
- 如果需要更小的检查,则保持其范围在相同失败的主机、URL、注册表或服务内。
- 在推荐下一步之前,始终解释每个诊断结果的含义。