素材来源于日常工作中接触到的学员或自己、或他人遇到的实验或现网故障,旨在分析、总结、分享,请勿转载,谢谢。

网络拓扑:

image

两台路由器通过串行接口S1/1连接,中间配置IP子网为 12.1.1.0/24,R1为 .1 ,R2为 .2

模拟环境使用EVE仿真环境,加载了IOL模拟器,感谢仿真环境和模拟器的开发者。


故障描述:

管理员做了如下配置,但R1和R2之间却无法ping通,甚至自己ping自己也无法通讯。


R1

configure terminal

interface s1/1

encapsulation ppp

ip address 12.1.1.1 255.255.255.0

no shutdown

end


R2

configure terminal

interface s1/1

ip address 12.1.1.2 255.255.255.0

no shutdown


故障现象:

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


故障诊断:

    方法一:通过查看基本配置。

R1和R2的接口下一个配置了封装类型为PPP,另外一个却没有配置,而IOS操作系统下,串行接口默认的封装类型为HDLC,这就好比两个人在使用不同国家的语言聊天,根本互相听不懂啊。

    结论为,链路两端接口数据封装类型不一致导致故障。但是这种方法太过武断,需要有丰富的实践操作经验和扎实的理论基础支撑,并不推荐哦。经验老道的工程师们,可以在此基础上做进一步诊断,确定故障原因。


    方法二:通过log做出诊断

    对于有一定经验的工程师来说,其实在前面的配置过程中通过查看IOS操作系统给出的反馈就可以得出结论,看哪里呢?

R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int s1/1
R1(config-if)#encapsulation ppp
R1(config-if)#ip add 12.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
*May  4 08:19:21.872: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up
R1(config-if)#end
R1#

是的,细心的人会注意到,这个位置少了点什么,所谓事物反常即为妖,那么究竟少了什么呢?我们来看一个接口开启之后应该出现些什么。

R1(config)#int e0/0
R1(config-if)#no shutdown
*May  4 08:31:02.560: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
R1(config-if)#
*May  4 08:31:03.564: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R1(config-if)#

不仅会有一个接口开启的log,同时正常情况下链路层也应该工作正常,因此还会出现一个链路层up的log。也就是说,实际上,R1的S1/1接口网络接口层并没有正常工作;

R2(config)#int s1/1
R2(config-if)#ip add 12.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#end
R2#
*May  4 08:20:55.922: %SYS-5-CONFIG_I: Configured from console by console
R2#
*May  4 08:20:57.488: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up
*May  4 08:20:58.496: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
R2#
*May  4 08:21:23.792: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to down

再来看R2上面的log,接口链路层UP后又down了,这说明什么问题呢?说明R2的S1/1接口网络接口层也没有正常工作;

接下来验证我们的猜测:网络接口层工作不正常

R1#show ip interface brief s1/1
Interface                  IP-Address      OK?   Method       Status               Protocol
Serial1/1                  12.1.1.1          YES      manual         up                    down   


R2#show ip interface brief s1/1
Interface                  IP-Address      OK?    Method      Status                Protocol
Serial1/1                  12.1.1.2          YES       manual        up                   down


R1#show interfaces s1/1
Serial1/1 is up, line protocol is down
   Hardware is M4T
   Internet address is 12.1.1.1/24
   MTU 1500 bytes, BW 1544 Kbit/sec, DLY 20000 usec,
      reliability 255/255, txload 1/255, rxload 1/255
   Encapsulation PPP, LCP Closed, crc 16, loopback not set


R2#show interfaces s1/1
Serial1/1 is up, line protocol is down
   Hardware is M4T
   Internet address is 12.1.1.2/24
   MTU 1500 bytes, BW 1544 Kbit/sec, DLY 20000 usec,
      reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation HDLC, crc 16, loopback not set


通过上面log可以看出,我们的猜测是正确的,可以下诊断;


故障排除:

通过上面log判断,链路两端接口封装类型不一致导致了故障,因此我们需要普及一下普通话,让它们封装一致了。就一R1的S1/1接口配置为准吧,现在我们将R2的接口封装类型也配置为PPP。

R2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#interface s1/1
R2(config-if)#encapsulation ppp
R2(config-if)#end
R2#
*May  4 09:06:28.360: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
*May  4 09:06:28.821: %SYS-5-CONFIG_I: Configured from console by console
R2#


R1#
*May  4 09:06:28.365: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
R1#

现在两边都弹出了log,通知管理员接口的数据链路层up了。

R1#show ip interface brief s1/1
Interface                  IP-Address      OK?   Method   Status                Protocol
Serial1/1                  12.1.1.1           YES   manual      up                   up


R2#show ip interface brief s1/1
Interface                  IP-Address      OK?   Method    Status                Protocol
Serial1/1                  12.1.1.2          YES     manual     up                   up     


检查故障是否排除:

R1#ping 12.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/8/9 ms
R1#ping 12.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/17/18 ms


解惑:

通常情况下我们发现远端主机无法ping通,第一反应是需要测试本地主机接口卡工作是否正常,因此该同学在ping 12.1.1.2不通之后,又ping了12.1.1.1,证实了本地也不通。这他就疑惑了,对端不通你说因为接口协议down的,那咋自己也不通呢?

首先我们还原故障现象。

then

无论R1还是R2,当S1/1接口数据链路层down掉之后,我们来看下路由表:


R1#show ip route
Codes: L - local, 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, H - NHRP, l - LISP
        a - application route
        + - replicated route, % - next hop override

Gateway of last resort is not set

R1#


R2#show ip route
Codes: L - local, 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, H - NHRP, l - LISP
        a - application route
        + - replicated route, % - next hop override

Gateway of last resort is not set

R2#


路由表居然的空的!!!

接口的数据链路层都无法正常工作了,那么直连路由还有存在的必要么?数据也没办法完成链路层封装啊。一般的情况下,即使是发给自己的数据,路由器也需要有路由表项的嘛。没有表项,就好比一个人没有嘴巴,即使他知道别人给了他名字,心里也会默念,可就是说不出来呐。