在出现故障时,网络用户可以利用ping命令检测网络故障原因,查看问题是计算机端故障、外界线路故障还是其他故障引起的。
网络检测命令有以下两种方法:
(1)选择“开始”→“运行”命令,如图11-11所示,然后在“运行”对话框中按需求输入命令,如图11-12所示。
图11-11 选择“运行”命令 图11-12 输入命令
(2)选择“开始”→“程序”→“附件”→“命令提示符”命令,如图11-13所示。
图11-13 选择“命令提示符”命令
在“命令提示符”窗口内输入检测命令,如图11-14所示。
图11-14 输入检测命令
下面就为大家介绍常用的网络故障检测命令和功能。
ipconfig命令和功能介绍如下。
(1)命令:ipconfig。
功能:显示网卡的简单配置。
输入ipconfig,若出现如下信息,则表示IP线路完全畅通:
Windows IP Configuration
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :lzu.edu.cn
IP Address. . . . . . . . . . . . : 202.201.15.55
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
若出现如下信息,则表示未获得IP,利用ipconfig/renew命令重新获取IP:
Windows IP Configuration
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.5.55
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.5.1
(2)命令:ipconfig/all。
功能:显示网卡的详细配置。
ipconfig/all
Windows IP Configuration
Host Name . . . . . . . . . . . . : Seal
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . : lzu.edu.cn
Description . . . . . . . . . . . : Intel(R) PRO/100+ PCI Adapter
Physical Address. . . . . . . . . : 00-D0-B7-E0-6D-E0
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 202.201.5.19
Subnet Mask . . . . . . . . . . . : 255.255.255.128
Default Gateway . . . . . . . . . : 202.201.5.1
DHCP Server . . . . . . . . . . . : 202.201.5.1
DNS Servers . . . . . . . . . . . : 202.201.0.131
202.201.0.132
Lease Obtained. . . . . . . . . . : 2004年10月9日10:21:56
Lease Expires . . . . . . . . . . : 2004年10月9日10:21:56
(3)命令:ipconfig/renew。
功能:释放并更新网卡的配置。
ipconfig/renew
Windows IP Configuration
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . : lzu.edu.cn
IP Address. . . . . . . . . . . . : 202.201.3.19
Subnet Mask . . . . . . . . . . . : 255.255.255.128
Default Gateway . . . . . . . . . : 202.201.3.1
(4)命令:ipconfig/release。
功能:释放网卡的配置。
ipconfig/release:
Windows IP Configuration
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 0.0.0.0
Subnet Mask . . . . . . . . . . . : 0.0.0.0
Default Gateway . . . . . . . . . :
ping命令用来验证本机到被ping目标主机的物理线路连通性。
命令格式:ping IP地址或主机名[-t] [-a] [-n count] [-l size]
常用参数含义:
· -t 不停地向目标主机发送数据。
· -a 以IP地址格式来显示目标主机的网络地址。
· -n count指定要ping多少次,具体次数由count来指定。
· -l size指定发送到目标主机的数据包大小。
(1)命令:ping 127.0.0.1。
功能:验证本机TCP/IP协议是否安装好。
打开“命令提示符”窗口,输入ping 127.0.0.1命令,如出现如下所示字样,则表示本机TCP/IP协议安装完好:
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<10ms TTL=128
Reply from 127.0.0.1: bytes=32 time<10ms TTL=128
Reply from 127.0.0.1: bytes=32 time<10ms TTL=128
Reply from 127.0.0.1: bytes=32 time<10ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent=4, Received=4, Lost=0(0% loss),
Approximate round trip times in milli-seconds:
Minimum=0ms, Maximum=0ms, Average=0ms
如出现如下所示字样,则表示本机TCP/IP协议安装不完整,需重新添加TCP/IP协议:
Pinging 127.0.0.1 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 127.0.0.1:
Packets: Sent=4, Received=0, Lost=4(100% loss),
Approximate round trip times in milli-seconds:
Minimum=0ms, Maximum=0ms, Average=0ms
(2)命令:ping本机IP。
功能:验证用户本机IP地址是否配置完成或者网卡物理属性是否完好。
假设本机IP地址是196.168.11.32,输入命令后如出现如下所示字样,则表示本机IP地址已配置好且网卡物理属性完好:
Pinging 196.168.11.32 with 32 bytes of data:
Reply from 196.168.11.32: bytes=32 time<10ms TTL=128
Reply from 196.168.11.32: bytes=32 time<10ms TTL=128
Reply from 196.168.11.32: bytes=32 time<10ms TTL=128
Reply from 196.168.11.32: bytes=32 time<10ms TTL=128
Ping statistics for 196.168.11.32:
Packets: Sent=4, Received=4, Lost=0(0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
如出现Request timed out字样,则表示本机IP地址未配置好或网卡物理属性不好,需配置好IP地址,如果还有问题,则要更换用户的网卡或重新安装用户的网卡驱动程序。
(3)命令:ping网关IP。
功能:验证从用户本机到网关的物理线路是否连通。
假设ping网关196.168.11.2,如出现Reply from...,则表示本机到它的网关物理线路连通性完好;如出现Request timed out字样,则表示本机到它的网关物理线路连通性有故障,需联系网络管理员解决。
Tracert命令用来显示数据包到达目标主机所经过的路径,并显示到达每个节点的时间。该命令比较适用于大型网络。
Tracert IP地址或主机名[-d][-h maximumhops][-j host_list] [-w timeout]
如果我们在Tracert命令后面加上一些参数,还可以检测到其他更详细的信息。例如,使用参数-d,可以指定程序在跟踪主机的路径信息时,同时也解析目标主机的域名。所用参数含义如下:
· -d 不解析目标主机的名字。
· -h maximum_hops 指定搜索到目标地址的最大跳跃数。
· -j host_list 按照主机列表中的地址释放源路由。
· -w timeout 指定超时时间间隔,程序默认的时间单位是ms。
例如,大家想要了解自己的计算机与目标主机www.sohu.com.cn之间详细的传输路径信息,可以在MS-DOS方式输入tracert www.sohu .com.cn。