龙空技术网

典型OSPF V2组网排错案例(1)—来回路径不一致

onme0 227

前言:

现时看官们对“路径不对怎么解决”可能比较关切,大家都想要分析一些“路径不对怎么解决”的相关内容。那么小编同时在网络上汇集了一些关于“路径不对怎么解决””的相关资讯,希望我们能喜欢,同学们快快来学习一下吧!

概述

OSPF(Open Shortest Path First)是IETF组织开发的一个基于链路状态的内部网关协议。目前针对IPv4协议使用的是OSPF Version 2(RFC2328)。OSPF是不属于任何一个厂商或组织私有的路由协议,使用Dijkstra的最短路径(SPF)算法计算路由。在OSPF中引入了区域的概念,有效的减少了路由选择协议对路由器CPU和内存的占用,同时也降低了路由选择协议的通信量,使得构建大型层次化网络成为可能。

本次将结合实践案例分三期文章总结分享关于OSPF V2组网排错案例,那么,本期文章分享的主题是来回路径的不一致。

组网拓扑图组网地址规划组网设备配置

组网设备的配置思路基本一致,在此仅提供关键设备1、设备41和设备PC-1-1的配置,其它设备参考配置案例、组网拓扑和地址规划可自主完成。

设备1配置

[H3C] sysname 1

[1]

[1]line console 0

[1-line-console0]idle-timeout 0

[1-line-console0]quit

[1]

[1] ip unreachables enable

[1] ip ttl-expires enable

[1]

[1]vlan 10

[1-vlan10]quit

[1]

[1]interface LoopBack0

[1-LoopBack0] ip address 10.10.0.1 255.255.255.255

[1-LoopBack0]quit

[1]interface Vlan-interface10

[1-Vlan-interface10] ip address 172.16.10.254 255.255.255.0

[1-Vlan-interface10]quit

[1]interface GigabitEthernet1/0/1

[1-GigabitEthernet1/0/1] port link-mode route

[1-GigabitEthernet1/0/1] ip address 10.10.43.1 255.255.255.252

[1-GigabitEthernet1/0/1] ospf cost 20

[1-GigabitEthernet1/0/1] ospf network-type p2p

[1-GigabitEthernet1/0/1]quit

[1]interface GigabitEthernet1/0/2

[1-GigabitEthernet1/0/2] port link-mode route

[1-GigabitEthernet1/0/2] ip address 10.10.21.1 255.255.255.252

[1-GigabitEthernet1/0/2] ospf cost 100

[1-GigabitEthernet1/0/2] ospf network-type p2p

[1-GigabitEthernet1/0/2]quit

[1]interface GigabitEthernet1/0/3

[1-GigabitEthernet1/0/3] port link-mode route

[1-GigabitEthernet1/0/3] ip address 10.10.40.1 255.255.255.252

[1-GigabitEthernet1/0/3] ospf cost 10

[1-GigabitEthernet1/0/3] ospf network-type p2p

[1-GigabitEthernet1/0/3]quit

[1] interface GigabitEthernet1/0/11

[1-GigabitEthernet1/0/11] port access vlan 10

[1-GigabitEthernet1/0/11]quit

[1]

[1]ospf 1

[1-ospf-1] area 0.0.0.0

[1-ospf-1-area-0.0.0.0] network 10.10.0.1 0.0.0.0

[1-ospf-1-area-0.0.0.0] network 10.10.21.1 0.0.0.0

[1-ospf-1-area-0.0.0.0] network 10.10.40.1 0.0.0.0

[1-ospf-1-area-0.0.0.0] network 10.10.43.1 0.0.0.0

[1-ospf-1-area-0.0.0.0] network 172.16.10.0 0.0.0.255

[1-ospf-1-area-0.0.0.0]quit

[1-ospf-1]quit

[1]

[1]save force

Validating file. Please wait...

Saved the current configuration to mainboard device successfully.

[1]#

设备41配置

[H3C]sysname 41

[41]

[41]line console 0

[41-line-console0]idle-timeout 0

[41-line-console0]quit

[41]

[41]ip unreachables enable

[41]ip ttl-expires enable

[41]

[41]vlan 41

[41-vlan41]quit

[41]interface LoopBack0

[41-LoopBack0] ip address 10.10.0.41 255.255.255.255

[41-LoopBack0]quit

[41]

[41]interface Vlan-interface41

[41-Vlan-interface41] ip address 172.16.41.254 255.255.255.0

[41-Vlan-interface41]quit

[41]

[41]interface GigabitEthernet1/0/1

[41-GigabitEthernet1/0/1] port link-mode route

[41-GigabitEthernet1/0/1] ip address 10.40.41.2 255.255.255.252

[41-GigabitEthernet1/0/1] ospf cost 10

[41-GigabitEthernet1/0/1] ospf network-type p2p

[41-GigabitEthernet1/0/1]quit

[41]

[41]interface GigabitEthernet1/0/3

[41-GigabitEthernet1/0/3] port link-mode route

[41-GigabitEthernet1/0/3] ip address 10.41.42.1 255.255.255.252

[41-GigabitEthernet1/0/3] ospf cost 20

