Cisco MIBGP MPLS ×××配置指導

Cisco MIBGP MPLS ×××配置指導
  
 

1 BGP/MPLS ×××概述

BGP/MPLS ×××是一種三層×××技術,該技術使用MBGP在骨幹網絡發佈×××V4路由,使用MPLS在骨幹網上轉發×××報文。三層×××一般部署在運營商或者大型企業網內部,因爲其可以比較方便的支持MPLS QoS和TE技術,所以做爲企業DCN網絡的基本模型獲得愈來愈普遍的應用。
本文主要提供Cisco設備自治系統內的三層×××配置,並對關鍵點進行簡單分析。

2 一些基本概念

 
 
 
如上圖,整個三層×××網絡主要由CE、PE和P設備這三部分組成;圖中的R1和R5爲CE設備,即用戶網絡邊緣設備,能夠是一個用戶網絡,也能夠是一臺路由器,也能夠是一臺用戶主機,對於CE而言,CE感知不到×××的存在,也不須要支持MPLS功能,做爲CE,它與PE直連,只須要支持普通IP便可,與PE互通的網絡協議能夠是EBGP、多實例的IGP或者靜態路由,這個是具體狀況而言,本文的配置採用EBGP鏈接PE和CE;圖中的R2和R4爲PE設備,即服務提供商邊緣設備,與CE直連,在三層×××網絡中,對於×××的處理都發生在PE上;圖中的R3爲P設備,即整個網絡中的骨幹路由器,不與CE直連,P能夠和PE鏈接,也能夠和P鏈接,固然也能夠不存在,即整個三層×××網絡中只有PE設備,沒有P設備,對於P而言,只須要具備基本的MPLS轉發能力便可。
 
RD:Route Distinguisher,RD 用於發佈×××路由時區分使用相同地址的IPv4 前綴,好比兩個不一樣的×××均有相同的IPv4前綴,若是不加以區分的話,就不可以正常的經過BGP發佈給鄰居,這裏經過RD和普通的IPv4前綴造成一個新的×××V4的地址,而後經過MBGP發佈給對端鄰居,從而區分不一樣×××中的相同地址,這樣就能夠實現三層×××中地址重疊這一功能。須要注意的是必須保證RD值全局惟一,即不一樣的×××設置不一樣的RD。具體的RD格式這裏不做詳細描述。
 
RT:Route Target,RT是一種BGP擴展團體屬性,用來控制××× 路由信息的發佈。因爲RD不能用於判斷某條路由的發起者,也不能判斷某條路由屬於哪一個×××。這時就須要用到RT,RT用來描述一條×××v4路由能夠爲哪些×××所接收,以及PE能夠接收哪些×××發送來的路由。
 

3 網絡分析

R二、R3和R4之間部署IGP和LDP,R2和R4之間創建MIBG鄰居;
R1和R二、R4和R5之間分別創建普通EBGP鄰居;
R2和R4上配置vrf,將其與R1和R5直連的鏈路配置屬於該vrf。
 

4 數據設計

Loopback地址:202.1.1.X/32,X=一、二、三、四、5,即路由器序號;
接口地址:80.X.Y.Z/24,X/Y=路由器序號,Z=一、2,路由器序號小的爲1,大的爲2;
IGP:PE-P-PE之間部署OSPF和LDP;
AS:R2和R4的AS號爲100,R1的AS號爲1000,R5的AS號爲5000;
Vrf:RT爲100:1,RD爲100:1。
 

5 配置步驟

配置LSR的各接口地址;
配置OSPF保證LSR之間可達;
配置MPLS基本能力;
配置MIBGP和EBGP;
配置vrf以及相應的RD、RT。

6 詳細配置

爲了節約版本,只羅列出5臺路由器的相關配置,其餘無關配置均不貼出來。
[R1]
   
R1#show run   
!   
version 12.4  
!   
hostname R1   
!   
ip cef   
!   
no mpls ip
!   
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  
!   
router bgp 1000
 no synchronization
 bgp log-neighbor-changes
 redistribute connected 
 neighbor 80.1.2.2 remote-as 100  
 no auto-summary   
