跨域option C1没RR场景的目标是:R2与R6建立MP-EBGP邻居
配置思路:
首先,要把2.2.2.2传递到R6,6.6.6.6传递到R2,才能建立EBPG邻居
那么R2-R1-R3做IBGP、R4-R5-R6做IBGP、R3-R4建立EBGP来传递路由(ipv4单播即可)
当R2与R6互相学习了路由后,就可以建立MP-EBGP了
bgp进程下的ipv4-family vpnv4----这个需要开启mpls
所以需要配置mpls的ldp(由于两个mpls域,当然都要做mpls ldp)
当R2与R6建立MP-EBGP后,
[R6]display mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
192.168.2.0/24 1024/NULL -/- VPN1
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
4.4.4.4/32 NULL/1024 -/GE0/0/0
4.4.4.4/32 1025/1024 -/GE0/0/0
5.5.5.5/32 NULL/3 -/GE0/0/0
5.5.5.5/32 1026/3 -/GE0/0/0
6.6.6.6/32 3/NULL -/-
[R6]
你可以理解两个mpls域合成了一个mpls域了,类似mpls xxx非跨域时的传递原理
mpls xxx非跨域时,当pc2 ping pc1时,数据传输进入R6,会打上私网标签,然后下一跳是2.2.2.2,那么此时应该会打上公网标签,可问题来了,没有看到有2.2.2.2的lsp(这里称为BGP lsp)
所以,接下来就是解决这个了。
当R3通告2.2.2.2的路由时,应该传递标签
R3在通告2.2.2.2的路由时,应该添加label-1
[R3]route-policy label-1 permit node 10 //使用route-policy策略来添加label
Info: New Sequence of this List.
[R3-route-policy]app
[R3-route-policy]apply mp
[R3-route-policy]apply mpls-label
[R3-bgp]peer 10.1.34.4 route-policy label-1 export //应用到peer R4的出方向
peer 10.1.34.4 label-route-capability //开启发送标签路由能力
在普通非跨域中,我们配置了ldp来自动分配标签
<R3>display bgp routing-table 2.2.2.2
BGP local router ID : 3.3.3.3
Local AS number : 100
Paths: 1 available, 1 best, 1 select
BGP routing table entry information of 2.2.2.2/32:
Network route.
Label information (Received/Applied): NULL/1026 //此时在R3上可以看到2.2.2.2的路由带有标签(标签路由),必须在R3、R4的接口上开启mpls功能还有bgp邻居互相开启标签路由传递能力
From: 0.0.0.0 (0.0.0.0)
Route Duration: 01h04m22s
Direct Out-interface: GigabitEthernet0/0/0
Original nexthop: 10.1.13.1
Qos information : 0x0
AS-path Nil, origin igp, MED 2, pref-val 0, valid, local, best, select, pre 10
Advertised to such 2 peers:
1.1.1.1
10.1.34.4
R4传递到R5时,由于下一跳变成4.4.4.4了,要改标签
[R4]route-policy label-2 permit node 10 //更改标签
Info: New Sequence of this List.
[R4-route-policy]appl
[R4-route-policy]apply mp
[R4-route-policy]apply mpls-label
[R4-bgp]peer 5.5.5.5 route-policy label-2 export
[R4-bgp]display this
[V200R003C00]
#
bgp 200
peer 5.5.5.5 as-number 200
peer 5.5.5.5 connect-interface LoopBack0
peer 10.1.34.3 as-number 100
#
ipv4-family unicast
undo synchronization
network 6.6.6.6 255.255.255.255
peer 5.5.5.5 enable
peer 5.5.5.5 route-policy label-2 export
peer 5.5.5.5 next-hop-local
peer 5.5.5.5 label-route-capability //对R5开启标签路由传递功能
peer 10.1.34.3 enable
peer 10.1.34.3 label-route-capability //对R3开启标签路由传递功能
#
因为标签路由还得由R5传递到R6,所以,R5-R6之间也需要开启相互的标签路由传递功能
[R6-bgp]display mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
192.168.2.0/24 1024/NULL -/- VPN1
2.2.2.2/32 NULL/1026 -/- //此时就有了2.2.2.2的lsp了(BGP lsp)
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
4.4.4.4/32 NULL/1024 -/GE0/0/0
4.4.4.4/32 1025/1024 -/GE0/0/0
5.5.5.5/32 NULL/3 -/GE0/0/0
5.5.5.5/32 1026/3 -/GE0/0/0
6.6.6.6/32 3/NULL -/-
[R6-bgp]
同样的思路,R5把6.6.6.6的路由传递到R2
[R2-bgp]display mpls lsp
-------------------------------------------------------------------------------
LSP Information: BGP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
192.168.1.0/24 1024/NULL -/- VPN1
6.6.6.6/32 NULL/1027 -/- //R2中存在6.6.6.6的BGP lsp
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
2.2.2.2/32 3/NULL -/-
1.1.1.1/32 NULL/3 -/GE0/0/0
1.1.1.1/32 1025/3 -/GE0/0/0
3.3.3.3/32 NULL/1025 -/GE0/0/0
3.3.3.3/32 1026/1025 -/GE0/0/0
此时就可以放飞自我了
分析整个过程标签的情况:
当pc1 ping pc2时:icmp进入到R2,由于从xxx接口接收,打上私网标签1024
查看到下一跳是6.6.6.6
6.6.6.6有BGP lsp,打上标签1027,那6.6.6.6怎么来的?
下一跳是3.3.3.3
3.3.3.3有lsp,打上1025
即R2发出去的报文有三层标签:1024、1027、1025(由内往外)
报文到达R1,
1025对应出去为倒数第二跳弹出标签,从g0/0/1出口出去
报文从R1出去时候的标签:1024、1027(由内往外)
报文到达R3
标签1027换成1027,可是哪里出去?去往6.6.6.6的下一跳?
从R3出去报文的标签:1024、1027(由内往外)
到达R4,发现1027对应是空,但下面有个6.6.6.6的ldp lsp,之后打上1025,并从g0/0/1出去
R4出去的报文标签:1024、1025
到达R5,1025对应倒数第二跳弹出,此时出去只剩下1024了
到达R6,根据私网标签,往对应的xxx下发送