本產品的文件集力求使用無偏見用語。針對本文件集的目的,無偏見係定義為未根據年齡、身心障礙、性別、種族身分、民族身分、性別傾向、社會經濟地位及交織性表示歧視的用語。由於本產品軟體使用者介面中硬式編碼的語言、根據 RFP 文件使用的語言,或引用第三方產品的語言,因此本文件中可能會出現例外狀況。深入瞭解思科如何使用包容性用語。
思科已使用電腦和人工技術翻譯本文件,讓全世界的使用者能夠以自己的語言理解支援內容。請注意,即使是最佳機器翻譯,也不如專業譯者翻譯的內容準確。Cisco Systems, Inc. 對這些翻譯的準確度概不負責,並建議一律查看原始英文文件(提供連結)。
此文件說明如何設定基本的多重通訊協定標籤交換 (MPLS) VPN 核心網路。
思科建議您瞭解以下主題:
本文中的資訊係根據以下軟體和硬體版本:
P 和 PE 路由器
聚合服務路由器(ASR)和整合服務路由器(ISR)系列或其他更高端路由器上的任何Cisco路由器都支援P和PE功能。
C 和 CE 路由器
您可以使用能夠與其 PE 路由器交換路由資訊的任何路由器。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
這些字母代表所用的不同類型路由器和交換器:
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拓撲
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
有數種方式可以設定 BGP,例如,您可以將 PE 路由器設定為 BGP 芳鄰,或使用路由反射器 (RR) 或聯盟方法。下一個示例中使用的是路由反射器,它比PE路由器之間使用全網狀鄰居的可擴充性更高:
1.為此PE路由器上存在的每個VPN輸入address-family ipv4 vrf <VRF name> 命令。接下來,視需要繼續執行下列一個或多個步驟:
如果您使用 BGP 來和 CE 交換路由資訊,請透過 CE 路由器設定並啟用 BGP 芳鄰。
如果您使用不同的動態路由通訊協定來和 CE 交換路由資訊,請重新分發路由通訊協定。
附註:根據您使用的PE-CE路由協定,您可以在PE和CE裝置之間配置任何動態路由協定(EIGRP、OSPF或BGP)。如果使用 BGP 通訊協定在 PE 和 CE 之間交換路由資訊,則不需要在通訊協定之間設定重新分發。
2.在路由器bgp層次結構下,進入address-family vpnv4模式,然後完成以下步驟:
啟用芳鄰,且需要在每個 PE 路由器和路由反射器之間建立 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 |
PE-2 |
---|
hostname PE-2 ! ip cef |
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 驗證命令
MPLS LDP 驗證命令
PE 到 PE/RR 驗證命令
這是 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相關資訊
修訂 | 發佈日期 | 意見 |
---|---|---|
2.0 |
19-Oct-2022 |
重新認證 |
1.0 |
10-Dec-2001 |
初始版本 |