!   
end 
 
 
[R2]
R2#show run   
!   
version 12.4  
!   
hostname R2   
!   
ip cef   
!   
ip vrf vrf1   
 rd 100:1
 route-target export 100:1   
 route-target import 100:1   
!   
interface Loopback0
 ip address 202.1.1.2 255.255.255.255  
!   
interface Ethernet4/0   
 ip vrf forwarding vrf1 
 ip address 80.1.2.2 255.255.255.0
 duplex full  
!   
interface Ethernet4/1   
 ip address 80.2.3.1 255.255.255.0
 duplex full  
 mpls ip 
!   
router ospf 1 
 log-adjacency-changes  
 network 80.1.2.0 0.0.0.255 area 0
 network 80.2.3.0 0.0.0.255 area 0
 network 202.1.1.2 0.0.0.0 area 0 
!   
router bgp 100
 bgp log-neighbor-changes
 neighbor 202.1.1.4 remote-as 100 
 neighbor 202.1.1.4 update-source Loopback0 
 !  
 address-family ipv4
 no neighbor 202.1.1.4 activate   
 no auto-summary   
 no synchronization
 exit-address-family
 !  
 address-family ***v4   
 neighbor 202.1.1.4 activate 
 neighbor 202.1.1.4 send-community extended 
 exit-address-family
 !  
 address-family ipv4 vrf vrf1
 redistribute connected 
 neighbor 80.1.2.1 remote-as 1000 
 neighbor 80.1.2.1 activate  
 no synchronization
 exit-address-family
!   
end 
 
[R3]
R3#show run   
!   
version 12.4  
!   
hostname R3   
!   
ip cef   
!   
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  
 mpls ip 
!   
interface Ethernet4/2   
 ip address 80.3.4.1 255.255.255.0
 duplex half  
 mpls ip 
!   
router ospf 1 
 log-adjacency-changes  
 network 80.1.3.0 0.0.0.255 area 0
 network 80.2.3.0 0.0.0.255 area 0
 network 80.3.4.0 0.0.0.255 area 0
 network 202.1.1.3 0.0.0.0 area 0 
!   
end   
 
[R4]
R4#show run   
!   
version 12.4  
!   
hostname R4   
!   
ip cef   
!   
ip vrf vrf1   
 rd 100:1
 route-target export 100:1   
 route-target import 100:1   
!   
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  
 mpls ip 
!   
interface Ethernet4/3   
 ip vrf forwarding vrf1 
 ip address 80.4.5.1 255.255.255.0
 duplex half  
!   
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 100
 bgp log-neighbor-changes
 neighbor 202.1.1.2 remote-as 100 
 neighbor 202.1.1.2 update-source Loopback0 
 !  
 address-family ipv4
 no neighbor 202.1.1.2 activate   
 no auto-summary   
 no synchronization
 exit-address-family
 !  
 address-family ***v4   
 neighbor 202.1.1.2 activate 
 neighbor 202.1.1.2 send-community extended 
 exit-address-family
 !  
 address-family ipv4 vrf vrf1
 neighbor 80.4.5.2 remote-as 5000 
 neighbor 80.4.5.2 activate  
 no synchronization
 exit-address-family
!   
end 
 
[R5]
R5# 
R5#show run   
!   
version 12.4  
!   
hostname R5   
!   
ip cef   
!   
no mpls ip
!   
interface Loopback0
 ip address 202.1.1.5 255.255.255.255  
!   
interface Ethernet4/3   
 ip address 80.4.5.2 255.255.255.0
 duplex half  
!   
router bgp 5000
 no synchronization
 bgp log-neighbor-changes
 redistribute connected 
 neighbor 80.4.5.1 remote-as 100  
 no auto-summary   
!   
end
R5#
 

7 顯示信息

BGP 鄰居的創建
 
在R2上顯示BGP鄰居能夠看出,R2和R1創建EBGP鄰居,和R4創建MIBGP鄰居:
 
