Cisco三層×××流量導入TE隧道轉發
Maa nj 2007-12-31
『一點祝福』
2007年終於走到了最後一天,在這以前,從沒想到過本身會隻身來到南京,來到這個陌生的異地,或許因緣際會吧,只爲認識你,或許有一天本身終將離開,或許這一天會很快,可是在之後本身全部的日子裏,我都會默默的爲你祝福,獲得屬於本身的幸福。
最近作了一個MPLS網絡的項目,其中一些總結,想寫出來分享一下。
該網絡的核心部署MPLS TE和三層×××,其中三層×××的私網流量經過MPLS TE隧道進行轉發,因爲MPLS TE隧道具備資源預留和帶寬保證等優點,可以爲私網流量轉發提供比較好的質量保證,經過TE隧道支持FRR快速重路由切換,當核心網絡鏈路或者節點失效發生時,經過TE FRR切換,能夠達到50ms級的流量快速倒換,最大限度的保證核心網絡的流量轉發。
正由於如此,才由MPLS TE隧道代替了日常三層×××中的LDP,做爲私網流量在公網轉發的通道,因此在整個核心網絡的部署中,是不須要部署LDP的。三層×××的配置和TE的基本配置都很廣泛了,所以不是要提到的重點,本文要提的重點,是私網流量引入TE隧道的方式以及對該方式的理解。
如圖所示,R1、R2和R3上均部署MPLS TE,R1和R3做爲PE設備部署三層×××,IGP路由協議採用OSPF。在部署好以後,咱們能夠在兩個PE上看到對應的私網路由信息,以下:
R1#show ip route vrf ***1
Routing Table: ***1
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
13.0.0
.0/24 is subnetted, 1 subnets
C
13.1.2
.0 is directly connected, Ethernet4/7
31.0.0.0/24 is subnetted, 1 subnets
B 31.1.2.0 [200/0] via 202.1.1.3, 01:54:45
R3#show ip route vrf ***1
Routing Table: ***1
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
13.0.0
.0/24 is subnetted, 1 subnets
B
13.1.2
.0 [200/0] via 202.1.1.1, 01:56:41
31.0.0.0/24 is subnetted, 1 subnets
C 31.1.2.0 is directly connected, Ethernet4/7
R3#
能夠看出這時私網路由都指向了對端PE的BGP建鏈的loopback地址,可是隻是有了私網路由,在轉發層面上仍是不可能通的,由於這個時候私網標籤是不能指導公網轉發的,可是又必須保證私網標籤在到達對端PE以前不會被錯誤的剝掉,這時就須要公網標籤封裝在私網標籤以外,完成在公網這一段的數據報文轉發,之前是LDP的標籤,那麼如今沒有LDP,天然就是TE的標籤了,其實這個時候,回想一下,私網流量的轉發原理無非就是如此了,無論你外層須要嵌套多少層標籤,也只是爲了保證BGP分配的私網標籤可以正確的被攜帶到對端PE。
那麼這個時候,須要作的只是在兩端PE上配置一條到對端PE BGP創建地址的靜態路由指向TE隧道。爲何這樣作呢,讓我再連貫起來講上一下就清楚了。好比,我在R1上查看到R3上私網地址31.1.2.0/24的路由下一跳是指向202.1.1.3的,這個時候給數據封裝一層私網標籤;可是202.1.1.3這個地址並非R1的地址,會繼續查路由表,查到下一跳爲TE隧道,而該TE隧道是本地的直鏈接口,因而再封裝一層TE隧道的出標籤做爲公網標籤進行轉發。這裏實際上是一個路由迭代的問題,在迭代的過程當中也肯定了內層標籤和外層標籤的位置,而這個時候有了公網標籤,私網流量天然也能經過TE隧道進行轉發了。
在本文中,配置靜態路由就是一種將私網流量引入TE隧道轉發的方式;一樣的,若是TE隧道支持自動路由,那麼經過自動路由的方式也是能夠將私網流量引入TE隧道轉發的。其實,不管是靜態路由仍是自動路由,其本質是將BGP的建鏈地址發佈到路由表中,而後經過路由迭代將私網流量引進隧道。
可是這樣的方式,目前看來只是一個實現,由於這樣仍是有很大侷限的,由於全部不一樣的×××都會經過同一個TE隧道進行轉發,同一隧道對於全部的×××提供的都是相同的服務質量和帶寬資源。還有其餘的方式,好比在vrf下面指定該vrf流量選擇的TE隧道,這樣就能夠根據不一樣的×××選擇不一樣的TE隧道轉發,還有就是根據策略路由指定不一樣的×××進入合適的TE隧道等等,因爲侷限於目前手上的版本,所以只能作這樣最簡單的實現,可是這裏提到這些是但願提醒你們,不要由於個人講述而限制了你們的思惟。
後面是我得一個簡單配置,提供給有興趣的朋友作參考。
『R1配置』
R1#show run
Building configuration...
Current configuration : 2071 bytes
!
version 12.4
!
hostname R1
!
ip vrf ***1
rd 100:1
route-target export 100:1
route-target import 100:1
!
!
mpls traffic-eng tunnels
!
interface Tunnel1
ip unnumbered Loopback1
tunnel destination 202.1.1.3
tunnel mode mpls traffic-eng
tunnel mpls traffic-eng path-option 16 dynamic
no routing dynamic
!
interface Loopback1
ip address 202.1.1.1 255.255.255.255
!
interface Ethernet4/0
ip address 80.1.2.1 255.255.255.0
duplex half
mpls traffic-eng tunnels
!
interface Ethernet4/7
ip vrf forwarding ***1
ip address
13.1.2
.1 255.255.255.0
duplex half
!
router ospf 1
mpls traffic-eng router-id Loopback1
mpls traffic-eng area 0
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 100
no synchronization
bgp log-neighbor-changes
neighbor 202.1.1.3 remote-as 100
neighbor 202.1.1.3 update-source Loopback1
no auto-summary
!
address-family ***v4
neighbor 202.1.1.3 activate
neighbor 202.1.1.3 send-community extended
exit-address-family
!
address-family ipv4 vrf ***1
redistribute connected
no synchronization
exit-address-family
!
ip route 202.1.1.3 255.255.255.255 Tunnel1
『R2配置』
R2#show run
Building configuration...
Current configuration : 1369 bytes
!
version 12.4
!
hostname R2
!
mpls traffic-eng tunnels
!
interface Loopback1
ip address 202.1.1.2 255.255.255.255
!
interface Ethernet4/0
ip address 80.1.2.2 255.255.255.0
duplex half
mpls traffic-eng tunnels
!
interface Ethernet4/1
ip address 80.2.3.1 255.255.255.0
duplex half
mpls traffic-eng tunnels
!
router ospf 1
mpls traffic-eng router-id Loopback1
mpls traffic-eng area 0
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
『R3配置』
R3#show run
Building configuration...
Current configuration : 2045 bytes
!
version 12.4
!
hostname R3
!
ip vrf ***1
rd 100:1
route-target export 100:1
route-target import 100:1
!
!
mpls traffic-eng tunnels
!
interface Tunnel1
ip unnumbered Loopback1
tunnel destination 202.1.1.1
tunnel mode mpls traffic-eng
tunnel mpls traffic-eng path-option 16 dynamic
no routing dynamic
!
interface Loopback1
ip address 202.1.1.3 255.255.255.255
!
interface Ethernet4/1
ip address 80.2.3.2 255.255.255.0
duplex half
mpls traffic-eng tunnels
!
interface Ethernet4/7
ip vrf forwarding ***1
ip address 31.1.2.1 255.255.255.0
duplex half
!
router ospf 1
mpls traffic-eng router-id Loopback1
mpls traffic-eng area 0
log-adjacency-changes
network 80.2.3.0
0.0.0
.255 area 0
network 202.1.1.3
0.0.0
.0 area 0
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 202.1.1.1 remote-as 100
neighbor 202.1.1.1 update-source Loopback1
no auto-summary
!
address-family ***v4
neighbor 202.1.1.1 activate
neighbor 202.1.1.1 send-community extended
exit-address-family
!
address-family ipv4 vrf ***1
redistribute connected
no synchronization
exit-address-family
!
ip route 202.1.1.1 255.255.255.255 Tunnel1
『R1上顯示隧道1的出標籤』
R1#show mpls traffic-eng tunnels tunnel 1
Name: R1_t1 (Tunnel1) Destination: 202.1.1.3
Status:
Admin: up Oper: up Path: valid Signalling: connected
path option 16, type dynamic (Basis for Setup, path weight 20)
Config Parameters:
Bandwidth: 0 kbps (Global) Priority: 7 7 Affinity: 0x0/0xFFFF
Metric Type: TE (default)
AutoRoute: disabled LockDown: disabled Loadshare: 0 bw-based
auto-bw: disabled
InLabel : -
OutLabel : Ethernet4/0, 16
RSVP Signalling Info:
Src 202.1.1.1, Dst 202.1.1.3, Tun_Id 1, Tun_Instance 11
RSVP Path Info:
My Address: 80.1.2.1
Explicit Route: 80.1.2.2 80.2.3.1 80.2.3.2 202.1.1.3
Record Route: NONE
Tspec: ave rate=0 kbits, burst=1000 bytes, peak rate=0 kbits
RSVP Resv Info:
Record Route: NONE
Fspec: ave rate=0 kbits, burst=1000 bytes, peak rate=0 kbits
Shortest Unconstrained Path Info:
Path Weight: 20 (TE)
Explicit Route: 80.1.2.1 80.1.2.2 80.2.3.1 80.2.3.2
202.1.1.3
History:
Tunnel:
Time since created: 3 hours, 41 minutes
Time since path change: 3 hours, 39 minutes
Current LSP:
Uptime: 3 hours, 39 minutes
R1#
『R1上顯示私網標籤』
R1#show bgp ***v4 unicast vrf ***1 labels
Network Next Hop In label/Out label
Route Distinguisher: 100:1 (***1)
13.1.2
.0/24
0.0.0
.0 18/aggregate(***1)
31.1.2.0/24 202.1.1.3 nolabel/18
『兩層嵌套標籤』