簡介
此文件說明如何設定基本的多重通訊協定標籤交換 (MPLS) VPN 核心網路。
必要條件
需求
思科建議您瞭解以下主題:
- 基本IP路由知識
- 瞭解Cisco IOS® 指令行介面(CLI)
採用元件
本文中的資訊係根據以下軟體和硬體版本:
P 和 PE 路由器
C 和 CE 路由器
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
慣例
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
這些字母代表所用的不同類型路由器和交換器:
-
P — 提供商路由器
-
PE — 提供商邊緣路由器
-
CE — 邊Customer緣路由器
-
C — 路由Customer器
附註:PE路由器是提供商網路中的最後一跳。這些裝置直接連線到CE路由器,CE路由器是客戶所有的裝置,與服務提供商網路介面,但不參與MPLS操作。
背景資訊
MPLS是一種高效能網路技術,它使用短路徑標籤而不是長網路地址將資料從一個節點引導到另一個節點。
此方法可加速和改變企業和服務提供商網路中的流量傳輸。
MPLS為標籤分配標籤,標籤交換路由器(LSR)或P路由器使用這些標籤來做出轉發決策。
網路邊緣的邊緣路由器(LER)或PE路由器新增和刪除這些標籤。
MPLS使用轉發等價類(FEC)對以相同方式轉發的資料包進行分組,並使用標籤分發協定(LDP)在路由器之間分發標籤對映。
這可確保整個網路中標籤繫結的檢視一致。
MPLS的優勢包括改進的效能、可擴充性、流量工程能力,以及對服務品質(QoS)的支援。
它不受協定限制,因此成為適用於各種網路環境的通用解決方案。
MPLS廣泛用於建立可擴展且安全的虛擬專用網路(VPN)、管理和最佳化流量流,並支援將不同型別的流量(例如資料、語音和影片)融合到單個網路基礎設施中。
本檔案將提供MPLS VPN網路的範例組態,其中邊界閘道通訊協定(BGP)在提供商邊緣(PE)和CE客戶邊緣(CE)路由器之間使用。
與 MLPS 搭配使用時,VPN 功能可讓數個網站透過服務提供者網路,透明地互相連線。
一個服務提供商網路可以支援多個不同的IP VPN,每個IP VPN在其使用者看來都是一個獨立於所有其他網路的專用網路。
在一個 VPN 中,每個網站可以傳送 IP 封包到相同 VPN 中的任何其他網站。
每個 VPN 與一個或多個虛擬路由和轉送 (VRF) 執行個體相關聯。一個 VRF 的組成包含 IP 路由表、衍生的 Cisco Express Forwarding (CEF) 表,以及使用此轉送表的一系列介面。
路由器為每個 VRF 維持各別的路由資訊庫 (RIB) 和 CEF 表。這可確保資訊不會在VPN外部傳送,從而允許在多個VPN中使用相同的子網,而不會導致重複的IP地址問題。
使用多重通訊協定 BGP (MP-BGP) 的路由器透過 MP-BGP 延伸社群分發 VPN 路由資訊。
組態
本節提供組態設定範例,以及這些範例的實作方式。
網路圖表
本文使用此網路設定,此圖顯示說明前述慣例的典型組態:
MPLS拓撲
MPLS配置過程
在核心網路中配置MPLS
1.確認在需要MPLS的路由器上啟用了ip cef(在最新軟體版本上預設啟用CEF)。
2.在服務提供商核心上配置內部網關協定(IGP),建議採用開放最短路徑優先(OSPF)或中間系統到中間系統(IS-IS)協定,並從每台P路由器和PE路由器通告Loopback0。
3.服務提供商核心路由器在其環回之間完全可以到達第3層(L3)後,在P路由器和PE路由器之間的每個L3介面上配置命令mpls ip,或使用mpls ldp autoconfig命令在運行OSPF或IS-IS進程的每個介面上啟用LDP。
附註:直接連線到CE路由器的PE路由器介面不需要mpls ip命令配置。
將mpls ip配置新增到介面後,在PE路由器上完成以下步驟:
4.為使用命令連線的每個VPN建立一個 vrf definition VRF。額外步驟:
指定用於該 VPN 的路由識別碼。命令 rd 用於擴展IP地址,以便您可以確定它屬於哪個VPN。
vrf definition Client_A
rd 100:110
為 MP-BGP 延伸社群設定匯入與匯出內容。這些屬性會透過 route-target{import|export|both} <target VPN extended community> 命令,用於篩選匯入與匯出程序,如以下輸出所示:
vrf definition Client_A
rd 100:110
route-target export 100:1000
route-target import 100:1000
!
address-family ipv4
exit-address-family
5.在PE路由器上,新增將CE連線到相應VRF的介面。使用 vrf forwarding 命令,設定相關介面的轉送詳細資料,並設定 IP 位址。
PE-1#show run interface GigabitEthernet0/1
Building configuration...
Current configuration : 138 bytes
!
interface GigabitEthernet0/1
vrf forwarding Client_A
ip address 10.0.4.2 255.255.255.0
duplex auto
speed auto
media-type rj45
end
設定 MP-BGP
有數種方式可以設定 BGP,例如,您可以將 PE 路由器設定為 BGP 芳鄰,或使用路由反射器 (RR) 或聯盟方法。下一個示例中使用的是路由反射器,它比PE路由器之間使用全網狀鄰居的可擴充性更高:
1.為此PE路由器上存在的每個VPN輸入address-family ipv4 vrf <VRF name> 命令。接下來,視需要繼續執行下列一個或多個步驟:
附註:根據您使用的PE-CE路由協定,您可以在PE和CE裝置之間配置任何動態路由協定(EIGRP、OSPF或BGP)。如果使用 BGP 通訊協定在 PE 和 CE 之間交換路由資訊,則不需要在通訊協定之間設定重新分發。
2.在路由器bgp層次結構下,進入address-family vpnv4模式,然後完成以下步驟:
組態
本文件使用這些組態設定來設定 MPLS VPN 網路範例:
| PE-1 |
hostname PE-1
!
ip cef
!
!--- VPN Client_A commands.
vrf definition Client_A
rd 100:110
route-target export 100:1000
route-target import 100:1000 !
address-family ipv4
exit-address-family
!--- Enables the VPN routing and forwarding (VRF) routing table. !--- Route distinguisher creates routing and forwarding tables for a VRF. !--- Route targets creates lists of import and export extended communities for the specified VRF.
!--- VPN Client_B commands.
vrf definition Client_B
rd 100:120
route-target export 100:2000
route-target import 100:2000
!
address-family ipv4
exit-address-family ! interface Loopback0
ip address 10.10.10.4 255.255.255.255
ip router isis !
interface GigabitEthernet0/1
vrf forwarding Client_A
ip address 10.0.4.2 255.255.255.0
duplex auto
speed auto
media-type rj45
!
interface GigabitEthernet0/2
vrf forwarding Client_B
ip address 10.0.4.2 255.255.255.0
duplex auto
speed auto
media-type rj45
!--- Associates a VRF instance with an interface or subinterface. !--- GigabitEthernet0/1 and 0/2 use the same IP address, 10.0.4.2. !--- This is allowed because they belong to two different customer VRFs.
! interface GigabitEthernet0/0
description link to P-1
ip address 10.1.1.14 255.255.255.252
ip router isis
duplex auto
speed auto
media-type rj45
mpls ip
!--- Enables MPLS on the L3 interface connecting to the P router
! router isis
net 49.0001.0000.0000.0004.00
is-type level-2-only
metric-style wide
passive-interface Loopback0
!--- Enables IS-IS as the IGP in the provider core network
!
router bgp 65000
bgp log-neighbor-changes neighbor 10.10.10.2 remote-as 65000 neighbor 10.10.10.2 update-source Loopback0
!--- Adds an entry to the BGP or MP-BGP neighbor table. !--- And enables BGP sessions to use a specific operational interface for TCP connections.
!
address-family vpnv4
neighbor 10.10.10.2 activate
neighbor 10.10.10.2 send-community both
exit-address-family
!--- To enter address family configuration mode that use standard VPN version 4 address prefixes. !--- Creates the VPNv4 neighbor session to the Route Reflector. !--- And to send the community attribute to the BGP neighbor. !
address-family ipv4 vrf Client_A
neighbor 10.0.4.1 remote-as 65002
neighbor 10.0.4.1 activate
exit-address-family
!
address-family ipv4 vrf Client_B
neighbor 10.0.4.1 remote-as 65001
neighbor 10.0.4.1 activate
exit-address-family
!--- These are the eBGP sessions to each CE router belonging to different customers. !--- The eBGP sessions are configured within the VRF address family
! end
|
| PE-2 |
hostname PE-2
!
ip cef !
vrf definition Client_A
rd 100:110
route-target export 100:1000
route-target import 100:1000
!
address-family ipv4
exit-address-family
! vrf definition Client_B
rd 100:120
route-target export 100:2000
route-target import 100:2000
!
address-family ipv4
exit-address-family
!
ip cef
!
interface Loopback0
ip address 10.10.10.6 255.255.255.255 ip router isis !
interface GigabitEthernet0/0
description link to P-2
ip address 10.1.1.22 255.255.255.252
ip router isis
duplex auto
speed auto
media-type rj45
mpls ip
!
interface GigabitEthernet0/1
vrf forwarding Client_B
ip address 10.0.6.2 255.255.255.0
duplex auto
speed auto
media-type rj45
!
interface GigabitEthernet0/2
vrf forwarding Client_A
ip address 10.1.6.2 255.255.255.0
duplex auto
speed auto
media-type rj45
!
interface GigabitEthernet0/3
vrf forwarding Client_A
ip address 10.0.6.2 255.255.255.0
duplex auto
speed auto
media-type rj45
!
router isis
net 49.0001.0000.0000.0006.00
is-type level-2-only
metric-style wide
passive-interface Loopback0
!
router bgp 65000
bgp log-neighbor-changes
neighbor 10.10.10.2 remote-as 65000
neighbor 10.10.10.2 update-source Loopback0
!
address-family vpnv4
neighbor 10.10.10.2 activate
neighbor 10.10.10.2 send-community both
exit-address-family
!
address-family ipv4 vrf Client_A
neighbor 10.0.6.1 remote-as 65004
neighbor 10.0.6.1 activate
neighbor 10.1.6.1 remote-as 65004
neighbor 10.1.6.1 activate
exit-address-family
!
address-family ipv4 vrf Client_B
neighbor 10.0.6.1 remote-as 65003
neighbor 10.0.6.1 activate
exit-address-family
!
!
end
|
| P-2 |
hostname P-2
!
ip cef
!
interface Loopback0
ip address 10.10.10.3 255.255.255.255
ip router isis
!
interface GigabitEthernet0/0
description link to PE-2
ip address 10.1.1.21 255.255.255.252
ip router isis
duplex auto
speed auto
media-type rj45
mpls ip
!
interface GigabitEthernet0/1
description link to P-1
ip address 10.1.1.6 255.255.255.252
ip router isis
duplex auto
speed auto
media-type rj45
mpls ip
!
interface GigabitEthernet0/2
description link to RR
ip address 10.1.1.9 255.255.255.252
ip router isis
duplex auto
speed auto
media-type rj45
mpls ip
!
router isis
net 49.0001.0000.0000.0003.00
is-type level-2-only
metric-style wide
passive-interface Loopback0
!
end
|
| RR |
hostname RR
!
ip cef
!
interface Loopback0
ip address 10.10.10.2 255.255.255.255
ip router isis
!
interface GigabitEthernet0/0
description link to P-1
ip address 10.1.1.2 255.255.255.252ip router isis
duplex auto
speed auto
media-type rj45
mpls ip
!
interface GigabitEthernet0/1
description link to P-2
ip address 10.1.1.10 255.255.255.252ip router isis
duplex auto
speed auto
media-type rj45
mpls ip
!
interface GigabitEthernet0/3
no ip address
shutdown
duplex auto
speed auto
media-type rj45
!
router isis
net 49.0001.0000.0000.0002.00
is-type level-2-only
metric-style wide
passive-interface Loopback0
!
router bgp 65000
bgp log-neighbor-changes
neighbor 10.10.10.4 remote-as 65000
neighbor 10.10.10.4 update-source Loopback0
neighbor 10.10.10.6 remote-as 65000
neighbor 10.10.10.6 update-source Loopback0
!
address-family vpnv4
neighbor 10.10.10.4 activate
neighbor 10.10.10.4 send-community both
neighbor 10.10.10.4 route-reflector-client
neighbor 10.10.10.6 activate
neighbor 10.10.10.6 send-community both
neighbor 10.10.10.6 route-reflector-client
exit-address-family
!
!
end
|
| P-1 |
hostname P-1
!
ip cef
!
interface Loopback0
ip address 10.10.10.1 255.255.255.255
ip router isis
!
interface GigabitEthernet0/0
description link to PE-1
ip address 10.1.1.13 255.255.255.252
ip router isis
duplex auto
speed auto
media-type rj45
mpls ip
!
interface GigabitEthernet0/1
description link to RR
ip address 10.1.1.5 255.255.255.252
ip router isis
duplex auto
speed auto
media-type rj45
mpls ip
!
interface GigabitEthernet0/2
description link to P-2
ip address 10.1.1.1 255.255.255.252
ip router isis
duplex auto
speed auto
media-type rj45
mpls ip
!
router isis
net 49.0001.0000.0000.0001.00
is-type level-2-only
metric-style wide
passive-interface Loopback0
!
end
|
| CE-A1 |
CE-A3 |
hostname CE-A1
!
ip cef
!
interface GigabitEthernet0/0
ip address 10.0.4.1 255.255.255.0
duplex auto
speed auto
media-type rj45
!
router bgp 65002
bgp log-neighbor-changes
redistribute connected
neighbor 10.0.4.2 remote-as 65000
!
end
|
hostname CE-A3
!
ip cef
!
interface GigabitEthernet0/0
ip address 10.0.6.1 255.255.255.0
duplex auto
speed auto
media-type rj45
!
router bgp 65004
bgp log-neighbor-changes
redistribute connected
neighbor 10.0.6.2 remote-as 65000
!
end
|
驗證
本節提供的資訊可讓您用於確認組態是否正常運作:
PE 到 CE 驗證命令
- show ip vrf — 驗證存在正確的 VRF。
- show ip vrf interfaces — 驗證已啟用的介面。
- show ip route vrf <VRF name> — 驗證 PE 路由器上的路由資訊。
- traceroute vrf <VRF name> <IP address> — 驗證 PE 路由器上的路由資訊。
- show ip cef vrf <VRF name> <IP address> detail — 驗證 PE 路由器上的路由資訊。
MPLS LDP 驗證命令
- show mpls interfaces
- show mpls forwarding-table
- show mpls ldp bindings
- show mpls ldp neighbor
PE 到 PE/RR 驗證命令
- show bgp vpnv4 unicast all summary
- show bgp vpnv4 unicast all neighbor <neighbor IP address> advertised-routes - 驗證已傳送 VPNv4 首碼
- show bgp vpnv4 unicast all neighbor <neighbor IP address> routes - 驗證已收到 VPNv4 首碼
這是 show ip vrf 命令的範例命令輸出。
PE-1#show ip vrf
Name Default RD Interfaces
Client_A 100:110 Gi0/1
Client_B 100:120 Gi0/2
下一個是 show ip vrf interfaces 命令的範例命令輸出。
PE-2#show ip vrf interfaces
Interface IP-Address VRF Protocol
Gi0/2 10.1.6.2 Client_A up
Gi0/3 10.0.6.2 Client_A up
Gi0/1 10.0.6.2 Client_B up
在下一個範例中,show ip route vrf 命令在兩個輸出中都顯示相同的首碼 10.0.6.0/24。這是因為兩個思科用戶端,CE_B2 和 CE_A3,在遠端 PE 為相同的網路,這是一般 MPLS VPN 解決方案所允許的。
PE-1#show ip route vrf Client_A
Routing Table: Client_A
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.0.4.0/24 is directly connected, GigabitEthernet0/1
L 10.0.4.2/32 is directly connected, GigabitEthernet0/1
B 10.0.6.0/24 [200/0] via 10.10.10.6, 11:11:11
B 10.1.6.0/24 [200/0] via 10.10.10.6, 11:24:16
PE-1#
PE-1#show ip route vrf Client_B
Routing Table: Client_B
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.0.4.0/24 is directly connected, GigabitEthernet0/2
L 10.0.4.2/32 is directly connected, GigabitEthernet0/2
B 10.0.6.0/24 [200/0] via 10.10.10.6, 11:26:05
當您在兩個網站之間執行路徑追蹤時,可能會看到 MPLS 網路使用的標籤堆疊(如果 mpls ip propagate-ttl 如此設定),在這個範例中是 Client_A 的兩個網站(CE-A1 至 CE-A3)。
CE-A1#show ip route 10.0.6.1
Routing entry for 10.0.6.0/24
Known via "bgp 65002", distance 20, metric 0
Tag 65000, type external
Last update from 10.0.4.2 11:16:14 ago
Routing Descriptor Blocks:
* 10.0.4.2, from 10.0.4.2, 11:16:14 ago
Route metric is 0, traffic share count is 1
AS Hops 2
Route tag 65000
MPLS label: none
CE-A1#
CE-A1#ping 10.0.6.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.6.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 7/8/9 ms
CE-A1#
CE-A1#traceroute 10.0.6.1 probe 1 numeric
Type escape sequence to abort.
Tracing the route to 10.0.6.1
VRF info: (vrf in name/id, vrf out name/id)
1 10.0.4.2 2 msec
2 10.1.1.13 [MPLS: Labels 20/26 Exp 0] 8 msec
3 10.1.1.6 [MPLS: Labels 21/26 Exp 0] 17 msec
4 10.0.6.2 [AS 65004] 11 msec
5 10.0.6.1 [AS 65004] 8 msec
附註:Exp 0 是用於服務品質(QoS)的實驗欄位。
下一個輸出顯示 RR 和一些服務提供者核心網路中的 P 路由器之間建立了 IS-IS 和 LDP 相鄰。
RR#show isis neighbors
Tag null:
System Id Type Interface IP Address State Holdtime Circuit Id
P-1 L2 Gi0/0 10.1.1.1 UP 25 RR.01
P-2 L2 Gi0/1 10.1.1.9 UP 23 RR.02
RR#
RR#show mpls ldp neighbor
Peer LDP Ident: 10.10.10.1:0; Local LDP Ident 10.10.10.2:0
TCP connection: 10.10.10.1.646 - 10.10.10.2.46298
State: Oper; Msgs sent/rcvd: 924/921; Downstream
Up time: 13:16:03
LDP discovery sources:
GigabitEthernet0/0, Src IP addr: 10.1.1.1
Addresses bound to peer LDP Ident:
10.1.1.13 10.1.1.5 10.1.1.1 10.10.10.1
Peer LDP Ident: 10.10.10.3:0; Local LDP Ident 10.10.10.2:0
TCP connection: 10.10.10.3.14116 - 10.10.10.2.646
State: Oper; Msgs sent/rcvd: 920/916; Downstream
Up time: 13:13:09
LDP discovery sources:
GigabitEthernet0/1, Src IP addr: 10.1.1.9
Addresses bound to peer LDP Ident:
10.1.1.6 10.1.1.9 10.10.10.3 10.1.1.21
相關資訊