R2#show bgp ***v4 unicast all neighbors
BGP neighbor is 80.1.2.1,  vrf vrf1,  remote AS 1000, external link  
  BGP version 4, remote router ID 202.1.1.1 
  BGP state = Established, up for 00:57:54  
  Last read 00:00:55, last write 00:00:55, hold time is 180, keepalive interval
is 60 seconds 
  Neighbor capabilities:
    Route refresh: advertised and received(old & new) 
    Address family IPv4 Unicast: advertised and received   
 
BGP neighbor is 202.1.1.4,  remote AS 100, internal link   
  BGP version 4, remote router ID 202.1.1.4 
  BGP state = Established, up for 00:56:46  
  Last read 00:00:46, last write 00:00:46, hold time is 180, keepalive interval
is 60 seconds 
  Neighbor capabilities:
    Route refresh: advertised and received(old & new) 
    Address family ×××v4 Unicast: advertised and received  
 
當BGP鄰居創建好以後,此時R2已經可以學習到×××V4路由,以下:
R2#show ip route vrf vrf1
 
Routing Table: vrf1
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP  
  D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
  N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
  E1 - OSPF external type 1, E2 - OSPF external type 2
  i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2   
  ia - IS-IS inter area, * - candidate default, U - per-user static route 
  o - ODR, P - periodic downloaded static route  
 
Gateway of last resort is not set 
 
80.0.0.0/24 is subnetted, 2 subnets
B  80.4.5.0 [200/0] via 202.1.1.4, 00:57:58 
C  80.1.2.0 is directly connected, Ethernet4/0   
202.1.1.0/32 is subnetted, 2 subnets   
B  202.1.1.1 [20/0] via 80.1.2.1, 00:59:13  
B  202.1.1.5 [200/0] via 202.1.1.4, 00:57:58 
R1和R5上也有各自的路由信息了,可是此時若是在R1上ping R5,卻不能通,爲何?由於BGP只是用於信令層面上的路由信息的發佈,要打通轉發層面,必須在R2-R3-R4之間配置LDP。
 
公網標籤和私網標籤
 
在徹底作好配置以後,咱們能夠在R2和R4上看到公網標籤和私網標籤,公網標籤是由LDP觸發的,因爲指導×××數據報文在MPLS域中轉發,而私網標籤則是由MBGP觸發的,用於指導×××數據在私網×××中的轉發,這一點在跨域的三層×××中體現的比較明顯。從公網和私網標籤的簡單分析,咱們能夠看出×××中的數據轉發時,是攜帶了兩層MPLS標籤的,即內層標籤爲私網標籤,外層標籤爲公網標籤,這裏咱們能夠經過顯示標籤信息和捕獲數據報文映射對比一下。
 
在R4上顯示LDP公網標籤,能夠看出R4到R2出標籤爲16:
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.2.3.0/24  0   Et4/2 80.3.4.1  
17   16   202.1.1.2/32   0   Et4/2 80.3.4.1  
18   Pop tag   202.1.1.3/32 0   Et4/2 80.3.4.1  
19   Untagged    202.1.1.5/32[V]   3420  Et4/3 80.4.5.2  
20   Aggregate   80.4.5.0/24[V]    0 
R4#
 
在R4上顯示MBGP私網標籤,能夠看出到R1的出標籤爲19:
R4#show bgp ***v4 unicast all labels   
   NetworkNext Hop In label/Out label  
Route Distinguisher: 100:1 (vrf1) 
   80.1.2.0/24 202.1.1.2  nolabel/18   
   80.4.5.0/24 80.4.5.2   20/aggregate(vrf1)
   202.1.1.1/32 202.1.1.2  nolabel/19   
   202.1.1.5/32 80.4.5.2   19/nolabel
 
那麼正常的從R5到R1的×××數據的標籤頭就應該是 16|19,從下面捕獲的報文中咱們就能夠看出確實如此:
 
    
 
 
總結:本文寫的不是很詳細,惟有配置最完整,用以提供給有必定基礎的兄弟參考,網絡這個東西不能閉門造車,溝通越多提升越快。
相關文章
相關標籤/搜索