[41-GigabitEthernet1/0/3] ospf network-type p2p

[41-GigabitEthernet1/0/3]quit

[41]

[41]interface GigabitEthernet1/0/11

[41-GigabitEthernet1/0/11] port access vlan 41

[41-GigabitEthernet1/0/11]quit

[41]

[41]ospf 1

[41-ospf-1] area 0.0.0.0

[41-ospf-1-area-0.0.0.0] network 10.40.41.2 0.0.0.0

[41-ospf-1-area-0.0.0.0] area 0.0.0.1

[41-ospf-1-area-0.0.0.1] network 10.10.0.41 0.0.0.0

[41-ospf-1-area-0.0.0.1] network 10.41.42.1 0.0.0.0

[41-ospf-1-area-0.0.0.1] network 172.16.41.0 0.0.0.255

[41-ospf-1-area-0.0.0.1]quit

[41-ospf-1]quit

[41]

[41]save force

Validating file. Please wait...

Saved the current configuration to mainboard device successfully.

[41]#

设备PC-1-1配置

[H3C]sysname PC-1-1

[PC-1-1]

[PC-1-1]line console 0

[PC-1-1-line-console0]idle-timeout 0

[PC-1-1-line-console0]quit

[PC-1-1]

[PC-1-1]line vty 0 4

[PC-1-1-line-vty0-4] authentication-mode scheme

[PC-1-1-line-vty0-4] idle-timeout 0

[PC-1-1-line-vty0-4]quit

[PC-1-1]

[PC-1-1]ip unreachables enable

[PC-1-1]ip ttl-expires enable

[PC-1-1]#

[PC-1-1]

[PC-1-1]interface Vlan-interface1

[PC-1-1-Vlan-interface1] ip address 172.16.10.1 255.255.255.0

[PC-1-1-Vlan-interface1]quit

[PC-1-1]

[PC-1-1]local-user admin class manage

[PC-1-1-luser-manage-admin] password simple admin

[PC-1-1-luser-manage-admin] service-type telnet

[PC-1-1-luser-manage-admin]authorization-attribute user-role level-15

[PC-1-1-luser-manage-admin]quit

[PC-1-1]

[PC-1-1]telnet server enable

[PC-1-1]

[PC-1-1]ip route-static 0.0.0.0 0 172.16.10.254

[PC-1-1]

[PC-1-1]undo stp global enable

[PC-1-1]

[PC-1-1]undo lldp global enable

[PC-1-1]

PC-1-1和PC-41-1之间的相互访问组网链路均正常

PC-1-1访问PC-41-1的最优路径:PC-1-1—>1—>40—>41—>PC-41-1,跟踪路由的结果如下图所示;

从设备1上可查看去往172.16.41.0地址段的下一跳是10.10.40.2,对应的开销是21,如下所示;

<1>dis ip routing-table protocol ospf | include 172.16.41

172.16.41.0/24 O_INTER 10 21 10.10.40.2 GE1/0/3

<1>

PC-41-1访问PC-1-1的最优路径:PC-41-1—>41—>40—>1—>PC-1-1,跟踪路由的结果如下图所示;

从设备41上可查看去往172.16.10.0地址段的下一跳是10.40.41.1,对应的开销是21,如下所示;

<41>dis ip routing-table protocol ospf | include 172.16.10.0

172.16.10.0/24 O_INTRA 10 21 10.40.41.1 GE1/0/1

<41>

小节:PC-1-1和PC-41-1之间的相互访问(如telnet应用和icmp等)的来回路径所经设备是一样的,相应的开销值也是一样的。

模拟中断设备1和设备40之间的链路

PC-1-1访问PC-41-1的最优路径:PC-1-1—>1—>43—>42—>41—>PC-41-1,跟踪路由的结果如下图所示;

从设备1上可查看去往172.16.41.0地址段的下一跳是10.10.43.2,对应的开销是61,如下所示;

<1>dis ip routing-table protocol ospf | include 172.16.41

172.16.41.0/24 O_INTER 10 61 10.10.43.2 GE1/0/1

<1>

PC-41-1访问PC-1-1的最优路径:PC-41-1—>41—>40—>21—>1—>PC-1-1,跟踪路由的结果如下图所示;

从设备41上可查看去往172.16.10.0地址段的下一跳是10.40.41.1,对应的开销是121,如下所示;

<41>dis ip routing-table protocol ospf | include 172.16.10.0

172.16.10.0/24 O_INTRA 10 121 10.40.41.1 GE1/0/1

<41>

小节:虽然PC-1-1和PC-41-1之间的相互访问的来回路径所经设备是不一样的,相应的开销值也是不一样的,但是,两者之间业务访问是正常的

总结

当中断设备1和设备40之间的链路,虽然PC-1-1和PC-41-1之间的相互访问的来回路径所经设备是不一样的,不影响两者之间的业务访问,但是在实际组网规划中需尽量避免此种情况。下期文章将总结分享来回路径不一致而引发的网络故障。

以上分享,希望各位小伙伴有所收获,欢迎各位点赞、收藏和指正。

标签: #路径不对怎么解决