1、实验1常用网络命令使用五、实验步骤1、记录本机的主机名,MAC地址,IP地址,DNS,网关等信息。命令描述:ipconfig all执行结果: 主机名 . . . . . . . . . . . . : lenovo-73 主 Dns 后缀 . . . . . . . : 节点类型 . . . . . . . . . . . . : Unknown IP 路由已启动 . . . . . . . : No WINS 代理已启动. . . . . . . . : NoEthernet adapter 本地连接: 连接特定的DNS后缀. . . . . .: 描述. . . . . . . . .
2、. . : Marvell Yukon 88E8056 PCI-E Gigabit Ether net Controller 物理地址. . . . . . . . . : 00-21-97-4E-92-64 DHCP 已启用. . . . . . . . . . . : No IP 地址. . . . . . . . . . . . : 192.168.215.73 子网掩码. . . . . . . . . . . : 255.255.255.0 默认网关. . . . . . . . . : 192.168.215.254 DNS 服务器 . . . . . . . . . . . :
3、8.8.8.8 218.193.32.82、利用ping工具检测网络连通性1) 当一台计算机不能和网络中其他计算机进行通信时,可以按照如下步骤进行检测。在 DOS 窗口下输入“ping 127.0.0.1” 命令,此命令用于检查本机的 TCP/IP 协议安装是否正确,注:凡是以 127 开头的 IP 地址都代表本机。命令描述:ping 127.0.0.1执行结果:_ Pinging 127.0.0.1 with 32 bytes of data:Reply from 127.0.0.1: bytes=32 time1ms TTL=128Reply from 127.0.0.1: bytes=3
4、2 time1ms TTL=128Reply from 127.0.0.1: bytes=32 time1ms TTL=128Reply from 127.0.0.1: bytes=32 time1ms TTL=128Ping statistics for 127.0.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% lApproximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms2) 在 DOS 窗口下输入“ ping 本机
5、 IP 地址”命令,此命令用于检查本机的服务和网络适配器的绑定是否正确。注:这里的服务一般是指“Microsoft 网络客户端”和“Microsoft 网络的文件和打印机共享”。命令描述: ping 192.168.215.73执行结果: _ Pinging 192.168.215.73 with 32 bytes of data:Reply from 192.168.215.73: bytes=32 time1ms TTL=128Reply from 192.168.215.73: bytes=32 time1ms TTL=128Reply from 192.168.215.73: byte
6、s=32 time1ms TTL=128Reply from 192.168.215.73: bytes=32 time1ms TTL=128Ping statistics for 192.168.215.73: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms3) 接下来在 DOS 窗口下输入 “ping 网关 IP 地址” 命令,此命令用来检查本机和网关的连
7、接是否正常。命令描述:ping 192.168.215.254执行结果: _ Pinging 192.168.215.254 with 32 bytes of data:Reply from 192.168.215.254: bytes=32 time=1ms TTL=255Reply from 192.168.215.254: bytes=32 time1ms TTL=255Reply from 192.168.215.254: bytes=32 time1ms TTL=255Reply from 192.168.215.254: bytes=32 time1ms TTL=255Ping s
8、tatistics for 192.168.215.254: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 1ms, Average = 0ms4) 最后在 DOS 窗口下输入 “ping 远程主机 IP 地址” 命令,此命令用来检查网关能否将数据包转发出去。命令描述: ping 执行结果: _ Pinging 220.181.111.147 with 32 bytes of data:Repl
9、y from 220.181.111.147: bytes=32 time=46ms TTL=53Reply from 220.181.111.147: bytes=32 time=47ms TTL=53Reply from 220.181.111.147: bytes=32 time=46ms TTL=53Reply from 220.181.111.147: bytes=32 time=46ms TTL=53Ping statistics for 220.181.111.147: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),App
10、roximate round trip times in milli-seconds: Minimum = 46ms, Maximum = 47ms, Average = 46ms5) 利用 ping 命令还可以来检测其他的一些配置是否正确。在 DOS 窗口下输入 “ping 主机名” 命令,此命令用来检测 DNS 服务器能否进行主机名称解析。命令描述:ping lenovo-73执行结果: _ Pinging lenovo-73 192.168.215.73 with 32 bytes of data:Reply from 192.168.215.73: bytes=32 time1ms T
11、TL=128Reply from 192.168.215.73: bytes=32 time1ms TTL=128Reply from 192.168.215.73: bytes=32 time1ms TTL=128Reply from 192.168.215.73: bytes=32 time1ms TTL=128Ping statistics for 192.168.215.73: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimu
12、m = 0ms, Maximum = 0ms, Average = 0ms6) 在DOS窗口下输入“ping 远程主机 IP 地址”命令,如果显示的信息为 “Destination host unreachable ”(目标主机不可达),说明这台计算机没有配置网关地址。 运行 “ipconfig /all” 命令进行查看,网关地址为空。(若(4)可以,则不会出现此种情况)7) 在配置网关地址后再次运行同样命令,信息变为“ Request timed out ”( 请求时间超时)。此信息表示网关已经接到请求,只是找不到 IP 地址为 远程主机 的这台计算机。命令描述:ping 192.168.1
13、.108执行结果: _ Pinging 192.168.1.108 with 32 bytes of data:Request timed out.Request timed out.Request timed out.Request timed out.Ping statistics for 192.168.1.108: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),Ping命令的其它用法8) 连续发送 ping探测报文: 如 ping -t 210.41.109.52(这个地址需要根据具体的实验环境来搭配)Ctrl+Break查
14、看统计信息,Ctrl+C结束命令命令描述:ping -t 执行结果: _ Pinging 220.181.111.147 with 32 bytes of data:Reply from 220.181.111.147: bytes=32 time=46ms TTL=53Reply from 220.181.111.147: bytes=32 time=46ms TTL=53Reply from 220.181.111.147: bytes=32 time=46ms TTL=53Reply from 220.181.111.147: bytes=32 time=47ms TTL=53Reply
15、 from 220.181.111.147: bytes=32 time=47ms TTL=53Reply from 220.181.111.147: bytes=32 time=47ms TTL=53Reply from 220.181.111.147: bytes=32 time=47ms TTL=53Reply from 220.181.111.147: bytes=32 time=47ms TTL=53Ping statistics for 220.181.111.147: Packets: Sent = 8, Received = 8, Lost = 0 (0% loss),Appr
16、oximate round trip times in milli-seconds: Minimum = 46ms, Maximum = 47ms, Average = 46msControl-CC9) 自选数据长度的ping探测报文: ping 目的主机 IP地址 -l size命令描述:ping -l 1450 执行结果: _ Pinging 220.181.111.147 with 1450 bytes of data:Reply from 220.181.111.147: bytes=1450 time=47ms TTL=53Reply from 220.181.111.147: by
17、tes=1450 time=47ms TTL=53Reply from 220.181.111.147: bytes=1450 time=48ms TTL=53Reply from 220.181.111.147: bytes=1450 time=47ms TTL=53Ping statistics for 220.181.111.147: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimum = 47ms, Maximum = 48m
18、s, Average = 47ms10) 不允许对ping探测报分片: ping 目的主机 IP地址 -f命令描述:ping -f -l 2000 192.168.215.73执行结果: _ Pinging 192.168.215.73 with 2000 bytes of data:Packet needs to be fragmented but DF set.Packet needs to be fragmented but DF set.Packet needs to be fragmented but DF set.Packet needs to be fragmented but
19、DF set.Ping statistics for 192.168.215.73: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),11) 修改“ping”命令的请求超时时间: ping 目的主机IP地址 -w time 指定等待每个回送应答的超时时间,单位为毫秒,默认值为1000毫秒 命令描述:ping -w 6000 192.168.215.73执行结果: _ Pinging 192.168.215.73 with 32 bytes of data:Reply from 192.168.215.73: bytes=32 time
20、1ms TTL=128Reply from 192.168.215.73: bytes=32 time1ms TTL=128Reply from 192.168.215.73: bytes=32 time1ms TTL=128Reply from 192.168.215.73: bytes=32 time1ms TTL=128Ping statistics for 192.168.215.73: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: M
21、inimum = 0ms, Maximum = 0ms, Average = 0ms3、 利用 Arp 工具检验 MAC 地址解析1) 输入 “arp a” 命令,可以查看本机的 arp 缓存内容命令描述:arp -a 192.168.215.73执行结果: _ No ARP Entries Found2) 如本机的 ARP 表是空的,则ping 本组相邻机的 IP 地址(要能 PING 通),再查看本机的 arp 缓存内容,此时是否还是空的? 利用“ ping ”命令将一个站点的 IP 地址与 MAC 地址的映射关系加入 ARP 表 命令描述:ping 192.168.215.105执行结果
22、: Pinging 192.168.215.105 with 32 bytes of data:Reply from 192.168.215.105: bytes=32 time=1ms TTL=128Reply from 192.168.215.105: bytes=32 time1ms TTL=128Reply from 192.168.215.105: bytes=32 time1ms TTL=128Reply from 192.168.215.105: bytes=32 timearp -aInterface: 192.168.215.73 - 0x10003 Internet Add
23、ress Physical Address Type 192.168.215.105 00-21-97-4e-95-c5 dynamic3) 将相邻机在本机 ARP 表中的表项删除。 arp -d ip地址 (删除由 ip地址 指定的项) 利用“ arp -d”命令删除ARP表项 4) 命令描述:查看站点的 IP 地址与 MAC 地址的映射关系,加入 ARP 表。arp -d ip地址 (删除由 ip地址 指定的项) ,使用将相邻机在本机 ARP 表中的表项删除。 能够人工删除一个项目。_输入 “arp a” 命令,可以查看本机的 arp 缓存内容_ 执行结果: _C:Documents an
24、d SettingsAdministratorarp -aInterface: 192.168.215.73 - 0x10003 Internet Address Physical Address Type 192.168.215.45 00-21-97-48-4e-af dynamicC:Documents and SettingsAdministratorarp -d 192.168.215.105C:Documents and SettingsAdministratorarp -aInterface: 192.168.215.73 - 0x10003 Internet Address P
25、hysical Address Type 192.168.215.45 00-21-97-48-4e-af dynamicC:Documents and SettingsAdministratorarp -d *C:Documents and SettingsAdministratorarp -aNo ARP Entries Found 5) 给相邻机的 IP 添加一个静止的错误的 MAC 地址对应项,再 PING 相邻机,此时是否能 PING 通?arp -s ip 地址 MAC 地址在 ARP 缓存中添加项,将 IP 地址 和物理地址关联。 例: arp -s 192.168.0.100
26、00-d0-09-f0-33-71 添加ip为192.168.0.100与其对应的MAC为00-d0-09-f0-33-71的表项 命令描述:arp -s 192.168.215.105 00-21-97-4e-95-c5_ 执行结果: _ C:Documents and SettingsAdministratorarp -aInterface: 192.168.215.73 - 0x10003 Internet Address Physical Address Type 192.168.215.105 00-21-97-4e-95-c5 dynamicC:Documents and Sett
27、ingsAdministratorarp -s 192.168.215.105 00-21-97-4e-95-c5C:Documents and SettingsAdministratorarp -aInterface: 192.168.215.73 - 0x10003 Internet Address Physical Address Type 192.168.215.105 00-21-97-4e-95-c5 staticC:Documents and SettingsAdministratorping 192.168.215.105Pinging 192.168.215.105 with 32 bytes of data:Reply from 192.168.215.105: bytes=32 time1ms TTL=128Reply from 192.168.215.105: bytes=32 time1ms TTL=128Reply from 192.168.215.105: bytes=32 time1ms TTL=128Reply from 192.168.215.105: bytes=32 time1ms TTL=128Ping statistics for 192.168.215.105: Packets
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1