作者:https://blog.51cto.com/361531/1755204
MPLS ***+TE隧道P--P之间建立TE隧道数据传输过程
P--P 双向TE tunnel
R2---R6之间,双向的tunnel已经配置了.
R1和R7作为----PE. 其他所有设备都是P设备.
需要把R1和R7的MPLS *** PE的基本配置完成.
1)MPLS ***
在两个PE上面分别起loopback1,然后放入到两边PE的vrf中去.
R1和R7的环回口1可以相互通讯.
对于R6来讲,需要R2分配的标签.而不是R5的.当前在R6上面是没有标签.
IOU6#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
600 [T] No Label 1.1.1.1/32 0 Tu62 point2point
为什么R6需要R2分配的标签呢?
因为这个观念是R2--R6之间建立了一个TE tunnel的隧道。逻辑上面就是一个直连的.
这样理解就比较直观了。
如何让R2给R6对于前缀1.1.1.1/32分配标签呢?
这个时候需要在R2和R6之间起一个LDP的邻居关系.
实际上R2和R6之间建立的LDP邻居不是直连邻居,是一个Target LDP邻居.
R5这里有三层标签:
1)最内层是MP-BGP分配的***v4的私网标签.
2)中间的一层标签是去往1.1.1.1的 标签是R2通过LDP分配的标签.
3)外层标签是MPLS TE隧道rsvp分配的标签.
下面是具体的标签观察图:
我这里做的示意图仅仅是单向的.R1是PE1,R7是PE-2,其他的所有设备均为P.
标签的分发过程:
1)R1和R7是PE.
2)R1和R2之间建立直连LDP邻居关系.在R1上面,对于7.7.7.7/32的前缀,R2会为该前缀分配205的LDP标签给R1:
IOU1#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
106 205 7.7.7.7/32 0 Et0/0 12.1.1.2
也就是如图所示的R2的蓝色标签205分发给R1.
3)R2和R6通过MPLS TEtunnel建立的隧道,建立了target LDP邻居.
所以R6会通过LDP协议分配给R2一个605的标签达到7.7.7.7/32的前缀.
在R2上面查看表项:
IOU2#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
205 [T] 605 7.7.7.7/32 10419 Tu26 point2point
4)R2,R5还有R6之间建立的是TE的隧道,所以RSVP R5也会分配标签给R2作为最外层的标签.
R5通过RSVP分配给R2到达6.6.6.6(TE隧道尾端)的标签是500,可以通过下面命令在R2上面查看:
IOU2#show mpls traffic-eng tunnels tunnel 26
Name: IOU2_t26 (Tunnel26) Destination: 6.6.6.6
Status:
Admin: up Oper: up Path: valid Signalling: connected
path option 10, type dynamic (Basis for Setup, path weight 20)
Config Parameters:
Band 3000 kbps (Global) Priority: 7 7 Affinity: 0x0/0xFFFF
Metric Type: TE (default)
AutoRoute: enabled LockDown: disabled Loadshare: 3000 bw-based
auto-bw: disabled
Active Path Option Parameters:
State: dynamic path option 10 is active
BandwidthOverride: disabled LockDown: disabled Verbatim: disabled
InLabel : -
OutLabel : Ethernet0/1, 500
RSVP Signalling Info:
5)在R5上面,R6为6.6.6.6/32前缀分派的标签是POP标签,通过给R5:
IOU5#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
500 Pop Label 2.2.2.2 26 [13] 22009 Et0/0 56.1.1.6
6)R7和R6之间建立的是直连LDP邻居.
R7为7.7.7.7/32分配的标签是POP,通告给R6:
IOU6#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
605 Pop Label 7.7.7.7/32 6023 Et0/1 67.1.1.7
下面是标签封装和报文传输过程:
最后在R1上面traceroute的结果如下:
IOU1#traceroute vrf Hank 77.77.77.77
Type escape sequence to abort.
Tracing the route to 77.77.77.77
VRF info: (vrf in name/id, vrf out name/id)
1 12.1.1.2 [MPLS: Labels 205/700 Exp 0] 1 msec 6 msec 1 msec
2 25.1.1.5 [MPLS: Labels 500/605/700 Exp 0] 0 msec 1 msec 0 msec
3 56.1.1.6 [MPLS: Labels 605/700 Exp 0] 0 msec 0 msec 0 msec
4 77.77.77.77 1 msec 0 msec 1 msec
总结:
对于P--P之间建立TE tunnel,为了整个LSP链路保持一致性,所以整个标签路由是拆分为了三块.标签最多的时候也有三层标签.
1,首先是PE1到隧道的起始点.这一段需要建立直连LDP邻居,用于LDP的标签分发.
2, 其次是R2--R5--R6需要建立MPLS TE隧道.
3,对于R2--R6之间需要建立target LDP邻居.
4, R6作为隧道的终结点,需要和R7建立LDP的直连邻居.
只有有了上面四个条件,一条完整的
下面是相关的抓包截图:
方向依然是从R1-->R7的单向:(因为重启了IOU以后,标签分配和以前的图中所示标签有所变化)
1,当数据包从R1的e 0/0出去的时候,携带了2层标签.
外层标签是LDP R2分配给R1的标签到达7.7.7.7/32的前缀.
内层标签是MP-BGP R7分配给R1的标签.
2,当数据包从R2的e 0/1出去的时候.
携带了三层标签.
外网是RSVP 协议,R5为前缀隧道尾端6.6.6.6/32通告给R2的外层标签.
中间是R6为前缀7.7.7.7/32通过target LDP通告给R2的LDP标签.
内层标签是R7为vrf Hank 77.77.77.77/32分配的MP-BGP私网标签.
3, 数据包从R5的e0/0出去的时候.
携带了2层标签.
R6是隧道的尾端了.所以针对于R6的6.6.6.6/32前缀,R6会分配POP空标签,通告给R5.
所以R5的e0/0出去的时候,外层的RSVP L=500会被弹出.
所以R5 e0/0出去的时候,仅仅会携带两层标签.
外层是R6为7.7.7.7/32前缀分配的602 LDP标签。通过 MPLS TE隧道通告给R2,然后这个LDP标签会原封不动的从R5的e0/0出去.
内层依然是MP-BGP ***V4私网标签715.
下面是从R5的e0/0出接口抓包:
4, 数据包从R6的e0/1出去的时候.
当数据包从R6的e 0/1出去的时候,外层的LDP标签会被POP掉。
因为R7为7.7.7.7/32本地前缀分配的就是空标签.通告给R6.
最后从R6的e0/1数据包出去的时候只会携带一层标签.就是MP-BGP的私网标签715,最后到了R7以后再pop掉私网标签.
所以最后的结果在R1上面进行traceroute vrf Hank 77.77.77.77为下面的结果:
从上面的traceroute 也可以看出,和抓包的截图完全一致.
核心配置:
R1-PE1的配置:
ip vrf Hank
rd 100:1
route-target export 100:17
route-target import 100:17
!
ip cef
mpls label range 100 199
mpls traffic-eng tunnels
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Loopback1
ip vrf forwarding Hank
ip address 11.11.11.11 255.255.255.255
!
interface Ethernet0/0
ip address 12.1.1.1 255.255.255.0
mpls traffic-eng tunnels
mpls label protocol ldp
mpls ip
ip rsvp bandwidth
!
router ospf 1
mpls traffic-eng router-id Loopback0
mpls traffic-eng area 0
router-id 1.1.1.1
network 1.1.1.1 0.0.0.0 area 0
network 12.1.1.1 0.0.0.0 area 0
!
router bgp 100
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 7.7.7.7 remote-as 100
neighbor 7.7.7.7 update-source Loopback0
!
address-family ipv4
neighbor 7.7.7.7 activate
exit-address-family
!
address-family ***v4
neighbor 7.7.7.7 activate
neighbor 7.7.7.7 send-community extended
exit-address-family
!
address-family ipv4 vrf Hank
network 11.11.11.11 mask 255.255.255.255
exit-address-family
!
R2的配置:
ip vrf Hank
rd 100:100
route-target export 100:100
route-target import 100:100
!
ip cef
mpls label range 200 299
mpls traffic-eng tunnels
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Loopback1
ip vrf forwarding Hank
ip address 22.2.2.2 255.255.255.255
!
interface Tunnel26
ip unnumbered Loopback0
mpls traffic-eng tunnels
mpls label protocol ldp
mpls ip
tunnel mode mpls traffic-eng
tunnel destination 6.6.6.6
tunnel mpls traffic-eng autoroute announce
tunnel mpls traffic-eng priority 7 7
tunnel mpls traffic-eng bandwidth 3000
tunnel mpls traffic-eng path-option 10 dynamic
no routing dynamic
!
interface Ethernet0/0
ip address 12.1.1.2 255.255.255.0
mpls traffic-eng tunnels
mpls label protocol ldp
mpls ip
ip rsvp bandwidth
!
interface Ethernet0/1
ip address 25.1.1.2 255.255.255.0
mpls traffic-eng tunnels
ip rsvp bandwidth
!
interface Ethernet1/0
ip address 24.1.1.2 255.255.255.0
shutdown
mpls traffic-eng tunnels
ip rsvp bandwidth
!
router ospf 1
mpls traffic-eng router-id Loopback0
mpls traffic-eng area 0
router-id 2.2.2.2
network 2.2.2.2 0.0.0.0 area 0
network 12.1.1.2 0.0.0.0 area 0
network 22.2.2.2 0.0.0.0 area 0
network 24.1.1.2 0.0.0.0 area 0
network 25.1.1.2 0.0.0.0 area 0
!
R5的核心配置:
ip cef
mpls label range 500 599
mpls traffic-eng tunnels
!
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface Ethernet0/0
ip address 56.1.1.5 255.255.255.0
mpls traffic-eng tunnels
ip rsvp bandwidth
!
interface Ethernet0/1
ip address 25.1.1.5 255.255.255.0
mpls traffic-eng tunnels
ip rsvp bandwidth
!
interface Ethernet1/1
ip address 45.1.1.5 255.255.255.0
mpls traffic-eng tunnels
ip rsvp bandwidth
!
router ospf 1
mpls traffic-eng router-id Loopback0
mpls traffic-eng area 0
router-id 5.5.5.5
network 5.5.5.5 0.0.0.0 area 0
network 25.1.1.5 0.0.0.0 area 0
network 45.1.1.5 0.0.0.0 area 0
network 56.1.1.5 0.0.0.0 area 0
!
R6的核心配置:
ip vrf Hank
rd 100:100
route-target export 100:100
route-target import 100:100
!
ip cef
mpls label range 600 699
mpls label protocol ldp
mpls traffic-eng tunnels
!
interface Loopback0
ip address 6.6.6.6 255.255.255.255
!
interface Loopback1
ip vrf forwarding Hank
ip address 66.6.6.6 255.255.255.255
!
interface Tunnel62
ip unnumbered Loopback0
mpls traffic-eng tunnels
mpls label protocol ldp
mpls ip
tunnel mode mpls traffic-eng
tunnel destination 2.2.2.2
tunnel mpls traffic-eng autoroute announce
tunnel mpls traffic-eng priority 7 7
tunnel mpls traffic-eng bandwidth 3000
tunnel mpls traffic-eng path-option 10 dynamic
no routing dynamic
!
interface Ethernet0/0
ip address 56.1.1.6 255.255.255.0
mpls traffic-eng tunnels
ip rsvp bandwidth
!
interface Ethernet0/1
ip address 67.1.1.6 255.255.255.0
mpls traffic-eng tunnels
mpls label protocol ldp
mpls ip
ip rsvp bandwidth
!
interface Ethernet1/0
ip address 36.1.1.6 255.255.255.0
shutdown
mpls traffic-eng tunnels
ip rsvp bandwidth
!
router ospf 1
mpls traffic-eng router-id Loopback0
mpls traffic-eng area 0
router-id 6.6.6.6
network 6.6.6.6 0.0.0.0 area 0
network 36.1.1.6 0.0.0.0 area 0
network 56.1.1.6 0.0.0.0 area 0
network 66.6.6.6 0.0.0.0 area 0
network 67.1.1.6 0.0.0.0 area 0
!
R7的核心配置:
ip vrf Hank
rd 100:7
route-target export 100:17
route-target import 100:17
!
ip cef
mpls label range 700 799
mpls traffic-eng tunnels
!
interface Loopback0
ip address 7.7.7.7 255.255.255.255
!
interface Loopback1
ip vrf forwarding Hank
ip address 77.77.77.77 255.255.255.255
!
interface Ethernet0/1
ip address 67.1.1.7 255.255.255.0
mpls traffic-eng tunnels
mpls label protocol ldp
mpls ip
ip rsvp bandwidth
!
router ospf 1
mpls traffic-eng router-id Loopback0
mpls traffic-eng area 0
router-id 7.7.7.7
network 7.7.7.7 0.0.0.0 area 0
network 37.1.1.7 0.0.0.0 area 0
network 67.1.1.7 0.0.0.0 area 0
!
router bgp 100
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback0
!
address-family ipv4
neighbor 1.1.1.1 activate
exit-address-family
!
address-family ***v4
neighbor 1.1.1.1 activate
neighbor 1.1.1.1 send-community both
exit-address-family
!
address-family ipv4 vrf Hank
network 77.77.77.77 mask 255.255.255.255
exit-address-family
!