网络技术实战:网络连通性测试全攻略(原理+工具+流程+排错)
-
- 一、文章目录
- 二、网络连通性测试:基本概念
-
- 2.1 什么是网络连通性测试
- 2.2 测试目的
- 三、网络连通性测试:标准工作流程(流程图)
- 四、网络连通性测试:常用工具命令
-
- 4.1 ping 命令(最核心)
- 4.2 tracert 命令(Windows)
- 4.3 traceroute(Linux)
- 4.4 ipconfig / ifconfig
- 4.5 nslookup / dig
- 4.6 telnet / nc
- 五、网络连通性测试:标准步骤(5步必背)
-
- 5.1 第一步:测试本地回环地址(127.0.0.1)
- 5.2 第二步:测试本地IP地址
- 5.3 第三步:测试网关连通性
- 5.4 第四步:测试公网IP(114.114.114.114)
- 5.5 第五步:测试域名解析
- 六、网络连通性测试:高级扩展命令
-
- 6.1 路径追踪(定位断点)
- 6.2 端口连通性测试
- 七、不同场景连通性测试方法
-
- 7.1 局域网内设备不通
- 7.2 能上QQ不能打开网页
- 7.3 跨网段设备无法通信
- 7.4 远程服务器无法连接
- 八、网络连通性测试:常见故障定位
-
- 8.1 ping 不通本地回环
- 8.2 ping 不通网关
- 8.3 ping 不通外网IP
- 8.4 能ping IP但不能ping域名
- 九、总结
-
- 9.1 网络连通性测试核心思想
- 9.2 标准5步
- 9.3 必备命令
|
🌺The Begin🌺点点关注,收藏不迷路🌺 |
摘要: 在网络运维、系统安装、故障排查中,网络连通性测试是最基础、最核心的技能。无论是新手排错、工程师巡检,还是面试笔试,掌握一套标准的连通性测试方法,能快速定位90%的网络问题。本文从测试流程、常用命令、测试步骤、典型场景、故障定位全方位讲解,附带流程图+实战命令,建议收藏!
一、文章目录
二、网络连通性测试:基本概念
2.1 什么是网络连通性测试
网络连通性测试是验证源设备与目标设备之间是否能够正常通信的过程,用于判断网络是否通畅、丢包、延迟、路由是否可达。
2.2 测试目的
三、网络连通性测试:标准工作流程(流程图)
#mermaid-svg-8YcgLZZYtWliQtSZ{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-8YcgLZZYtWliQtSZ .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-8YcgLZZYtWliQtSZ .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-8YcgLZZYtWliQtSZ .error-icon{fill:#552222;}#mermaid-svg-8YcgLZZYtWliQtSZ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-8YcgLZZYtWliQtSZ .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-8YcgLZZYtWliQtSZ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-8YcgLZZYtWliQtSZ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-8YcgLZZYtWliQtSZ .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-8YcgLZZYtWliQtSZ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-8YcgLZZYtWliQtSZ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-8YcgLZZYtWliQtSZ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-8YcgLZZYtWliQtSZ .marker.cross{stroke:#333333;}#mermaid-svg-8YcgLZZYtWliQtSZ svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-8YcgLZZYtWliQtSZ p{margin:0;}#mermaid-svg-8YcgLZZYtWliQtSZ .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#mermaid-svg-8YcgLZZYtWliQtSZ .cluster-label text{fill:#333;}#mermaid-svg-8YcgLZZYtWliQtSZ .cluster-label span{color:#333;}#mermaid-svg-8YcgLZZYtWliQtSZ .cluster-label span p{background-color:transparent;}#mermaid-svg-8YcgLZZYtWliQtSZ .label text,#mermaid-svg-8YcgLZZYtWliQtSZ span{fill:#333;color:#333;}#mermaid-svg-8YcgLZZYtWliQtSZ .node rect,#mermaid-svg-8YcgLZZYtWliQtSZ .node circle,#mermaid-svg-8YcgLZZYtWliQtSZ .node ellipse,#mermaid-svg-8YcgLZZYtWliQtSZ .node polygon,#mermaid-svg-8YcgLZZYtWliQtSZ .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-8YcgLZZYtWliQtSZ .rough-node .label text,#mermaid-svg-8YcgLZZYtWliQtSZ .node .label text,#mermaid-svg-8YcgLZZYtWliQtSZ .image-shape .label,#mermaid-svg-8YcgLZZYtWliQtSZ .icon-shape .label{text-anchor:middle;}#mermaid-svg-8YcgLZZYtWliQtSZ .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-8YcgLZZYtWliQtSZ .rough-node .label,#mermaid-svg-8YcgLZZYtWliQtSZ .node .label,#mermaid-svg-8YcgLZZYtWliQtSZ .image-shape .label,#mermaid-svg-8YcgLZZYtWliQtSZ .icon-shape .label{text-align:center;}#mermaid-svg-8YcgLZZYtWliQtSZ .node.clickable{cursor:pointer;}#mermaid-svg-8YcgLZZYtWliQtSZ .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-8YcgLZZYtWliQtSZ .arrowheadPath{fill:#333333;}#mermaid-svg-8YcgLZZYtWliQtSZ .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-8YcgLZZYtWliQtSZ .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-8YcgLZZYtWliQtSZ .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-8YcgLZZYtWliQtSZ .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-8YcgLZZYtWliQtSZ .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-8YcgLZZYtWliQtSZ .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-8YcgLZZYtWliQtSZ .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-8YcgLZZYtWliQtSZ .cluster text{fill:#333;}#mermaid-svg-8YcgLZZYtWliQtSZ .cluster span{color:#333;}#mermaid-svg-8YcgLZZYtWliQtSZ div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-8YcgLZZYtWliQtSZ .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-8YcgLZZYtWliQtSZ rect.text{fill:none;stroke-width:0;}#mermaid-svg-8YcgLZZYtWliQtSZ .icon-shape,#mermaid-svg-8YcgLZZYtWliQtSZ .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-8YcgLZZYtWliQtSZ .icon-shape p,#mermaid-svg-8YcgLZZYtWliQtSZ .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-8YcgLZZYtWliQtSZ .icon-shape .label rect,#mermaid-svg-8YcgLZZYtWliQtSZ .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-8YcgLZZYtWliQtSZ .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-8YcgLZZYtWliQtSZ .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-8YcgLZZYtWliQtSZ :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}
开始测试
1. 测试本地回环 127.0.0.1
2. 测试本地IP/网卡
3. 测试网关连通性
4. 测试公网IP(如114.114.114.114)
5. 测试域名解析(www.baidu.com)
连通正常→测试结束
故障→定位对应层
标准测试思想:由内向外、由近到远、从底层到上层。
四、网络连通性测试:常用工具命令
4.1 ping 命令(最核心)
- 功能:测试连通性、延迟、丢包
- 原理:ICMP协议
- 用法:
ping 目标IP/域名
4.2 tracert 命令(Windows)
4.3 traceroute(Linux)
- 功能:路径追踪,查看每一跳路由
- 定位:数据包在哪个节点中断
4.4 ipconfig / ifconfig
- 查看本地IP、掩码、网关、DNS
4.5 nslookup / dig
- 测试域名解析是否正常
4.6 telnet / nc
- 测试端口是否开放(TCP连通性)
五、网络连通性测试:标准步骤(5步必背)
5.1 第一步:测试本地回环地址(127.0.0.1)
命令:
ping 127.0.0.1
作用:
- 验证本地TCP/IP协议栈是否正常
- 验证网卡驱动是否工作 失败原因: 协议故障、网卡驱动异常
5.2 第二步:测试本地IP地址
命令:
ping 本机IP
作用:
- 验证本地网卡、IP配置是否正常 失败原因: IP配置错误、网卡未启用
5.3 第三步:测试网关连通性
命令:
ping 网关IP
作用:
- 验证内网是否通畅
- 验证是否能到达三层网关 失败原因: 网线、交换机、VLAN、网关配置错误
5.4 第四步:测试公网IP(114.114.114.114)
命令:
ping 114.114.114.114
作用:
- 验证是否能访问外网
- 验证路由、NAT是否正常 失败原因: 网关无出口、路由缺失、运营商故障
5.5 第五步:测试域名解析
命令:
ping www.baidu.com
nslookup www.baidu.com
作用:
- 验证DNS服务器是否正常 失败原因: DNS配置错误、DNS服务器故障
六、网络连通性测试:高级扩展命令
6.1 路径追踪(定位断点)
Windows:
tracert www.baidu.com
Linux:
traceroute www.baidu.com
6.2 端口连通性测试
telnet 192.168.1.1 80
用于测试:Web、SSH、FTP等服务端口是否通
七、不同场景连通性测试方法
7.1 局域网内设备不通
7.2 能上QQ不能打开网页
- 现象:IP连通正常,域名无法解析
- 原因:DNS故障
- 测试:nslookup
7.3 跨网段设备无法通信
- 测试:ping网关
- 排查:路由、三层接口、ACL、防火墙策略
7.4 远程服务器无法连接
- 使用telnet测试端口
- 使用tracert追踪路由中断点
八、网络连通性测试:常见故障定位
8.1 ping 不通本地回环
- TCP/IP协议损坏
- 网卡驱动异常
8.2 ping 不通网关
- 网线故障
- 交换机未UP
- IP/掩码错误
- 端口未放通VLAN
8.3 ping 不通外网IP
- 网关无路由
- NAT未配置
- 防火墙拦截ICMP
- 运营商线路故障
8.4 能ping IP但不能ping域名
- DNS配置错误
- DNS服务器不可达
九、总结
9.1 网络连通性测试核心思想
由内向外、由近到远、从底层到上层。
9.2 标准5步
9.3 必备命令
- ping(连通性)
- tracert(路径追踪)
- ipconfig(查看IP)
- nslookup(DNS测试)
- telnet(端口测试)
掌握这套方法,所有网络连通问题都能快速定位!

|
🌺The End🌺点点关注,收藏不迷路🌺 |



