Cisco
跨域三層××× OptionB配置指導
1 跨域×××需求產生的背景
隨着MPLS ×××解決方案的流行,網絡的規模也在不斷增加,在運營商的不一樣城域網之間,或是同骨幹網之間都存在着很是現實的跨越不一樣自治域問題,這些都須要一個不一樣於自治系統內MPLS ×××體系結構,即跨域的MPLS ×××,爲了支持服務提供商之間的×××路由選擇信息交換,須要一個新的機制,以即可以穿過提供商間的鏈路來廣播路由前綴和標籤信息,跨域×××的出現正是解決這個問題的。
目前跨域×××的技術方案主要有三種:
1)VRF-TO-VRF(背靠背方式) option A
2)MP-EBGP (單跳的MP-EBGP方式) option B
3)MULTIHOP-EBGP(多跳的MP-EBGP方式) option C
我在這篇文章中首先講述OptionB的跨域×××方案,即單跳的MP-EBGP方式,其餘兩種方式在後續的時間也會發布在個人blog中。
2 OptionB方式跨域×××描述
如上圖,整個網絡中存在3個AS,AS號分別爲200、300和400,其中AS200和AS400之間的×××有互通需求。
在這個網絡中R2、R3和R4爲3個AS的ASBR,那麼咱們在ASBR之間運行MP-EBGP協議,MP-EBGP將本身AS內的全部的×××信息傳遞給另一個AS,傳遞的是私網路由和標籤信息,因爲MP-EBGP在傳遞路由時,是要改變路由的下一跳,根據標籤分配的原則,當一個FEC的下一跳被改變時,必須在本地更換標籤,所以ASBR在收到AS內的×××路由信息,再向外發布時,必須給這些×××路由信息從新分配標籤,×××路由信息伴隨着新的標籤被髮布出去,而在ASBR本地,新舊標籤造成一個標籤的交換操做,這也是BGP中next-hop-self的來歷之一。
對端的ASBR收到從MP-EBGP來的×××路由信息後,在本地保存,在繼續向本身AS內的PE設備擴散,當這個ASBR向域內的MP-IBGP鄰居發佈路由時,它能夠選擇不改變路由的下一跳,或是將路由的下一跳改成本身,若是改變了路由的下一跳,同上面的標籤分配原則,也須要爲這些×××路由從新分配標籤,在本地造成標籤的交換操做。
3 ×××路由信息擴散的關鍵點
改變下一跳:
本文的跨域×××採用的是改變下一跳的設計,即ASBR在於IBGP對等體創建鄰居時,將下一跳指向本身,也就是說ASBR向IBGP鄰居發送×××路由時,會改變×××路由的下一跳指向ASBR,這樣的話在ASBR之間不須要運行額外的如LDP之類的信令協議,由MBGP觸發標籤便可。反之,若是不改變下一跳,那麼在ASBR之間是須要運行LDP之類的信令協議的,我的認爲這樣作雖然能夠實現跨域×××的互通,可是不是很標準,因此在本文中均是採用改變下一跳的設計來發布×××路由信息的。
×××路由信息的過濾:
報文轉發時,須要ASBR都要對×××的LSP作一次交換。還有一個問題須要注意的是,這種解決方案須要在ASBR上接收本AS內和AS外傳過來的全部×××路由,而後在把×××給擴散出去,可是MPLS ×××的特性結構中要求,只有一個PE上有×××匹配一條×××路由時,這條×××路由纔會被保存下來,所以對於上述ASBR上須要保存×××路由的需求必須作特殊的配置(由於ASBR上可能根本就沒有配置×××),讓ASBR把收到的×××路由所有的保存下來,而無論,本地是否有和它匹配的×××。這樣的目的能夠經過關閉BGP默認的route-target過濾來實現,也能夠配置專門的策略來實現對×××路由信息的控制。爲了省事起見,我這裏採用直接關閉BGP默認的route-target過濾來實現。
因爲這種方案須要在ASBR上保存全部的×××路由,所以這自己就是對路由器提出了很高的要求,使ASBR更容易成爲故障點。不過只要×××的路由數量不是不少,這種方案不失爲一種配置簡單且實用的方案。
4 數據設計
因爲通常的跨域×××配置示例都是兩個AS,這裏我故意調整成了三個AS,其實也沒什麼變化,就是多配置一些EBGP鄰居而已。
Loopback地址:202.1.1.X/32,X=1、2、3、4、5、6,即路由器序號;
接口地址:80.X.Y.Z/24,X/Y=路由器序號,Z=1、2,路由器序號小的爲1,大的爲2;
IGP:PE-P-PE之間部署OSPF和LDP,ASBR之間不起用任何IGP,只創建MEBGP鄰居;
AS:R1和R2AS號爲200,R3的AS號爲300,R4和R6的AS號爲400;
Vrf:R1上配置兩個vrf
Vrf20 RD=100:20 RT=100:20 路由爲
10.0.30
.0/24
Vrf30 RD=100:30 RT=100:30 路由爲
10.0.30
.0/24
配置爲不一樣***相同的路由是客觀驗證一下***路由地址重疊的狀況。
R6上配置兩個vrf
Vrf20 RD=100:20 RT=100:20 路由爲60.0.20.0/24
Vrf30 RD=100:30 RT=100:30 路由爲60.0.30.0/24
驗證:從R6上ping R1上的vrf地址,在R4-R5之間的鏈路上抓包。
分析報文的標籤嵌套狀況,正常狀況應該是:
R1-R6方向的報文應該是兩層標籤,
R6-R1方向的報文應該是一層標籤。
5 詳細配置
爲了節約版本,只羅列出6臺路由器的相關配置,其餘無關配置均不貼出來。
[R1]
R1#
R1#show run
!
version 12.4
!
hostname R1
!
ip cef
!
!
ip vrf vrf10
rd 100:10
route-target export 100:10
route-target import 100:10
!
ip vrf vrf20
rd 100:20
route-target export 100:20
route-target import 100:20
!
ip vrf vrf30
rd 100:30
route-target export 100:30
route-target import 100:30
!
interface Loopback0
ip address 202.1.1.1 255.255.255.255
!
interface Ethernet4/0
ip address 80.1.2.1 255.255.255.0
duplex full
mpls ip
!
interface Ethernet4/6
ip vrf forwarding vrf20
ip address
10.0.30
.1 255.255.255.0
duplex half
!
interface Ethernet4/7
ip vrf forwarding vrf30
ip address
10.0.30
.1 255.255.255.0
duplex half
!
router ospf 1
log-adjacency-changes
network 80.1.2.0
0.0.0
.255 area 0
network 202.1.1.1
0.0.0
.0 area 0
!
router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 202.1.1.2 remote-as 200
neighbor 202.1.1.2 update-source Loopback0
no auto-summary
!
address-family ***v4
neighbor 202.1.1.2 activate
neighbor 202.1.1.2 send-community extended
exit-address-family
!
address-family ipv4 vrf vrf30
redistribute connected
no synchronization
exit-address-family
!
address-family ipv4 vrf vrf20
redistribute connected
no synchronization
exit-address-family
!
address-family ipv4 vrf vrf10
no synchronization
exit-address-family
!
end
[R2]
R2#show run
!
version 12.4
!
hostname R2
!
ip cef
!
interface Loopback0
ip address 202.1.1.2 255.255.255.255
!
interface Ethernet4/0
ip address 80.1.2.2 255.255.255.0
duplex full
mpls ip
!
interface Ethernet4/1
ip address 80.2.3.1 255.255.255.0
duplex full
!
router ospf 1
log-adjacency-changes
network 80.1.2.0
0.0.0
.255 area 0
network 202.1.1.2
0.0.0
.0 area 0
!
router bgp 200
no synchronization
no bgp default route-target filter
bgp log-neighbor-changes
neighbor 80.2.3.2 remote-as 300
neighbor 202.1.1.1 remote-as 200
neighbor 202.1.1.1 update-source Loopback0
no auto-summary
!
address-family ***v4
neighbor 80.2.3.2 activate
neighbor 80.2.3.2 send-community extended
neighbor 202.1.1.1 activate
neighbor 202.1.1.1 send-community extended
neighbor 202.1.1.1 next-hop-self
exit-address-family
!
end
[R3]
R3#show run
!
version 12.4
!
hostname R3
!
ip cef
!
no mpls ip
!
interface Loopback0
ip address 202.1.1.3 255.255.255.255
!
interface Ethernet4/1
ip address 80.2.3.2 255.255.255.0
duplex full
!
interface Ethernet4/2
ip address 80.3.4.1 255.255.255.0
duplex half
!
router bgp 300
no synchronization
no bgp default route-target filter
bgp log-neighbor-changes
neighbor 80.2.3.1 remote-as 200
neighbor 80.3.4.2 remote-as 400
no auto-summary
!
address-family ***v4
neighbor 80.2.3.1 activate
neighbor 80.2.3.1 send-community extended
neighbor 80.3.4.2 activate
neighbor 80.3.4.2 send-community extended
exit-address-family
!
end
[R4]
R4#show run
!
version 12.4
!
hostname R4
!
ip cef
!
interface Loopback0
ip address 202.1.1.4 255.255.255.255
!
interface Ethernet4/2
ip address 80.3.4.2 255.255.255.0
duplex half
!
interface Ethernet4/3
ip address 80.4.5.1 255.255.255.0
duplex half
mpls ip
!
router ospf 1
log-adjacency-changes
network 80.3.4.0
0.0.0
.255 area 0
network 80.4.5.0
0.0.0
.255 area 0
network 202.1.1.4
0.0.0
.0 area 0
!
router bgp 400
no synchronization
no bgp default route-target filter
bgp log-neighbor-changes
neighbor 80.3.4.1 remote-as 300
neighbor 202.1.1.6 remote-as 400
neighbor 202.1.1.6 update-source Loopback0
no auto-summary
!
address-family ***v4
neighbor 80.3.4.1 activate
neighbor 80.3.4.1 send-community extended
neighbor 202.1.1.6 activate
neighbor 202.1.1.6 send-community extended
neighbor 202.1.1.6 next-hop-self
exit-address-family
!
end
[R5]
R5#show run
!
version 12.4
!
hostname R5
!
ip cef
!
interface Loopback0
ip address 202.1.1.5 255.255.255.255
!
interface Ethernet4/0
ip address 80.5.6.1 255.255.255.0
duplex half
mpls ip
!
interface Ethernet4/3
ip address 80.4.5.2 255.255.255.0
duplex half
mpls ip
!
router ospf 1
log-adjacency-changes
network 80.4.5.0
0.0.0
.255 area 0
network 80.5.6.0
0.0.0
.255 area 0
network 202.1.1.5
0.0.0
.0 area 0
!
end
[R6]
R6#show run
!
version 12.4
!
hostname R6
!
ip cef
!
ip vrf vrf10
rd 100:10
route-target export 100:10
route-target import 100:10
!
ip vrf vrf20
rd 100:20
route-target export 100:20
route-target import 100:20
!
ip vrf vrf30
rd 100:30
route-target export 100:30
route-target import 100:30
!
interface Loopback0
ip address 202.1.1.6 255.255.255.255
!
interface Ethernet4/0
ip address 80.5.6.2 255.255.255.0
duplex half
mpls ip
!
interface Ethernet4/6
ip vrf forwarding vrf20
ip address 60.0.20.1 255.255.255.0
duplex half
!
interface Ethernet4/7
ip vrf forwarding vrf30
ip address 60.0.30.1 255.255.255.0
duplex half
!
router ospf 1
log-adjacency-changes
network 80.5.6.0
0.0.0
.255 area 0
network 202.1.1.6
0.0.0
.0 area 0
!
router bgp 400
no synchronization
bgp log-neighbor-changes
neighbor 202.1.1.4 remote-as 400
neighbor 202.1.1.4 update-source Loopback0
no auto-summary
!
address-family ***v4
neighbor 202.1.1.4 activate
neighbor 202.1.1.4 send-community extended
exit-address-family
!
address-family ipv4 vrf vrf30
redistribute connected
no synchronization
exit-address-family
!
address-family ipv4 vrf vrf20
redistribute connected
no synchronization
exit-address-family
!
address-family ipv4 vrf vrf10
redistribute connected
no synchronization
exit-address-family
!
end
6 調試信息
查看各個BGP鄰居上的私網路由和標籤信息
[R1]
R1#show bgp ***v4 uni all
BGP table version is 15, local router ID is 202.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
NetworkNext Hop Metric LocPrf Weight Path
Route Distinguisher: 100:20 (default for vrf vrf20)
*>
10.0.30
.0/24
0.0.0
.0 0 32768 ?
*>i60.0.20.0/24 202.1.1.2 0 100 0 300 400 ?
Route Distinguisher: 100:30 (default for vrf vrf30)
*>
10.0.30
.0/24
0.0.0
.0 0 32768 ?
*>i60.0.30.0/24 202.1.1.2 0 100 0 300 400 ?
R1#show bgp ***v4 uni all labels
NetworkNext Hop In label/Out label
Route Distinguisher: 100:20 (vrf20)
10.0.30
.0/24
0.0.0
.0 17/aggregate(vrf20)
60.0.20.0/24 202.1.1.2 nolabel/23
Route Distinguisher: 100:30 (vrf30)
10.0.30
.0/24
0.0.0
.0 18/aggregate(vrf30)
60.0.30.0/24 202.1.1.2 nolabel/22
[R2]
R2#show bgp ***v4 uni all
BGP table version is 9, local router ID is 202.1.1.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
NetworkNext Hop Metric LocPrf Weight Path
Route Distinguisher: 100:20
*>i
10.0.30
.0/24 202.1.1.1 0 100 0 ?
*> 60.0.20.0/24 80.2.3.2 0 300 400 ?
Route Distinguisher: 100:30
*>i
10.0.30
.0/24 202.1.1.1 0 100 0 ?
*> 60.0.30.0/24 80.2.3.2 0 300 400 ?
R2#show bgp ***v4 uni all labels
NetworkNext Hop In label/Out label
Route Distinguisher: 100:20
10.0.30
.0/24 202.1.1.1 18/17
60.0.20.0/24 80.2.3.2 23/20
Route Distinguisher: 100:30
10.0.30
.0/24 202.1.1.1 19/18
60.0.30.0/24 80.2.3.2 22/21
[R3]
R3#show bgp ***v4 uni all
BGP table version is 5, local router ID is 202.1.1.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
NetworkNext Hop Metric LocPrf Weight Path
Route Distinguisher: 100:20
*>
10.0.30
.0/24 80.2.3.1 0 200 ?
*> 60.0.20.0/24 80.3.4.2 0 400 ?
Route Distinguisher: 100:30
*>
10.0.30
.0/24 80.2.3.1 0 200 ?
*> 60.0.30.0/24 80.3.4.2 0 400 ?
R3#show bgp ***v4 uni all labels
NetworkNext Hop In label/Out label
Route Distinguisher: 100:20
10.0.30
.0/24 80.2.3.1 19/18
60.0.20.0/24 80.3.4.2 20/22
Route Distinguisher: 100:30
10.0.30
.0/24 80.2.3.1 18/19
60.0.30.0/24 80.3.4.2 21/23
[R4]
R4#show bgp ***v4 uni all
BGP table version is 9, local router ID is 202.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
NetworkNext Hop Metric LocPrf Weight Path
Route Distinguisher: 100:20
*>
10.0.30
.0/24 80.3.4.1 0 300 200 ?
*>i60.0.20.0/24 202.1.1.6 0 100 0 ?
Route Distinguisher: 100:30
*>
10.0.30
.0/24 80.3.4.1 0 300 200 ?
*>i60.0.30.0/24 202.1.1.6 0 100 0 ?
R4#show bgp ***v4 uni all labels
NetworkNext Hop In label/Out label
Route Distinguisher: 100:20
10.0.30
.0/24 80.3.4.1 25/19
60.0.20.0/24 202.1.1.6 22/20
Route Distinguisher: 100:30
10.0.30
.0/24 80.3.4.1 24/18
60.0.30.0/24 202.1.1.6 23/21
[R6]
R6#show bgp ***v4 uni all
BGP table version is 15, local router ID is 202.1.1.6
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
NetworkNext Hop Metric LocPrf Weight Path
Route Distinguisher: 100:20 (default for vrf vrf20)
*>i
10.0.30
.0/24 202.1.1.4 0 100 0 300 200 ?
*> 60.0.20.0/24
0.0.0
.0 0 32768 ?
Route Distinguisher: 100:30 (default for vrf vrf30)
*>i
10.0.30
.0/24 202.1.1.4 0 100 0 300 200 ?
*> 60.0.30.0/24
0.0.0
.0 0 32768 ?
R6#show bgp ***v4 uni all labels
NetworkNext Hop In label/Out label
Route Distinguisher: 100:20 (vrf20)
10.0.30
.0/24 202.1.1.4 nolabel/25
60.0.20.0/24
0.0.0
.0 20/aggregate(vrf20)
Route Distinguisher: 100:30 (vrf30)
10.0.30
.0/24 202.1.1.4 nolabel/24
60.0.30.0/24
0.0.0
.0 21/aggregate(vrf30)
從上面的標籤信息能夠明顯的看出MBGP的×××路由觸發的標籤狀況,即在跨域的時候報文中是靠這些標籤指導轉發的,也從側面印證了前文中[改變下一跳]中所描述的×××路由觸發標籤分配的狀況。
查看實際的mpls標籤轉發表
[R1]
R1#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Pop tag 202.1.1.2/32 0Et4/0 80.1.2.2
17 Aggregate
10.0.30
.0/24[V] 0
18 Aggregate
10.0.30
.0/24[V] 0
[R2]
R2#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Pop tag 202.1.1.1/32 0Et4/0 80.1.2.1
17 Pop tag 80.2.3.2/32 0Et4/1 80.2.3.2
18 17 100:20:
10.0.30
.0/24 \ 0Et4/0 80.1.2.1
19 18 100:30:
10.0.30
.0/24 \ 0Et4/0 80.1.2.1
22 21 100:30:60.0.30.0/24 \ 0Et4/1 80.2.3.2
23 20 100:20:60.0.20.0/24 \ 0Et4/1 80.2.3.2
[R3]
R3#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Pop tag 80.2.3.1/32 0Et4/1 80.2.3.1
17 Pop tag 80.3.4.2/32 0Et4/2 80.3.4.2
18 19 100:30:
10.0.30
.0/24 \ 0Et4/1 80.2.3.1
19 18 100:20:
10.0.30
.0/24 \ 0Et4/1 80.2.3.1
20 22 100:20:60.0.20.0/24 \ 0Et4/2 80.3.4.2
21 23 100:30:60.0.30.0/24 \ 0Et4/2 80.3.4.2
[R4]
R4#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Pop tag 80.3.4.1/32 0Et4/2 80.3.4.1
17 Pop tag 80.5.6.0/24 0Et4/3 80.4.5.2
18 Pop tag 202.1.1.5/32 0Et4/3 80.4.5.2
19 18 202.1.1.6/32 0Et4/3 80.4.5.2
22 18 100:20:60.0.20.0/24 \ 0Et4/3 80.4.5.2
23 18 100:30:60.0.30.0/24 \ 0Et4/3 80.4.5.2
24 18 100:30:
10.0.30
.0/24 \ 0Et4/2 80.3.4.1
25 19 100:20:
10.0.30
.0/24 \ 0Et4/2 80.3.4.1
[R5]
R5#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Pop tag 80.3.4.0/24 0Et4/3 80.4.5.1
17 Pop tag 202.1.1.4/32 73 Et4/3 80.4.5.1
18 Pop tag 202.1.1.6/32 8236 Et4/0 80.5.6.2
[R6]
R6#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
16 Pop tag 80.4.5.0/24 0Et4/0 80.5.6.1
17 16 80.3.4.0/24 0Et4/0 80.5.6.1
18 17 202.1.1.4/32 0Et4/0 80.5.6.1
19 Pop tag 202.1.1.5/32 0Et4/0 80.5.6.1
20 Aggregate 60.0.20.0/24[V] 0
21 Aggregate 60.0.30.0/24[V] 0
從上面的信息咱們看出,在ASBR上可以明顯的看到×××V4的路由信息對應的標籤轉發項。
公網標籤和私網標籤
前面提到從R6上ping R1上的vrf地址,在R4-R5之間的鏈路上抓包。而後分析報文的標籤嵌套狀況,正常狀況應該是:
R1-R6方向的報文應該是兩層標籤,公網標籤+私網標籤;
R6-R1方向的報文應該是一層標籤,公網標籤被彈出,只剩餘私網標籤。
能夠經過下面的抓包圖片進行驗證:
R1-R6方向的兩層標籤
R6-R1方向的一層標籤
根據朋友的提醒,在此增長從R6到R1的私網路由trace信息,能夠清楚的看到沿途標籤信息的變化:
R6#traceroute vrf vrf30
Protocol [ip]:
Target IP address: 10.0.30.1
Source address: 60.0.30.1
Numeric display [n]:
Resolve AS number in (G)lobal table, (V)RF or(N)one [G]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 10.0.30.1
1 80.5.6.1 [MPLS: Labels 17/21 Exp 0] 180 msec 224 msec 144 msec 2 80.4.5.1 [MPLS: Label 21 Exp 0] 156 msec 208 msec 192 msec 3 80.3.4.1 [MPLS: Label 18 Exp 0] 180 msec 272 msec 236 msec 4 80.2.3.1 [MPLS: Label 19 Exp 0] 164 msec 192 msec 364 msec 5 10.0.30.1 220 msec 196 msec *