0x00 实验环境

名称 版本 说明
Host OS Window 7
模拟器 GNS3 v2.2.8
GNS3 vm v2.2.8
虚拟机 VMware 15
路由器镜像 c7200 adventerprisek9

0x01 网络拓扑

在这里插入图片描述

0x02 问题描述

主机PC1 ping不通路由器R1 的f1口

同样,路由器R1 也ping不通主机PC1的e0口

0x03 排查思路

1. GNS3软件本身是否运行正常

VM是否能正常连接,因为我的环境是跑在gns3 vm上的,所以需要关注下,一般不用vm在本机上的话,都不会出问题。

检查实验用的模拟设备是否都是开启状态。
在这里插入图片描述

2. 检查路由器的配置

查看interface简介

查看FastEthernet1/0的网卡是不是开启状态,up没问题


Router>show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            10.10.10.10     YES NVRAM  down                  down
GigabitEthernet0/1         unassigned      YES NVRAM  administratively down down
GigabitEthernet0/2         unassigned      YES NVRAM  administratively down down
GigabitEthernet0/3         unassigned      YES NVRAM  administratively down down
FastEthernet1/0            10.67.8.52      YES manual up                    up
FastEthernet2/0            unassigned      YES unset  administratively down down
FastEthernet3/0            unassigned      YES unset  administratively down down
FastEthernet4/0            unassigned      YES unset  administratively down down
SSLVPN-VIF0                unassigned      NO  unset  up                    up

查看路由
使用enable进入特权模式
执行命令show ip route,查看路由器的路由设置

Router>enable
Router#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 10.67.255.254 to network 0.0.0.0

     10.0.0.0/16 is subnetted, 1 subnets
C       10.67.0.0 is directly connected, FastEthernet1/0
S*   0.0.0.0/0 [1/0] via 10.67.255.254

正如自带的描述, C表示已连接状态,FastEthernet1/0接口状态正常。这里说一句,之前我用的是GigabitEthernet1/0,死活也不通,在R1上把PA-GE删了都换成PA-FE-TX就能ping通了。

当然,如果没有route肯定是有问题的

在这里插入图片描述
贴下配置路由FastEthernet1/0接口的命令

Router>enable
Router#configure t
Router(config)#interface fastEthernet 1/0
Router(config-if)#ip add 10.67.8.52 255.255.0.0
Router(config-if)#no shutdown
Router(config-if)#ip route 0.0.0.0 0.0.0.0 10.67.255.254
Router(config)#end
Router#write

查看主机配置
使用命令show ip查看PC1的ip配置,不是ipconfig哈,也不是ifconfig


To get command syntax help, please enter '?' as an argument of the command.

PC1> show ip

NAME        : PC1[1]
IP/MASK     : 0.0.0.0/0
GATEWAY     : 0.0.0.0
DNS         :
MAC         : 00:50:79:66:68:03
LPORT       : 20008
RHOST:PORT  : 127.0.0.1:20009
MTU:        : 1500

发现只有127.0.0.1没有预期的10.67.8.100,赶紧重新配置

10.67.8.100 是本机ip,10.67.8.52是网关
命令如下:

PC1> ip 10.67.8.100/16 10.67.8.52
Checking for duplicate address...
PC1 : 10.67.8.100 255.255.0.0 gateway 10.67.8.52

重新查看ip配置,已经设置好了

PC1> show ip

NAME        : PC1[1]
IP/MASK     : 10.67.8.100/16
GATEWAY     : 10.67.8.52
DNS         :
MAC         : 00:50:79:66:68:03
LPORT       : 20008
RHOST:PORT  : 127.0.0.1:20009
MTU:        : 1500

3. 检查设备是否能相互ping通

路由器ping主机

先说下不成功的情况,会提示成功率是0

Router#ping 10.67.8.101

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.67.8.101, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

成功的情况是4/5.。。非常稳定的4/5

Router#ping 10.67.8.100

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.67.8.100, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 8/23/40 ms

当然,ping本机地址127.0.0.1是不通的,可能是没有

主机ping路由器/网关

正常状态下,是能ping通的

PC1> ping 10.67.8.52
84 bytes from 10.67.8.52 icmp_seq=1 ttl=255 time=9.829 ms
84 bytes from 10.67.8.52 icmp_seq=2 ttl=255 time=3.069 ms
84 bytes from 10.67.8.52 icmp_seq=3 ttl=255 time=10.362 ms
84 bytes from 10.67.8.52 icmp_seq=4 ttl=255 time=3.563 ms
84 bytes from 10.67.8.52 icmp_seq=5 ttl=255 time=6.078 ms

测试本地,是不通的。

PC1> ping localhost
Cannot resolve localhost

PC1> ping 127.0.0.1
127.0.0.1 icmp_seq=1 timeout
127.0.0.1 icmp_seq=2 timeout
127.0.0.1 icmp_seq=3 timeout
127.0.0.1 icmp_seq=4 timeout
127.0.0.1 icmp_seq=5 timeout

PC1> show ip

NAME        : PC1[1]
IP/MASK     : 10.67.8.100/16
GATEWAY     : 10.67.8.52
DNS         :
MAC         : 00:50:79:66:68:03
LPORT       : 20008
RHOST:PORT  : 127.0.0.1:20009
MTU:        : 1500

参考文献

https://blog.51cto.com/gezhongyun/1297611
https://www.cnblogs.com/sherlock-tang/p/7887119.html

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