多自治系統之間MPLS *** 實施詳解
實驗拓撲入上如圖所示:
基礎配置說明:
所有設備都配置lo 0 地址,地址爲設備序列號如R1(1.1.1.1/32);
設備互聯地址使用10.1.R1R2.R1,如R1和R2互聯地址就爲10.1.12.1;
AS100 配置ospf進程100,AS200配置OSPF進程200,lo 0接口通告進OSPF進程;
基本配置:
在AS100和AS200中配置OSPF進程100和200
在AS100和AS200中配置mpls
PE-CE路由器之間配置OSPF,並在PE路由器上相互重分發
配置思路:
PE路由器PE1、PE2分別和RR路由器RR1、RR2之間建立MP-iBGP鄰居關係,從而使得RR1和RR2能夠學習到去往CE1和CE2的***V4路由條目;
此時,只要兩個RR之間能互相交換***V4路由條目,就可以實現CE1和CE2網絡互通;
爲了使得RR1和RR2之間能夠互相學習***V4路由,需要在RR1和RR2之間配置MP-EBGP鄰居關係,使用各自的LO 0地址;
爲了使得RR1和RR2的lo 0 接口能夠互相學習到彼此的路由,在ASBR1和ASBR2之間配置普通EBGP鄰居關係,並將RR1和RR2的lo 0 接口路由通告進BGP進程100和200,從而使得RR1和RR2能夠學習到彼此的lo 0網絡;
通過以上配置,MP-EBGP鄰居關係已經能夠建立,並且能夠互相學習到彼此的***V4路由:
在R1和R6上分別查看***V4路由,如下:
R1#show ip bgp ***v4 all
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 100:1 (default for vrf cisco)
*> 7.7.7.7/32 10.1.17.7 11 32768 ?
*> 10.1.17.0/24 0.0.0.0 0 32768 ?
Route Distinguisher: 100:6
* i8.8.8.8/32 5.5.5.5 0 100 0 200 ?
* i10.1.68.0/24 5.5.5.5 0 100 0 200 ?
R6#show ip bgp ***v4 all
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 100:1
* i7.7.7.7/32 2.2.2.2 0 100 0 100 ?
* i10.1.17.0/24 2.2.2.2 0 100 0 100 ?
Route Distinguisher: 100:6 (default for vrf cisco)
*> 8.8.8.8/32 10.1.68.8 11 32768 ?
*> 10.1.68.0/24 0.0.0.0 0 32768 ?
可以看到相互學習到的路由爲不優路由,這是因爲路由的下一跳2.2.2.2和5.5.5.5不可達的原因造成的。因爲PE1和PE2沒有和RR建立普通BGP鄰居關係,並且RR也不是普通BGP的路由反射器;
BGP路由不優就會導致在重分發時,不能將路由重分發進CE和PE間的OSPF,所以R7和R8學習不到互相的路由,如下:
R7#show ip route
7.0.0.0/32 is subnetted, 1 subnets
C 7.7.7.7 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.17.0 is directly connected, Ethernet0/0
R8#show ip route
8.0.0.0/32 is subnetted, 1 subnets
C 8.8.8.8 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.68.0 is directly connected, Ethernet0/0
爲了解決以上問題,在RR上分別針對PE路由器配置next-hop-self,如下:
R2(config)#router bgp 100
R2(config-router)#address-family ***v4
R2(config-router-af)#neighbor 1.1.1.1 next-hop-self
R2(config)#router bgp 100
R2(config-router)#address-family ***v4
R2(config-router-af)#neighbor 1.1.1.1 next-hop-self
然後在R7和R8上查看路由,如下:
R7#show ip route
7.0.0.0/32 is subnetted, 1 subnets
C 7.7.7.7 is directly connected, Loopback0
8.0.0.0/32 is subnetted, 1 subnets
O IA 8.8.8.8 [110/11] via 10.1.17.1, 00:02:00, Ethernet0/0
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.17.0 is directly connected, Ethernet0/0
O IA 10.1.68.0 [110/11] via 10.1.17.1, 00:02:00, Ethernet0/0
R8#show ip route
7.0.0.0/32 is subnetted, 1 subnets
O IA 7.7.7.7 [110/11] via 10.1.68.6, 00:01:44, Ethernet0/0
8.0.0.0/32 is subnetted, 1 subnets
C 8.8.8.8 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 2 subnets
O IA 10.1.17.0 [110/11] via 10.1.68.6, 00:01:44, Ethernet0/0
C 10.1.68.0 is directly connected, Ethernet0/0
可以看到,R7和R8已經互相學習到了彼此的路由,進行ping測試如下:
R7#ping 8.8.8.8 source loopback 0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
Packet sent with a source address of 7.7.7.7
.....
Success rate is 0 percent (0/5)
可以看到,雖然已經學習到了彼此的路由,但是並不能實現數據通信。
數據轉發分析:
1、當R7 ping 8.8.8.8 source 7.7.7.7是,數據被送往先一條10.1.17.1,進入PE1的VRF中;
2、進入PE1VFR後,數據需要進行標籤轉發,查看8.8.8.8的標籤在PE1中,如下:
R1#show ip bgp ***v4 rd 100:6 labels
Network Next Hop In label/Out label
Route Distinguisher: 100:6
8.8.8.8/32 2.2.2.2 nolabel/205
10.1.68.0/24 2.2.2.2 nolabel/204
可以看到8.8.8.8的出站標籤爲205,此時ip數據包頭就會封裝***標籤205,然後查找路由下一跳爲2.2.2.2;
3、然後進入標籤轉發,查看2.2.2.2的標籤,如下:
R1# show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
100 Pop tag 2.2.2.2/32 0 Et0/1 10.1.12.2
101 201 3.3.3.3/32 0 Et0/1 10.1.12.2
102 Pop tag 10.1.23.0/24 0 Et0/1 10.1.12.2
103 Untagged 7.7.7.7/32[V] 1140 Et0/0 10.1.17.7
104 Aggregate 10.1.17.0/24[V] 0
因爲2.2.2.2的標籤由RR1通告,所以爲隱式空標籤,數據在PE1上將只被***標籤205封裝後發送給RR1,然後RR1,根據***標籤205進行標籤轉發,RR1的標籤如下:
R2#show ip bgp ***v4 rd 100:6 labels
Network Next Hop In label/Out label
Route Distinguisher: 100:6
8.8.8.8/32 5.5.5.5 205/503
10.1.68.0/24 5.5.5.5 204/504
所以數據包的***標籤將被交換爲503後由下一跳5.5.5.5轉發,查看5.5.5.5的標籤:
R2#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
200 Pop tag 1.1.1.1/32 0 Et0/1 10.1.12.1
201 Pop tag 3.3.3.3/32 0 Et0/0 10.1.23.3
202 103 100:1:7.7.7.7/32 1180 Et0/1 10.1.12.1
203 104 100:1:10.1.17.0/24 \
0 Et0/1 10.1.12.1
204 504 100:6:10.1.68.0/24 \
0 Et0/0 10.1.23.3
205 503 100:6:8.8.8.8/32 1770 Et0/0 10.1.23.3
可以看到,LDP沒有給5.5.5.5分發標籤,因爲5.5.5.5是BGP路由,LDP是不會給BGP路由分發標籤的,所以數據在此丟棄!
通過分析,可以看到數據在PE上封裝了一層***標籤,這肯定不合理,在一個AS域中,數據交換應該是按照LDP分發的標籤進行交換的,所以針對8.8.8.8路由的下一跳保持不變爲5.5.5.5
將上面配置的next-hop-self刪除
爲了使得LDP能給BGP路由5.5.5.5和2.2.2.2分配標籤,我們將5.5.5.5和2.2.2.2的BGP路由在ASBR1和ASBR2上重分發進ospf 100和200,如下:
R3(config)#router ospf 100
R3(config-router)#redistribute bgp 100 subnets
R4(config)#router ospf 200
R4(config-router)#redistribute bgp 200 subnets
再次測試:
R7#ping 8.8.8.8 source loopback 0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
Packet sent with a source address of 7.7.7.7
.....
Success rate is 0 percent (0/5)
還是不通,
再次進行數據轉發分析:
R7將目的8.8.8.8 源7.7.7.7的IP數據包路由給R1後,R1根據如下的***V4標籤表和LFIB表,對數據進行封裝
R1#show ip bgp ***v4 rd 100:6 labels
Network Next Hop In label/Out label
Route Distinguisher: 100:6
8.8.8.8/32 2.2.2.2 nolabel/205
10.1.68.0/24 2.2.2.2 nolabel/204
R1#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
100 Pop tag 2.2.2.2/32 0 Et0/1 10.1.12.2
101 201 3.3.3.3/32 0 Et0/1 10.1.12.2
102 Pop tag 10.1.23.0/24 0 Et0/1 10.1.12.2
103 Untagged 7.7.7.7/32[V] 1140 Et0/0 10.1.17.7
104 Aggregate 10.1.17.0/24[V] 0
105 206 5.5.5.5/32 0 Et0/1 10.1.12.2
可以看到數據將被封裝底層***標籤205,頂層IGP標籤206,然後轉發給RR1;
RR1收到數據包後,查看LFIB表,如下,進行轉發:
R2#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
200 Pop tag 1.1.1.1/32 0 Et0/1 10.1.12.1
201 Pop tag 3.3.3.3/32 0 Et0/0 10.1.23.3
202 103 100:1:7.7.7.7/32 1180 Et0/1 10.1.12.1
203 104 100:1:10.1.17.0/24 \
0 Et0/1 10.1.12.1
206 Untagged 5.5.5.5/32 0 Et0/0 10.1.23.3
可以看到,標籤206被交換後,將Untagged ,所以數據還是不能轉發。
分析原因如下:
因爲ASBR1和ASBR2依然不能給自己路由表裏的BGP路由5.5.5.5和2.2.2.2分發標籤,此時就會用到BGP擴展功能,就是配置讓普通BGP可以發送標籤,在ASBR1和ASBR2上分別配置,如下:
R3(config)#router bgp 100
R3(config-router)#neighbor 10.1.34.4 send-label
R4(config)#router bgp 200
R4(config-router)#neighbor 10.1.34.3 send-label
在此查看RR1的標籤轉發數據庫,如下:
R2#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
200 Pop tag 1.1.1.1/32 0 Et0/1 10.1.12.1
201 Pop tag 3.3.3.3/32 0 Et0/0 10.1.23.3
202 103 100:1:7.7.7.7/32 1180 Et0/1 10.1.12.1
203 104 100:1:10.1.17.0/24 \
0 Et0/1 10.1.12.1
204 304 100:6:10.1.68.0/24 \
0 Et0/0 10.1.23.3
205 304 100:6:8.8.8.8/32 1770 Et0/0 10.1.23.3
207 304 5.5.5.5/32 0 Et0/0 10.1.23.3
在R7上進行聯通性測試:
R7#ping 8.8.8.8 source loopback 0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
Packet sent with a source address of 7.7.7.7
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 120/141/156 ms
可以看到數據已經可以通行了!!!
***標籤傳遞分析:
R6#show ip bgp ***v4 rd 100:6 labels
Network Next Hop In label/Out label
Route Distinguisher: 100:6 (cisco)
7.7.7.7/32 5.5.5.5 nolabel/502
8.8.8.8/32 10.1.68.8 604/nolabel
10.1.17.0/24 5.5.5.5 nolabel/505
10.1.68.0/24 0.0.0.0 605/aggregate(cisco)
R5#show ip bgp ***v4 RD 100:6 LAbels
Network Next Hop In label/Out label
Route Distinguisher: 100:6
8.8.8.8/32 6.6.6.6 503/604
10.1.68.0/24 6.6.6.6 504/605
R2#SHOw IP BGp ***v4 RD 100:6 LAbels
Network Next Hop In label/Out label
Route Distinguisher: 100:6
8.8.8.8/32 5.5.5.5 205/503
10.1.68.0/24 5.5.5.5 204/504
R1#SHOw IP BGp ***v4 RD 100:6 LAbels
Network Next Hop In label/Out label
Route Distinguisher: 100:6
8.8.8.8/32 5.5.5.5 nolabel/503
10.1.68.0/24 5.5.5.5 nolabel/504
以上就是***V4標籤飛分發路徑,可以自己分析一下。。。。。。。。可以看到R1和R2對路由8.8.8.8的標籤都爲503
未完待續。。