# 主体思路

  • 检查物理链路

  • 查看本机 IP 地址、路由、DNS 的设置;

  • 测试网关或路由器的通畅情况。先测网关然后再测路由器,一级一级地测试;

  • 测试 ping 公网 IP 的通畅情况

  • 测试 DNS 的通畅情况

# Windows 控制面板

控制面板 - 网络和 Internet - 网络连接

可能的情况:

# 一片空白

没有网卡 / 没装驱动

# 网络电缆被拔出

检查物理链路

# 未识别的网络

没有 IP 地址 / 网关配置错误

检查 DHCP 服务器设置

# 网络 *

正常网络 (不包括 DNS)

# 非底层错误方案

# 检查本地环回

ping 127.0.0.1
# 正在 Ping 127.0.0.1 具有 32 字节的数据:
# 来自 127.0.0.1 的回复:字节 = 32 时间 & lt;1ms TTL=128
# 来自 127.0.0.1 的回复:字节 = 32 时间 & lt;1ms TTL=128
# 来自 127.0.0.1 的回复:字节 = 32 时间 & lt;1ms TTL=128
# 来自 127.0.0.1 的回复:字节 = 32 时间 & lt;1ms TTL=128
# 
# 127.0.0.1 的 Ping 统计信息:
#     数据包:已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
# 往返行程的估计时间 (以毫秒为单位):
#     最短 = 0ms,最长 = 0ms,平均 = 0ms

如果超时或者其他问题,建议使用’官方镜像’重装系统

# 查看 IP 配置

ipconfig /all
# 以太网适配器 以太网:
# 
#    连接特定的 DNS 后缀 . . . . . . . : lan
#    描述. . . . . . . . . . . . . . . : Realtek PCIe GbE Family Controller
#    物理地址. . . . . . . . . . . . . : ***
#    DHCP 已启用 . . . . . . . . . . . : 是
#    IPv4 地址 . . . . . . . . . . . . : 192.168.1.**(首选)
#    子网掩码  . . . . . . . . . . . . : 255.255.255.0
#    获得租约的时间  . . . . . . . . . : 2022 年 1 月 21 日 15:44:36
#    租约过期的时间  . . . . . . . . . : 2022 年 1 月 22 日 15:44:35
#    默认网关. . . . . . . . . . . . . : 192.168.1.1
#    DHCP 服务器 . . . . . . . . . . . : 192.168.1.1
#    DNS 服务器  . . . . . . . . . . . : 192.168.1.10
#    TCPIP 上的 NetBIOS  . . . . . . . : 已启用

如果 IPv4 地址为 169.254.*.*

检查 DHCP 服务器设置

# 尝试使用 ping 测试网关、DNS 服务器的连通性

ping <gateway>
# ping 192.168.1.1
ping <dns>
# ping 192.168.1.10

# 尝试使用 ping 测试公共服务器的连通性

ping 223.5.5.5
# ali DNS
ping 114.114.114.114
# 114 DNS

# 尝试使用 nslookup 测试域名解析

nslookup <domain.com>
# nslookup baidu.com
# 使用系统设置的 DNS 进行解析
nslookup <domain.com> <DNS Server>
# nslookup baidu.com 223.5.5.5
# 指定 DNS 服务器进行解析

# 尝试使用 ping 测试域名解析

ping <domain.com>
# ping baidu.com

如果使用’nslookup’测试正常,但 ping 无法连通,检查’hosts’文件

# 尝试使用 curl 测试 HTTP

curl -v <http_204>
# curl -v http://connectivitycheck.gstatic.com/generate_204
# [gstatic.com] http://connectivitycheck.gstatic.com/generate_204
# [google.cn] http://www.google.cn/generate_204
# [miui.com] http://connect.rom.miui.com/generate_204
# [hicloud.com] http://connectivitycheck.platform.hicloud.com/generate_204
# *   Trying ***:80...
# * Connected to connectivitycheck.gstatic.com (***) port 80 (#0)
# > GET /generate_204 HTTP/1.1
# > Host: connectivitycheck.gstatic.com
# > User-Agent: curl/7.79.1
# > Accept: */*
# >
# * Mark bundle as not supporting multiuse
# < HTTP/1.1 204 No Content
# < Content-Length: 0
# < Date: Fri, 21 Jan 2022 08:09:26 GMT
# <
# * Connection #0 to host connectivitycheck.gstatic.com left intact

关键字: 204 No Content

# Windows 互联网检测基准

http://www.msftconnecttest.com/connecttest.txt

Microsoft Connect Test

http://www.msftncsi.com/ncsi.txt

Microsoft NCSI

dns://dns.msftncsi.com

fd3e:4f5a:5b81::1
131.107.255.255