本文共 9455 字,大约阅读时间需要 31 分钟。
本节书摘来自异步社区《深入解析IPv6(第3版)》一书中的第2章,第2.7节,作者: 【美】Joseph Davies 更多章节内容可以访问云栖社区“异步社区”公众号查看。
Windows包括了如下支持IPv6的命令行工具,而这些工具也是网络故障修理中最常用的。
2.7.1 ipconfig
ipconfig用于显示所有当前网络的配置参数配置,它一般用于执行一些维护任务,比如刷新DHCP和DNS设置等。在Windows系统中,不带参数的ipconfig命令用来显示所有分配有地址的物理网络适配器和隧道接口的IPv4和IPv6配置。运行Windows Server 2012的计算机上ipconfig命令的示例如下:
Windows IP ConfigurationEthernet adapter Wired Ethernet Connection: Connection-specific DNS Suffix . : ecoast.example.com IPv6 Address. . . . . . . . . . . : 2001:db8:21da:7:713e:a426:d167:37ab Temporary IPv6 Address. . . . . . : 2001:db8:21da:7:5099:ba54:9881:2e54 Link-local IPv6 Address . . . . . : fe80::713e:a426:d167:37ab%6 IPv4 Address. . . . . . . . . . . : 157.60.14.11 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : fe80::20a:42ff:feb0:5400%6 157.60.14.1Tunnel adapter IPHTTPSInterface: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . :Tunnel adapter Teredo Tunneling Pseudo-Interface: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . :
ipconfig.exe会将IPv6在IPv4地址之前显示出来,并用如下标签标识出IPv6地址的类型。
如需进一步了解有关不同类型IPv6地址和区域ID的内容,请参阅第3章。
默认情况下,在Windows Server 2008和Windows Vista中包含星号(*)的接口名称是隧道接口。
在Windows Server 2012和Windows 8中,Windows PowerShell命令Get-NetIPConfiguration相当于ipconfig命令。
2.7.2 route
route工具用于显示本地IPv4和IPv6路由表中的条目,并对这些条目进行修改。当运行route print命令时,route工具会同时显示出IPv4和IPv6路由表。如下是在Windows Server 2012的计算机上运行route print命令所显示出的IPv6部分的路由表:IPv6 Route Table===========================================================================Active Routes: If Metric Network Destination Gateway 8 286 ::/0 fe80::3cec:bf16:505:eae6 1 306 ::1/128 On-link 8 38 2001:db8::/64 On-link 8 286 2001:db8::4074:2dce:b313:7c65/128 On-link 8 286 2001:db8::b500:734b:fe5b:3945/128 On-link 8 286 fe80::/64 On-link 17 296 fe80::5efe:10.0.0.3/128 On-link 8 286 fe80::b500:734b:fe5b:3945/128 On-link 1 306 ff00::/8 On-link 8 286 ff00::/8 On-link===========================================================================Persistent Routes:None
用户可以通过route.exe的route add、route change以及route delete命令,修改IPv6路由表中的条目。
如需进一步了解有关IPv6路由表的内容,请参阅第10章。
2.7.3 ping
在以前的Windows版本中,ping工具通过向另一台TCP/IP计算机发送ICMP(Internet控制消息协议)Echo消息来验证它们之间在IPv4层的连通性。它会将接收到的相应Echo Reply消息显示出来,同时也会显示往返的时间。ping是用于检测可达性和域名解析的主要TCP/IP工具。Windows中的Ping工具得到了增强,能够在如下方面支持IPv6。
下面是在一台Windows Server 2012计算机上对一个IPv6地址运行Ping命令的显示结果:
F:\>ping 2001:db8:1:f282:dd48:ab34:d07c:3914Pinging 2001:db8:1:f282:dd48:ab34:d07c:3914 from 2001:db8:1:f282:3cec:bf16:505:eae6 with 32 bytes of data:Reply from 2001:db8:1:f282:dd48:ab34:d07c:3914: time<1msReply from 2001:db8:1:f282:dd48:ab34:d07c:3914: time<1msReply from 2001:db8:1:f282:dd48:ab34:d07c:3914: time<1msReply from 2001:db8:1:f282:dd48:ab34:d07c:3914: time<1msPing statistics for 2001:db8:1:f282:dd48:ab34:d07c:3914: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms
下列命令行参数支持IPv6。
注释
ping的-f、-v TOS、-r count、-s count、-j host-list,以及-k host-list命令行参数不支持IPv6协议。
为ping、tracert或者pathping命令指定目的IPv6地址时,可能需要同时指定区域ID(作为目的地址的一部分)。区域ID,也称为作用域ID,标识了拥有特定作用域的网络直连区域。指定区域ID的语法是IPv6Address%ZoneID,其中的ZoneID是整型值。对于典型的链路本地地址,ZoneID等于发送接口的接口索引值,这个值可以通过在Windows PowerShell中输入命令Get-NetIPInterface(仅适用于Windows Server 2012和Windows 8)或者在命令行中输入netsh interface ipv6 show interface命令显示出来。当目的地址是全局地址时,无需ZoneID参数。2.7.4 tracert
tracert工具可以用来判断出到达目的地址的路径。在IPv4中,tracert会向目的地址发送ICMPv4 Echo消息,而该数据包中的TTL字段的值会逐渐增大。在IPv6中,tracert会向目的地址发送ICMPv6 Echo请求消息,同时使该数据包中的跳数限制字段的值逐渐增大。tracert会以列表的形式显示源主机与目的主机间的路径中的相邻路由接口。Windows中的tracert工具得到了增强,并在如下方面支持IPv6。
tracert能同时解析IPv4和IPv6地址格式。
如果通过域名来指定目的主机,那么利用Windows域名解析技术返回的地址会同时包括IPv4和IPv6地址,在这种情况下,默认优先选择IPv6地址(取决于源地址和目的地址的选择)。下面是在一台Windows Server 2012计算机上运行tracert工具所显示的结果:F:\>tracert 2001:db8:1:f282:dd48:ab34:d07c:3914Tracing route to 2001:db8:1:f282:dd48:ab34:d07c:3914 over a maximum of 30 hops 1 <1 ms <1 ms <1 ms 2001:db8:1:f241:2b0:d0ff:fea4:243d 2 <1 ms <1 ms <1 ms 2001:db8:1:f2ac:2b0:d0ff:fea5:d347 3 <1 ms <1 ms <1 ms 2001:db8:1:f282:dd48:ab34:d07c:3914Trace complete.
下列命令行参数可以支持IPv6。
注释
tracert的-j host-list命令行参数不支持IPv6协议。
2.7.5 pathpingpathping工具可以提供数据包在源和目的之间跳转时的网络延迟以及数据丢失的信息。对于IPv4,pathping会在某一时段将多个ICMPv4 Echo消息发送到源和目的之间的每台路由器,然后根据各个路由器返回的包计算结果。对于IPv6,pathping则会发送ICMPv6 Echo请求消息。由于pathping可以显示任意指定路由器或链路的丢包程度,因此它可以用于判断哪个路由器或子网可能出现了问题。pathping会采用与tracert相同的手段,以找出路径中存在哪些路由器,然后在一段时间内周期性地发送信息到所有路由器,并根据每个路由返回的数据算出结果。Windows中的pathping工具得到了增强,并在如下方面支持IPv6。
下面是在一台Windows Server 2012计算机上运行pathping工具所显示的结果:
F:\>pathping 2001:db8:1:f282:dd48:ab34:d07c:3914Tracing route to 2001:db8:1:f282:dd48:ab34:d07c:3914 over a maximum of 30 hops 0 server1.example.microsoft.com [2001:db8:1:f282:204:5aff:fe56:1006] 1 2001:db8:1:f282:dd48:ab34:d07c:3914Computing statistics for 25 seconds...Source to Here This Node/LinkHop RTT Lost/Sent = Pct Lost/Sent = Pct Address 0 server1.example.microsoft.com[2001:db8:1:f282:204:5aff:fe56:1006] 0/ 100 = 0% | 1 0ms 0/ 100 = 0% 0/ 100 = 0% 2001:db8:1:f282:dd48:ab34:d07c:3914Trace complete.
下列pathping命令行选项支持IPv6。
注释
pathping的-g host-list命令行参数不支持IPv6协议。
2.7.6 netstatnetstat工具能够显示以下内容:处于活动状态的TCP连接、计算机侦听的端口、以太网数据、IPv4路由表、IPv4统计数据(如IP、ICMP、TCP和UDP等协议的相关信息)、IPv6路由表和IPv6统计数据(如IPv6、ICMPv6、IPv6的TCP和IPv6的UDP等协议的相关信息)。下面是在一台Windows Server 2012计算机上运行netstat工具所显示的结果:
F:\>netstat -sIPv4 StatisticsPackets Received = 187107 Received Header Errors = 0 Received Address Errors = 84248 Datagrams Forwarded = 0 Unknown Protocols Received = 0 Received Packets Discarded = 0 Received Packets Delivered = 186194 Output Requests = 27767 Routing Discards = 0 Discarded Output Packets = 0 Output Packet No Route = 0 Reassembly Required = 0 Reassembly Successful = 0 Reassembly Failures = 0 Datagrams Successfully Fragmented = 0 Datagrams Failing Fragmentation = 0 Fragments Created = 0IPv6 Statistics Packets Received = 53118 Received Header Errors = 0 Received Address Errors = 0 Datagrams Forwarded = 0 Unknown Protocols Received = 0 Received Packets Discarded = 0 Received Packets Delivered = 0 Output Requests = 60695 Routing Discards = 0 Discarded Output Packets = 0 Output Packet No Route = 0 Reassembly Required = 0 Reassembly Successful = 0 Reassembly Failures = 0 Datagrams Successfully Fragmented = 0 Datagrams Failing Fragmentation = 0 Fragments Created = 0ICMPv4 Statistics Received Sent Messages 682 881 Errors 0 0 Destination Unreachable 2 201 Time Exceeded 0 0 Parameter Problems 0 0 Source Quenches 0 0 Redirects 0 0 Echos 340 340 Echo Replies 340 340 Timestamps 0 0 Timestamp Replies 0 0 Address Masks 0 0 Address Mask Replies 0 0ICMPv6 Statistics Received Sent Messages 309 80 Errors 0 0 Destination Unreachable 193 0 Echos 4 0 Echo Replies 0 4 MLD Reports 0 6 Router Solicitations 0 7 Router Advertisements 54 0 Neighbor Solicitations 31 32 Neighbor Advertisements 27 31TCP Statistics for IPv4 Active Opens = 128 Passive Opens = 106 Failed Connection Attempts = 0 Reset Connections = 3 Current Connections = 16 Segments Received = 22708 Segments Sent = 26255 Segments Retransmitted = 37TCP Statistics for IPv6 Active Opens = 74 Passive Opens = 72 Failed Connection Attempts = 1 Reset Connections = 0 Current Connections = 14 Segments Received = 52809 Segments Sent = 59813 Segments Retransmitted = 3UDP Statistics for IPv4 Datagrams Received = 160982 No Ports = 2158 Receive Errors = 2 Datagrams Sent = 591UDP Statistics for IPv6 Datagrams Received = 0 No Ports = 0 Receive Errors = 0 Datagrams Sent = 744
转载地址:http://cwogx.baihongyu.com/