
如上图所示,这是本次实验的拓扑。
如下图所示,如果上述实验拓扑中R3和R4之间的链路中断了,那么链路将会切换到R7。

因为帧模式下LDP的标签分配方式是独立自主的,标签保留方式也是自由保留的,所以R3和R4上是一直都是有R7的MPLS标签的。只要IGP切换到R7了,数据包就可以从R7走了。
PS:关于帧模式下标签分配模式等,详情请看:《MPLS标签分配模式 —— 帧模式和信元模式(Frame-Mode and Cell-Mode)》
但问题是R3和R4之间的链路再次恢复的时候,可能会出现问题:
因为链路断开导致R3和R4之间的LDP邻居关系中断,所以LDP邻居关系中断后R3和R4之间的标签将会被删除。当R3和R4之间的链路再次恢复的时候,除了R3和R4之间的IGP的邻居关系要起来以外,R3和R4之间的LDP的邻居关系也要起来( LDP之间还需要相互发现、相互分配和相互传输MPLS标签)。也就是说,只有IGP和LDP都起来以后,链路才能重新切换回R3和R4。

那如果IGP先起来(链路在IGP上已经从R7切换回R3和R4了),但LDP还没有起来(R3和R4之间的MPLS标签还没有分配好),这个时候数据包就会因为没有MPLS标签而丢包。
所以IGP和LDP之间的同步功能就派上用场了:就算IGP先起来了,但是LDP还没有准备好,IGP就会先把R3和R4之间的链路的Metric值设置为最大,让数据包先往R7走。当MPLS准备好以后,IGP再把链路切换回来,这样就不会出现丢包了。现在我们做一下上面那个实验。
实验环境:
使用四台Cisco 2811路由器,IOS是目前最新的c2800nm-adventerprisek9-mz.151-4.M10.bin

实验需求:
- R1、R2、R3和R4都开启MPLS和IGP(ISIS),
- 模拟上述实验,在R2和R4上开启LDP和IGP之间的同步功能。
实验步骤:
完成配置(IP地址、IGP和MPLS):
R1 – Cisco 2811:
conf t int l 0 int s 0/0/0 ! configurate IGP router isis 1 int s 0/0/0 ! configurate MPLS: mpls ip router isis 1 |
R2 – Cisco 2811:
conf t int l 0 int s 0/0/0 int s 0/0/1 int s 0/1/0 ! configurate IGP router isis 1 int s 0/0/0 int s 0/0/1 int s 0/1/0 ! configurate MPLS: mpls ip router isis 1 |
R3 – Cisco 2811:
conf t int l 0 int s 0/0/0 int s 0/0/1 ! configurate IGP router isis 1 int s 0/0/0 int s 0/0/1 ! configurate MPLS: mpls ip router isis 1 |
R4 – Cisco 2811:
conf t int l 0 int s 0/0/1 int s 0/1/0 ! configurate IGP router isis 1 int s 0/1/0 int s 0/0/1 ! configurate MPLS: mpls ip router isis 1 |
现在我们故意shutdown掉R2和R4之间的链路,看R2和R4之间的链路恢复的时候,会丢几个包。
如下图所示,R2和R4之间的链路被shutdown:
R2(config)#int s 0/1/0 R2(config-if)#sh R4(config)#int s 0/1/0 R4(config-if)#sh
现在,R2上去往R4(4.4.4.4)的MPLS标签从R3走了,如下图所示。
R2#sh mpls forwarding-table Local Outgoing Prefix Bytes Label Outgoing Next Hop Label Label or Tunnel Id Switched interface 2000 Pop Label 1.1.1.1/32 0 Se0/0/0 point2point 2001 Pop Label 3.3.3.3/32 0 Se0/0/1 point2point 2002 3002 4.4.4.4/32 0 Se0/0/1 point2point PS:R2的Se0/0/1口就是去往R3的。
在R1上trace 4.4.4.4 so 1.1.1.1可以看到,数据包确实经过了R3:
R1#trace 4.4.4.4 so 1.1.1.1 Type escape sequence to abort. Tracing the route to alu7750testscr.xyz1.gblx.mgmt.Level3.net (4.4.4.4) VRF info: (vrf in name/id, vrf out name/id) 1 12.1.1.2 [MPLS: Label 2002 Exp 0] 4 msec 4 msec 8 msec 2 23.1.1.3 [MPLS: Label 3002 Exp 0] 4 msec 4 msec 4 msec 3 34.1.1.4 4 msec * 4 msec
现在我们在R1上ping上10万个数据包,同时恢复R2和R4之间的链路,看在没有做LDP和IGP同步的时候会丢几个包:
R1#ping 4.4.4.4 so 1.1.1.1 repeat 100000 R2(config)#int s 0/1/0 R2(config-if)#no sh R4(config)#int s 0/1/0 R4(config-if)#no sh
见证奇迹的时刻到了!如下图所示,我试了好几次…竟然…没有…丢包…
这…可能是LDP起来的速度要比ISIS快吧…
R1#ping 4.4.4.4 so 1.1.1.1 repeat 100000
Type escape sequence to abort.
Sending 100000, 100-byte ICMP Echos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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (2856/2856), round-trip min/avg/max = 1/4/12 ms
不过呢,大家就假装此处有几个丢包好了。_(:з」∠)_
为了防止IGP起来了,LDP却还没有准备好,从而造成丢包的情况,就需要配置LDP和IGP的同步,配置如下图所示。
R2(config-if)#router isis 1 R2(config-router)#mpls ldp sync R4(config)#router isis 1 R4(config-router)#mpls ldp sync
配置很简单,一条命令就搞定了。这样,在LDP没有起来的时候,IGP会先将R2和R4之间的链路的Metric值设置为最大,让数据包先从备用链路(也就是R3)走。当LDP准备好了以后,IGP再把链路切换回来。
发表评论?