06-MPLS L3VPN配置
本章節下載: 06-MPLS L3VPN配置 (1.73 MB)
目 錄
1.7.3 配置BGP引入Loopback接口地址和OSPF的路由
1.10.1 PE-CE間使用EBGP基本MPLS L3VPN配置示例
1.10.2 PE-CE間使用IBGP基本MPLS L3VPN配置示例
2.1.4 IPv6 MPLS L3VPN支持的組網方案及功能
![]()
l 本章所指的路由器代表了一般意義下的路由器,以及運行了路由協議的三層交換機。為提高可讀性,在手冊的描述中將不另行說明。
l 本章隻涉及MPLS L3VPN的介紹和配置,有關MPLS基本配置的介紹請參見 “MPLS基本配置”,有關BGP的介紹請參見“三層技術-IP路由配置指導”中的“BGP”。
l 目前,如果需要使用MPLS L3VPN的相應功能,需要配備SD係列業務板,並使用這幾種業務板上的端口連接用戶網絡和運營商網絡。
MPLS L3VPN是服務提供商VPN解決方案中一種基於PE的L3VPN技術,它使用BGP在服務提供商骨幹網上發布VPN路由,使用MPLS在服務提供商骨幹網上轉發VPN報文。
MPLS L3VPN組網方式靈活、可擴展性好,並能夠方便地支持MPLS QoS和MPLS TE,因此得到越來越多的應用。
MPLS L3VPN模型由三部分組成:
l CE(Customer Edge)設備:用戶網絡邊緣設備,有接口直接與SP(Service Provider,服務提供商)相連。CE可以是路由器或交換機,也可以是一台主機。CE“感知”不到VPN的存在,也不需要必須支持MPLS。
l PE(Provider Edge)設備:服務提供商網絡的邊緣設備,與用戶的CE直接相連。在MPLS網絡中,對VPN的所有處理都發生在PE上。
l P(Provider)設備:服務提供商網絡中的骨幹設備,不與CE直接相連。P設備隻需要具備基本MPLS轉發能力。
圖1-1是一個MPLS L3VPN組網方案的示意圖。

CE和PE的劃分主要是根據服務提供商與用戶的管理範圍,CE和PE是兩者管理範圍的邊界。
CE設備通常是一台路由器,當CE與直接相連的PE建立鄰接關係後,CE把本站點的VPN路由發布給PE,並從PE學到遠端VPN的路由。CE與PE之間使用BGP/IGP交換路由信息,也可以使用靜態路由。
PE從CE學到CE本地的VPN路由信息後,通過BGP與其它PE交換VPN路由信息。PE路由器隻維護與它直接相連的VPN的路由信息,不維護服務提供商網絡中的所有VPN路由。
P路由器隻維護到PE的路由,不需要了解任何VPN路由信息。
當在MPLS骨幹網上傳輸VPN流量時,入口PE做為Ingress LSR(Label Switching Router,標簽交換路由器),出口PE做為Egress LSR,P路由器則做為Transit LSR。
在介紹VPN時經常會提到“Site”,Site(站點)的含義可以從下述幾個方麵理解:
l Site是指相互之間具備IP連通性的一組IP係統,並且,這組IP係統的IP連通性不需通過服務提供商網絡實現;
l Site的劃分是根據設備的拓撲關係,而不是地理位置,盡管在大多數情況下一個Site中的設備地理位置相鄰;
l 一個Site中的設備可以屬於多個VPN,換言之,一個Site可以屬於多個VPN;
l Site通過CE連接到服務提供商網絡,一個Site可以包含多個CE,但一個CE隻屬於一個Site。
對於多個連接到同一服務提供商網絡的Sites,通過製定策略,可以將它們劃分為不同的集合(set),隻有屬於相同集合的Sites之間才能通過服務提供商網絡互訪,這種集合就是VPN。
VPN是一種私有網絡,不同的VPN獨立管理自己使用的地址範圍,也稱為地址空間(Address Space)。
不同VPN的地址空間可能會在一定範圍內重合,比如,VPN 1和VPN 2都使用了10.110.10.0/24網段的地址,這就發生了地址空間重疊(Overlapping Address Spaces)。
在MPLS VPN中,不同VPN之間的路由隔離通過VPN實例(VPN-instance)實現。
PE為直接相連的Site建立並維護VPN實例。VPN實例中包含對應Site的VPN成員關係和路由規則。如果一個Site中的用戶同時屬於多個VPN,則該Site的VPN實例中將包括所有這些VPN的信息。
為保證VPN數據的獨立性和安全性,PE上每個VPN實例都有相對獨立的路由表和LFIB(Label Forwarding Information Base,標簽轉發表)。
具體來說,VPN實例中的信息包括:標簽轉發表、IP路由表、與VPN實例綁定的接口以及VPN實例的管理信息。VPN實例的管理信息包括RD(Route Distinguisher,路由標識符)、路由過濾策略、成員接口列表等。
傳統BGP無法正確處理地址空間重疊的VPN的路由。假設VPN 1和VPN 2都使用了10.110.10.0/24網段的地址,並各自發布了一條去往此網段的路由,BGP將隻會選擇其中一條路由,從而導致去往另一個VPN的路由丟失。
PE路由器之間使用MP-BGP來發布VPN路由,並使用VPN-IPv4地址族來解決上述問題。
VPN-IPv4地址共有12個字節,包括8字節的RD和4字節的IPv4地址前綴,如圖1-2所示。
圖1-2 VPN-IPv4地址結構

PE從CE接收到普通IPv4路由後,需要將這些私網VPN路由發布給對端PE。私網路由的獨立性是通過為這些路由附加RD實現的。
SP可以獨立地分配RD,但必須保證RD的全局唯一性。這樣,即使來自不同服務提供商的VPN使用了同樣的IPv4地址空間,PE路由器也可以向各VPN發布不同的路由。
建議為PE上每個VPN實例配置專門的RD,以保證到達同一CE的路由都使用相同的RD。RD為0的VPN-IPv4地址相當於全局唯一的IPv4地址。
RD的作用是添加到一個特定的IPv4前綴,使之成為全局唯一的VPN IPv4前綴。
RD或者是與自治係統號(ASN)相關的,在這種情況下,RD是由一個自治係統號和一個任意的數組成;或者是與IP地址相關的,在這種情況下,RD是由一個IP地址和一個任意的數組成。
RD有三種格式,通過2字節的Type字段區分:
l Type為0時,Administrator子字段占2字節,Assigned number子字段占4字節,格式為:16bits自治係統號:32bits用戶自定義數字。例如:100:1
l Type為1時,Administrator子字段占4字節,Assigned number子字段占2字節,格式為:32bitsIPv4地址:16bits用戶自定義數字。例如:172.1.1.1:1
l Type為2時,Administrator子字段占4字節,Assigned number子字段占2字節,格式為:32bits自治係統號:16bits用戶自定義數字,其中的自治係統號最小值為65536。例如:65536:1
為保證RD的全局唯一性,建議不要將Administrator子字段的值設置為私有AS號或私有IP地址。
MPLS L3VPN使用BGP擴展團體屬性——VPN Target(也稱為Route Target)來控製VPN路由信息的發布。
PE路由器上的VPN實例有兩類VPN Target屬性:
l Export Target屬性:在本地PE將從與自己直接相連的Site學到的VPN-IPv4路由發布給其它PE之前,為這些路由設置Export Target屬性;
l Import Target屬性:PE在接收到其它PE路由器發布的VPN-IPv4路由時,檢查其Export Target屬性,隻有當此屬性與PE上VPN實例的Import Target屬性匹配時,才把路由加入到相應的VPN路由表中。
也就是說,VPN Target屬性定義了一條VPN-IPv4路由可以為哪些Site所接收,PE路由器可以接收哪些Site發送來的路由。
與RD類似,VPN Target也有三種格式:
l 16bits自治係統號:32bits用戶自定義數字,例如:100:1。
l 32bits IPv4地址:16bits用戶自定義數字,例如:172.1.1.1:1。
l 32bits自治係統號:16bits用戶自定義數字,其中的自治係統號最小值為65536。例如:65536:1。
MP-BGP(Multiprotocol extensions for BGP-4)在PE路由器之間傳播VPN組成信息和路由。MP-BGP向下兼容,既可以支持傳統的IPv4地址族,又可以支持其他地址族(比如VPN-IPv4地址族)。使用MP-BGP既確保VPN的私網路由隻在VPN內發布,又實現了MPLS VPN成員間的通信。
在通過入口、出口擴展團體來控製VPN路由發布的基礎上,如果需要更精確地控製VPN路由的引入和發布,可以使用入方向或出方向路由策略。
入方向路由策略根據路由的VPN Target屬性進一步過濾可引入到VPN實例的路由,它可以拒絕接收引入列表中的團體選定的路由,而出方向路由策略則可以拒絕發布輸出列表中的團體選定的路由。
VPN實例創建完成後,可以選擇是否需要配置入方向或出方向路由策略。
隧道策略用於選擇給特定VPN實例的報文使用的隧道。
隧道策略是可選配的,VPN實例創建完成後,就可以配置隧道策略。缺省情況下,按照LSP隧道->CR-LSP隧道的優先級順序選擇隧道,負載分擔條數為1,即不進行負載分擔。另外,隧道策略隻在同一AS域內生效。
在基本MPLS L3VPN應用中(不包括跨域的情況),VPN報文轉發采用兩層標簽方式:
l 第一層(外層)標簽在骨幹網內部進行交換,指示從PE到對端PE的一條LSP。VPN報文利用這層標簽,可以沿LSP到達對端PE;
l 第二層(內層)標簽在從對端PE到達CE時使用,指示報文應被送到哪個Site,或者更具體一些,到達哪一個CE。這樣,對端PE根據內層標簽可以找到轉發報文的接口。
特殊情況下,屬於同一個VPN的兩個Site連接到同一個PE,這種情況下隻需要知道如何到達對端CE。
以圖1-3為例,說明VPN報文的轉發:
圖1-3 VPN報文轉發示意圖

(1) Site 1發出一個目的地址為1.1.1.2的IP報文,由CE 1將報文發送至PE 1。
(2) PE 1根據報文到達的接口及目的地址查找VPN實例表項,匹配後將報文轉發出去,同時打上內層和外層兩個標簽。
(3) MPLS網絡利用報文的外層標簽,將報文傳送到PE 2(報文在到達PE 2前一跳時已經被剝離外層標簽,僅含內層標簽)。
(4) PE 2根據內層標簽和目的地址查找VPN實例表項,確定報文的出接口,將報文轉發至CE 2。
(5) CE 2根據正常的IP轉發過程將報文傳送到目的地。
在MPLS L3VPN網絡中,通過VPN Target屬性來控製VPN路由信息在各Site之間的發布和接收。VPN Export Target和Import Target的設置相互獨立,並且都可以設置多個值,能夠實現靈活的VPN訪問控製,從而實現多種VPN組網方案。
最簡單的情況下,一個VPN中的所有用戶形成閉合用戶群,相互之間能夠進行流量轉發,VPN中的用戶不能與任何本VPN以外的用戶通信。
對於這種組網,需要為每個VPN分配一個VPN Target,作為該VPN的Export Target和Import Target,並且,此VPN Target不能被其他VPN使用。
圖1-4 基本的VPN組網方案

在圖1-4中,PE上為VPN 1分配的VPN Target值為100:1,為VPN 2分配的VPN Target值為200:1。VPN 1的兩個Site之間可以互訪,VPN 2的兩個Site之間也可以互訪,但VPN 1和VPN 2的Site之間不能互訪。
如果希望在VPN中設置中心訪問控製設備,其它用戶的互訪都通過中心訪問控製設備進行,可以使用Hub&Spoke組網方案,從而實現中心設備對兩端設備之間的互訪進行監控和過濾等功能。
對於這種組網,需要設置兩個VPN Target,一個表示“Hub”,另一個表示“Spoke”。
各Site在PE上的VPN實例的VPN Target設置規則為:
l 連接Spoke站點(Site 1和Site 2)的Spoke-PE:Export Target為“Spoke”,Import Target為“Hub”;
l 連接Hub站點(Site 3)的Hub-PE:Hub-PE上需要使用兩個接口或子接口,一個用於接收Spoke-PE發來的路由,其VPN實例的Import Target為“Spoke”;另一個用於向Spoke-PE發布路由,其VPN實例的Export Target為“Hub”。
圖1-5 Hub&Spoke組網方案

在圖1-5中,Spoke站點之間的通信通過Hub站點進行(圖中箭頭所示為Site 2的路由向Site 1的發布過程):
l Hub-PE能夠接收所有Spoke-PE發布的VPN-IPv4路由;
l Hub-PE發布的VPN-IPv4路由能夠為所有Spoke-PE接收;
l Hub-PE將從Spoke-PE學到的路由發布給其他Spoke-PE,因此,Spoke站點之間可以通過Hub站點互訪。
l 任意Spoke-PE的Import Target屬性不與其它Spoke-PE的Export Target屬性相同。因此,任意兩個Spoke-PE之間不直接發布VPN-IPv4路由,Spoke站點之間不能直接互訪。
如果一個VPN用戶希望提供部分本VPN的站點資源給非本VPN的用戶訪問,可以使用Extranet組網方案。
對於這種組網,如果某個VPN需要訪問共享站點,則該VPN的Export Target必須包含在共享站點的VPN實例的Import Target中,而其Import Target必須包含在共享站點VPN實例的Export Target中。
圖1-6 Extranet組網方案

在圖1-6中,VPN 1的Site 3能夠被VPN 1和VPN 2訪問:
l PE 3能夠接受PE 1和PE 2發布的VPN-IPv4路由;
l PE 3發布的VPN-IPv4路由能夠為PE 1和PE 2接受;
l 基於以上兩點,VPN 1的Site 1和Site 3之間能夠互訪,VPN 2的Site 2和VPN 1的Site 3之間能夠互訪。
PE 3不把從PE 1接收的VPN-IPv4路由發布給PE 2,也不把從PE 2接收的VPN-IPv4路由發布給PE 1(IBGP鄰居學來的條目是不會再發送給別的IBGP鄰居),因此,VPN 1的Site 1和VPN 2的Site 2之間不能互訪。
在基本MPLS L3VPN組網中,VPN路由信息的發布涉及CE和PE,P路由器隻維護骨幹網的路由,不需要了解任何VPN路由信息。PE路由器也隻維護與它直接相連的VPN的路由信息,不維護所有VPN路由。因此,MPLS L3VPN網絡具有良好的可擴展性。
VPN路由信息的發布過程包括三部分:本地CE到入口PE、入口PE到出口PE、出口PE到遠端CE。完成這三部分後,本地CE與遠端CE之間將建立可達路由,VPN私網路由信息能夠在骨幹網上發布。
下麵分別對這三部分進行介紹。
CE與直接相連的PE建立鄰接關係後,把本站點的VPN路由發布給PE。
CE與PE之間可以使用靜態路由、RIP、OSPF、IS-IS、EBGP或IBGP。無論使用哪種路由協議,CE發布給PE的都是標準的IPv4路由。
PE從CE學到VPN路由信息後,為這些標準IPv4路由增加RD和VPN Target屬性,形成VPN-IPv4路由,存放到為CE創建的VPN實例的路由表中,並觸發MPLS為其分配私網標簽。
入口PE通過MP-BGP把VPN-IPv4路由發布給出口PE。出口PE根據VPN-IPv4路由的Export Target屬性與自己維護的VPN實例的Import Target屬性,決定是否將該路由加入到VPN實例的路由表。
PE之間通過IGP來保證內部的連通性。
遠端CE有多種方式可以從出口PE學習VPN路由,包括靜態路由、RIP、OSPF、IS-IS、EBGP和IBGP,與本地CE到入口PE的路由信息交換相同。
實際組網應用中,某用戶一個VPN的多個Site可能會連接到使用不同AS號的多個服務提供商,或者連接到一個服務提供商的多個AS。這種VPN跨越多個自治係統的應用方式被稱為跨域VPN(Multi-AS VPN)。
RFC 2547bis中提出了三種跨域VPN解決方案,分別是:
l VRF-to-VRF:ASBR間使用子接口管理VPN路由,也稱為Inter-Provider Option A;
l EBGP Redistribution of labeled VPN-IPv4 routes:ASBR間通過MP-EBGP發布標簽VPN-IPv4路由,也稱為Inter-Provider Option B;
l Multihop EBGP redistribution of labeled VPN-IPv4 routes:PE間通過MP-EBGP發布標簽VPN-IPv4路由,也稱為Inter-Provider Option C。
下麵逐一對這些方案進行介紹。
這種方式下,兩個AS的PE路由器直接相連,PE路由器同時也是各自所在自治係統的邊界路由器ASBR。
作為ASBR的PE之間通過多個子接口相連,兩個PE都把對方作為自己的CE設備對待,使用傳統的EBGP方式向對端發布IPv4路由。報文在AS內部作為VPN報文,采用兩層標簽轉發方式;在ASBR之間則采用普通IP轉發方式。
理想情況下,每個跨域的VPN都有一對子接口與之對應,用來交換VPN路由信息。
圖1-7 ASBR間使用子接口管理VPN路由組網圖

使用子接口實現跨域VPN的優點是實現簡單:兩個作為ASBR的PE之間不需要為跨域進行特殊配置。
缺點是可擴展性差:作為ASBR的PE需要管理所有VPN路由,為每個VPN創建VPN實例。這將導致PE上的VPN-IPv4路由數量過於龐大。並且,為每個VPN單獨創建子接口也提高了對PE設備的要求。
這種方式下,兩個ASBR通過MP-EBGP交換它們從各自AS的PE路由器接收的標簽VPN-IPv4路由。
路由發布過程可分為以下步驟:
(1) AS 100內的PE先通過MP-IBGP方式把標簽VPN-IPv4路由發布給AS 100的邊界路由器PE,或發布給為ASBR PE反射路由的路由反射器;
(2) 作為ASBR的PE通過MP-EBGP方式把標簽VPN-IPv4路由發布給AS 200的PE(也是AS 200的邊界路由器);
(3) AS 200的ASBR PE再通過MP-IBGP方式把標簽VPN-IPv4路由發布給AS 200內的PE,或發布給為PE反射路由的路由反射器。
這種方式的ASBR需要對標簽VPN-IPv4路由進行特殊處理,因此也稱為ASBR擴展方式。
圖1-8 ASBR間通過MP-EBGP發布標簽VPN-IPv4路由組網圖

在可擴展性方麵,通過MP-EBGP發布標簽VPN-IPv4路由優於ASBR間通過子接口管理VPN。
采用MP-EBGP方式時,需要注意:
l ASBR之間不對接收的VPN-IPv4路由進行VPN Target過濾,因此,交換VPN-IPv4路由的各AS服務提供商之間需要就這種路由交換達成信任協議;
l VPN-IPv4路由交換僅發生在私網對等點之間,不能與公網交換VPN-IPv4路由,也不能與沒有達成信任協議的MP-EBGP對等體交換VPN-IPv4路由。
前麵介紹的兩種方式都能夠滿足跨域VPN的組網需求,但這兩種方式也都需要ASBR參與VPN-IPv4路由的維護和發布。當每個AS都有大量的VPN路由需要交換時,ASBR就很可能成為阻礙網絡進一步擴展的瓶頸。
解決上述可擴展性問題的方案是:ASBR不維護或發布VPN-IPv4路由,PE之間直接交換VPN-IPv4路由。
兩個ASBR通過MP-IBGP向各自AS內的PE路由器發布標簽IPv4路由。
ASBR上不保存VPN-IPv4路由,相互之間也不通告VPN-IPv4路由。
ASBR保存AS內PE的帶標簽的IPv4路由,並通告給其它AS的對等體。另一個自治係統中的ASBR也通告帶標簽的IPv4路由。這樣,在入口PE和出口PE之間建立起一條LSP。
不同AS的PE之間建立Multihop方式的EBGP連接,交換VPN-IPv4路由。
圖1-9 PE間通過Multi-hop MP-EBGP發布標簽VPN-IPv4路由組網圖

為提高可擴展性,可以在每個AS中指定一個路由反射器RR(Route Reflector),由RR保存所有VPN-IPv4路由,與AS的PE交換VPN-IPv4路由信息。兩個AS的RR之間建立跨域VPNv4連接,通告VPN-IPv4路由。如圖1-10所示。
圖1-10 采用RR的跨域VPN OptionC方式組網圖

MPLS L3VPN服務提供商的用戶可能也是一個服務提供商。這種情況下,前者稱為提供商運營商(Provider Carrier)或一級運營商(First Carrier),後者稱為客戶運營商(Customer Carrier)或二級運營商(Second Carrier)。這種組網模型稱為運營商的運營商(Carriers’ carriers),低級別的SP作為更高級別SP的CE。
為保持良好的可擴展性,一級運營商並不引入二級運營商連接的用戶網絡的路由,隻引入為不同站點的二級運營商交換報文的路由。二級運營商連接的用戶網絡的路由通過在相關二級運營商路由器間建立BGP會話交換。這可以大大減少一級運營商網絡中需要維護的路由數量。
與普通MPLS L3VPN相比,配置運營商的運營商的主要區別在於一級運營商PE接入二級運營商CE這一部分:
l 如果一級運營商PE與二級運營商CE位於同一個AS內,則它們之間配置IGP和LDP;
l 如果一級運營商PE與二級運營商CE位於不同的AS,則它們之間配置MP-EBGP。MP-EBGP為PE與CE之間交換的路由分配標簽。
無論哪種情況,CE上都需要使能MPLS。並且,CE上雖然有二級運營商的VPN路由,但它們並不把這些路由發布給一級運營商的PE,隻在二級運營商PE之間交換。
二級運營商可能隻是普通ISP,也可能是MPLS L3VPN服務提供商。
二級運營商是普通ISP時,其PE不需要運行MPLS,與CE之間運行IGP。PE 3和PE 4之間通過IBGP會話交換二級運營商的VPN路由。如圖1-11所示。

二級運營商是MPLS L3VPN服務提供商時,其PE也需要運行MPLS,與CE之間運行IGP和LDP。PE 3和PE 4之間通過MP-IBGP會話交換二級運營商的VPN路由。如圖1-12所示。
![]()
如果一級運營商和二級運營商之間存在等價路由,則建議在一級運營商和二級運營商之間建立對應的等價LSP。
在基本的MPLS L3VPN模型中,由運營商經營MPLS VPN骨幹網,通過PE設備提供VPN服務。VPN用戶通過CE設備與運營商的PE設備互連,接入MPLS VPN網絡,實現屬於用戶VPN的不同Site之間的通信。在這種情況下,用戶網絡是普通的IP網絡,VPN用戶不能再劃分子VPN。
實際組網中,VPN用戶網絡複雜多樣,繁簡不同。當VPN用戶內部需要進一步劃分多個VPN時,傳統的解決方案是直接在運營商的PE設備上配置用戶內部的VPN。這種方案實現簡單,缺點是將導致PE上承載的VPN數量急劇增加,並且,如果用戶內部需要調整VPN關係,也必須通過運營商操作。這不僅增加了網絡的運營成本,也帶來了管理和安全方麵的問題。
嵌套VPN是一種更為完善的解決方案,它的主要思想是在普通MPLS L3VPN的PE和CE之間傳遞VPNv4路由,由用戶管理自己內部的VPN劃分,運營商不參與用戶內部VPN的管理。如圖1-13所示,用戶在運營商MPLS VPN網絡上所屬的VPN為VPN A,在用戶網絡內部劃分子VPN:VPN A-1和VPN A-2。運營商PE設備把用戶網絡當作普通VPN用戶對待,不參與子VPN的劃分。VPN用戶的CE設備(CE 1、CE 2、CE 7和CE 8)和運營商PE設備之間傳遞包括子VPN路由信息的VPNv4路由,從而實現用戶網絡內部子VPN路由信息的傳遞。
圖1-13 嵌套VPN組網應用

嵌套VPN中,路由信息的傳播過程為:
(1) 運營商的PE設備與VPN用戶的CE設備交互VPNv4路由,VPNv4路由攜帶用戶內部的VPN信息。
(2) 運營商的PE設備收到VPNv4路由後,保留用戶內部的VPN信息,並附加用戶在運營商網絡上的MPLS VPN屬性,即將該VPNv4路由的RD更換為用戶所處運營商網絡VPN的RD,同時將用戶所處運營商網絡VPN的ERT(Export Route-target,引出路由標識)添加到路由的擴展團體屬性列表中。運營商的PE設備維護用戶內部的VPN信息。
(3) 運營商的PE設備向其他運營商PE設備發布這些攜帶綜合VPN信息的VPNv4路由。
(4) 其他的運營商PE設備收到VPNv4路由後,與本地的VPN進行匹配,每個VPN接收屬於自己的路由,然後將路由擴散到自己連接的子VPNCE設備(如圖1-13中的CE 3、CE 4、CE 5和CE 6):如果運營商PE和CE設備之間是IPv4連接,直接擴散IPv4路由;如果和CE設備之間是VPNv4連接,表示通過私網連接的是一個用戶MPLS VPN網絡,向CE擴散VPNv4路由。
嵌套VPN技術的主要優點是:
l 實現了VPN聚合功能,可以把用戶的多個內部VPN聚合成一個用戶VPN,接入運營商的MPLS VPN網絡;
l 支持對稱組網方式和非對稱組網方式,即屬於同一VPN用戶的不同Site包括的用戶內部VPN數目可以相同,也可以不同;
l 支持用戶內部VPN的多層嵌套。
嵌套VPN技術降低了用戶接入VPN網絡的複雜度和成本,為用戶提供多樣化的VPN組網方式,實現了用戶對內部VPN以及多層VPN之間的互訪權限控製管理。
(1) 分層模型與平麵模型
在MPLS L3VPN解決方案中,PE設備最為關鍵,它完成兩方麵的功能:首先是為用戶提供接入功能,這需要PE具有大量接口;然後是管理和發布VPN路由,處理用戶報文,這需要PE設備具有大容量存儲和高轉發能力。
目前的網絡設計大多采用經典的分層結構,例如,城域網的典型結構是三層模型:核心層、彙聚層、接入層。從核心層到接入層,對設備的性能要求依次下降,網絡的規模則依次擴大。
而MPLS L3VPN是一種平麵模型,對網絡中所有PE設備的性能要求相同,當網絡中某些PE在性能和可擴展性方麵存在問題時,整個網絡的性能和可擴展性將受到影響。
由於MPLS L3VPN的平麵模型與典型的分層網絡模型不相符,在每一個層次上部署PE都會遇到擴展性問題,不利於大規模部署VPN。
(2) HoVPN
為解決可擴展性問題,MPLS L3VPN必然要從平麵模型轉變為分層模型。
在MPLS L3VPN領域,分層VPN(Hierarchy of VPN,簡稱HoVPN)解決方案的提出,實現了將PE的功能分布到多個PE設備上,多個PE承擔不同的角色,並形成層次結構,共同完成一個PE的功能。
HoVPN對處於較高層次的設備的路由能力和轉發性能要求較高,而對處於較低層次的設備的相應要求也較低,符合典型的分層網絡模型。
(1) HoVPN的基本結構
圖1-14 HoVPN的基本結構

在圖1-14中,直接連結用戶的設備稱為下層PE(Underlayer PE)或用戶側PE(User-end PE),簡寫為UPE;連結UPE並位於網絡內部的設備稱為上層PE(Superstratum PE)或運營商側PE(Sevice Provider-end PE),簡寫為SPE。
多個UPE與SPE構成分層式PE,共同完成傳統上一個PE的功能。
![]()
HoVPN把PE的功能分層實現,因此,這種解決方案有時也被稱為分層PE(Hiberarchy of PE,HoPE)。
SPE與UPE的分工是:
l UPE主要完成用戶接入功能。UPE維護其直接相連的VPN Site的路由,但不維護VPN中其它遠程Site的路由或僅維護它們的聚合路由;UPE為其直接相連的Site的路由分配內層標簽,並通過MP-BGP隨VPN路由發布此標簽給SPE;
l SPE主要完成VPN路由的管理和發布。SPE維護其通過UPE連接的VPN所有路由,包括本地和遠程Site的路由,SPE將路由信息發布給UPE,並攜帶標簽。SPE發布的路由信息可以是VPN實例的缺省路由(或聚合路由),也可以是通過路由策略的路由信息。通過後者可以實現對同一VPN下不同站點之間互訪的控製。
由於分工的不同,對SPE和UPE的要求也不同:SPE的路由表容量大,轉發性能強,但接口資源較少;UPE的路由容量和轉發性能較低,但接入能力強。HoVPN充分利用了SPE的性能和UPE的接入能力。
需要說明的是,SPE和UPE是相對的概念。在多個層次的PE結構中,上層PE相對於下層就是SPE,下層PE相對於上層就是UPE。
分層式PE從外部來看同傳統上的PE沒有區別,可以同普通PE共存於一個MPLS網絡。
(2) SPE-UPE
SPE和UPE之間運行MP-BGP,可以是MP-IBGP,也可以是MP-EBGP,這取決於UPE和SPE是否屬於同一個AS。
采用MP-IBGP時,為了在IBGP對等體之間通告路由,SPE將作為路由反射器,把來自IBGP對等體UPE的VPN路由發布給IBGP對等體SPE,但SPE不作為其它PE的路由反射器。
(3) HoVPN的嵌套與擴展
HoVPN支持分層式PE的嵌套:
l 一個分層式PE可以作為UPE,同另一個SPE組成新的分層式PE;
l 一個分層式PE可以作為SPE,同多個UPE組成新的分層式PE;
l 以上這種嵌套可以多次進行。
通過分層式PE的嵌套,理論上可以將VPN無限擴展與延伸。
圖1-15 分層式PE的嵌套

圖1-15是一個三層的分層式PE,稱中間的PE為MPE(Middle-level PE)。SPE和MPE之間,以及MPE和UPE之間,均運行MP-BGP。
![]()
“MPE”這種說法隻是為了表述方便,在HoVPN模型中並沒有MPE。
MP-BGP為上層PE發布下層PE上的所有VPN路由,為下層PE發布上層PE的VPN實例缺省路由或通過路由策略的VPN路由。
SPE維護了這個分層式PE接入的所有Site的VPN路由,路由數目最多;UPE隻維護它所直接連接的Site的VPN路由,路由數目最少;MPE的路由數目介於SPE和UPE之間。
![]()
本節重點介紹OSPF對VPN的擴展,如果需要了解OSPF的基本知識,請參見“三層技術-IP路由配置指導”中的“OSPF配置”。
OSPF是應用廣泛的一種IGP協議,很多情況下,VPN客戶端通過BGP對等體連接,客戶端內部則經常以OSPF作為內部路由協議。如果能夠在PE-CE之間使用OSPF,則CE上就不需要再為到PE的連接支持其它路由協議,從而簡化CE的管理和配置。並且,如果客戶需要通過傳統的OSPF骨幹區域提供MPLS L3VPN服務,在PE和CE之間使用OSPF可以簡化這種轉換。
為了在PE-CE間運行OSPF,PE必須支持OSPF多實例,每個OSPF實例與一個VPN實例對應,使用自己的接口、路由表。
下麵具體介紹在PE-CE間配置OSPF需要了解的知識。
(1) PE和CE間的OSPF區域配置
PE與CE之間的OSPF區域可以是非骨幹區域,也可以是骨幹區域。
在OSPF VPN擴展應用中,MPLS VPN骨幹網被看作是骨幹區域area 0。由於OSPF要求骨幹區域連續,因此,所有VPN站點的area 0必須與MPLS VPN骨幹網相連。
即:如果VPN站點存在OSPF area 0,則CE接入的PE必須通過area 0與這個VPN站點的骨幹區域相連(可以通過Virtual-link實現邏輯上的連通)。
(2) BGP/OSPF交互
在PE-CE間運行OSPF後,PE與PE通過BGP發布VPN路由,PE通過OSPF向CE發布VPN路由。
對於普通OSPF,即使兩個不同站點屬於同一VPN,它們也會被看作屬於不同的自治係統。這樣,在一個站點學到的路由,將被作為外部路由傳送給另一站點。這種處理方式導致了比較高的OSPF路由協議流量,並帶來了一些原本可以避免的網絡管理問題。
目前的OSPF可以解決上述問題。通過適當配置,運行OSPF的不同站點之間彼此看作是直接相連的。這樣,PE路由器交換OSPF路由信息時就好像是通過一條專線相連。改善了網絡管理並使OSPF的應用更為有效。
以圖1-16為例,PE 1和PE 2通過MPLS骨幹網相連,CE 11、CE 21和CE 22都屬於VPN 1。假設圖中所有路由器屬於同一個域,即CE 11、CE 21、CE 22屬於同一個OSPF域(OSPF domain)。
VPN 1路由的發布過程可以描述為:首先在PE 1上將CE 11的OSPF路由引入BGP;然後通過BGP將這些VPN路由發布給PE 2;在PE 2上將BGP的VPN路由引入到OSPF,再發布給CE 21和CE 22。
圖1-16 OSPF在VPN中的使用

如果使用標準的BGP/OSPF交互過程,PE 2將把BGP VPN路由通過Type5 LSAs(即ASE LSAs)發布給CE 21和CE 22。但CE 11與CE 21、CE 22是同一個OSPF域,它們之間的路由發布應該使用Type3 LSAs,即區域間路由。
為了解決上述問題,PE使用一種經過修改的BGP/OSPF交互過程(簡稱為BGP/OSPF互操作功能),發布從一個Site到另一個Site的路由,將這種路由與真正的AS-External路由進行區分。這一過程需要BGP使用擴展團體屬性,攜帶可以標識OSPF屬性的信息。
在實現中,要求每個OSPF域有一個可配置的域ID(Domain ID)。一般建議:與每個VPN實例相關的網絡中的所有OSPF實例要麼配置一個相同的域ID,要麼都使用缺省的域ID。這樣在收到BGP的VPN路由時,域ID相同的是來自同一VPN實例的路由。
(3) 路由環的檢測
假設PE與CE之間通過OSPF骨幹區域相連,且同一個VPN站點(Site)連接到多個不同PE。這種情況下,當一個PE通過LSA向VPN站點發布從MPLS/BGP學的BGP VPN路由時,LSA可能被另一個PE接收到,造成路由環。
為了防止產生路由環,對於從MPLS/BGP學到的BGP VPN路由,無論PE與CE間是否通過OSPF骨幹區域相連,PE在生成Type3 LSA時,都會設置標誌位DN。PE路由器的OSPF進程在進行路由計算時,忽略DN置位的Type3 LSAs。
如果PE需要向CE發布一條來自其它OSPF域的路由,則PE應表明自己是ASBR,並將該路由作為Type5 LSA發布。
通常情況下,BGP對等體之間通過BGP擴展團體屬性在MPLS VPN骨幹網上承載路由信息。另一端PE上運行的OSPF可利用這些信息來生成PE到CE的Type3 summary LSA,這些路由是區域間路由。
如圖1-17所示:在OSPF的PE-CE連接中,同一個OSPF區域中有兩個Site連接到不同的PE,兩個Site屬於同一個VPN,它們之間存在一條區域內OSPF鏈路(backdoor link)。這種情況下,通過PE連接兩個Site的路由將作為區域間路由(Inter-Area Route),由於其優先級低於經過backdoor鏈路的區域內路由(Intra-Area Route),不會被OSPF優選。
圖1-17 Sham-link應用示意圖

上述情況導致VPN流量總是通過backdoor路由轉發,而不走骨幹網。為了避免這一問題,可以在PE路由器之間建立OSPF偽連接(Sham-link),使經過MPLS VPN骨幹網的路由也成為OSPF區域內路由。
Sham-link作為區域內的一條點到點鏈路,包含在Type1 LSA中發布。用戶可以通過調整度量值在Sham-link和backdoor鏈路之間進行選路。
Sham-link被看成是兩個VPN實例之間的鏈路,每個VPN實例中必須有一個Sham-link的端點地址,它是PE路由器上VPN地址空間中的一個有32位掩碼的Loopback接口地址。同一個OSPF進程的Sham-link可以共用端點地址,但不同OSPF進程不能擁有兩條端點地址完全相同的Sham-link。
Sham-link的端點地址被BGP作為VPN-IPv4地址發布。如果路由經過了Sham-link,它就不能再以VPN-IPv4路由的形式被引入到BGP。
Sham-link可以在任何區域配置。Sham-link需要手工配置,並且,本端VPN實例中必須有到Sham-link目的地址的路由。
![]()
配置OSPF偽連接時,需要在PE上配置BGP引入OSPF的私網路由,但不能配置OSPF引入BGP路由,否則會引起路由環路。
在MPLS L3VPN中,如果PE和CE之間運行EBGP,由於BGP使用AS號檢測路由環路,為保證路由信息的正確發送,需要為物理位置不同的站點分配不同的AS號。
如果物理分散的CE複用相同的AS號,就應該在PE上配置BGP的AS號替換功能。此功能是BGP的出口策略,在發布路由時有效。
使能了BGP的AS號替換功能後,當PE向指定對等體中的CE發布路由時,如果路由的AS_PATH中有與CE相同的AS號,將被替換成PE的AS號後再發布。
![]()
使能BGP的AS號替換功能後,PE向對等體組中所有已建立連接的CE重新發送所有路由,並對發送路由中的AS_PATH屬性按上述規則替換。
圖1-18 BGP AS號替換應用示意圖

在圖1-18中,CE 1和CE 2都使用AS號800,在PE 2上使能針對CE 2的AS號替換功能。當CE 1發來的Update信息從PE 2發布給CE 2時,PE 2發現AS_PATH中存在與CE 2相同的AS號800,就把它替換為自己的AS號100,這樣,CE 2就可以正確接收CE 1的路由信息。
對於PE使用不同接口連接多個CE的情況,如上圖中的CE 2和CE 3,也可以使用BGP的AS號替換功能。
對於CE連接到多個PE的情況(Multi-homed CE),單獨使用BGP的AS號替換功能將可能導致路由環路,需要配合SOO(Site-of-Origin)特性一起使用。
表1-1 MPLS L3VPN配置任務簡介
|
配置任務 |
詳細配置 |
說明 |
|
配置基本MPLS L3VPN |
完成基本MPLS L3VPN配置後,即可實現通過MPLS技術構建簡單的VPN網絡 如果部署一些特殊的MPLS L3VPN組網方案,例如跨域VPN、嵌套VPN等,除了配置基本MPLS L3VPN外,還需要根據相應章節進行其他的配置 |
|
|
配置跨域VPN |
||
|
配置嵌套VPN |
||
|
配置HoVPN |
||
|
配置OSPF偽連接 |
||
|
配置BGP的AS號替換 |
配置MPLS L3VPN的關鍵在於管理VPN私網路由在MPLS骨幹網上的發布,包括PE-CE間的路由發布管理以及PE-PE間的路由發布管理。
表1-2 基本MPLS L3VPN配置任務簡介
|
配置任務 |
說明 |
詳細配置 |
|
|
配置VPN實例 |
創建VPN實例 |
必選 |
|
|
配置VPN實例與接口關聯 |
必選 |
||
|
配置VPN實例的路由相關屬性 |
可選 |
||
|
配置VPN實例的隧道策略 |
可選 |
||
|
配置LDP實例 |
可選 |
||
|
配置PE-CE間的路由交換 |
必選 |
||
|
配置PE-PE間的路由交換 |
必選 |
||
|
配置BGP-VPNv4子地址族下的路由特性 |
可選 |
||
在配置基本MPLS L3VPN之前,需完成以下任務:
l 對MPLS骨幹網(PE、P)配置IGP,實現骨幹網的IP連通性
l 對MPLS骨幹網(PE、P)配置MPLS基本能力
l 對MPLS骨幹網(PE、P)配置MPLS LDP,建立LDP LSP
VPN實例不僅可以隔離VPN私網路由與公網路由,還可以隔離不同VPN實例的路由,這一特點使得VPN實例的使用不限於MPLS L3VPN。
配置VPN實例的操作是在PE或MCE設備上進行的。
VPN實例在實現中與Site關聯。VPN實例不是直接對應於VPN,一個VPN實例綜合了和它所對應Site的VPN成員關係和路由規則。
一個VPN實例隻有配置了RD後才生效。
描述信息用於描述VPN實例,可以用來記錄VPN實例與某個VPN的關係等信息。
表1-3 創建VPN實例
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建VPN實例,並進入VPN實例視圖 |
ip vpn-instance vpn-instance-name |
必選 |
|
配置VPN實例的RD |
route-distinguisher route-distinguisher |
必選 一個VPN實例隻有配置了RD後才會生效 |
|
配置VPN實例的描述信息 |
description text |
可選 描述信息用於描述VPN實例,可以用來記錄VPN實例與某個VPN的關係等信息 |
VPN實例配置完成後,還需要與連接CE的接口進行關聯。支持MPLS LDP能力的接口類型都可以與VPN實例相關聯。具體接口類型請參見 “MPLS基本配置”。
表1-4 配置VPN實例與接口關聯
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入要關聯接口的接口視圖 |
interface interface-type interface-number |
- |
|
將當前接口與VPN實例關聯 |
ip binding vpn-instance vpn-instance-name |
必選 缺省情況下,接口不關聯任何VPN實例 |
![]()
執行ip binding vpn-instance命令將刪除接口上已經配置的IP地址,因此需要重新配置接口的IP地址。
VPN路由的發布控製過程如下:
l 當從CE學習到的一條VPN路由引入BGP時,BGP為它關聯一個VPN Target擴展團體屬性列表,通常這個列表是與CE相關聯的VPN實例的輸出路由屬性列表。
l VPN實例根據VPN Target中import-extcommunity決定可被接受並引入此VPN實例的路由。
l VPN實例根據VPN Target中的export-extcommunity對向外發布的路由進行VPN Target屬性的修改。
表1-5 配置VPN實例的路由相關屬性
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入VPN實例視圖 |
ip vpn-instance vpn-instance-name |
- |
|
進入IPv4 VPN視圖 |
ipv4-family |
可選 |
|
配置VPN Target |
vpn-target vpn-target&<1-8> [ both | export-extcommunity | import-extcommunity ] |
必選 |
|
配置支持的最大路由數 |
routing-table limit number { warn-threshold | simply-alert } |
可選 |
|
應用入方向路由策略 |
import route-policy route-policy |
可選 缺省情況下,接收所有VPN Target屬性匹配的路由 |
|
應用出方向路由策略 |
export route-policy route-policy |
可選 缺省情況下,不對發布的路由進行過濾 |
![]()
l VPN實例視圖下配置的路由相關屬性既可以用於IPv4 VPN,也可以用於IPv6 VPN。
l 既可以在VPN實例視圖下,也可以在IPv4 VPN視圖下,配置IPv4 VPN的路由相關屬性。如果同時在兩個視圖下配置了路由相關屬性,則IPv4 VPN采用IPv4 VPN視圖下配置的路由相關屬性。
l 命令vpn-target最多可以配置8個VPN Target;一個VPN實例最多可以配置64個VPN Target。
l 可以配置一個VPN實例支持的最大路由數,以防止PE路由器的入接口有過多的路由。一個PE路由器最多可以支持的路由條數與具體產品有關。
l 為VPN實例配置路由策略之前必須已經創建了路由策略,否則無法對接收和發布的路由進行過濾。
表1-6 配置VPN實例的隧道策略
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建隧道策略,並進入隧道策略視圖 |
tunnel-policy tunnel-policy-name |
必選 |
|
配置隧道的優先級順序和負載分擔條數 |
tunnel select-seq { cr-lsp | lsp } * load-balance-number number |
必選 缺省情況下,按照LSP隧道->CR-LSP隧道的優先級順序選擇隧道,負載分擔條數為1 |
|
退回係統視圖 |
quit |
- |
|
進入VPN實例視圖 |
ip vpn-instance vpn-instance-name |
必選 |
|
進入IPv4 VPN視圖 |
ipv4-family |
可選 |
|
配置VPN實例的隧道策略 |
tnl-policy tunnel-policy-name |
必選 缺省情況下,按照LSP隧道->CR-LSP隧道的優先級順序選擇隧道,負載分擔條數為1 |
:
l 配置的隧道類型不止一種,且負載分擔的條數多於單個類型包含的隧道個數時,會使用不同類型的隧道一起進行負載分擔。
l 在配置隧道優先級順序時,隧道類型越靠近關鍵字select-seq的,其優先級越高。例如:如果配置了命令tunnel select-seq lsp cr-lsp load-balance-number 1,在沒有LSP的情況下,VPN將使用CR-LSP隧道,當LSP建立後,VPN將選用LSP。
l VPN實例視圖下配置的隧道策略既可以用於IPv4 VPN,也可以用於IPv6 VPN。
l 既可以在VPN實例視圖下,也可以在IPv4 VPN視圖下,配置IPv4 VPN的隧道策略。如果同時在兩個視圖下配置了隧道策略,則IPv4 VPN采用IPv4 VPN視圖下配置的隧道策略。
l 為VPN實例配置隧道策略之前必須先創建隧道策略,否則將采用缺省策略,即按照LSP隧道->CR-LSP隧道的優先級順序選擇隧道,負載分擔條數為1。
LDP實例應用於運營商的運營商(Carriers’ carriers)組網模型中。
本配置任務用來使能VPN實例的LDP能力,創建LDP實例,並在MPLS-LDP-VPN實例視圖下為VPN實例配置LDP參數。
表1-7 配置LDP實例
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
使能指定VPN實例的LDP能力,創建LDP實例,並進入MPLS-LDP-VPN實例視圖 |
mpls ldp vpn-instance vpn-instance-name |
必選 缺省情況下,未使能VPN實例的LDP能力 |
|
配置除LDP GR外的其他LDP參數 |
詳細配置請參見 “MPLS基本配置” |
可選 |
![]()
l 除了LDP GR和LDP NSR特性外,MPLS LDP視圖下的命令都可以在MPLS-LDP-VPN實例視圖下使用。MPLS LDP的詳細介紹請參見 “MPLS基本配置”。
l 對於使能LDP能力的接口,MPLS-LDP-VPN實例視圖下的配置隻影響綁定VPN實例的接口;而MPLS LDP視圖下的配置對綁定到VPN實例的接口沒有影響。為LDP實例配置傳輸地址時,也必須使用綁定到VPN實例的接口的IP地址。
l 對於私網側的LDP鄰居關係,缺省情況下是使用使能LDP能力的接口地址建立的;而公網上的LDP鄰居關係,缺省情況下是使用LDP實例的LSR ID建立的。
PE-CE間路由交換可以使用靜態路由、RIP、OSPF、IS-IS、EBGP和IBGP路由協議。根據實際組網情況選擇一種進行配置即可。
在配置PE-CE間路由交換之前,需要先完成以下任務:
l 在CE上配置連接PE接口的IP地址
l 在PE上配置連接CE接口的IP地址
表1-8 配置PE-CE間使用靜態路由
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
為指定VPN實例配置靜態路由 |
ip route-static dest-address { mask | mask-length } { gateway-address | interface-type interface-number [ gateway-address ] | vpn-instance d-vpn-instance-name gateway-address } [ preference preference-value ] [ tag tag-value ] [ description description-text ] |
必選 該配置在PE上進行,CE上的配置方法與普通靜態路由相同 |
|
ip route-static vpn-instance s-vpn-instance-name&<1-5> dest-address { mask | mask-length } { gateway-address [ public ] | interface-type interface-number [ gateway-address ] | vpn-instance d-vpn-instance-name gateway-address } [ preference preference-value ] [ tag tag-value ] [ description description-text ] |
![]()
有關靜態路由的配置請參見“三層技術-IP路由配置指導”中的“靜態路由”。
一個RIP進程隻能屬於一個VPN實例。如果在啟動RIP進程時不綁定到VPN實例,則該進程屬於公網進程。
表1-9 配置PE-CE間使用RIP
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建PE-CE間的RIP實例,並進入RIP視圖 |
rip [ process-id ] vpn-instance vpn-instance-name |
必選 該配置在PE上進行,CE上配置普通RIP即可 |
|
在指定網段接口上使能RIP |
network network-address |
必選 缺省情況下,接口上的RIP功能處於關閉狀態 |
![]()
有關RIP的介紹和詳細配置,請參見“三層技術-IP路由配置指導”中的“RIP”。
VPN實例綁定的OSPF進程中不使用係統視圖下配置的公網Router ID,因此用戶需要在啟動進程時手工配置Router ID,或者所要綁定的VPN實例中至少有一個接口配置了IP地址。
一個OSPF進程隻能屬於一個VPN實例。如果在啟動OSPF進程時不綁定到VPN實例,則該進程屬於公網進程。
表1-10 配置PE-CE間使用OSPF
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建PE-CE間的OSPF實例,並進入OSPF視圖 |
ospf [ process-id | router-id router-id | vpn-instance vpn-instance-name ] * |
必選 該配置在PE上進行,CE上配置普通OSPF即可 |
|
配置OSPF域標識符 |
domain-id domain-id [ secondary ] |
可選 缺省情況下,OSPF域標識符為0 該配置在PE上進行,CE上配置普通OSPF即可 |
|
配置OSPF擴展團體屬性的類型編碼 |
ext-community-type { domain-id type-code1 | router-id type-code2 | route-type type-code3 } |
可選 缺省情況下,OSPF擴展團體屬性Domain ID的類型編碼是0x0005,Router ID的類型編碼是0x0107,Route Type的類型編碼是0x0306 該配置在PE上進行 |
|
配置OSPF區域,進入OSPF區域視圖 |
area area-id |
必選 缺省情況下,沒有配置OSPF區域 |
|
配置區域所包含的網段並在指定網段的接口上使能OSPF |
network ip-address wildcard-mask |
必選 缺省情況下,接口不屬於任何區域且OSPF功能處於關閉狀態 |
![]()
刪除VPN實例後,相關的所有OSPF進程也將全部被刪除。
每個OSPF進程隻能配置一個域ID,不同進程的域ID相互沒有影響。不同VPN的PE的OSPF進程域ID配置沒有限製。但同一VPN的所有OSPF進程應配置相同的域ID,以保證路由發布的正確性。
OSPF進程的域ID包含在此進程生成的路由中,在將OSPF路由引入BGP中時, 域ID被附加到BGP VPN路由上,作為BGP的擴展團體屬性傳遞。
![]()
l 配置OSPF實例後,需要啟動OSPF,具體配置與普通的OSPF相同。
l 有關OSPF的介紹和詳細配置,請參見“三層技術-IP路由配置指導”中的“OSPF”。
一個IS-IS進程隻能屬於一個VPN實例。如果在啟動IS-IS進程時不綁定到VPN實例,則該進程屬於公網進程。
表1-11 配置PE-CE間使用IS-IS
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建PE-CE間的IS-IS實例,並進入IS-IS視圖 |
isis [ process-id ] vpn-instance vpn-instance-name |
必選 該配置在PE上進行,CE上配置普通IS-IS即可 |
|
配置網絡實體名稱 |
network-entity net |
必選 缺省情況下,沒有配置網絡實體名稱 |
|
退回係統視圖 |
quit |
- |
|
進入接口視圖 |
interface interface-type interface-number |
- |
|
使能接口IS-IS並指定要關聯的IS-IS進程號 |
isis enable [ process-id ] |
必選 缺省情況下,接口上沒有使能IS-IS |
![]()
有關IS-IS的介紹和詳細配置,請參見“三層技術-IP路由配置指導”中的“IS-IS”。
(1) PE上的配置
表1-12 PE上的配置
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
進入BGP-VPN實例視圖 |
ipv4-family vpn-instance vpn-instance-name |
必選 |
|
將CE配置為VPN私網EBGP對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
引入本端CE路由 |
import-route protocol [ process-id ] [ med med-value | route-policy route-policy-name ] * |
必選 PE需要將到本端CE的路由引入VPN路由表中,以發布給對端PE |
|
配置對發布的路由信息進行過濾 |
filter-policy { acl-number | ip-prefix ip-prefix-name } export [ direct | isis process-id | ospf process-id | rip process-id | static ] |
可選 缺省情況下,不對發布的路由信息進行過濾 |
|
配置對接收的路由信息進行過濾 |
filter-policy { acl-number | ip-prefix ip-prefix-name } import |
可選 缺省情況下,不對接收的路由信息進行過濾 |
|
配置允許本地AS號在所接收的路由的AS_PATH屬性中出現,並可同時配置允許重複的次數 |
peer { group-name | ip-address } allow-as-loop [ number ] |
可選 用於Hub&Spoke組網方案 |
![]()
通常情況下,BGP通過AS號檢測路由環路。但在Hub&Spoke組網方式下,如果在PE和CE之間運行EBGP,當PE將路由信息通告給CE時帶上本自治係統的AS號,再從CE接收路由更新時,路由更新消息中會帶有本自治係統的AS號,這樣PE就不能接收這條路由更新信息,此時需要配置允許路由環路。
(2) CE上的配置
表1-13 CE上的配置
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
將PE配置為EBGP對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
配置路由引入 |
import-route protocol [ process-id ] [ med med-value | route-policy route-policy-name ] * |
可選 CE需要將自己所能到達的VPN網段地址發布給接入的PE,通過PE發布給對端CE |
:
l 配置BGP VPN實例後,VPN實例中的BGP路由交換與普通的BGP相同。
l BGP實例視圖下配置任務與BGP視圖下的相同,有關介紹和詳細配置,請參見“三層技術-IP路由配置指導”中的“BGP”。
l BGP的配置中有對等體和對等體組的配置,有關介紹和詳細說明請參見“三層技術-IP路由配置指導”中的“BGP”。本章中不將對等體和對等體組加以區分。
![]()
PE和CE之間使用IBGP路由協議隻適用於普通的MPLS L3VPN組網環境,Extranet、跨域VPN、運營商的運營商、嵌套VPN和HoVPN等組網中,PE和CE之間不能配置IBGP。
(1) PE上的配置
表1-14 PE上的配置
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
進入BGP-VPN實例視圖 |
ipv4-family vpn-instance vpn-instance-name |
必選 |
|
將CE配置為VPN私網IBGP對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
將CE配置為路由反射器的客戶端 |
peer { group-name | ip-address } reflect-client |
可選 缺省情況下,沒有配置路由發射器及其客戶端 |
|
允許客戶到客戶的路由反射 |
reflect between-clients |
可選 缺省情況下,允許客戶到客戶的路由反射 |
|
為路由反射器配置群ID |
reflector cluster-id { cluster-id | ip-address } |
可選 缺省情況下,群ID是群中某個路由反射器的Router ID |
|
配置對發布的路由信息進行過濾 |
filter-policy { acl-number | ip-prefix ip-prefix-name } export [ direct | isis process-id | ospf process-id | rip process-id | static ] |
可選 缺省情況下,不對發布的路由信息進行過濾 |
|
配置對接收的路由信息進行過濾 |
filter-policy { acl-number | ip-prefix ip-prefix-name } import |
可選 缺省情況下,不對接收的路由信息進行過濾 |
![]()
l 缺省情況下PE不會向IBGP對等體(包括VPNv4的IBGP對等體)發送從IBGP對等體CE學習的路由,隻有將CE配置為路由反射器的客戶端後,才能向其它IBGP對等體發送從該CE學習的路由。
l 可以在多個視圖下執行reflect between-clients和reflector cluster-id命令,如BGP-VPN實例視圖和BGP-VPNv4子地址族視圖。這兩條命令僅對執行此命令的視圖下的路由反射器生效,對於其他視圖下的路由反射器不生效。
l 配置路由反射器後不會修改路由的下一跳。如果需要修改下一跳,則需在路由的接收端通過入策略進行修改。
(2) CE上的配置
表1-15 CE上的配置
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
將PE配置為IBGP對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
配置路由引入 |
import-route protocol [ process-id ] [ med med-value | route-policy route-policy-name ] * |
可選 CE需要將自己所能到達的VPN網段地址發布給接入的PE,通過PE發布給對端CE |
:
l 配置BGP VPN實例後,VPN實例中的BGP路由交換與普通的BGP相同。
l BGP-VPN實例視圖下配置任務與BGP視圖下的相同,有關介紹和詳細配置,請參見“三層技術-IP路由配置指導”中的“BGP”。
l 有關對等體和對等體組的介紹和詳細說明請參見“三層技術-IP路由配置指導”中的“BGP”。本章中不將對等體和對等體組加以區分。
以下配置是在PE上進行的。
表1-16 配置PE-PE間的路由交換
|
操作 |
命令 |
說明 |
|
|
進入係統視圖 |
system-view |
- |
|
|
進入BGP視圖 |
bgp as-number |
必選 |
|
|
將對端PE配置為對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
|
指定路由更新報文的源接口 |
peer { group-name | ip-address } connect-interface interface-type interface-number |
必選 缺省情況下,BGP使用最佳路由更新報文的源接口 |
|
|
進入BGP-VPNv4子地址族視圖 |
ipv4-family vpnv4 |
必選 |
|
|
使能對等體交換BGP-VPNv4路由信息 |
peer { group-name | ip-address } enable |
必選 缺省情況下,BGP對等體之間隻能交換IPv4路由信息 |
|
BGP-VPNv4子地址族下的很多路由特性都與BGP IPv4單播路由的特性相同。這些特性根據組網的需求來決定是否選擇。
對於VPN的應用,BGP的地址族包括:BGP-VPNv4子地址族、BGP-L2VPN地址族和VPLS地址族。對於下麵的命令在各地址族中的作用都是相同的,且隻對相應地址族中的BGP路由起作用。
表1-17 配置各種地址族通用路由特性
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
必選 |
|
將對端PE配置為對等體 |
peer ip-address as-number as-number |
必選 |
|
指定建立TCP連接的接口 |
peer ip-address connect-interface interface-type interface-number |
必選 |
|
進入地址族視圖 |
ipv4-family vpnv4 |
必選 根據不同的組網情況選擇地址族 |
|
l2vpn-family |
||
|
vpls-family |
||
|
配置允許本地AS號在所接收的路由的AS_PATH屬性中出現,並可同時配置允許重複的次數 |
peer { group-name | ip-address } allow-as-loop [ number ] |
可選 |
|
在指定的地址族下使能對等體,並使能交換對應地址族的BGP路由信息的能力 |
peer { group-name | ip-address } enable |
必選 缺省情況下,BGP對等體之間隻能交換IPv4路由信息 |
|
將對等體加入已存在的對等體組 |
peer ip-address group group-name |
可選 |
|
向對等體或對等體組發布路由時,將自身地址作為下一跳 |
peer { group-name | ip-address } next-hop-local |
可選 缺省情況下,向EBGP對等體發布路由時會將下一跳改為自己的地址。在跨域VPN OptionC組網中反射器上對多跳EBGP鄰居和反射客戶需要配置next-hop-invariable以保證私網路由下一跳不會被改變。 |
|
配置將本機作為路由反射器,並將對等體或對等體組作為路由反射器的客戶 |
peer { group-name | ip-address } reflect-client |
可選 缺省情況下,沒有配置路由反射器及其客戶 |
|
配置BGP鄰居的ORF(Outbound Route Filtering,輸出路由過濾)能力 |
peer { group-name | ip-address } capability-advertise orf ip-prefix { both | receive | send } |
可選 缺省情況下,BGP對等體/對等體組不使能鄰居的ORF能力 |
|
對接收到的相應地址族下BGP路由使能VPN-Target過濾功能 |
policy vpn-target |
可選 缺省情況下,對接收到的相應地址族的BGP路由使能VPN-Target過濾功能 |
|
允許客戶到客戶的路由反射 |
reflect between-clients |
可選 缺省情況下,允許客戶到客戶的路由反射 |
|
為路由反射器配置群ID |
reflector cluster-id { cluster-id | ip-address } |
可選 缺省情況下,群ID是群中某個路由反射器的Router ID |
|
創建路由反射器的反射策略 |
rr-filter extended-community-list-number |
可選 |
![]()
有關BGP-L2VPN地址族和VPLS地址族的介紹請參見“MPLS命令參考”中的“MPLS L2VPN”和“VPLS”。
表1-18 配置BGP-VPNv4子地址族的特有路由特性
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
將對端PE配置為對等體 |
peer ip-address as-number as-number |
必選 |
|
指定建立TCP連接的接口 |
peer ip-address connect-interface interface-type interface-number |
必選 |
|
進入BGP-VPNv4子地址族視圖 |
ipv4-family vpnv4 |
- |
|
配置本地優先級的缺省值 |
default local-preference value |
可選 缺省情況下,本地優先級的值為100 |
|
配置係統MED的缺省值 |
default med med-value |
可選 缺省情況下,係統MED的缺省值為0 |
|
配置對發布的路由信息進行過濾 |
filter-policy { acl-number | ip-prefix ip-prefix-name } export [ direct | isis process-id | ospf process-id | rip process-id | static ] |
可選 缺省情況下,不對發布的路由信息進行過濾 |
|
配置對接收的路由信息進行過濾 |
filter-policy { acl-number | ip-prefix ip-prefix-name } import |
可選 缺省情況下,不對接收的路由信息進行過濾 |
|
配置將團體屬性通告給對等體或對等體組 |
peer { group-name | ip-address } advertise-community |
可選 缺省情況下,不將團體屬性傳給任何對等體或對等體組 |
|
為指定對等體或對等體組配置基於AS路徑列表的路由過濾 |
peer { group-name | ip-address } as-path-acl aspath-filter-number { import | export } |
可選 缺省情況下,對等體及對等體組沒有應用AS過濾列表 |
|
配置向對等體或對等體組發布與指定VPN實例相關的所有缺省路由 |
peer { group-name | ip-address } default-route-advertise vpn-instance vpn-instance-name |
可選 缺省情況下,不向對等體或對等體組發布缺省路由 |
|
配置為指定對等體或對等體組應用過濾策略 |
peer { group-name | ip-address } filter-policy acl-number { export | import } |
可選 缺省情況下,沒有為對等體或對等體組應用過濾策略 |
|
為指定對等體或對等體組應用基於IP前綴列表的路由過濾策略 |
peer { group-name | ip-address } ip-prefix prefix-name { export | import } |
可選 缺省情況下,對等體或對等體組上不應用基於IP前綴列表的路由過濾策略 |
|
配置向EBGP對等體發布路由時不改變下一跳 |
peer { group-name | ip-address } next-hop-invariable |
可選 缺省情況下,向EBGP對等體發布路由時會將下一跳改為自己的地址 |
|
為從對等體/對等體組接收的路由分配首選值 |
peer { group-name | ip-address } preferred-value value |
可選 缺省情況下,從對等體/對等體組接收的路由的首選值為0 |
|
配置發送BGP更新報文時不攜帶私有自治係統號 |
peer { group-name | ip-address } public-as-only |
可選 缺省情況下,發送BGP更新報文時,攜帶私有自治係統號 |
|
為指定對等體或對等體組配置路由策略 |
peer { group-name | ip-address } route-policy route-policy-name { export | import } |
可選 缺省情況下,對等體及對等體組沒有應用路由策略 |
![]()
有關BGP的路由特性請參見“三層技術-IP路由配置指導”中的“BGP”。
如果承載VPN路由的MPLS骨幹網跨越多個AS,就需要配置跨域VPN。
跨域VPN有三種解決方案,詳細描述請參見“1.1.6 跨域VPN”。
在配置跨域VPN之前,需完成以下任務:
l 為各AS的MPLS骨幹網分別配置IGP,實現同一AS內骨幹網的IP連通性
l 為各AS的MPLS骨幹網分別配置MPLS基本能力
l 為各AS的MPLS骨幹網分別配置MPLS LDP,建立LDP LSP
l 為各AS分別進行基本MPLS L3VPN配置
在對各AS分別進行基本MPLS L3VPN配置時,根據所選擇的跨域VPN方式,PE和ASBR-PE上還需要進行專門的配置。
![]()
請根據實際應用的跨域VPN方式,選擇下述配置任務中的對應項。
跨域VPN-OptionA的實現比較簡單,當PE上的VPN數量及VPN路由數量都比較少時可以采用這種方案。跨域VPN-OptionA的配置可以描述為:對各AS分別進行基本MPLS L3VPN配置,對於ASBR-PE,將對端ASBR-PE看作自己的CE配置即可。即:跨域VPN-OptionA方式需要在PE和ASBR-PE上分別配置VPN實例,前者用於接入CE,後者用於接入對端ASBR-PE。
請參見“1.3 配置基本MPLS L3VPN”。
:
在跨域VPN-OptionA方式中,對於同一個VPN,同一AS內的ASBR-PE和PE上配置的VPN Target應能匹配,即VPN Target的配置應能保證PE(或ASBR-PE)發送的VPN路由能夠被ASBR-PE(或PE)接受;不同AS的PE上配置的VPN Target則不需要匹配。
以下配置是在作為ASBR-PE的路由器上進行的。
表1-19 配置跨域VPN-OptionB的ASBR-PE
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入連接對端ASBR-PE接口的接口視圖 |
interface interface-type interface-number |
- |
|
配置接口IP地址 |
ip address ip-address { mask | mask-length } |
必選 |
|
退回係統視圖 |
quit |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
進入BGP-VPNv4子地址族視圖 |
ipv4-family vpnv4 |
- |
|
不對VPNv4路由進行VPN Target過濾 |
undo policy vpn-target |
必選 缺省情況下,PE對收到的VPNv4路由進行VPN Target過濾 通過過濾的路由會被加入到路由表中,沒有通過過濾的路由將被丟棄 |
在跨域VPN-OptionB方式中,ASBR-PE需要保存所有VPNv4路由信息,以通告給對端ASBR-PE。這種情況下,ASBR-PE應接收所有的VPNv4路由信息,不對它們進行VPN Target過濾。
![]()
在跨域VPN-OptionB方式中,對於同一個VPN,不同AS的PE之間的VPN實例的VPN Target需要匹配。
![]()
對於跨域VPN-OptionB,存在兩種配置方式:
l 一種是在ASBR不改下一跳的方式,在這種方式下ASBR間仍然需要配置MPLS LDP;
l 另一種在ASBR上需要修改下一跳,這種組網下ASBR間不需要配置MPLS LDP。
目前實現隻支持在ASBR上修改下一跳的方式,因此在實現上,默認情況下對於MP-EBGP路由,在發往MP-IBGP時是修改下一跳的。而對於發往IBGP的普通EBGP路由,默認情況下是不改下一跳的,如果需要將下一跳改為本地地址,需要配置peer { ip-address | group-name } next-hop-local命令。具體說明請參見“三層技術-IP路由配置指導”中的“BGP”。
同一AS內的PE和ASBR-PE之間建立普通的IBGP對等體關係,不同AS的PE之間建立MP-EBGP對等體關係。
同一AS內的PE和ASBR-PE之間應能夠交換標簽IPv4路由。
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
配置本AS的ASBR-PE為IBGP對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
配置與本AS的ASBR-PE之間能夠交換帶標簽的IPv4路由 |
peer { group-name | ip-address } label-route-capability |
必選 缺省情況下,不向IPv4對等體/對等體組發送標簽路由 |
|
將另一AS的PE配置為EBGP對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
進入BGP-VPNv4子地址族視圖 |
ipv4-family vpnv4 |
- |
|
使能EBGP對等體交換BGP-VPNv4路由信息 |
peer { group-name | ip-address } enable |
必選 |
|
配置向EBGP對等體發送路由時不改變下一跳 |
peer { group-name | ip-address } next-hop-invariable |
可選 該步驟用於使用路由反射器RR(Route Reflector)通告VPNv4路由的情況:RR之間通告VPNv4路由時,路由的下一跳不能被改變 |
在跨域VPN-OptionC方式中,需要建立一條跨域的VPN LSP,相關PE、ASBR之間發布公網路由時攜帶MPLS標簽信息。
ASBR-PE與本AS的PE建立普通IBGP對等體關係,與對端ASBR-PE建立普通EBGP對等體關係。都能夠交換標簽IPv4路由。
攜帶MPLS標簽的公網路由通過MP-BGP發布。根據RFC 3107(Carrying Label Information in BGP-4)中的描述,一條路由的標簽映射信息可以通過發布這條路由的BGP Update消息捎帶(piggyback)。這種能力使用BGP的擴展屬性實現,要求BGP對等體能夠處理標簽IPv4路由。
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
配置本AS的PE為IBGP對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
配置與本AS的PE之間能夠交換帶標簽的IPv4路由 |
peer { group-name | ip-address } label-route-capability |
必選 缺省情況下,不向IPv4對等體/對等體組發送標簽路由 |
|
向本AS的PE發布路由時將下一跳改為自己 |
peer { group-name | ip-address } next-hop-local |
必選 缺省情況下,BGP發言者在向IBGP對等體/對等體組發布路由時不會將下一跳改為自己的地址 |
|
將對端ASBR-PE配置為EBGP對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
配置與對端ASBR-PE之間能夠交換帶標簽的IPv4路由 |
peer { group-name | ip-address } label-route-capability |
必選 缺省情況下,不向IPv4對等體發送標簽路由 |
|
對對端ASBR-PE發布來的路由應用路由策略 |
peer { group-name | ip-address } route-policy route-policy-name export |
必選 缺省情況下,對等體及對等體組沒有應用路由策略 |
配置路由策略應用在ASBR-PE上:
l 對於從本AS的PE接收的路由,在向對端ASBR-PE發布時,分配MPLS標簽;
l 對於向本AS的PE發布的路由,如果是帶標簽的IPv4路由,為其分配新的MPLS標簽。
對IPv4路由分配MPLS標簽是通過路由策略控製的,隻對滿足某些條件的路由分配標簽,其它路由還是普通IPv4路由。
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入路由策略視圖 |
route-policy policy-name permit node seq-number |
必選 |
|
匹配帶標簽的IPv4路由 |
if-match mpls-label |
必選 |
|
為IPv4路由分配標簽 |
apply mpls-label |
必選 缺省情況下,IPv4路由不帶標簽 |
![]()
有關路由策略的配置請參見“三層技術-IP路由配置指導”中的“路由策略”。
如果網絡中VPN接入數量比較多,管理者想要管理權限層次化(通過VPN劃分訪問權限),且不想讓外部知道用戶內部VPN的部署情況,可以使用嵌套VPN的組網方式。在嵌套VPN組網方式中,用戶通過較低的管理複雜度和組網成本,就可以實現內部VPN網絡的層次化管理。
配置嵌套VPN之前,需完成MPLS L3VPN的基本配置,請參見“1.3 配置基本MPLS L3VPN”。
表1-23 配置嵌套VPN
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
進入BGP-VPN實例視圖 |
ipv4-family vpn-instance vpn-instance-name |
- |
|
配置CE對等體或對等體組 |
peer { group-name | peer-address } as-number number |
必選 |
|
退回BGP視圖 |
quit |
- |
|
進入BGP-VPNv4子地址族視圖 |
ipv4-family vpnv4 |
- |
|
使能嵌套VPN功能 |
nesting-vpn |
必選 缺省情況下,禁止嵌套VPN功能 |
|
激活嵌套VPN對等體或對等體組,並使能其交換BGP-VPNv4路由信息的能力 |
peer { group-name | peer-address } vpn-instance vpn-instance-name enable |
必選 缺省情況下,嵌套VPN對等體/對等體組之間隻能交換IPv4路由信息,不能交換BGP-VPNv4路由信息 |
|
將對等體加入到嵌套VPN對等體組中 |
peer peer-address vpn-instance vpn-instance-name group group-name |
可選 缺省情況下,對等體沒有加入任何嵌套VPN對等體組 |
|
配置從嵌套VPN對等體或對等體組接收的VPNv4路由應用的路由策略 |
peer { group-name | peer-address } vpn-instance vpn-instance-name route-policy route-policy-name import |
可選 缺省情況下,對於從嵌套VPN對等體或對等體組接收的VPNv4路由不應用路由策略 |
![]()
l 同一用戶VPN的不同子VPN之間地址空間不能重疊。
l 建議嵌套VPN對等體的地址不要與公網中對等體的地址重疊。
l 配置嵌套VPN對等體或對等體組之前,需要先配置BGP-VPN實例視圖下的CE對等體或對等體組。
l 目前嵌套VPN不支持多跳EBGP組網方式,因此運營商PE和CE之間必須使用直連接口地址建立鄰居關係。
l 在某些產品上,如果子VPN的CE設備直接連接運營商PE設備,則需要在該PE設備上配置策略路由,使得主VPN和子VPN可以互訪。
對於層次化比較明顯的VPN網絡,可以采用HoVPN方案,以降低對PE設備的性能要求。
在配置HoVPN之前,需先在UPE和SPE上配置基本MPLS L3VPN。
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
進入BGP-VPNv4子地址族視圖 |
ipv4-family vpnv4 |
必選 |
|
使能對等體交換BGP-VPNv4路由信息 |
peer { group-name | ip-address } enable |
必選 |
|
配置BGP對等體或對等體組為UPE |
peer { group-name | ip-address } upe |
必選 |
|
向UPE發送指定VPN實例的缺省路由 |
peer { group-name | ip-address } default-route-advertise vpn-instance vpn-instance-name |
二者必選其一 缺省情況下,不向對等體發布路由 |
|
向UPE發送通過路由策略的路由 |
peer { group-name | ip-address } upe route-policy route-policy-name export |
執行peer default-route-advertise vpn-instance命令後,不論本地路由表中是否存在缺省路由,SPE都會向UPE發布一條下一跳地址為本地地址的缺省路由。
![]()
l 向BGP對等體或對等體組發布VPN實例缺省路由的前提是:此BGP對等體或對等體組必須是UPE。
l 建議不要同時配置peer default-route-advertise vpn-instance命令和peer upe route-policy命令。
l 建議SPE不直接同CE連接,如必須連接,則SPE上VPN實例和UPE上VPN實例必須配置不同的RD。
在VPN PE間配置偽連接Sham-link後,Sham-link將被視為OSPF區域內路由。這一特性用於使經過MPLS VPN骨幹網的路由成為OSPF區域內路由,避免VPN流量經backdoor路由轉發。
Sham-link的源地址和目的地址應使用32位掩碼的Loopback接口地址,且該loopback接口需要綁定到VPN實例中,並通過BGP發布。
在配置OSPF偽連接之前,需完成以下任務:
l 配置基本MPLS L3VPN(PE-CE間使用OSPF)
l 配置用戶CE所在局域網的OSPF
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建Loopback接口並進入Loopback接口視圖 |
interface loopback interface-number |
必選 |
|
將Loopback接口綁定到VPN實例 |
ip binding vpn-instance vpn-instance-name |
必選 缺省情況下,接口不關聯到任何VPN實例,屬於公網接口 |
|
配置Loopback接口的地址 |
ip address ip-address { mask | mask-length } |
必選 |
表1-26 發布Loopback接口的路由
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
必選 |
|
進入BGP-VPN實例視圖 |
ipv4-family vpn-instance vpn-instance-name |
必選 |
|
引入直連路由(將Loopback主機路由引入BGP) |
import-route direct [ med med-value | route-policy route-policy-name ] * |
必選 |
|
引入OSPF的私網路由 |
import-route ospf [ { process-id | all-processes } [ allow-direct | med med-value | route-policy route-policy-name ] * ] |
必選 |
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入OSPF視圖 |
ospf [ process-id | router-id router-id | vpn-instance vpn-instance-name ] * |
- |
|
配置route tag |
route-tag tag-value |
必選 |
|
進入OSPF區域視圖 |
area area-id |
必選 |
|
配置偽連接 |
sham-link source-ip-address destination-ip-address [ cost cost | dead dead-interval | hello hello-interval | retransmit retrans-interval | trans-delay delay | simple [ cipher | plain ] password | { md5 | hmac-md5 } key-id [ cipher | plain ] password ] * |
必選 缺省情況下,未配置偽連接 |
![]()
l 啟動OSPF而不手工配置Router ID時,係統會自動選取出一個Router ID。選舉規則請參見“三層技術-IP路由配置指導”中的“OSPF”。需要注意的是,由於選舉規則相同會得到相同的Router ID。建議用戶啟動OSPF進程時手工配置Router ID。
l 配置OSPF的VPN多實例而不配置route tag時,係統會根據配置的BGP自治係統號生成一個tag值,如果沒有配置BGP則tag為0。需要注意的是,在BGP的自治係統號相同的PE或同一台PE上,因為計算規則相同會得到相同的tag值。建議用戶配置OSPF的VPN多實例時手工配置tag值。
在配置BGP的AS號替換之前,需完成以下任務:
l 配置基本MPLS L3VPN
l 不同Site的CE具有相同的AS號
不同Site的CE具有相同的AS號時,PE上需要開啟BGP的AS號替換功能,從而避免路由被丟棄。
使能了BGP的AS號替換功能後,當PE向指定對等體中的CE發布路由時,如果路由的AS_PATH中有與CE相同的AS號,將被替換成PE的AS號後再發布。
表1-28 配置BGP的AS號替換
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
必選 |
|
進入BGP-VPN實例視圖 |
ipv4-family vpn-instance vpn-instance-name |
必選 |
|
使能BGP的AS號替換功能 |
peer { ip-address | group-name } substitute-as |
必選 缺省情況下,BGP的AS號替換功能是被禁止的 |
![]()
有關命令peer { ip-address | group-name } substitute-as介紹請參見“三層技術-IP路由命令參考”中的“BGP”。
當BGP配置變化後,可以通過軟複位或複位BGP連接使新的配置生效。軟複位需要BGP對等體具備路由刷新能力(支持ROUTE-REFRESH消息)。
![]()
軟複位BGP連接是指在不斷開BGP鄰居關係的情況下,更新BGP路由信息;複位BGP連接是指斷開並重新建立BGP鄰居關係的情況下,更新BGP路由信息。
請在用戶視圖下進行下列操作。
|
操作 |
命令 |
|
軟複位指定VPN實例的BGP連接 |
refresh bgp vpn-instance vpn-instance-name { ip-address | all | external | group group-name } { export | import } |
|
軟複位BGP的VPNv4連接 |
refresh bgp vpnv4 { ip-address | all | external | group group-name | internal } { export | import } |
|
複位指定VPN實例的BGP連接 |
reset bgp vpn-instance vpn-instance-name { as-number | ip-address | all | external | group group-name } |
|
複位BGP的VPNv4連接 |
reset bgp vpnv4 { as-number | ip-address | all | external | internal | group group-name } |
在完成上述配置後,在任意視圖下執行display命令可以顯示配置後MPLS L3VPN的運行情況,通過查看顯示信息驗證配置的效果。
在用戶視圖下執行reset命令可以清除路由振蕩衰減信息。
表1-30 顯示MPLS L3VPN的運行狀態
|
操作 |
命令 |
|
|
顯示與VPN實例相關聯的IP路由表 |
display ip routing-table vpn-instance vpn-instance-name [ verbose ] [ | { begin | exclude | include } regular-expression ] |
|
|
顯示指定VPN實例信息 |
display ip vpn-instance [ instance-name vpn-instance-name ] [ | { begin | exclude | include } regular-expression ] |
|
|
顯示指定VPN實例的FIB信息 |
display fib vpn-instance vpn-instance-name [ acl acl-number | ip-prefix ip-prefix-name ] [ | { begin | exclude | include } regular-expression ] |
|
|
顯示指定VPN實例中與指定目的IP地址匹配的FIB信息 |
display fib vpn-instance vpn-instance-name ip-address [ mask | mask-length ] [ | { begin | exclude | include } regular-expression ] |
|
|
顯示BGP路由表中的標簽路由信息 |
display bgp vpnv4 { all | vpn-instance vpn-instance-name } routing-table label [ | { begin | exclude | include } regular-expression ] |
|
|
顯示BGP VPNv4對等體組信息 |
display bgp vpnv4 { all | vpn-instance vpn-instance-name } group [ group-name ] [ | { begin | exclude | include } regular-expression ] |
|
|
顯示引入的BGP VPNv4路由信息 |
display bgp vpnv4 { all | vpn-instance vpn-instance-name } network [ | { begin | exclude | include } regular-expression ] |
|
|
顯示BGP VPNv4的AS路徑信息 |
display bgp vpnv4 { all | vpn-instance vpn-instance-name } paths [ as-regular-expression | { | { begin | exclude | include } regular-expression } ] |
|
|
顯示BGP VPNv4對等體信息 |
display bgp vpnv4 all peer [ ip-address verbose | verbose ] [ | { begin | exclude | include } regular-expression ] display bgp vpnv4 vpn-instance vpn-instance-name peer [ group-name log-info | ip-address { log-info | verbose } | verbose ] [ | { begin | exclude | include } regular-expression ] |
|
|
顯示從指定鄰居收到的ORF報文中的前綴信息 |
display bgp vpnv4 { all | vpn-instance vpn-instance-name } peer ip-address received ip-prefix [ | { begin | exclude | include } regular-expression ] |
|
|
顯示所有BGP VPNv4路由信息 |
display bgp vpnv4 all routing-table [ [ network-address [ { mask | mask-length } [ longer-prefixes ] ] | as-path-acl as-path-acl-number | cidr | community [ aa:nn ]&<1-13> [ no-advertise | no-export | no-export-subconfed ] * [ whole-match ] | community-list { { basic-community-list-number | comm-list-name } [ whole-match ] | adv-community-list-number } | different-origin-as | peer ip-address { advertised-routes | received-routes } [ statistic ] | statistic ] [ | { begin | exclude | include } regular-expression ] | regular-expression as-regular-expression ] |
|
|
顯示指定路由標識符的BGP VPNv4路由信息 |
display bgp vpnv4 route-distinguisher route-distinguisher routing-table [ [ network-address [ mask | mask-length ] | as-path-acl as-path-acl-number | cidr | community [ aa:nn ]&<1-13> [ no-advertise | no-export | no-export-subconfed ] * [ whole-match ] | community-list { { basic-community-list-number | comm-list-name } [ whole-match ] | adv-community-list-number } | different-origin-as ] [ | { begin | exclude | include } regular-expression ] | regular-expression as-regular-expression ] |
|
|
顯示指定VPN實例的BGP VPNv4路由信息 |
display bgp vpnv4 vpn-instance vpn-instance-name routing-table [ [ network-address [ { mask | mask-length } [ longer-prefixes ] ] | as-path-acl as-path-acl-number | cidr | community [ aa:nn ]&<1-13> [ no-advertise | no-export | no-export-subconfed ] * [ whole-match ] | community-list { { basic-community-list-number | comm-list-name } [ whole-match ] | adv-community-list-number } | dampened | dampening parameter | different-origin-as | flap-info [ network-address [ { mask | mask-length } [ longer-match ] ] | as-path-acl as-path-acl-number ] | peer ip-address { advertised-routes | received-routes } | statistic ] [ | { begin | exclude | include } regular-expression ] | [ flap-info ] regular-expression as-regular-expression ] |
|
|
顯示OSPF偽連接信息 |
display ospf [ process-id ] sham-link [ area area-id ] [ | { begin | exclude | include } regular-expression ] |
|
|
顯示所有或指定隧道策略的信息 |
display tunnel-policy { all | policy-name tunnel-policy-name } [ | { begin | exclude | include } regular-expression ] |
|
|
顯示指定LDP實例的信息 |
display mpls ldp vpn-instance vpn-instance-name [ | { begin | exclude | include } regular-expression ] |
|
|
清除指定VPN實例的路由振蕩衰減信息 |
reset bgp vpn-instance vpn-instance-name dampening [ network-address [ mask | mask-length ] |
|
|
清除指定VPN實例的BGP對等體路由振蕩曆史信息 |
reset bgp vpn-instance vpn-instance-name ip-address flap-info reset bgp vpn-instance vpn-instance-name flap-info [ ip-address [ mask | mask-length ] | as-path-acl as-path-acl-number | regexp as-path-regexp ] |
|
![]()
有關查看路由表的命令介紹請參見“三層技術-IP路由命令參考”中的“IP路由基礎命令”。
l CE 1、CE 3屬於VPN 1,CE 2、CE 4屬於VPN 2;
l VPN 1使用的VPN Target屬性為111:1,VPN 2使用的VPN Target屬性為222:2。不同VPN用戶之間不能互相訪問;
l CE與PE之間配置EBGP交換VPN路由信息;
l PE與PE之間配置OSPF實現PE內部的互通、配置MP-IBGP交換VPN路由信息。
圖1-19 PE-CE間使用EBGP基本MPLS L3VPN組網圖

|
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
CE 1 |
Vlan-int11 |
10.1.1.1/24 |
P |
Loop0 |
2.2.2.9/32 |
|
PE 1 |
Loop0 |
1.1.1.9/32 |
|
Vlan-int12 |
172.2.1.1/24 |
|
|
Vlan-int11 |
10.1.1.2/24 |
|
Vlan-int13 |
172.1.1.2/24 |
|
|
Vlan-int13 |
172.1.1.1/24 |
PE 2 |
Loop0 |
3.3.3.9/32 |
|
|
Vlan-int12 |
10.2.1.2/24 |
|
Vlan-int12 |
172.2.1.2/24 |
|
CE 2 |
Vlan-int12 |
10.2.1.1/24 |
|
Vlan-int11 |
10.3.1.2/24 |
|
CE 3 |
Vlan-int11 |
10.3.1.1/24 |
|
Vlan-int13 |
10.4.1.2/24 |
|
CE 4 |
Vlan-int13 |
10.4.1.1/24 |
|
|
|
(1) 在MPLS骨幹網上配置IGP協議,實現骨幹網PE和P的互通
# 配置PE 1。
<PE1> system-view
[PE1] interface loopback 0
[PE1-LoopBack0] ip address 1.1.1.9 32
[PE1-LoopBack0] quit
[PE1] interface vlan-interface 13
[PE1-Vlan-interface13] ip address 172.1.1.1 24
[PE1-Vlan-interface13] quit
[PE1] ospf
[PE1-ospf-1] area 0
[PE1-ospf-1-area-0.0.0.0] network 172.1.1.0 0.0.0.255
[PE1-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[PE1-ospf-1-area-0.0.0.0] quit
[PE1-ospf-1] quit
# 配置P。
<P> system-view
[P] interface loopback 0
[P-LoopBack0] ip address 2.2.2.9 32
[P-LoopBack0] quit
[P] interface vlan-interface 13
[P-Vlan-interface13] ip address 172.1.1.2 24
[P-Vlan-interface13] quit
[P] interface vlan-interface 12
[P-Vlan-interface12] ip address 172.2.1.1 24
[P-Vlan-interface12] quit
[P] ospf
[P-ospf-1] area 0
[P-ospf-1-area-0.0.0.0] network 172.1.1.0 0.0.0.255
[P-ospf-1-area-0.0.0.0] network 172.2.1.0 0.0.0.255
[P-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[P-ospf-1-area-0.0.0.0] quit
[P-ospf-1] quit
# 配置PE 2。
<PE2> system-view
[PE2] interface loopback 0
[PE2-LoopBack0] ip address 3.3.3.9 32
[PE2-LoopBack0] quit
[PE2] interface vlan-interface 12
[PE2-Vlan-interface12] ip address 172.2.1.2 24
[PE2-Vlan-interface12] quit
[PE2] ospf
[PE2-ospf-1] area 0
[PE2-ospf-1-area-0.0.0.0] network 172.2.1.0 0.0.0.255
[PE2-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[PE2-ospf-1-area-0.0.0.0] quit
[PE2-ospf-1] quit
配置完成後,PE 1、P、PE 2之間應能建立OSPF鄰居,執行display ospf peer命令可以看到鄰居達到FULL狀態。執行display ip routing-table命令可以看到PE之間學習到對方的Loopback路由。
以PE 1為例:
[PE1] display ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.9/32 OSPF 10 1 172.1.1.2 Vlan13
3.3.3.9/32 OSPF 10 2 172.1.1.2 Vlan13
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
172.1.1.0/24 Direct 0 0 172.1.1.1 Vlan13
172.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
172.2.1.0/24 OSPF 10 1 172.1.1.2 Vlan13
[PE1] display ospf peer verbose
OSPF Process 1 with Router ID 1.1.1.9
Neighbors
Area 0.0.0.0 interface 172.1.1.1(Vlan-interface13)'s neighbors
Router ID: 172.1.1.2 Address: 172.1.1.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: 172.1.1.1 BDR: 172.1.1.2 MTU: 0
Dead timer due in 38 sec
Neighbor is up for 00:02:44
Authentication Sequence: [ 0 ]
Neighbor state change count: 5
(2) 在MPLS骨幹網上配置MPLS基本能力和MPLS LDP,建立LDP LSP
# 配置PE 1。
[PE1] mpls lsr-id 1.1.1.9
[PE1] mpls
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
[PE1] interface vlan-interface 13
[PE1-Vlan-interface13] mpls
[PE1-Vlan-interface13] mpls ldp
[PE1-Vlan-interface13] quit
# 配置P。
[P] mpls lsr-id 2.2.2.9
[P] mpls
[P-mpls] quit
[P] mpls ldp
[P-mpls-ldp] quit
[P] interface vlan-interface 13
[P-Vlan-interface13] mpls
[P-Vlan-interface13] mpls ldp
[P-Vlan-interface13] quit
[P] interface vlan-interface 12
[P-Vlan-interface12] mpls
[P-Vlan0interface12] mpls ldp
[P-Vlan-interface12] quit
# 配置PE 2。
[PE2] mpls lsr-id 3.3.3.9
[PE2] mpls
[PE2-mpls] quit
[PE2] mpls ldp
[PE2-mpls-ldp] quit
[PE2] interface vlan-interface 12
[PE2-Vlan-interface12] mpls
[PE2-Vlan-interface12] mpls ldp
[PE2-Vlan-interface12] quit
上述配置完成後,PE 1、P、PE 2之間應能建立LDP會話,執行display mpls ldp session命令可以看到顯示結果中Status字段為Operational。執行display mpls ldp lsp命令,可以看到LDP LSP的建立情況。
以PE 1為例:
[PE1] display mpls ldp session
LDP Session(s) in Public Network
Total number of sessions: 1
----------------------------------------------------------------
Peer-ID Status LAM SsnRole FT MD5 KA-Sent/Rcv
---------------------------------------------------------------
2.2.2.9:0 Operational DU Passive Off Off 5/5
---------------------------------------------------------------
LAM : Label Advertisement Mode FT : Fault Tolerance
[PE1] display mpls ldp lsp
LDP LSP Information
------------------------------------------------------------------
SN DestAddress/Mask In/OutLabel Next-Hop In/Out-Interface
------------------------------------------------------------------
1 1.1.1.9/32 3/NULL 127.0.0.1 -------/InLoop0
2 2.2.2.9/32 NULL/3 172.1.1.2 -------/Vlan-interface13
3 3.3.3.9/32 NULL/1024 172.1.1.2 -------/Vlan-interface13
------------------------------------------------------------------
A '*' before an LSP means the LSP is not established
A '*' before a Label means the USCB or DSCB is stale
(3) 在PE設備上配置VPN實例,將CE接入PE
# 配置PE 1。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 100:1
[PE1-vpn-instance-vpn1] vpn-target 111:1
[PE1-vpn-instance-vpn1] quit
[PE1] ip vpn-instance vpn2
[PE1-vpn-instance-vpn2] route-distinguisher 100:2
[PE1-vpn-instance-vpn2] vpn-target 222:2
[PE1-vpn-instance-vpn2] quit
[PE1] interface vlan-interface 11
[PE1-Vlan-interface11] ip binding vpn-instance vpn1
[PE1-Vlan-interface11] ip address 10.1.1.2 24
[PE1-Vlan-interface11] quit
[PE1] interface vlan-interface 12
[PE1-Vlan-interface12] ip binding vpn-instance vpn2
[PE1-Vlan-interface12] ip address 10.2.1.2 24
[PE1-Vlan-interface12] quit
# 配置PE 2。
[PE2] ip vpn-instance vpn1
[PE2-vpn-instance-vpn1] route-distinguisher 200:1
[PE2-vpn-instance-vpn1] vpn-target 111:1
[PE2-vpn-instance-vpn1] quit
[PE2] ip vpn-instance vpn2
[PE2-vpn-instance-vpn2] route-distinguisher 200:2
[PE2-vpn-instance-vpn2] vpn-target 222:2
[PE2-vpn-instance-vpn2] quit
[PE2] interface vlan-interface 11
[PE2-Vlan-interface11] ip binding vpn-instance vpn1
[PE2-Vlan-interface11] ip address 10.3.1.2 24
[PE2-Vlan-interface11] quit
[PE2] interface vlan-interface 13
[PE2-Vlan-interface13] ip binding vpn-instance vpn2
[PE2-Vlan-interface13] ip address 10.4.1.2 24
[PE2-Vlan-interface13] quit
# 按圖1-19配置各CE的接口IP地址,配置過程略。
配置完成後,在PE設備上執行display ip vpn-instance命令可以看到VPN實例的配置情況。各PE能ping通自己接入的CE。
以PE 1和CE 1為例:
[PE1] display ip vpn-instance
Total VPN-Instances configured : 2
VPN-Instance Name RD Create time
vpn1 100:1 2009/01/22 13:02:21
vpn2 100:2 2009/01/22 13:02:40
[PE1] ping -vpn-instance vpn1 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=56 ms
Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=4 ms
Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=4 ms
Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=52 ms
Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=3 ms
--- 10.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 3/23/56 ms
(4) 在PE與CE之間建立EBGP對等體,引入VPN路由
# 配置CE 1。
<CE1> system-view
[CE1] bgp 65410
[CE1-bgp] peer 10.1.1.2 as-number 100
[CE1-bgp] import-route direct
[CE1-bgp] quit
![]()
另外3個CE設備(CE 2~CE 4)配置與CE 1設備配置類似,配置過程省略。
# 配置PE 1。
[PE1] bgp 100
[PE1-bgp] ipv4-family vpn-instance vpn1
[PE1-bgp-vpn1] peer 10.1.1.1 as-number 65410
[PE1-bgp-vpn1] import-route direct
[PE1-bgp-vpn1] quit
[PE1-bgp] ipv4-family vpn-instance vpn2
[PE1-bgp-vpn2] peer 10.2.1.1 as-number 65420
[PE1-bgp-vpn2] import-route direct
[PE1-bgp-vpn2] quit
[PE1-bgp] quit
![]()
PE 2的配置與PE 1類似,配置過程省略。
配置完成後,在PE設備上執行display bgp vpnv4 vpn-instance peer命令,可以看到PE與CE之間的BGP對等體關係已建立,並達到Established狀態。
以PE 1與CE 1的對等體關係為例:
[PE1] display bgp vpnv4 vpn-instance vpn1 peer
BGP local router ID : 1.1.1.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
10.1.1.1 65410 11 9 0 1 00:06:37 Established
(5) 在PE之間建立MP-IBGP對等體
# 配置PE 1。
[PE1] bgp 100
[PE1-bgp] peer 3.3.3.9 as-number 100
[PE1-bgp] peer 3.3.3.9 connect-interface loopback 0
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp-af-vpnv4] peer 3.3.3.9 enable
[PE1-bgp-af-vpnv4] quit
[PE1-bgp] quit
# 配置PE 2。
[PE2] bgp 100
[PE2-bgp] peer 1.1.1.9 as-number 100
[PE2-bgp] peer 1.1.1.9 connect-interface loopback 0
[PE2-bgp] ipv4-family vpnv4
[PE2-bgp-af-vpnv4] peer 1.1.1.9 enable
[PE2-bgp-af-vpnv4] quit
[PE2-bgp] quit
配置完成後,在PE設備上執行display bgp peer或display bgp vpnv4 all peer命令,可以看到PE之間的BGP對等體關係已建立,並達到Established狀態。
[PE1] display bgp peer
BGP local router ID : 1.1.1.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
3.3.3.9 100 2 6 0 0 00:00:12 Established
(6) 配置完成後的檢驗
在PE設備上執行display ip routing-table vpn-instance命令,可以看到去往對端CE的路由。
以PE 1為例:
[PE1] display ip routing-table vpn-instance vpn1
Routing Tables: vpn1
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 Direct 0 0 10.1.1.2 Vlan11
10.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.3.1.0/24 BGP 255 0 3.3.3.9 NULL0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
[PE1] display ip routing-table vpn-instance vpn2
Routing Tables: vpn2
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
10.2.1.0/24 Direct 0 0 10.2.1.2 Vlan12
10.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.4.1.0/24 BGP 255 0 3.3.3.9 NULL0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
同一VPN的CE能夠相互Ping通,不同VPN的CE不能相互Ping通。
例如:CE 1能夠Ping通CE 3(10.3.1.1),但不能Ping通CE 4(10.4.1.1)。
[CE1] ping 10.3.1.1
PING 10.3.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.3.1.1: bytes=56 Sequence=1 ttl=253 time=72 ms
Reply from 10.3.1.1: bytes=56 Sequence=2 ttl=253 time=34 ms
Reply from 10.3.1.1: bytes=56 Sequence=3 ttl=253 time=50 ms
Reply from 10.3.1.1: bytes=56 Sequence=4 ttl=253 time=50 ms
Reply from 10.3.1.1: bytes=56 Sequence=5 ttl=253 time=34 ms
--- 10.3.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 34/48/72 ms
[CE1] ping 10.4.1.1
PING 10.4.1.1: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 10.4.1.1 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
l CE 1、CE 3屬於VPN 1,CE 2、CE 4屬於VPN 2;
l VPN 1使用的VPN Target屬性為111:1,VPN 2使用的VPN Target屬性為222:2。不同VPN用戶之間不能互相訪問;
l CE與PE之間配置IBGP交換VPN路由信息;
l PE與PE之間配置OSPF實現PE內部的互通、配置MP-IBGP交換VPN路由信息。
圖1-20 PE-CE間使用IBGP基本MPLS L3VPN組網圖

|
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
PE 1 |
Loop0 |
1.1.1.9/32 |
PE 2 |
Loop0 |
3.3.3.9/32 |
|
|
Vlan-int11 |
10.1.1.2/24 |
|
Vlan-int12 |
172.2.1.2/24 |
|
|
Vlan-int13 |
172.1.1.1/24 |
|
Vlan-int11 |
10.3.1.2/24 |
|
|
Vlan-int12 |
10.2.1.2/24 |
|
Vlan-int13 |
10.4.1.2/24 |
|
CE 1 |
Loop0 |
4.4.4.9/32 |
P |
Loop0 |
2.2.2.9/32 |
|
|
Vlan-int11 |
10.1.1.1/24 |
|
Vlan-int12 |
172.2.1.1/24 |
|
CE 2 |
Loop0 |
5.5.5.9/32 |
|
Vlan-int13 |
172.1.1.2/24 |
|
|
Vlan-int12 |
10.2.1.1/24 |
CE 4 |
Loop0 |
7.7.7.9/32 |
|
CE 3 |
Loop0 |
6.6.6.9/32 |
|
Vlan-int13 |
10.4.1.1/24 |
|
|
Vlan-int11 |
10.3.1.1/24 |
|
|
|
|
|
|
|
|
|
|
(1) 在MPLS骨幹網上配置IGP協議,實現骨幹網PE和P的互通
# 配置PE 1。
<PE1> system-view
[PE1] interface loopback 0
[PE1-LoopBack0] ip address 1.1.1.9 32
[PE1-LoopBack0] quit
[PE1] interface vlan-interface 13
[PE1-Vlan-interface13] ip address 172.1.1.1 24
[PE1-Vlan-interface13] quit
[PE1] ospf
[PE1-ospf-1] area 0
[PE1-ospf-1-area-0.0.0.0] network 172.1.1.0 0.0.0.255
[PE1-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[PE1-ospf-1-area-0.0.0.0] quit
[PE1-ospf-1] quit
# 配置P。
<P> system-view
[P] interface loopback 0
[P-LoopBack0] ip address 2.2.2.9 32
[P-LoopBack0] quit
[P] interface vlan-interface 13
[P-Vlan-interface13] ip address 172.1.1.2 24
[P-Vlan-interface13] quit
[P] interface vlan-interface 12
[P-Vlan-interface12] ip address 172.2.1.1 24
[P-Vlan-interface12] quit
[P] ospf
[P-ospf-1] area 0
[P-ospf-1-area-0.0.0.0] network 172.1.1.0 0.0.0.255
[P-ospf-1-area-0.0.0.0] network 172.2.1.0 0.0.0.255
[P-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[P-ospf-1-area-0.0.0.0] quit
[P-ospf-1] quit
# 配置PE 2。
<PE2> system-view
[PE2] interface loopback 0
[PE2-LoopBack0] ip address 3.3.3.9 32
[PE2-LoopBack0] quit
[PE2] interface vlan-interface 12
[PE2-Vlan-interface12] ip address 172.2.1.2 24
[PE2-Vlan-interface12] quit
[PE2] ospf
[PE2-ospf-1] area 0
[PE2-ospf-1-area-0.0.0.0] network 172.2.1.0 0.0.0.255
[PE2-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[PE2-ospf-1-area-0.0.0.0] quit
[PE2-ospf-1] quit
配置完成後,PE 1、P、PE 2之間應能建立OSPF鄰居,執行display ospf peer命令可以看到鄰居達到FULL狀態。執行display ip routing-table命令可以看到PE之間學習到對方的Loopback路由。
以PE 1為例:
[PE1] display ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.9/32 OSPF 10 1 172.1.1.2 Vlan13
3.3.3.9/32 OSPF 10 2 172.1.1.2 Vlan13
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
172.1.1.0/24 Direct 0 0 172.1.1.1 Vlan13
172.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
172.2.1.0/24 OSPF 10 1 172.1.1.2 Vlan13
[PE1] display ospf peer verbose
OSPF Process 1 with Router ID 1.1.1.9
Neighbors
Area 0.0.0.0 interface 172.1.1.1(Vlan-interface13)'s neighbors
Router ID: 172.1.1.2 Address: 172.1.1.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: 172.1.1.1 BDR: 172.1.1.2 MTU: 0
Dead timer due in 38 sec
Neighbor is up for 00:02:44
Authentication Sequence: [ 0 ]
Neighbor state change count: 5
(2) 在MPLS骨幹網上配置MPLS基本能力和MPLS LDP,建立LDP LSP
# 配置PE 1。
[PE1] mpls lsr-id 1.1.1.9
[PE1] mpls
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
[PE1] interface vlan-interface 13
[PE1-Vlan-interface13] mpls
[PE1-Vlan-interface13] mpls ldp
[PE1-Vlan-interface13] quit
# 配置P。
[P] mpls lsr-id 2.2.2.9
[P] mpls
[P-mpls] quit
[P] mpls ldp
[P-mpls-ldp] quit
[P] interface vlan-interface 13
[P-Vlan-interface13] mpls
[P-Vlan-interface13] mpls ldp
[P-Vlan-interface13] quit
[P] interface vlan-interface 12
[P-Vlan-interface12] mpls
[P-Vlan0interface12] mpls ldp
[P-Vlan-interface12] quit
# 配置PE 2。
[PE2] mpls lsr-id 3.3.3.9
[PE2] mpls
[PE2-mpls] quit
[PE2] mpls ldp
[PE2-mpls-ldp] quit
[PE2] interface vlan-interface 12
[PE2-Vlan-interface12] mpls
[PE2-Vlan-interface12] mpls ldp
[PE2-Vlan-interface12] quit
上述配置完成後,PE 1、P、PE 2之間應能建立LDP會話,執行display mpls ldp session命令可以看到顯示結果中Status字段為Operational。執行display mpls ldp lsp命令,可以看到LDP LSP的建立情況。
以PE 1為例:
[PE1] display mpls ldp session
LDP Session(s) in Public Network
Total number of sessions: 1
----------------------------------------------------------------
Peer-ID Status LAM SsnRole FT MD5 KA-Sent/Rcv
---------------------------------------------------------------
2.2.2.9:0 Operational DU Passive Off Off 5/5
---------------------------------------------------------------
LAM : Label Advertisement Mode FT : Fault Tolerance
[PE1] display mpls ldp lsp
LDP LSP Information
------------------------------------------------------------------
SN DestAddress/Mask In/OutLabel Next-Hop In/Out-Interface
------------------------------------------------------------------
1 1.1.1.9/32 3/NULL 127.0.0.1 -------/InLoop0
2 2.2.2.9/32 NULL/3 172.1.1.2 -------/Vlan-interface13
3 3.3.3.9/32 NULL/1024 172.1.1.2 -------/Vlan-interface13
------------------------------------------------------------------
A '*' before an LSP means the LSP is not established
A '*' before a Label means the USCB or DSCB is stale
(3) 在PE設備上配置VPN實例,將CE接入PE
# 配置PE 1。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 100:1
[PE1-vpn-instance-vpn1] vpn-target 111:1
[PE1-vpn-instance-vpn1] quit
[PE1] ip vpn-instance vpn2
[PE1-vpn-instance-vpn2] route-distinguisher 100:2
[PE1-vpn-instance-vpn2] vpn-target 222:2
[PE1-vpn-instance-vpn2] quit
[PE1] interface vlan-interface 11
[PE1-Vlan-interface11] ip binding vpn-instance vpn1
[PE1-Vlan-interface11] ip address 10.1.1.2 24
[PE1-Vlan-interface11] quit
[PE1] interface vlan-interface 12
[PE1-Vlan-interface12] ip binding vpn-instance vpn2
[PE1-Vlan-interface12] ip address 10.2.1.2 24
[PE1-Vlan-interface12] quit
# 配置PE 2。
[PE2] ip vpn-instance vpn1
[PE2-vpn-instance-vpn1] route-distinguisher 200:1
[PE2-vpn-instance-vpn1] vpn-target 111:1
[PE2-vpn-instance-vpn1] quit
[PE2] ip vpn-instance vpn2
[PE2-vpn-instance-vpn2] route-distinguisher 200:2
[PE2-vpn-instance-vpn2] vpn-target 222:2
[PE2-vpn-instance-vpn2] quit
[PE2] interface vlan-interface 11
[PE2-Vlan-interface11] ip binding vpn-instance vpn1
[PE2-Vlan-interface11] ip address 10.3.1.2 24
[PE2-Vlan-interface11] quit
[PE2] interface vlan-interface 13
[PE2-Vlan-interface13] ip binding vpn-instance vpn2
[PE2-Vlan-interface13] ip address 10.4.1.2 24
[PE2-Vlan-interface13] quit
# 按圖1-20配置各CE的接口IP地址,配置過程略。
配置完成後,在PE設備上執行display ip vpn-instance命令可以看到VPN實例的配置情況。各PE能ping通自己接入的CE。
以PE 1和CE 1為例:
[PE1] display ip vpn-instance
Total VPN-Instances configured : 2
VPN-Instance Name RD Create time
vpn1 100:1 2009/01/22 13:02:21
vpn2 100:2 2009/01/22 13:02:40
[PE1] ping -vpn-instance vpn1 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=56 ms
Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=4 ms
Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=4 ms
Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=52 ms
Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=3 ms
--- 10.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 3/23/56 ms
(4) 在PE與CE之間建立IBGP對等體,引入VPN路由,並配置路由策略修改路由的下一跳
# 在CE 1上配置IBGP對等體,並對從PE 1接收的路由應用路由策略,將路由下一跳修改為PE 1的地址。
<CE1> system-view
[CE1] route-policy ce-ibgp permit node 0
[CE1-route-policy] apply ip-address next-hop 10.1.1.2
[CE1-route-policy] quit
[CE1] bgp 100
[CE1-bgp] peer 10.1.1.2 as-number 100
[CE1-bgp] peer 10.1.1.2 route-policy ce-ibgp import
[CE1-bgp] import-route direct
[CE1-bgp] quit
![]()
另外3個CE設備(CE 2~CE 4)配置與CE 1設備配置類似,配置過程省略。
# 在PE 1上配置IBGP對等體,並配置PE 1作為路由反射器反射路由。
[PE1] bgp 100
[PE1-bgp] ipv4-family vpn-instance vpn1
[PE1-bgp-vpn1] peer 10.1.1.1 as-number 100
[PE1-bgp-vpn1] peer 10.1.1.1 reflect-client
[PE1-bgp-vpn1] import-route direct
[PE1-bgp-vpn1] quit
[PE1-bgp] ipv4-family vpn-instance vpn2
[PE1-bgp-vpn2] peer 10.2.1.1 as-number 100
[PE1-bgp-vpn2] peer 10.2.1.1 reflect-client
[PE1-bgp-vpn2] import-route direct
[PE1-bgp-vpn2] quit
[PE1-bgp] quit
![]()
PE 2的配置與PE 1類似,配置過程省略。
配置完成後,在PE設備上執行display bgp vpnv4 vpn-instance peer命令,可以看到PE與CE之間的BGP對等體關係已建立,並達到Established狀態。
以PE 1與CE 1的對等體關係為例:
[PE1] display bgp vpnv4 vpn-instance vpn1 peer
BGP local router ID : 1.1.1.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
10.1.1.1 100 26 21 0 2 00:11:08 Established
(5) 在PE之間建立MP-IBGP對等體
# 在PE 1上配置MP-IBGP對等體,並對從PE 2接收的路由應用路由策略,將路由下一跳修改為PE 2的環回接口地址。
[PE1] route-policy pe-ibgp permit node 0
[PE1-route-policy] apply ip-address next-hop 3.3.3.9
[PE1-route-policy] quit
[PE1] bgp 100
[PE1-bgp] peer 3.3.3.9 as-number 100
[PE1-bgp] peer 3.3.3.9 connect-interface loopback 0
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp-af-vpnv4] peer 3.3.3.9 route-policy pe-ibgp import
[PE1-bgp-af-vpnv4] peer 3.3.3.9 enable
[PE1-bgp-af-vpnv4] quit
[PE1-bgp] quit
# 在PE 2上配置MP-IBGP對等體,並對從PE 1接收的路由應用路由策略,將路由下一跳修改為PE 1的環回接口地址。
[PE2] route-policy pe-ibgp permit node 0
[PE2-route-policy] apply ip-address next-hop 1.1.1.9
[PE2-route-policy] quit
[PE2] bgp 100
[PE2-bgp] peer 1.1.1.9 as-number 100
[PE2-bgp] peer 1.1.1.9 connect-interface loopback 0
[PE2-bgp] ipv4-family vpnv4
[PE2-bgp-af-vpnv4] peer 1.1.1.9 route-policy pe-ibgp import
[PE2-bgp-af-vpnv4] peer 1.1.1.9 enable
[PE2-bgp-af-vpnv4] quit
[PE2-bgp] quit
配置完成後,在PE設備上執行display bgp peer或display bgp vpnv4 all peer命令,可以看到PE之間的BGP對等體關係已建立,並達到Established狀態。
[PE1] display bgp peer
BGP local router ID : 1.1.1.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
3.3.3.9 100 4 8 0 0 00:00:09 Established
(6) 配置完成後的檢驗
在PE設備上執行display ip routing-table vpn-instance命令,可以看到去往對端CE的路由。
以PE 1為例:
[PE1] display ip routing-table vpn-instance vpn1
Routing Tables: vpn1
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost NextHop Interface
4.4.4.9/32 BGP 255 0 10.1.1.1 Vlan11
6.6.6.9/32 BGP 255 0 3.3.3.9 NULL0
10.1.1.0/24 Direct 0 0 10.1.1.2 Vlan11
10.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.3.1.0/24 BGP 255 0 3.3.3.9 NULL0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
[PE1] display ip routing-table vpn-instance vpn2
Routing Tables: vpn2
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
5.5.5.9/32 BGP 255 0 10.2.1.1 Vlan12
7.7.7.9/32 BGP 255 0 3.3.3.9 NULL0
10.2.1.0/24 Direct 0 0 10.2.1.2 Vlan12
10.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.4.1.0/24 BGP 255 0 3.3.3.9 NULL0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
同一VPN的CE能夠相互Ping通,不同VPN的CE不能相互Ping通。
例如:CE 1能夠Ping通CE 3(6.6.6.9),但不能Ping通CE 4(7.7.7.9)。
[CE1] ping 6.6.6.9
PING 6.6.6.9: 56 data bytes, press CTRL_C to break
Reply from 6.6.6.9: bytes=56 Sequence=1 ttl=253 time=72 ms
Reply from 6.6.6.9: bytes=56 Sequence=2 ttl=253 time=34 ms
Reply from 6.6.6.9: bytes=56 Sequence=3 ttl=253 time=50 ms
Reply from 6.6.6.9: bytes=56 Sequence=4 ttl=253 time=50 ms
Reply from 6.6.6.9: bytes=56 Sequence=5 ttl=253 time=34 ms
--- 6.6.6.9 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 34/48/72 ms
[CE1] ping 7.7.7.9
PING 7.7.7.9: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 7.7.7.9 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
l Spoke-CE之間不能直接通信,隻能通過Hub-CE轉發Spoke-CE之間的流量。
l Spoke-CE與Spoke-PE之間、Hub-CE與Hub-PE之間配置EBGP交換VPN路由信息。
l Spoke-PE與Hub-PE之間配置OSPF實現PE內部的互通、配置MP-IBGP交換VPN路由信息。

|
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
|
Spoke-CE 1 |
Vlan-int2 |
10.1.1.1/24 |
Hub-CE |
Vlan-int6 |
10.3.1.1/24 |
|
Spoke-PE 1 |
Loop0 |
1.1.1.9/32 |
|
Vlan-int7 |
10.4.1.1/24 |
|
|
Vlan-int2 |
10.1.1.2/24 |
Hub-PE |
Loop0 |
2.2.2.9/32 |
|
|
Vlan-int4 |
172.1.1.1/24 |
|
Vlan-int4 |
172.1.1.2/24 |
|
Spoke-CE 2 |
Vlan-int3 |
10.2.1.1/24 |
|
Vlan-int5 |
172.2.1.2/24 |
|
Spoke-PE 2 |
Loop0 |
3.3.3.9/32 |
|
Vlan-int6 |
10.3.1.2/24 |
|
|
Vlan-int3 |
10.2.1.2/24 |
|
Vlan-int7 |
10.4.1.2/24 |
|
|
Vlan-int5 |
172.2.1.1/24 |
|
|
|
(1) 在MPLS骨幹網上配置IGP協議,實現骨幹網Spoke-PE、Hub-PE之間的互通
# 配置Spoke-PE 1。
<Spoke-PE1> system-view
[Spoke-PE1] interface loopback 0
[Spoke-PE1-LoopBack0] ip address 1.1.1.9 32
[Spoke-PE1-LoopBack0] quit
[Spoke-PE1] interface vlan-interface 4
[Spoke-PE1-Vlan-interface4] ip address 172.1.1.1 24
[Spoke-PE1-Vlan-interface4] quit
[Spoke-PE1] ospf
[Spoke-PE1-ospf-1] area 0
[Spoke-PE1-ospf-1-area-0.0.0.0] network 172.1.1.0 0.0.0.255
[Spoke-PE1-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[Spoke-PE1-ospf-1-area-0.0.0.0] quit
[Spoke-PE1-ospf-1] quit
# 配置Spoke-PE 2。
<Spoke-PE2> system-view
[Spoke-PE2] interface loopback 0
[Spoke-PE2-LoopBack0] ip address 3.3.3.9 32
[Spoke-PE2-LoopBack0] quit
[Spoke-PE2] interface vlan-interface 5
[Spoke-PE2-Vlan-interface5] ip address 172.2.1.1 24
[Spoke-PE2-Vlan-interface5] quit
[Spoke-PE2] ospf
[Spoke-PE2-ospf-1] area 0
[Spoke-PE2-ospf-1-area-0.0.0.0] network 172.2.1.0 0.0.0.255
[Spoke-PE2-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[Spoke-PE2-ospf-1-area-0.0.0.0] quit
[Spoke-PE2-ospf-1] quit
# 配置Hub-PE。
<Hub-PE> system-view
[Hub-PE] interface loopback 0
[Hub-PE-LoopBack0] ip address 2.2.2.9 32
[Hub-PE-LoopBack0] quit
[Hub-PE] interface vlan-interface 4
[Hub-PE-Vlan-interface4] ip address 172.1.1.2 24
[Hub-PE-Vlan-interface4] quit
[Hub-PE] interface vlan-interface 5
[Hub-PE-Vlan-interface5] ip address 172.2.1.2 24
[Hub-PE-Vlan-interface5] quit
[Hub-PE] ospf
[Hub-PE-ospf-1] area 0
[Hub-PE-ospf-1-area-0.0.0.0] network 172.1.1.0 0.0.0.255
[Hub-PE-ospf-1-area-0.0.0.0] network 172.2.1.0 0.0.0.255
[Hub-PE-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[Hub-PE-ospf-1-area-0.0.0.0] quit
[Hub-PE-ospf-1] quit
配置完成後,Spoke-PE 1、Spoke-PE 2、Hub-PE之間應能建立OSPF鄰居,執行display ospf peer命令可以看到鄰居達到FULL狀態。執行display ip routing-table命令可以看到PE之間學習到對方的Loopback路由。
以Spoke-PE 1為例:
[Spoke-PE1] display ip routing-table
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.9/32 OSPF 10 1 172.1.1.2 Vlan4
3.3.3.9/32 OSPF 10 2 172.1.1.2 Vlan4
10.1.1.0/24 Direct 0 0 10.1.1.2 Vlan2
10.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
172.1.1.0/24 Direct 0 0 172.1.1.1 Vlan4
172.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
172.2.1.0/24 OSPF 10 1 172.1.1.2 Vlan4
[Spoke-PE1] display ospf peer verbose
OSPF Process 1 with Router ID 1.1.1.9
Neighbors
Area 0.0.0.0 interface 172.1.1.1(Vlan-interface4)'s neighbors
Router ID: 2.2.2.9 Address: 172.1.1.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: 172.1.1.1 BDR: 172.1.1.2 MTU: 0
Dead timer due in 38 sec
Neighbor is up for 00:02:44
Authentication Sequence: [ 0 ]
Neighbor state change count: 5
(2) 在MPLS骨幹網上配置MPLS基本能力和MPLS LDP,建立LDP LSP
# 配置Spoke-PE 1。
[Spoke-PE1] mpls lsr-id 1.1.1.9
[Spoke-PE1] mpls
[Spoke-PE1-mpls] quit
[Spoke-PE1] mpls ldp
[Spoke-PE1-mpls-ldp] quit
[Spoke-PE1] interface vlan-interface 4
[Spoke-PE1-Vlan-interface4] mpls
[Spoke-PE1-Vlan-interface4] mpls ldp
[Spoke-PE1-Vlan-interface4] quit
# 配置Spoke-PE 2。
[Spoke-PE2] mpls lsr-id 3.3.3.9
[Spoke-PE2] mpls
[Spoke-PE2-mpls] quit
[Spoke-PE2] mpls ldp
[Spoke-PE2-mpls-ldp] quit
[Spoke-PE2] interface vlan-interface 5
[Spoke-PE2-Vlan-interface5] mpls
[Spoke-PE2-Vlan-interface5] mpls ldp
[Spoke-PE2-Vlan-interface5] quit
# 配置Hub-PE。
[Hub-PE] mpls lsr-id 2.2.2.9
[Hub-PE] mpls
[Hub-PE-mpls] quit
[Hub-PE] mpls ldp
[Hub-PE-mpls-ldp] quit
[Hub-PE] interface vlan-interface 4
[Hub-PE-Vlan-interface4] mpls
[Hub-PE-Vlan-interface4] mpls ldp
[Hub-PE-Vlan-interface4] quit
[Hub-PE] interface vlan-interface 5
[Hub-PE-Vlan-interface5] mpls
[Hub-PE-Vlan-interface5] mpls ldp
[Hub-PE-Vlan-interface5] quit
上述配置完成後,Spoke-PE 1、Spoke-PE 2、Hub-PE之間應能建立LDP會話,執行display mpls ldp session命令可以看到顯示結果中Status字段為Operational。執行display mpls ldp lsp命令,可以看到LDP LSP的建立情況。
以Spoke-PE 1為例:
[Spoke-PE1] display mpls ldp session
LDP Session(s) in Public Network
Total number of sessions: 1
----------------------------------------------------------------
Peer-ID Status LAM SsnRole FT MD5 KA-Sent/Rcv
---------------------------------------------------------------
2.2.2.9:0 Operational DU Passive Off Off 5/5
---------------------------------------------------------------
LAM : Label Advertisement Mode FT : Fault Tolerance
[Spoke-PE1] display mpls ldp lsp
LDP LSP Information
------------------------------------------------------------------
SN DestAddress/Mask In/OutLabel Next-Hop In/Out-Interface
------------------------------------------------------------------
1 1.1.1.9/32 3/NULL 127.0.0.1 -------/InLoop0
2 2.2.2.9/32 NULL/3 172.1.1.2 -------/Vlan-interface4
3 3.3.3.9/32 NULL/1024 172.1.1.2 -------/Vlan-interface4
------------------------------------------------------------------
A '*' before an LSP means the LSP is not established
A '*' before a Label means the USCB or DSCB is stale
(3) 在Spoke-PE和Hub-PE設備上配置VPN實例,將CE接入PE
# 配置Spoke-PE 1。
[Spoke-PE1] ip vpn-instance vpn1
[Spoke-PE1-vpn-instance-vpn1] route-distinguisher 100:1
[Spoke-PE1-vpn-instance-vpn1] vpn-target 111:1 import-extcommunity
[Spoke-PE1-vpn-instance-vpn1] vpn-target 222:2 export-extcommunity
[Spoke-PE1-vpn-instance-vpn1] quit
[Spoke-PE1] interface vlan-interface 2
[Spoke-PE1-Vlan-interface2] ip binding vpn-instance vpn1
[Spoke-PE1-Vlan-interface2] ip address 10.1.1.2 24
[Spoke-PE1-Vlan-interface2] quit
# 配置Spoke-PE 2。
[Spoke-PE2] ip vpn-instance vpn1
[Spoke-PE2-vpn-instance-vpn1] route-distinguisher 100:2
[Spoke-PE2-vpn-instance-vpn1] vpn-target 111:1 import-extcommunity
[Spoke-PE2-vpn-instance-vpn1] vpn-target 222:2 export-extcommunity
[Spoke-PE2-vpn-instance-vpn1] quit
[Spoke-PE2] interface vlan-interface 3
[Spoke-PE2-Vlan-interface3] ip binding vpn-instance vpn1
[Spoke-PE2-Vlan-interface3] ip address 10.2.1.2 24
[Spoke-PE2-Vlan-interface3] quit
# 配置Hub-PE。
[Hub-PE] ip vpn-instance vpn1-in
[Hub-PE-vpn-instance-vpn1-in] route-distinguisher 100:3
[Hub-PE-vpn-instance-vpn1-in] vpn-target 222:2 import-extcommunity
[Hub-PE-vpn-instance-vpn1-in] quit
[Hub-PE] ip vpn-instance vpn1-out
[Hub-PE-vpn-instance-vpn1-out] route-distinguisher 100:4
[Hub-PE-vpn-instance-vpn1-out] vpn-target 111:1 export-extcommunity
[Hub-PE-vpn-instance-vpn1-out] quit
[Hub-PE] interface vlan-interface 6
[Hub-PE-Vlan-interface6] ip binding vpn-instance vpn1-in
[Hub-PE-Vlan-interface6] ip address 10.3.1.2 24
[Hub-PE-Vlan-interface6] quit
[Hub-PE] interface vlan-interface 7
[Hub-PE-Vlan-interface7] ip binding vpn-instance vpn1-out
[Hub-PE-Vlan-interface7] ip address 10.4.1.2 24
[Hub-PE-Vlan-interface7] quit
# 按圖1-21配置各CE的接口IP地址,配置過程略。
配置完成後,在PE設備上執行display ip vpn-instance命令可以看到VPN實例的配置情況。各PE能ping通自己接入的CE。
以Spoke-PE 1和Spoke-CE 1為例:
[Spoke-PE1] display ip vpn-instance
Total VPN-Instances configured : 1
VPN-Instance Name RD Create time
vpn1 100:1 2009/04/08 10:55:07
[Spoke-PE1] ping -vpn-instance vpn1 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=56 ms
Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=4 ms
Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=4 ms
Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=52 ms
Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=3 ms
--- 10.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 3/23/56 ms
(4) 在PE與CE之間建立EBGP對等體,引入VPN路由
# 配置Spoke-CE 1。
<Spoke-CE1> system-view
[Spoke-CE1] bgp 65410
[Spoke-CE1-bgp] peer 10.1.1.2 as-number 100
[Spoke-CE1-bgp] import-route direct
[Spoke-CE1-bgp] quit
# 配置Spoke-CE 2。
<Spoke-CE2> system-view
[Spoke-CE2] bgp 65420
[Spoke-CE2-bgp] peer 10.2.1.2 as-number 100
[Spoke-CE2-bgp] import-route direct
[Spoke-CE2-bgp] quit
# 配置Hub-CE。
<Hub-CE> system-view
[Hub-CE] bgp 65430
[Hub-CE-bgp] peer 10.3.1.2 as-number 100
[Hub-CE-bgp] peer 10.4.1.2 as-number 100
[Hub-CE-bgp] import-route direct
[Hub-CE-bgp] quit
# 配置Spoke-PE 1。
[Spoke-PE1] bgp 100
[Spoke-PE1-bgp] ipv4-family vpn-instance vpn1
[Spoke-PE1-bgp-vpn1] peer 10.1.1.1 as-number 65410
[Spoke-PE1-bgp-vpn1] import-route direct
[Spoke-PE1-bgp-vpn1] quit
[Spoke-PE1-bgp] quit
# 配置Spoke-PE 2。
[Spoke-PE2] bgp 100
[Spoke-PE2-bgp] ipv4-family vpn-instance vpn1
[Spoke-PE2-bgp-vpn1] peer 10.2.1.1 as-number 65420
[Spoke-PE2-bgp-vpn1] import-route direct
[Spoke-PE2-bgp-vpn1] quit
[Spoke-PE2-bgp] quit
# 配置Hub-PE。
[Hub-PE] bgp 100
[Hub-PE-bgp] ipv4-family vpn-instance vpn1-in
[Hub-PE-bgp-vpn1-in] peer 10.3.1.1 as-number 65430
[Hub-PE-bgp-vpn1-in] import-route direct
[Hub-PE-bgp-vpn1-in] quit
[Hub-PE-bgp] ipv4-family vpn-instance vpn1-out
[Hub-PE-bgp-vpn1-out] peer 10.4.1.1 as-number 65430
[Hub-PE-bgp-vpn1-out] peer 10.4.1.1 allow-as-loop
[Hub-PE-bgp-vpn1-out] import-route direct
[Hub-PE-bgp-vpn1-out] quit
[Hub-PE-bgp] quit
配置完成後,在PE設備上執行display bgp vpnv4 vpn-instance peer命令,可以看到PE與CE之間的BGP對等體關係已建立,並達到Established狀態。
以Spoke-PE 1與Spoke-CE 1的對等體關係為例:
[Spoke-PE1] display bgp vpnv4 vpn-instance vpn1 peer
BGP local router ID : 1.1.1.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
10.1.1.1 65410 6 7 0 2 00:03:16 Established
(5) 在Spoke-PE和Hub-PE之間建立MP-IBGP對等體
# 配置Spoke-PE 1。
[Spoke-PE1] bgp 100
[Spoke-PE1-bgp] peer 2.2.2.9 as-number 100
[Spoke-PE1-bgp] peer 2.2.2.9 connect-interface loopback 0
[Spoke-PE1-bgp] ipv4-family vpnv4
[Spoke-PE1-bgp-af-vpnv4] peer 2.2.2.9 enable
[Spoke-PE1-bgp-af-vpnv4] quit
[Spoke-PE1-bgp] quit
# 配置Spoke-PE 2。
[Spoke-PE2] bgp 100
[Spoke-PE2-bgp] peer 2.2.2.9 as-number 100
[Spoke-PE2-bgp] peer 2.2.2.9 connect-interface loopback 0
[Spoke-PE2-bgp] ipv4-family vpnv4
[Spoke-PE2-bgp-af-vpnv4] peer 2.2.2.9 enable
[Spoke-PE2-bgp-af-vpnv4] quit
[Spoke-PE2-bgp] quit
# 配置Hub-PE。
[Hub-PE] bgp 100
[Hub-PE-bgp] peer 1.1.1.9 as-number 100
[Hub-PE-bgp] peer 1.1.1.9 connect-interface loopback 0
[Hub-PE-bgp] peer 3.3.3.9 as-number 100
[Hub-PE-bgp] peer 3.3.3.9 connect-interface loopback 0
[Hub-PE-bgp] ipv4-family vpnv4
[Hub-PE-bgp-af-vpnv4] peer 1.1.1.9 enable
[Hub-PE-bgp-af-vpnv4] peer 3.3.3.9 enable
[Hub-PE-bgp-af-vpnv4] quit
[Hub-PE-bgp] quit
配置完成後,在PE設備上執行display bgp peer或display bgp vpnv4 all peer命令,可以看到PE之間的BGP對等體關係已建立,並達到Established狀態。
[Spoke-PE1] display bgp peer
BGP local router ID : 1.1.1.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
2.2.2.9 100 6 5 0 0 00:00:32 Established
(6) 配置完成後的檢驗
# 在PE設備上執行display ip routing-table vpn-instance命令,可以看到去往各個CE的路由,且Spoke-PE上到達對端Spoke-CE的路由指向Hub-PE。以Spoke-PE 1為例:
[Spoke-PE1] display ip routing-table vpn-instance vpn1
Routing Tables: vpn1
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
10.0.0.0/24 BGP 255 0 2.2.2.9 NULL0
10.1.1.0/24 Direct 0 0 10.1.1.2 Vlan2
10.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
10.2.1.0/24 BGP 255 0 2.2.2.9 NULL0
10.3.1.0/24 BGP 255 0 2.2.2.9 NULL0
10.4.1.0/24 BGP 255 0 2.2.2.9 NULL0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
# Spoke-CE 1和Spoke-CE 2之間可以ping通。從TTL值可以推算出Spoke-CE 1到Spoke-CE 2經過6跳(255-250),即Spoke-CE 1和Spoke-CE 2之間的流量需要通過Hub-CE轉發。以Spoke-CE 1為例:
[Spoke-CE1] ping 10.2.1.1
PING 10.2.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.2.1.1: bytes=56 Sequence=1 ttl=250 time=3 ms
Reply from 10.2.1.1: bytes=56 Sequence=2 ttl=250 time=3 ms
Reply from 10.2.1.1: bytes=56 Sequence=3 ttl=250 time=2 ms
Reply from 10.2.1.1: bytes=56 Sequence=4 ttl=250 time=2 ms
Reply from 10.2.1.1: bytes=56 Sequence=5 ttl=250 time=2 ms
--- 10.2.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 2/2/3 ms
l CE 1和CE 2屬於同一個VPN。
l CE 1通過AS100的PE 1接入,CE 2通過AS200的PE 2接入。
l 采用OptionA方式實現跨域的MPLS L3VPN,即,采用VRF-to-VRF方式管理VPN路由。
l 同一個AS內部的MPLS骨幹網使用OSPF作為IGP。
圖1-22 配置跨域VPN-OptionA方式組網圖

|
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
|
CE 1 |
Vlan-int12 |
10.1.1.1/24 |
CE 2 |
Vlan-int12 |
10.2.1.1/24 |
|
PE 1 |
Loop0 |
1.1.1.9/32 |
PE 2 |
Loop0 |
4.4.4.9/32 |
|
|
Vlan-int12 |
10.1.1.2/24 |
|
Vlan-int12 |
10.2.1.2/24 |
|
|
Vlan-int11 |
172.1.1.2/24 |
|
Vlan-int11 |
162.1.1.2/24 |
|
ASBR-PE 1 |
Loop0 |
2.2.2.9/32 |
ASBR-PE 2 |
Loop0 |
3.3.3.9/32 |
|
|
Vlan-int11 |
172.1.1.1/24 |
|
Vlan-int11 |
162.1.1.1/24 |
|
|
Vlan-int12 |
192.1.1.1/24 |
|
Vlan-int12 |
192.1.1.2/24 |
(1) 在MPLS骨幹網上配置IGP協議,實現骨幹網內互通
本例中采用OSPF,具體配置步驟略。
![]()
需要將作為LSR ID的LoopBack接口的32位地址通過OSPF發布出去。
配置完成後,ASBR-PE與本AS的PE之間應能建立OSPF鄰居,執行display ospf peer命令可以看到鄰居達到FULL狀態,PE之間能學習到對方的Loopback地址。
ASBR-PE與本AS的PE之間能夠互相ping通。
(2) 在MPLS骨幹網上配置MPLS基本能力和MPLS LDP,建立LDP LSP
# 配置PE 1的MPLS基本能力,並在與ASBR-PE 1相連的接口上使能LDP。
<PE1> system-view
[PE1] mpls lsr-id 1.1.1.9
[PE1] mpls
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
[PE1] interface vlan-interface 11
[PE1-Vlan-interface11] mpls
[PE1-Vlan-interface11] mpls ldp
[PE1-Vlan-interface11] quit
# 配置ASBR-PE 1的MPLS基本能力,並在與PE 1相連的接口上使能LDP。
<ASBR-PE1> system-view
[ASBR-PE1] mpls lsr-id 2.2.2.9
[ASBR-PE1] mpls
[ASBR-PE1-mpls] quit
[ASBR-PE1] mpls ldp
[ASBR-PE1-mpls-ldp] quit
[ASBR-PE1] interface vlan-interface 11
[ASBR-PE1-Vlan-interface11] mpls
[ASBR-PE1-Vlan-interface11] mpls ldp
[ASBR-PE1-Vlan-interface11] quit
# 配置ASBR-PE 2的MPLS基本能力,並在與PE 2相連的接口上使能LDP。
<ASBR-PE2> system-view
[ASBR-PE2] mpls lsr-id 3.3.3.9
[ASBR-PE2] mpls
[ASBR-PE2-mpls] quit
[ASBR-PE2] mpls ldp
[ASBR-PE2-mpls-ldp] quit
[ASBR-PE2] interface vlan-interface 11
[ASBR-PE2-Vlan-interface11] mpls
[ASBR-PE2-Vlan-interface11] mpls ldp
[ASBR-PE2-Vlan-interface11] quit
# 配置PE 2的MPLS基本能力,並在與ASBR-PE 2相連的接口上使能LDP。
<PE2> system-view
[PE2] mpls lsr-id 4.4.4.9
[PE2] mpls
[PE2-mpls] quit
[PE2] mpls ldp
[PE2-mpls-ldp] quit
[PE2] interface vlan-interface 11
[PE2-Vlan-interface11] mpls
[PE2-Vlan-interface11] mpls ldp
[PE2-Vlan-interface11] quit
上述配置完成後,同一AS的PE和ASBR-PE之間應該建立起LDP鄰居,在各設備上執行display mpls ldp session命令可以看到顯示結果中Status字段為“Operational”。
(3) 在PE設備上配置VPN實例,將CE接入PE
![]()
同一AS內的ASBR-PE與PE的VPN實例的VPN Target應能匹配,不同AS的PE的VPN實例的VPN Target則不需要匹配。
# 配置CE 1。
<CE1> system-view
[CE1] interface vlan-interface 12
[CE1-Vlan-interface12] ip address 10.1.1.1 24
[CE1-Vlan-interface12] quit
# 配置PE 1。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 100:1
[PE1-vpn-instance-vpn1] vpn-target 100:1 both
[PE1-vpn-instance-vpn1] quit
[PE1] interface vlan-interface 12
[PE1-Vlan-interface12] ip binding vpn-instance vpn1
[PE1-Vlan-interface12] ip address 10.1.1.2 24
[PE1-Vlan-interface12] quit
# 配置CE 2。
<CE2> system-view
[CE2] interface vlan-interface 12
[CE2-Vlan-interface12] ip address 10.2.1.1 24
[CE2-Vlan-interface12] quit
# 配置PE 2。
[PE2] ip vpn-instance vpn1
[PE2-vpn-instance] route-distinguisher 200:2
[PE2-vpn-instance] vpn-target 100:1 both
[PE2-vpn-instance] quit
[PE2] interface vlan-interface 12
[PE2-Vlan-interface12] ip binding vpn-instance vpn1
[PE2-Vlan-interface12] ip address 10.2.1.2 24
[PE2-Vlan-interface12] quit
# 配置ASBR-PE 1:創建VPN實例,並將此實例綁定到連接ASBR-PE 2的接口(ASBR-PE 1認為ASBR-PE 2是自己的CE)。
[ASBR-PE1] ip vpn-instance vpn1
[ASBR-PE1-vpn-instance-vpn1] route-distinguisher 100:1
[ASBR-PE1-vpn-instance-vpn1] vpn-target 100:1 both
[ASBR-PE1-vpn-instance-vpn1] quit
[ASBR-PE1] interface vlan-interface 12
[ASBR-PE1-Vlan-interface12] ip binding vpn-instance vpn1
[ASBR-PE1-Vlan-interface12] ip address 192.1.1.1 24
[ASBR-PE1-Vlan-interface12] quit
# 配置ASBR-PE 2:創建VPN實例,並將此實例綁定到連接ASBR-PE 1的接口(ASBR-PE 2認為ASBR-PE 1是自己的CE)。
[ASBR-PE2] ip vpn-instance vpn1
[ASBR-PE2-vpn-vpn-vpn1] route-distinguisher 200:1
[ASBR-PE2-vpn-vpn-vpn1] vpn-target 100:1 both
[ASBR-PE2-vpn-vpn-vpn1] quit
[ASBR-PE2] interface vlan-interface 12
[ASBR-PE2-Vlan-interface12] ip binding vpn-instance vpn1
[ASBR-PE2-Vlan-interface12] ip address 192.1.1.2 24
[ASBR-PE2-Vlan-interface12] quit
上述配置完成後,在各PE設備上執行display ip vpn-instance命令能正確顯示VPN實例配置。
各PE能ping通CE。ASBR-PE之間也能互相ping通。
(4) 在PE與CE之間建立EBGP對等體,引入VPN路由
# 配置CE 1。
[CE1] bgp 65001
[CE1-bgp] peer 10.1.1.2 as-number 100
[CE1-bgp] import-route direct
[CE1-bgp] quit
# 配置PE 1。
[PE1] bgp 100
[PE1-bgp] ipv4-family vpn-instance vpn1
[PE1-bgp-vpn1] peer 10.1.1.1 as-number 65001
[PE1-bgp-vpn1] import-route direct
[PE1-bgp-vpn1] quit
[PE1-bgp] quit
# 配置CE 2。
[CE2] bgp 65002
[CE2-bgp] peer 10.2.1.2 as-number 200
[CE2-bgp] import-route direct
[CE2-bgp] quit
# 配置PE 2。
[PE2] bgp 200
[PE2-bgp] ipv4-family vpn-instance vpn1
[PE2-bgp-vpn1] peer 10.2.1.1 as-number 65002
[PE2-bgp-vpn1] import-route direct
[PE2-bgp-vpn1] quit
[PE2-bgp] quit
(5) PE與本AS的ASBR-PE之間建立MP-IBGP對等體,ASBR-PE之間建立EBGP對等體
# 配置PE 1。
[PE1] bgp 100
[PE1-bgp] peer 2.2.2.9 as-number 100
[PE1-bgp] peer 2.2.2.9 connect-interface loopback 0
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp-af-vpnv4] peer 2.2.2.9 enable
[PE1-bgp-af-vpnv4] peer 2.2.2.9 next-hop-local
[PE1-bgp-af-vpnv4] quit
[PE1-bgp] quit
# 配置ASBR-PE 1。
[ASBR-PE1] bgp 100
[ASBR-PE1-bgp] ipv4-family vpn-instance vpn1
[ASBR-PE1-bgp-vpn1] peer 192.1.1.2 as-number 200
[ASBR-PE1-bgp-vpn1] quit
[ASBR-PE1-bgp] peer 1.1.1.9 as-number 100
[ASBR-PE1-bgp] peer 1.1.1.9 connect-interface loopback 0
[ASBR-PE1-bgp] ipv4-family vpnv4
[ASBR-PE1-bgp-af-vpnv4] peer 1.1.1.9 enable
[ASBR-PE1-bgp-af-vpnv4] peer 1.1.1.9 next-hop-local
[ASBR-PE1-bgp-af-vpnv4] quit
[ASBR-PE1-bgp] quit
# 配置ASBR-PE 2。
[ASBR-PE2] bgp 200
[ASBR-PE2-bgp] ipv4-family vpn-instance vpn1
[ASBR-PE2-bgp-vpn1] peer 192.1.1.1 as-number 100
[ASBR-PE2-bgp-vpn1] quit
[ASBR-PE2-bgp] peer 4.4.4.9 as-number 200
[ASBR-PE2-bgp] peer 4.4.4.9 connect-interface loopback 0
[ASBR-PE2-bgp] ipv4-family vpnv4
[ASBR-PE2-bgp-af-vpnv4] peer 4.4.4.9 enable
[ASBR-PE2-bgp-af-vpnv4] peer 4.4.4.9 next-hop-local
[ASBR-PE2-bgp-af-vpnv4] quit
[ASBR-PE2-bgp] quit
# 配置PE 2。
[PE2] bgp 200
[PE2-bgp] peer 3.3.3.9 as-number 200
[PE2-bgp] peer 3.3.3.9 connect-interface loopback 0
[PE2-bgp] ipv4-family vpnv4
[PE2-bgp-af-vpnv4] peer 3.3.3.9 enable
[PE2-bgp-af-vpnv4] peer 3.3.3.9 next-hop-local
[PE2-bgp-af-vpnv4] quit
[PE2-bgp] quit
(6) 配置完成後的檢驗
上述配置完成後,CE之間能學習到對方的接口路由,CE 1和CE 2能夠相互ping通。
l Site 1和Site 2屬於同一個VPN,Site 1的CE 1通過AS 100的PE 1接入,Site 2的CE 2通過AS 600的PE 2接入;
l 同一自治係統內的PE設備之間運行IS-IS作為IGP;
l PE 1與ASBR-PE 1間通過MP-IBGP交換標簽IPv4路由;
l PE 2與ASBR-PE 2間通過MP-IBGP交換標簽IPv4路由;
l ASBR-PE 1與ASBR-PE 2間通過MP-EBGP交換標簽IPv4路由;
l ASBR上不對接收的VPN-IPv4路由進行VPN Target過濾。
圖1-23 配置跨域VPN-OptionB方式組網圖

|
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
|
PE 1 |
Loop0 |
2.2.2.9/32 |
PE 2 |
Loop0 |
5.5.5.9/32 |
|
|
Vlan-int12 |
30.0.0.1/8 |
|
Vlan-int12 |
20.0.0.1/8 |
|
|
Vlan-int11 |
1.1.1.2/8 |
|
Vlan-int11 |
9.1.1.2/8 |
|
ASBR-PE 1 |
Loop0 |
3.3.3.9/32 |
ASBR-PE 2 |
Loop0 |
4.4.4.9/32 |
|
|
Vlan-int11 |
1.1.1.1/8 |
|
Vlan-int11 |
9.1.1.1/8 |
|
|
Vlan-int12 |
11.0.0.2/8 |
|
Vlan-int12 |
11.0.0.1/8 |
(1) 配置PE 1
# 在PE 1上運行IS-IS。
<PE1> system-view
[PE1] isis 1
[PE1-isis-1] network-entity 10.1111.1111.1111.1111.00
[PE1-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[PE1] mpls lsr-id 2.2.2.9
[PE1] mpls
[PE1-mpls] label advertise non-null
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
# 配置Vlan-interface11,在接口上運行IS-IS,並使能MPLS和LDP。
[PE1] interface vlan-interface 11
[PE1-Vlan-interface11] ip address 1.1.1.2 255.0.0.0
[PE1-Vlan-interface11] isis enable 1
[PE1-Vlan-interface11] mpls
[PE1-Vlan-interface11] mpls ldp
[PE1-Vlan-interface11] quit
# 創建Loopback0接口,在接口上運行IS-IS。
[PE1] interface loopback 0
[PE1-LoopBack0] ip address 2.2.2.9 32
[PE1-LoopBack0] isis enable 1
[PE1-LoopBack0] quit
# 創建一個VPN實例,名為vpn1,配置RD和VPN Target屬性。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 11:11
[PE1-vpn-instance-vpn1] vpn-target 3:3 import-extcommunity
[PE1-vpn-instance-vpn1] vpn-target 3:3 export-extcommunity
[PE1-vpn-instance-vpn1] quit
# 將連接CE 1的接口綁定到創建的VPN實例。
[PE1] interface vlan-interface 12
[PE1-Vlan-interface12] ip binding vpn-instance vpn1
[PE1-Vlan-interface12] ip address 30.0.0.1 8
[PE1-Vlan-interface12] quit
# 在PE 1上運行BGP。
[PE1] bgp 100
# 配置IBGP對等體3.3.3.9為VPNv4對等體。
[PE1-bgp] peer 3.3.3.9 as-number 100
[PE1-bgp] peer 3.3.3.9 connect-interface loopback 0
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp-af-vpnv4] peer 3.3.3.9 enable
[PE1-bgp-af-vpnv4] quit
# 將直連路由引入VPN1的VPN路由表。
[PE1-bgp] ipv4-family vpn-instance vpn1
[PE1-bgp-vpn1] import-route direct
[PE1-bgp-vpn1] quit
[PE1-bgp] quit
(2) 配置ASBR-PE 1
# 在ASBR-PE 1上運行IS-IS。
<ASBR-PE1> system-view
[ASBR-PE1] isis 1
[ASBR-PE1-isis-1] network-entity 10.2222.2222.2222.2222.00
[ASBR-PE1-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[ASBR-PE1] mpls lsr-id 3.3.3.9
[ASBR-PE1] mpls
[ASBR-PE1-mpls] label advertise non-null
[ASBR-PE1-mpls] quit
[ASBR-PE1] mpls ldp
[ASBR-PE1-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並使能MPLS和LDP。
[ASBR-PE1] interface vlan-interface11
[ASBR-PE1-Vlan-interface11] ip address 1.1.1.1 255.0.0.0
[ASBR-PE1-Vlan-interface11] isis enable 1
[ASBR-PE1-Vlan-interface11] mpls
[ASBR-PE1-Vlan-interface11] mpls ldp
[ASBR-PE1-Vlan-interface11] quit
# 配置接口Vlan-interface12,使能MPLS。
[ASBR-PE1] interface vlan-interface 12
[ASBR-PE1-Vlan-interface12] ip address 11.0.0.2 255.0.0.0
[ASBR-PE1-Vlan-interface12] mpls
[ASBR-PE1-Vlan-interface12] quit
# 創建Loopback0接口,並運行IS-IS。
[ASBR-PE1] interface loopback 0
[ASBR-PE1-LoopBack0] ip address 3.3.3.9 32
[ASBR-PE1-LoopBack0] isis enable 1
[ASBR-PE1-LoopBack0] quit
# 在ASBR-PE 1上運行BGP
[ASBR-PE1] bgp 100
[ASBR-PE1-bgp] peer 2.2.2.9 as-number 100
[ASBR-PE1-bgp] peer 2.2.2.9 connect-interface loopback 0
[ASBR-PE1-bgp] peer 11.0.0.1 as-number 600
# 不對接收的VPNv4路由進行Import VPN-target過濾。
[ASBR-PE1-bgp] ipv4-family vpnv4
[ASBR-PE1-bgp-af-vpnv4] undo policy vpn-target
# 將IBGP對等體2.2.2.9和EBGP對等體11.0.0.1都配置為VPNv4對等體。
[ASBR-PE1-bgp-af-vpnv4] peer 11.0.0.1 enable
[ASBR-PE1-bgp-af-vpnv4] peer 2.2.2.9 enable
[ASBR-PE1-bgp-af-vpnv4] quit
(3) 配置ASBR-PE 2
# 在ASBR-PE 2上運行IS-IS。
<ASBR-PE2> system-view
[ASBR-PE2] isis 1
[ASBR-PE2-isis-1] network-entity 10.2222.2222.2222.2222.00
[ASBR-PE2-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[ASBR-PE2] mpls lsr-id 4.4.4.9
[ASBR-PE2] mpls
[ASBR-PE2-mpls] label advertise non-null
[ASBR-PE2-mpls] quit
[ASBR-PE2] mpls ldp
[ASBR-PE2-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並使能MPLS和LDP。
[ASBR-PE2] interface vlan-interface 11
[ASBR-PE2-Vlan-interface11] ip address 9.1.1.1 255.0.0.0
[ASBR-PE2-Vlan-interface11] isis enable 1
[ASBR-PE2-Vlan-interface11] mpls
[ASBR-PE2-Vlan-interface11] mpls ldp
[ASBR-PE2-Vlan-interface11] quit
# 配置接口Vlan-interface12,使能MPLS。
[ASBR-PE2] interface vlan-interface 12
[ASBR-PE2-Vlan-interface12] ip address 11.0.0.1 255.0.0.0
[ASBR-PE2-Vlan-interface12] mpls
[ASBR-PE2-Vlan-interface12] quit
# 創建Loopback0接口,並運行IS-IS。
[ASBR-PE2] interface loopback 0
[ASBR-PE2-LoopBack0] ip address 4.4.4.9 32
[ASBR-PE2-LoopBack0] isis enable 1
[ASBR-PE2-LoopBack0] quit
# 在ASBR-PE 2上運行BGP。
[ASBR-PE2] bgp 600
[ASBR-PE2-bgp] peer 11.0.0.2 as-number 100
[ASBR-PE2-bgp] peer 5.5.5.9 as-number 600
[ASBR-PE2-bgp] peer 5.5.5.9 connect-interface loopback 0
# 不對接收的VPNv4路由進行Import VPN-target過濾。
[ASBR-PE2-bgp] ipv4-family vpnv4
[ASBR-PE2-bgp-af-vpnv4] undo policy vpn-target
# 將IBGP對等體5.5.5.9和EBGP對等體11.0.0.2都配置為VPNv4對等體。
[ASBR-PE2-bgp-af-vpnv4] peer 11.0.0.2 enable
[ASBR-PE2-bgp-af-vpnv4] peer 5.5.5.9 enable
[ASBR-PE2-bgp-af-vpnv4] quit
[ASBR-PE2-bgp] quit
(4) 配置PE 2
# 在PE 2上運行IS-IS。
<PE2> system-view
[PE2] isis 1
[PE2-isis-1] network-entity 10.1111.1111.1111.1111.00
[PE2-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[PE2] mpls lsr-id 5.5.5.9
[PE2] mpls
[PE2-mpls] label advertise non-null
[PE2-mpls] quit
[PE2] mpls ldp
[PE2-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並使能MPLS和LDP。
[PE2] interface vlan-interface 11
[PE2-Vlan-interface11] ip address 9.1.1.2 255.0.0.0
[PE2-Vlan-interface11] isis enable 1
[PE2-Vlan-interface11] mpls
[PE2-Vlan-interface11] mpls ldp
[PE2-Vlan-interface11] quit
# 創建Loopback0接口,在接口上運行IS-IS。
[PE2] interface loopback 0
[PE2-LoopBack0] ip address 5.5.5.9 32
[PE2-LoopBack0] isis enable 1
[PE2-LoopBack0] quit
# 創建一個VPN實例,名為vpn1,配置RD和VPN Target屬性。
[PE2] ip vpn-instance vpn1
[PE2-vpn-instance-vpn1] route-distinguisher 12:12
[PE2-vpn-instance-vpn1] vpn-target 3:3 import-extcommunity
[PE2-vpn-instance-vpn1] vpn-target 3:3 export-extcommunity
[PE2-vpn-instance-vpn1] quit
# 將連接CE 2的接口綁定到創建的VPN實例。
[PE2] interface Vlan-interface12
[PE2-Vlan-interface12] ip binding vpn-instance vpn1
[PE2-Vlan-interface12] ip address 20.0.0.1 8
[PE2-Vlan-interface12] quit
# 在PE 2上運行BGP。
[PE2] bgp 600
# 配置IBGP對等體4.4.4.9為VPNv4對等體。
[PE2-bgp] peer 4.4.4.9 as-number 600
[PE2-bgp] peer 4.4.4.9 connect-interface loopback 0
[PE2-bgp] ipv4-family vpnv4
[PE2-bgp-af-vpnv4] peer 4.4.4.9 enable
[PE2-bgp-af-vpnv4] quit
# 將直連路由引入VPN1的VPN路由表。
[PE2-bgp] ipv4-family vpn-instance vpn1
[PE2-bgp-vpn1] import-route direct
[PE2-bgp-vpn1] quit
[PE2-bgp] quit
(5) 配置完成後的檢驗
# 配置完成後,在PE 2上對PE 1進行Ping操作,可以Ping通:
[PE2] ping –vpn-instance vpn1 30.0.0.1
# 在PE 1上對PE 2進行Ping操作,也可以Ping通:
[PE1] ping –vpn-instance vpn1 20.0.0.1
l Site 1和Site 2屬於同一個VPN,Site 1通過AS 100的PE 1接入,Site 2通過AS 600的PE 2接入;
l 同一自治係統內的PE設備之間運行IS-IS作為IGP;
l PE 1與ASBR-PE 1間通過MP-IBGP交換標簽IPv4路由;
l PE 2與ASBR-PE 2間通過MP-IBGP交換標簽IPv4路由;
l PE 1與PE 2建立MP-EBGP對等體;
l ASBR-PE 1和ASBR-PE 2上分別配置路由策略,對從對方接收的路由壓入標簽;
l ASBR-PE 1與ASBR-PE 2間通過MP-EBGP交換標簽IPv4路由。
圖1-24 配置跨域VPN-OptionC方式組網圖

|
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
|
PE 1 |
Loop0 |
2.2.2.9/32 |
PE 2 |
Loop0 |
5.5.5.9/32 |
|
|
Loop1 |
30.0.0.1/32 |
|
Loop1 |
20.0.0.1/32 |
|
|
Vlan-int11 |
1.1.1.2/8 |
|
Vlan-int11 |
9.1.1.2/8 |
|
ASBR-PE 1 |
Loop0 |
3.3.3.9/32 |
ASBR-PE 2 |
Loop0 |
4.4.4.9/32 |
|
|
Vlan-int11 |
1.1.1.1/8 |
|
Vlan-int11 |
9.1.1.1/8 |
|
|
Vlan-int12 |
11.0.0.2/8 |
|
Vlan-int12 |
11.0.0.1/8 |
(1) 配置PE 1
# 在PE 1上運行IS-IS。
<PE1> system-view
[PE1] isis 1
[PE1-isis-1] network-entity 10.1111.1111.1111.1111.00
[PE1-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[PE1] mpls lsr-id 2.2.2.9
[PE1] mpls
[PE1-mpls] label advertise non-null
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並使能MPLS和LDP。
[PE1] interface vlan-interface 11
[PE1-Vlan-interface11] ip address 1.1.1.2 255.0.0.0
[PE1-Vlan-interface11] isis enable 1
[PE1-Vlan-interface11] mpls
[PE1-Vlan-interface11] mpls ldp
[PE1-Vlan-interface11] quit
# 創建Loopback0接口,在接口上運行IS-IS。
[PE1] interface loopback 0
[PE1-LoopBack0] ip address 2.2.2.9 32
[PE1-LoopBack0] isis enable 1
[PE1-LoopBack0] quit
# 創建VPN實例,名稱為vpn1,為其配置RD和VPN Target屬性。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 11:11
[PE1-vpn-instance-vpn1] vpn-target 3:3 import-extcommunity
[PE1-vpn-instance-vpn1] vpn-target 3:3 export-extcommunity
[PE1-vpn-instance-vpn1] quit
# 創建Loopback1接口,並將此接口綁定到vpn1。
[PE1] interface loopback 1
[PE1-LoopBack1] ip binding vpn-instance vpn1
[PE1-LoopBack1] ip address 30.0.0.1 32
[PE1-LoopBack1] quit
# 在PE 1上運行BGP。
[PE1] bgp 100
# 配置PE 1向IBGP對等體3.3.3.9發布標簽路由及從3.3.3.9接收標簽路由的能力。
[PE1-bgp] peer 3.3.3.9 as-number 100
[PE1-bgp] peer 3.3.3.9 connect-interface loopback 0
[PE1-bgp] peer 3.3.3.9 label-route-capability
# 配置PE 1到EBGP對等體5.5.5.9的最大跳數為10。
[PE1-bgp] peer 5.5.5.9 as-number 600
[PE1-bgp] peer 5.5.5.9 connect-interface loopback 0
[PE1-bgp] peer 5.5.5.9 ebgp-max-hop 10
# 配置對等體5.5.5.9作為VPNv4對等體。
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp-af-vpnv4] peer 5.5.5.9 enable
[PE1-bgp-af-vpnv4] quit
# 將直連路由引入vpn1的路由表。
[PE1-bgp] ipv4-family vpn-instance vpn1
[PE1-bgp-vpn1] import-route direct
[PE1-bgp-vpn1] quit
[PE1-bgp] quit
(2) 配置ASBR-PE1
# 在ASBR-PE 1上運行IS-IS。
<ASBR-PE1> system-view
[ASBR-PE1] isis 1
[ASBR-PE1-isis-1] network-entity 10.2222.2222.2222.2222.00
[ASBR-PE1-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[ASBR-PE1] mpls lsr-id 3.3.3.9
[ASBR-PE1] mpls
[ASBR-PE1-mpls] label advertise non-null
[ASBR-PE1-mpls] quit
[ASBR-PE1] mpls ldp
[ASBR-PE1-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並使能MPLS和LDP。
[ASBR-PE1] interface vlan-interface 11
[ASBR-PE1-Vlan-interface11] ip address 1.1.1.1 255.0.0.0
[ASBR-PE1-Vlan-interface11] isis enable 1
[ASBR-PE1-Vlan-interface11] mpls
[ASBR-PE1-Vlan-interface11] mpls ldp
[ASBR-PE1-Vlan-interface11] quit
# 配置接口Vlan-interface12,並在接口上使能MPLS。
[ASBR-PE1] interface vlan-interface 12
[ASBR-PE1-Vlan-interface12] ip address 11.0.0.2 255.0.0.0
[ASBR-PE1-Vlan-interface12] mpls
[ASBR-PE1-Vlan-interface12] quit
# 創建Loopback0接口,在接口上運行IS-IS。
[ASBR-PE1] interface loopback 0
[ASBR-PE1-LoopBack0] ip address 3.3.3.9 32
[ASBR-PE1-LoopBack0] isis enable 1
[ASBR-PE1-LoopBack0] quit
# 創建路由策略。
[ASBR-PE1] route-policy policy1 permit node 1
[ASBR-PE1-route-policy1] apply mpls-label
[ASBR-PE1-route-policy1] quit
[ASBR-PE1] route-policy policy2 permit node 1
[ASBR-PE1-route-policy2] if-match mpls-label
[ASBR-PE1-route-policy2] apply mpls-label
[ASBR-PE1-route-policy2] quit
# 在ASBR-PE 1上運行BGP,引入IS-IS進程1的路由。
[ASBR-PE1] bgp 100
[ASBR-PE1-bgp] import-route isis 1
# 對向IBGP對等體2.2.2.9發布的路由應用已配置的路由策略policy2。
[ASBR-PE1-bgp] peer 2.2.2.9 as-number 100
[ASBR-PE1-bgp] peer 2.2.2.9 route-policy policy2 export
# 向IBGP對等體2.2.2.9發布標簽路由及從2.2.2.9接收標簽路由的能力。
[ASBR-PE1-bgp] peer 2.2.2.9 connect-interface loopback 0
[ASBR-PE1-bgp] peer 2.2.2.9 label-route-capability
# 對向EBGP對等體11.0.0.1發布的路由應用已配置的路由策略policy1。
[ASBR-PE1-bgp] peer 11.0.0.1 as-number 600
[ASBR-PE1-bgp] peer 11.0.0.1 route-policy policy1 export
# 向EBGP對等體11.0.0.1發布標簽路由及從11.0.0.1接收標簽路由的能力。
[ASBR-PE1-bgp] peer 11.0.0.1 label-route-capability
[ASBR-PE1-bgp] quit
(3) 配置ASBR-PE 2
# 在ASBR-PE 2上運行IS-IS。
<ASBR-PE2> system-view
[ASBR-PE2] isis 1
[ASBR-PE2-isis-1] network-entity 10.2222.2222.2222.2222.00
[ASBR-PE2-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[ASBR-PE2] mpls lsr-id 4.4.4.9
[ASBR-PE2] mpls
[ASBR-PE2-mpls] label advertise non-null
[ASBR-PE2-mpls] quit
[ASBR-PE2] mpls ldp
[ASBR-PE2-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並在接口上使能MPLS和LDP。
[ASBR-PE2] interface vlan-interface 11
[ASBR-PE2-Vlan-interface11] ip address 9.1.1.1 255.0.0.0
[ASBR-PE2-Vlan-interface11] isis enable 1
[ASBR-PE2-Vlan-interface11] mpls
[ASBR-PE2-Vlan-interface11] mpls ldp
[ASBR-PE2-Vlan-interface11] quit
# 創建Loopback0接口,在接口上運行IS-IS。
[ASBR-PE2] interface loopback 0
[ASBR-PE2-LoopBack0] ip address 4.4.4.9 32
[ASBR-PE2-LoopBack0] isis enable 1
[ASBR-PE2-LoopBack0] quit
# 配置接口Vlan-interface12,在接口上使能MPLS。
[ASBR-PE2] interface vlan-interface 12
[ASBR-PE2-Vlan-interface12] ip address 11.0.0.1 255.0.0.0
[ASBR-PE2-Vlan-interface12] mpls
[ASBR-PE2-Vlan-interface12] quit
# 創建路由策略。
[ASBR-PE2] route-policy policy1 permit node 1
New Sequence of this List
[ASBR-PE2-route-policy1] apply mpls-label
[ASBR-PE2-route-policy1] quit
[ASBR-PE2] route-policy policy2 permit node 1
[ASBR-PE2-route-policy2] if-match mpls-label
[ASBR-PE2-route-policy2] apply mpls-label
[ASBR-PE2-route-policy2] quit
# 在ASBR-PE 2上運行BGP,引入IS-IS進程1的路由。
[ASBR-PE2] bgp 600
[ASBR-PE2-bgp] import-route isis 1
# 向IBGP對等體5.5.5.9發布標簽路由及從5.5.5.9接收標簽路由的能力。
[ASBR-PE2-bgp] peer 5.5.5.9 as-number 600
[ASBR-PE2-bgp] peer 5.5.5.9 connect-interface loopback 1
[ASBR-PE2-bgp] peer 5.5.5.9 label-route-capability
# 對向IBGP對等體5.5.5.9發布的路由應用已配置的路由策略policy2。
[ASBR-PE2-bgp] peer 5.5.5.9 route-policy policy2 export
# 對向EBGP對等體11.0.0.2發布的路由應用已配置的路由策略policy1。
[ASBR-PE2-bgp] peer 11.0.0.2 as-number 100
[ASBR-PE2-bgp] peer 11.0.0.2 route-policy policy1 export
# 向EBGP對等體11.0.0.2發布標簽路由及從11.0.0.2接收標簽路由的能力。
[ASBR-PE2-bgp] peer 11.0.0.2 label-route-capability
[ASBR-PE2-bgp] quit
(4) 配置PE 2
# 在PE 2上運行IS-IS。
<PE2> system-view
[PE2] isis 1
[PE2-isis-1] network-entity 10.1111.1111.1111.1111.00
[PE2-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[PE2] mpls lsr-id 5.5.5.9
[PE2] mpls
[PE2-mpls] label advertise non-null
[PE2-mpls] quit
[PE2] mpls ldp
[PE2-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並使能MPLS和LDP。
[PE2] interface vlan-interface 11
[PE2-Vlan-interface11] ip address 9.1.1.2 255.0.0.0
[PE2-Vlan-interface11] isis enable 1
[PE2-Vlan-interface11] mpls
[PE2-Vlan-interface11] mpls ldp
[PE2-Vlan-interface11] quit
# 創建Loopback0接口,在接口上運行IS-IS。
[PE2] interface loopback 0
[PE2-LoopBack0] ip address 5.5.5.9 32
[PE2-LoopBack0] isis enable 1
[PE2-LoopBack0] quit
# 創建VPN實例,名稱為vpn1,為其配置RD和VPN Target屬性。
[PE2] ip vpn-instance vpn1
[PE2-vpn-instance-vpn1] route-distinguisher 11:11
[PE2-vpn-instance-vpn1] vpn-target 3:3 import-extcommunity
[PE2-vpn-instance-vpn1] vpn-target 3:3 export-extcommunity
[PE2-vpn-instance-vpn1] quit
# 創建Loopback1接口,並將此接口綁定到vpn1。
[PE2] interface loopback 1
[PE2-LoopBack1] ip binding vpn-instance vpn1
[PE2-LoopBack1] ip address 20.0.0.1 32
[PE2-LoopBack1] quit
# 在PE 2上運行BGP。
[PE2] bgp 600
# 配置PE 2向IBGP對等體4.4.4.9發布標簽路由及從4.4.4.9接收標簽路由的能力。
[PE2-bgp] peer 4.4.4.9 as-number 600
[PE2-bgp] peer 4.4.4.9 connect-interface loopback 0
[PE2-bgp] peer 4.4.4.9 label-route-capability
# 配置PE 2到EBGP對等體2.2.2.9的最大跳數為10。
[PE2-bgp] peer 2.2.2.9 as-number 100
[PE2-bgp] peer 2.2.2.9 connect-interface loopback 0
[PE2-bgp] peer 2.2.2.9 ebgp-max-hop 10
# 配置對等體2.2.2.9作為VPNv4對等體。
[PE2-bgp] ipv4-family vpnv4
[PE2-bgp-af-vpnv4] peer 2.2.2.9 enable
[PE2-bgp-af-vpnv4] quit
# 將直連路由引入vpn1的路由表。
[PE2-bgp] ipv4-family vpn-instance vpn1
[PE2-bgp-vpn1] import-route direct
[PE2-bgp-vpn1] quit
[PE2-bgp] quit
配置完成後,在PE2上對PE1進行Ping操作,可以Ping通:
[PE2] ping –vpn-instance vpn1 30.0.0.1
在PE1上對PE2進行Ping操作,也可以Ping通:
[PE1] ping –vpn-instance vpn1 20.0.0.1
在圖1-25中:
l PE 1和PE 2是一級運營商骨幹網的PE設備,為二級運營商提供VPN服務;
l CE 1和CE 2是同一個二級運營商的設備,作為CE接入一級運營商的骨幹網;
l PE 3和PE 4是二級運營商的PE設備,為二級運營商的客戶提供MPLS L3VPN服務;
l CE 3和CE 4是二級運營商的客戶。
配置運營商的運營商關鍵在於配置兩類路由的交換:
l 二級運營商VPN內部路由在一級運營商骨幹網上的交換:一級運營商將二級運營商作為自己的CE接入;
l 二級運營商本身客戶的VPN路由在二級運營商PE設備間的交換:需要在二級運營商PE設備(PE 3和PE 4)間建立MP-IBGP對等體關係。
圖1-25 配置Carriers’ carriers配置組網圖

|
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
|
CE 3 |
Vlan-int11 |
100.1.1.1/24 |
CE 4 |
Vlan-int11 |
120.1.1.1/24 |
|
PE 3 |
Loop0 |
1.1.1.9/32 |
PE 4 |
Loop0 |
6.6.6.9/32 |
|
|
Vlan-int11 |
100.1.1.2/24 |
|
Vlan-int11 |
120.1.1.2/24 |
|
|
Vlan-int12 |
10.1.1.1/24 |
|
Vlan-int12 |
20.1.1.2/24 |
|
CE 1 |
Loop0 |
2.2.2.9/32 |
CE 2 |
Loop0 |
5.5.5.9/32 |
|
|
Vlan-int12 |
10.1.1.2/24 |
|
Vlan-int11 |
21.1.1.2/24 |
|
|
Vlan-int11 |
11.1.1.1/24 |
|
Vlan-int12 |
20.1.1.1/24 |
|
PE 1 |
Loop0 |
3.3.3.9/32 |
PE 2 |
Loop0 |
4.4.4.9/32 |
|
|
Vlan-int11 |
11.1.1.2/24 |
|
Vlan-int12 |
30.1.1.2/24 |
|
|
Vlan-int12 |
30.1.1.1/24 |
|
Vlan-int11 |
21.1.1.1/24 |
(1) 配置一級運營商骨幹網的MPLS L3VPN,使用IS-IS作為骨幹網的IGP協議,PE 1和PE 2之間使能LDP,並建立MP-IBGP對等體關係
# 配置PE 1。
<PE1> system-view
[PE1] interface loopback 0
[PE1-LoopBack0] ip address 3.3.3.9 32
[PE1-LoopBack0] quit
[PE1] mpls lsr-id 3.3.3.9
[PE1] mpls
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
[PE1] isis 1
[PE1-isis-1] network-entity 10.0000.0000.0000.0004.00
[PE1-isis-1] quit
[PE1] interface loopback 0
[PE1-LoopBack0] isis enable 1
[PE1-LoopBack0] quit
[PE1] interface vlan-interface 12
[PE1-Vlan-interface12] ip address 30.1.1.1 24
[PE1-Vlan-interface12] isis enable 1
[PE1-Vlan-interface12] mpls
[PE1-Vlan-interface12] mpls ldp
[PE1-Vlan-interface12] mpls ldp transport-address interface
[PE1-Vlan-interface12] quit
[PE1] bgp 100
[PE1-bgp] peer 4.4.4.9 as-number 100
[PE1-bgp] peer 4.4.4.9 connect-interface loopback 0
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp-af-vpnv4] peer 4.4.4.9 enable
[PE1-bgp-af-vpnv4] quit
[PE1-bgp] quit
![]()
PE 2的配置與PE 1類似,配置過程省略。
配置完成後,在PE 1或PE 2上執行display mpls ldp session命令可以看到LDP會話建立成功;執行display bgp peer命令可以看到BGP對等體關係已建立,並達到Established狀態;執行display isis peer命令可以看到IS-IS鄰居關係已建立,狀態為up。
以PE1為例:
[PE1] display mpls ldp session
LDP Session(s) in Public Network
Total number of sessions: 1
----------------------------------------------------------------
Peer-ID Status LAM SsnRole FT MD5 KA-Sent/Rcv
----------------------------------------------------------------
4.4.4.9:0 Operational DU Active Off Off 378/378
----------------------------------------------------------------
LAM : Label Advertisement Mode FT : Fault Tolerance
[PE1] display bgp peer
BGP local router ID : 3.3.3.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
4.4.4.9 100 162 145 0 0 02:12:47 Established
[PE1] display isis peer
Peer information for ISIS(1)
----------------------------
System Id Interface Circuit Id State HoldTime Type PRI
0000.0000.0005 Vlan-interface2 001 Up 29s L1L2 --
(2) 配置二級運營商網絡:使用IS-IS作為IGP協議,PE 3和CE 1、PE 4和CE 2之間分別使能LDP
# 配置PE 3。
<PE3> system-view
[PE3] interface loopback 0
[PE3-LoopBack0] ip address 1.1.1.9 32
[PE3-LoopBack0] quit
[PE3] mpls lsr-id 1.1.1.9
[PE3] mpls
[PE3-mpls] quit
[PE3] mpls ldp
[PE3-mpls-ldp] quit
[PE3] isis 2
[PE3-isis-2] network-entity 10.0000.0000.0000.0001.00
[PE3-isis-2] quit
[PE3] interface loopback 0
[PE3-LoopBack0] isis enable 2
[PE3-LoopBack0] quit
[PE3] interface vlan-interface 12
[PE3-Vlan-interface12] ip address 10.1.1.1 24
[PE3-Vlan-interface12] isis enable 2
[PE3-Vlan-interface12] mpls
[PE3-Vlan-interface12] mpls ldp
[PE3-Vlan-interface12] mpls ldp transport-address interface
[PE3-Vlan-interface12] quit
# 配置CE 1。
<CE1> system-view
[CE1] interface loopback 0
[CE1-LoopBack0] ip address 2.2.2.9 32
[CE1-LoopBack0] quit
[CE1] mpls lsr-id 2.2.2.9
[CE1] mpls
[CE1-mpls] quit
[CE1] mpls ldp
[CE1-mpls-ldp] quit
[CE1] isis 2
[CE1-isis-2] network-entity 10.0000.0000.0000.0002.00
[CE1-isis-2] quit
[CE1] interface loopback 0
[CE1-LoopBack0] isis enable 2
[CE1-LoopBack0] quit
[CE1] interface vlan-interface 12
[CE1-Vlan-interface12] ip address 10.1.1.2 24
[CE1-Vlan-interface12] isis enable 2
[CE1-Vlan-interface12] mpls
[CE1-Vlan-interface12] mpls ldp
[CE1-Vlan-interface12] mpls ldp transport-address interface
[CE1-Vlan-interface12] quit
配置完成後,PE 3和CE 1之間應能建立LDP和IS-IS鄰居關係。
![]()
PE 4和CE 2之間的配置與PE 3和CE 1之間的配置類似,配置過程省略。
(3) 配置二級運營商CE接入到一級運營商的PE,並在PE上配置IS-IS引入BGP路由、BGP引入IS-IS路由
# 配置PE 1。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 200:1
[PE1-vpn-instance-vpn1] vpn-target 1:1
[PE1-vpn-instance-vpn1] quit
[PE1] mpls ldp vpn-instance vpn1
[PE1-mpls-ldp-vpn-instance-vpn1] quit
[PE1] isis 2 vpn-instance vpn1
[PE1-isis-2] network-entity 10.0000.0000.0000.0003.00
[PE1-isis-2] import-route bgp allow-ibgp
[PE1-isis-2] quit
[PE1] interface vlan-interface11
[PE1-Vlan-interface11] ip binding vpn-instance vpn1
[PE1-Vlan-interface11] ip address 11.1.1.2 24
[PE1-Vlan-interface11] isis enable 2
[PE1-Vlan-interface11] mpls
[PE1-Vlan-interface11] mpls ldp
[PE1-Vlan-interface11] mpls ldp transport-address interface
[PE1-Vlan-interface11] quit
[PE1] bgp 100
[PE1-bgp] ipv4-family vpn-instance vpn1
[PE1-bgp-vpn1] import isis 2
[PE1-bgp-vpn1] quit
[PE1-bgp] quit
# 配置CE 1。
[CE1] interface vlan-interface11
[CE1-Vlan-interface11] ip address 11.1.1.1 24
[CE1-Vlan-interface11] isis enable 2
[CE1-Vlan-interface11] mpls
[CE1-Vlan-interface11] mpls ldp
[CE1-Vlan-interface11] mpls ldp transport-address interface
[CE1-Vlan-interface11] quit
配置完成後,PE 1和CE 1之間應能建立LDP和IS-IS鄰居關係。
![]()
PE 2和CE 2之間的配置與PE 1和CE 1之間的配置類似,配置過程省略。
(4) 配置二級運營商的客戶接入PE
# 配置CE 3。
<CE3> system-view
[CE3] interface vlan-interface11
[CE3-Vlan-interface11] ip address 100.1.1.1 24
[CE3-Vlan-interface11] quit
[CE3] bgp 65410
[CE3-bgp] peer 100.1.1.2 as-number 100
[CE3-bgp] import-route direct
[CE3-bgp] quit
# 配置PE 3。
[PE3] ip vpn-instance vpn1
[PE3-vpn-instance-vpn1] route-distinguisher 100:1
[PE3-vpn-instance-vpn1] vpn-target 1:1
[PE3-vpn-instance-vpn1] quit
[PE3] interface Vlan-interface11
[PE3-Vlan-interface11] ip binding vpn-instance vpn1
[PE3-Vlan-interface11] ip address 100.1.1.2 24
[PE3-Vlan-interface11] quit
[PE3] bgp 100
[PE3-bgp] ipv4-family vpn-instance vpn1
[PE3-bgp-vpn1] peer 100.1.1.1 as-number 65410
[PE3-bgp-vpn1] import-route direct
[PE3-bgp-vpn1] quit
[PE3-bgp] quit
![]()
PE 4和CE 4之間的配置與PE 3和CE 3之間的配置類似,配置過程省略。
(5) 在二級運營商的PE之間建立MP-IBGP對等體關係,交換二級運營商的客戶的VPN路由
# 配置PE 3。
[PE3] bgp 100
[PE3-bgp] peer 6.6.6.9 as-number 100
[PE3-bgp] peer 6.6.6.9 connect-interface loopback 0
[PE3-bgp] ipv4-family vpnv4
[PE3-bgp-af-vpnv4] peer 6.6.6.9 enable
[PE3-bgp-af-vpnv4] quit
[PE3-bgp] quit
![]()
PE 4的配置與PE 3類似,配置過程省略。
(6) 配置完成後的檢驗
所有配置完成後,在PE 1和PE 2上執行display ip routing-table命令,可以看到PE 1和PE 2的公網路由表中隻有一級運營商網絡的路由。以PE 1為例:
[PE1] display ip routing-table
Routing Tables: Public
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost NextHop Interface
3.3.3.9/32 Direct 0 0 127.0.0.1 InLoop0
4.4.4.9/32 ISIS 15 10 30.1.1.2 Vlan12
30.1.1.0/24 Direct 0 0 30.1.1.1 Vlan12
30.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
30.1.1.2/32 Direct 0 0 30.1.1.2 Vlan12
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在PE 1和PE 2上執行display ip routing-table vpn-instance命令,可以看到VPN路由表中有二級運營商網絡的內部路由,但沒有二級運營商維護的VPN路由。以PE 1為例:
[PE1] display ip routing-table vpn-instance vpn1
Routing Tables: vpn1
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 ISIS 15 20 11.1.1.1 Vlan11
2.2.2.9/32 ISIS 15 10 11.1.1.1 Vlan11
5.5.5.9/32 BGP 255 0 4.4.4.9 NULL0
6.6.6.9/32 BGP 255 0 4.4.4.9 NULL0
10.1.1.0/24 ISIS 15 20 11.1.1.1 Vlan11
11.1.1.0/24 Direct 0 0 11.1.1.1 Vlan11
11.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
11.1.1.2/32 Direct 0 0 11.1.1.2 Vlan11
20.1.1.0/24 BGP 255 0 4.4.4.9 NULL0
21.1.1.0/24 BGP 255 0 4.4.4.9 NULL0
21.1.1.2/32 BGP 255 0 4.4.4.9 NULL0
在CE 1和CE 2上執行display ip routing-table命令,可以看到公網路由表中有二級運營商網絡的內部路由,但沒有二級運營商維護的VPN路由。以CE 1為例:
[CE1] display ip routing-table
Routing Tables: Public
Destinations : 16 Routes : 16
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 ISIS 15 10 10.1.1.2 Vlan12
2.2.2.9/32 Direct 0 0 127.0.0.1 InLoop0
5.5.5.9/32 ISIS 15 74 11.1.1.2 Vlan11
6.6.6.9/32 ISIS 15 74 11.1.1.2 Vlan11
10.1.1.0/24 Direct 0 0 10.1.1.2 Vlan12
10.1.1.1/32 Direct 0 0 10.1.1.1 Vlan12
10.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
11.1.1.0/24 Direct 0 0 11.1.1.1 Vlan11
11.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
11.1.1.2/32 Direct 0 0 11.1.1.2 Vlan11
20.1.1.0/24 ISIS 15 74 11.1.1.2 Vlan11
21.1.1.0/24 ISIS 15 74 11.1.1.2 Vlan11
21.1.1.2/32 ISIS 15 74 11.1.1.2 Vlan11
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在PE 3和PE 4上執行display ip routing-table命令,可以看到公網路由表中有二級運營商網絡的內部路由。以PE 3為例:
[PE3] display ip routing-table
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.9/32 ISIS 15 10 10.1.1.2 Vlan12
5.5.5.9/32 ISIS 15 84 10.1.1.2 Vlan12
6.6.6.9/32 ISIS 15 84 10.1.1.2 Vlan12
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan12
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.2/32 Direct 0 0 10.1.1.2 Vlan12
11.1.1.0/24 ISIS 15 20 10.1.1.2 Vlan12
20.1.1.0/24 ISIS 15 84 10.1.1.2 Vlan12
21.1.1.0/24 ISIS 15 84 10.1.1.2 Vlan12
21.1.1.2/32 ISIS 15 84 10.1.1.2 Vlan12
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在PE 3和PE 4上執行display ip routing-table vpn-instance命令,可以看到VPN路由表中有遠端VPN客戶的路由。以PE 3為例:
[PE3] display ip routing-table vpn-instance vpn1
Routing Tables: vpn1
Destinations : 3 Routes : 3
Destination/Mask Proto Pre Cost NextHop Interface
100.1.1.0/24 Direct 0 0 100.1.1.2 Vlan11
100.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
120.1.1.0/24 BGP 255 0 6.6.6.9 NULL0
PE 3和PE 4可以相互Ping通:
[PE3] ping 20.1.1.2
PING 20.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 20.1.1.2: bytes=56 Sequence=1 ttl=252 time=127 ms
Reply from 20.1.1.2: bytes=56 Sequence=2 ttl=252 time=97 ms
Reply from 20.1.1.2: bytes=56 Sequence=3 ttl=252 time=83 ms
Reply from 20.1.1.2: bytes=56 Sequence=4 ttl=252 time=70 ms
Reply from 20.1.1.2: bytes=56 Sequence=5 ttl=252 time=60 ms
--- 20.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 60/87/127 ms
CE 3和CE 4可以互相Ping通。
[CE3] ping 120.1.1.1
PING 120.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 120.1.1.1: bytes=56 Sequence=1 ttl=252 time=102 ms
Reply from 120.1.1.1: bytes=56 Sequence=2 ttl=252 time=69 ms
Reply from 120.1.1.1: bytes=56 Sequence=3 ttl=252 time=105 ms
Reply from 120.1.1.1: bytes=56 Sequence=4 ttl=252 time=88 ms
Reply from 120.1.1.1: bytes=56 Sequence=5 ttl=252 time=87 ms
--- 120.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 69/90/105 ms
運營商向客戶提供嵌套VPN服務。如圖1-26所示:
l PE 1和PE 2是運營商骨幹網的PE設備,支持嵌套VPN功能;
l CE 1和CE 2是VPN用戶的CE設備,接入運營商的骨幹網,該CE設備支持發送VPNv4路由;
l PE 3和PE 4是用戶網絡內部的PE設備,支持MPLS L3VPN;
l CE 3、CE 4、CE 5和CE 6是用戶網絡內部的子VPN的CE設備;
配置嵌套VPN的關鍵在於理解子VPN路由在運營商PE設備上的處理過程:
l 運營商PE(PE 1和PE 2)收到用戶CE(CE 1和CE 2)發送來的VPNv4路由時,需要將該VPNv4路由的RD更換為用戶CE所處VPN的RD,同時將用戶CE所處VPN的ERT添加到路由的擴展團體屬性列表中,然後再按照一般的VPNv4路由發送出去;
l 為了實現用戶網絡內部子VPN的路由在用戶PE和運營商PE間交換,需要在運營商PE和用戶CE間建立MP-EBGP對等體關係。
圖1-26 嵌套VPN組網圖

|
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
CE 1 |
Loop0 |
2.2.2.9/32 |
CE 2 |
Loop0 |
5.5.5.9/32 |
|
|
Vlan-int12 |
10.1.1.2/24 |
|
Vlan-int11 |
21.1.1.2/24 |
|
|
Vlan-int11 |
11.1.1.1/24 |
|
Vlan-int12 |
20.1.1.1/24 |
|
CE 3 |
Vlan-int11 |
100.1.1.1/24 |
CE 4 |
Vlan-int11 |
120.1.1.1/24 |
|
CE 5 |
Vlan-int13 |
110.1.1.1/24 |
CE 6 |
Vlan-int13 |
130.1.1.1/24 |
|
PE 1 |
Loop0 |
3.3.3.9/32 |
PE 2 |
Loop0 |
4.4.4.9/32 |
|
|
Vlan-int11 |
11.1.1.2/24 |
|
Vlan-int11 |
21.1.1.1/24 |
|
|
Vlan-int12 |
30.1.1.1/24 |
|
Vlan-int12 |
30.1.1.2/24 |
|
PE 3 |
Loop0 |
1.1.1.9/32 |
PE 4 |
Loop0 |
6.6.6.9/32 |
|
|
Vlan-int11 |
100.1.1.2/24 |
|
Vlan-int11 |
120.1.1.2/24 |
|
|
Vlan-int12 |
10.1.1.1/24 |
|
Vlan-int12 |
20.1.1.2/24 |
|
|
Vlan-int13 |
110.1.1.2/24 |
|
Vlan-int13 |
130.1.1.2/24 |
(1) 配置運營商骨幹網的MPLS L3VPN,使用IS-IS作為骨幹網的IGP協議,PE 1和PE 2之間使能LDP,並建立MP-IBGP對等體關係
# 配置PE 1。
<PE1> system-view
[PE1] interface loopback 0
[PE1-LoopBack0] ip address 3.3.3.9 32
[PE1-LoopBack0] quit
[PE1] mpls lsr-id 3.3.3.9
[PE1] mpls
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
[PE1] isis 1
[PE1-isis-1] network-entity 10.0000.0000.0000.0004.00
[PE1-isis-1] quit
[PE1] interface loopback 0
[PE1-LoopBack0] isis enable 1
[PE1-LoopBack0] quit
[PE1] interface vlan-interface 12
[PE1-Vlan-interface12] ip address 30.1.1.1 24
[PE1-Vlan-interface12] isis enable 1
[PE1-Vlan-interface12] mpls
[PE1-Vlan-interface12] mpls ldp
[PE1-Vlan-interface12] quit
[PE1] bgp 100
[PE1-bgp] peer 4.4.4.9 as-number 100
[PE1-bgp] peer 4.4.4.9 connect-interface loopback 0
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp-af-vpnv4] peer 4.4.4.9 enable
[PE1-bgp-af-vpnv4] quit
[PE1-bgp] quit
![]()
PE 2的配置與PE 1類似,配置過程省略。
配置完成後,在PE 1或PE 2上執行display mpls ldp session命令可以看到LDP會話建立成功;執行display bgp peer命令可以看到BGP對等體關係已建立,並達到Established狀態;執行display isis peer命令可以看到IS-IS鄰居關係已建立,狀態為up。
以PE 1為例:
[PE1] display mpls ldp session
LDP Session(s) in Public Network
Total number of sessions: 1
----------------------------------------------------------------
Peer-ID Status LAM SsnRole FT MD5 KA-Sent/Rcv
----------------------------------------------------------------
4.4.4.9:0 Operational DU Active Off Off 378/378
----------------------------------------------------------------
LAM : Label Advertisement Mode FT : Fault Tolerance
[PE1] display bgp peer
BGP local router ID : 3.3.3.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
4.4.4.9 100 162 145 0 0 02:12:47 Established
[PE1] display isis peer
Peer information for ISIS(1)
----------------------------
System Id Interface Circuit Id State HoldTime Type PRI
0000.0000.0005 Vlan-interface12 001 Up 29s L1L2 --
(2) 配置用戶網絡:使用IS-IS作為IGP協議,PE 3和CE 1、PE 4和CE 2之間分別使能LDP
# 配置PE 3。
<PE3> system-view
[PE3] interface loopback 0
[PE3-LoopBack0] ip address 1.1.1.9 32
[PE3-LoopBack0] quit
[PE3] mpls lsr-id 1.1.1.9
[PE3] mpls
[PE3-mpls] quit
[PE3] mpls ldp
[PE3-mpls-ldp] quit
[PE3] isis 2
[PE3-isis-2] network-entity 10.0000.0000.0000.0001.00
[PE3-isis-2] quit
[PE3] interface loopback 0
[PE3-LoopBack0] isis enable 2
[PE3-LoopBack0] quit
[PE3] interface vlan-interface 12
[PE3-Vlan-interface12] ip address 10.1.1.1 24
[PE3-Vlan-interface12] isis enable 2
[PE3-Vlan-interface12] mpls
[PE3-Vlan-interface12] mpls ldp
[PE3-Vlan-interface12] quit
# 配置CE 1。
<CE1> system-view
[CE1] interface loopback 0
[CE1-LoopBack0] ip address 2.2.2.9 32
[CE1-LoopBack0] quit
[CE1] mpls lsr-id 2.2.2.9
[CE1] mpls
[CE1-mpls] quit
[CE1] mpls ldp
[CE1-mpls-ldp] quit
[CE1] isis 2
[CE1-isis-2] network-entity 10.0000.0000.0000.0002.00
[CE1-isis-2] quit
[CE1] interface loopback 0
[CE1-LoopBack0] isis enable 2
[CE1-LoopBack0] quit
[CE1] interface vlan-interface 12
[CE1-Vlan-interface12] ip address 10.1.1.2 24
[CE1-Vlan-interface12] isis enable 2
[CE1-Vlan-interface12] mpls
[CE1-Vlan-interface12] mpls ldp
[CE1-Vlan-interface12] quit
配置完成後,PE 3和CE 1之間可以建立LDP和IS-IS鄰居關係。
![]()
PE 4和CE 2之間的配置與PE 3和CE 1之間的配置類似,配置過程省略。
(3) 配置用戶CE接入到運營商的PE
# 配置PE 1
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 200:1
[PE1-vpn-instance-vpn1] vpn-target 1:1
[PE1-vpn-instance-vpn1] quit
[PE1] interface vlan-interface 11
[PE1-Vlan-interface11] ip binding vpn-instance vpn1
[PE1-Vlan-interface11] ip address 11.1.1.2 24
[PE1-Vlan-interface11] mpls
[PE1-Vlan-interface11] quit
[PE1] bgp 100
[PE1-bgp] ipv4-family vpn-instance vpn1
[PE1-bgp-vpn1] peer 11.1.1.1 as-number 200
[PE1-bgp-vpn1] quit
[PE1-bgp] quit
# 配置CE 1。
[CE1] interface vlan-interface 11
[CE1-Vlan-interface11] ip address 11.1.1.1 24
[CE1-Vlan-interface11] mpls
[CE1-Vlan-interface11] quit
[CE1] bgp 200
[CE1-bgp] peer 11.1.1.2 as-number 100
[CE1-bgp] import isis 2
[CE1-bgp] quit
![]()
PE 2和CE 2之間的配置與PE 1和CE 1之間的配置類似,配置過程省略。
(4) 配置子VPN的CE接入用戶網絡的PE
# 配置CE 3。
<CE3> system-view
[CE3] interface vlan-interface 11
[CE3-Vlan-interface11] ip address 100.1.1.1 24
[CE3-Vlan-interface11] quit
[CE3] bgp 65410
[CE3-bgp] peer 100.1.1.2 as-number 200
[CE3-bgp] import-route direct
[CE3-bgp] quit
# 配置CE 5。
<CE5> system-view
[CE5] interface vlan-interface 13
[CE5-Vlan-interface13] ip address 110.1.1.1 24
[CE5-Vlan-interface13] quit
[CE5] bgp 65411
[CE5-bgp] peer 110.1.1.2 as-number 200
[CE5-bgp] import-route direct
[CE5-bgp] quit
# 配置PE 3。
[PE3] ip vpn-instance SUB_VPN1
[PE3-vpn-instance-SUB_VPN1] route-distinguisher 100:1
[PE3-vpn-instance-SUB_VPN1] vpn-target 2:1
[PE3-vpn-instance-SUB_VPN1] quit
[PE3] interface vlan-interface 11
[PE3-Vlan-interface11] ip binding vpn-instance SUB_VPN1
[PE3-Vlan-interface11] ip address 100.1.1.2 24
[PE3-Vlan-interface11] quit
[PE3] ip vpn-instance SUB_VPN2
[PE3-vpn-instance-SUB_VPN2] route-distinguisher 101:1
[PE3-vpn-instance-SUB_VPN2] vpn-target 2:2
[PE3-vpn-instance-SUB_VPN2] quit
[PE3] interface vlan-interface 13
[PE3-Vlan-interface13] ip binding vpn-instance SUB_VPN2
[PE3-Vlan-interface13] ip address 110.1.1.2 24
[PE3-Vlan-interface13] quit
[PE3] bgp 200
[PE3-bgp] ipv4-family vpn-instance SUB_VPN1
[PE3-bgp-SUB_VPN1] peer 100.1.1.1 as-number 65410
[PE3-bgp-SUB_VPN1] import-route direct
[PE3-bgp-SUB_VPN1] quit
[PE3-bgp] ipv4-family vpn-instance SUB_VPN2
[PE3-bgp-SUB_VPN2] peer 100.1.1.1 as-number 65411
[PE3-bgp-SUB_VPN2] import-route direct
[PE3-bgp-SUB_VPN2] quit
[PE3-bgp] quit
![]()
PE 4和CE 4,CE 6之間的配置與PE 3和CE 3,CE 5之間的配置類似,配置過程省略。
(5) 在運營商的PE和用戶的CE之間建立MP-EBGP對等體關係,交換用戶的VPNv4路由
# 配置PE 1,使能嵌套VPN特性。
[PE1] bgp 100
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp-af-vpnv4] nesting-vpn
[PE1-bgp-af-vpnv4] peer 11.1.1.1 vpn-instance vpn1 enable
[PE1-bgp-af-vpnv4] quit
[PE1-bgp] quit
# 配置CE 1,使能VPNv4能力,使之與PE 1建立VPNv4鄰居關係。
[CE1] bgp 200
[CE1-bgp] ipv4-family vpnv4
[CE1-bgp-af-vpnv4] peer 11.1.1.2 enable
# 配置允許本地AS號在所接收的路由的AS_PATH屬性中出現。
[CE1-bgp-af-vpnv4] peer 11.1.1.2 allow-as-loop 2
# 配置接收所有VPNv4路由。
[CE1-bgp-af-vpnv4] undo policy vpn-target
[CE1-bgp-af-vpnv4] quit
[CE1-bgp] quit
![]()
PE 2和CE 2之間的配置與PE 1和CE 1之間的配置類似,配置過程省略。
(6) 在用戶網絡內部的PE和CE之間建立MP-IBGP對等體關係,交換用戶內部子VPN的VPNv4路由
# 配置PE 3。
[PE3] bgp 200
[PE3-bgp] peer 2.2.2.9 as-number 200
[PE3-bgp] peer 2.2.2.9 connect-interface loopback 0
[PE3-bgp] ipv4-family vpnv4
[PE3-bgp-af-vpnv4] peer 2.2.2.9 enable
# 配置允許本地AS號在所接收的路由的AS_PATH屬性中出現。
[PE3-bgp-af-vpnv4] peer 2.2.2.9 allow-as-loop 2
[PE3-bgp-af-vpnv4] quit
[PE3-bgp] quit
# 配置CE 1。
[CE1] bgp 200
[CE1-bgp] peer 1.1.1.9 as-number 200
[CE1-bgp] peer 1.1.1.9 connect-interface loopback 0
[CE1-bgp] ipv4-family vpnv4
[CE1-bgp-af-vpnv4] peer 1.1.1.9 enable
[CE1-bgp-af-vpnv4]undo policy vpn-target
[CE1-bgp-af-vpnv4] quit
[CE1-bgp] quit
![]()
PE 4和CE 2之間的配置與PE 3和CE 1之間的配置類似,配置過程省略。
(7) 配置完成後的檢驗
所有配置完成後,在PE 1和PE 2上執行display ip routing-table命令,可以看到PE 1和PE 2的公網路由表中隻有運營商網絡的路由。以PE 1為例:
[PE1] display ip routing-table
Routing Tables: Public
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost NextHop Interface
3.3.3.9/32 Direct 0 0 127.0.0.1 InLoop0
4.4.4.9/32 ISIS 15 10 30.1.1.2 Vlan12
30.1.1.0/24 Direct 0 0 30.1.1.1 Vlan12
30.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
30.1.1.2/32 Direct 0 0 30.1.1.2 Vlan12
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在PE 1和PE 2上執行display ip routing-table vpn-instance命令,可以看到VPN路由表中有用戶子VPN網絡的路由。以PE 1為例:
[PE1] display ip routing-table vpn-instance vpn1
Routing Tables: vpn1
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
11.1.1.0/24 Direct 0 0 11.1.1.1 Vlan11
11.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
11.1.1.2/32 Direct 0 0 11.1.1.2 Vlan11
100.1.1.0/24 BGP 255 0 11.1.1.1 NULL0
110.1.1.0/24 BGP 255 0 11.1.1.1 NULL0
120.1.1.0/24 BGP 255 0 4.4.4.9 NULL0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
130.1.1.0/24 BGP 255 0 4.4.4.9 NULL0
在CE 1和CE 2上執行display bgp vpnv4 all routing-table命令,可以看到用戶網絡中VPNv4路由表中有子VPN網絡的內部路由。以CE 1為例:
[CE1] display bgp vpnv4 all routing-table
BGP Local router ID is 11.11.11.11
Status codes: * - valid, ^ - VPN best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total number of routes from all PE: 4
Route Distinguisher: 100:1
Network NextHop In/Out Label MED LocPrf
*> 100.1.1.0/24 1.1.1.9 1024/1024
Route Distinguisher: 101:1
Network NextHop In/Out Label MED LocPrf
*^ 100.1.1.0/24 1.1.1.9 1024/1024
Route Distinguisher: 101:1
Network NextHop In/Out Label MED LocPrf
* > 110.1.1.0/24 1.1.1.9 1025/1025
Route Distinguisher: 200:1
Network NextHop In/Out Label MED LocPrf
* > 120.1.1.0/24 11.1.1.2 1026/1027
Route Distinguisher: 201:1
Network NextHop In/Out Label MED LocPrf
* > 130.1.1.0/24 11.1.1.2 1027/1028
在PE 3和PE 4上執行display ip routing-table vpn-instance SUB_VPN1命令,可以看到私網路由表中有從運營商PE發布到用戶網絡子VPN內部的路由。以PE 3為例:
[PE3] display ip routing-table vpn-instance SUB_VPN1
Routing Tables: SUB_VPN1
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
100.1.1.0/24 Direct 0 0 100.1.1.2 Vlan11
100.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
120.1.1.0/24 BGP 255 0 2.2.2.9 NULL0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在CE 3和CE 4上執行display ip routing-table命令,可以看到路由表中有遠端子VPN的路由。以CE 3為例:
[CE3] display ip routing-table
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
100.1.1.0/24 Direct 0 0 100.1.1.1 Vlan11
100.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
120.1.1.0/24 BGP 255 0 100.1.1.2 Vlan11
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在CE 5和CE 6上執行display ip routing-table命令,可以看到路由表中有遠端子VPN的路由。以CE 5為例:
[CE5] display ip routing-table
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
110.1.1.0/24 Direct 0 0 110.1.1.1 Vlan11
110.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
130.1.1.0/24 BGP 255 0 110.1.1.2 Vlan11
CE 3和CE 4可以互相Ping通。
[CE3] ping 120.1.1.1
PING 120.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 120.1.1.1: bytes=56 Sequence=1 ttl=252 time=102 ms
Reply from 120.1.1.1: bytes=56 Sequence=2 ttl=252 time=69 ms
Reply from 120.1.1.1: bytes=56 Sequence=3 ttl=252 time=105 ms
Reply from 120.1.1.1: bytes=56 Sequence=4 ttl=252 time=88 ms
Reply from 120.1.1.1: bytes=56 Sequence=5 ttl=252 time=87 ms
--- 120.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 69/90/105 ms
CE 5和CE 6可以互相Ping通。
[CE5] ping 130.1.1.1
PING 130.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 130.1.1.1: bytes=56 Sequence=1 ttl=252 time=102 ms
Reply from 130.1.1.1: bytes=56 Sequence=2 ttl=252 time=69 ms
Reply from 130.1.1.1: bytes=56 Sequence=3 ttl=252 time=105 ms
Reply from 130.1.1.1: bytes=56 Sequence=4 ttl=252 time=88 ms
Reply from 130.1.1.1: bytes=56 Sequence=5 ttl=252 time=87 ms
--- 130.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 69/90/105 ms
CE 3和CE 6不能互相Ping通。
[CE3] ping 130.1.1.1
PING 130.1.1.1: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 130.1.1.1 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
以一個包括省骨幹和地市的MPLS VPN網絡為例:
l SPE作為省網的PE設備,接入地市的MPLS VPN網絡;
l UPE作為下層地市網絡的PE設備,最終接入VPN客戶。對UPE的性能要求低於對SPE的性能要求。
l SPE將通過路由策略的路由發送給UPE,限製不同Site之間的互相訪問權限,使得VPN 1內的CE 1和CE 3可以互相訪問,VPN 2內的CE 2和CE 4不能互相訪問。
圖1-27 配置HoVPN組網圖
|
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
CE 1 |
Vlan-int12 |
10.2.1.1/24 |
CE 3 |
Vlan-int12 |
10.1.1.1/24 |
|
CE 2 |
Vlan-int13 |
10.4.1.1/24 |
CE 4 |
Vlan-int13 |
10.3.1.1/24 |
|
UPE 1 |
Loop0 |
1.1.1.9/32 |
UPE 2 |
Loop0 |
4.4.4.9/32 |
|
|
Vlan-int11 |
172.1.1.1/24 |
|
Vlan-int11 |
172.2.1.1/24 |
|
|
Vlan-int12 |
10.2.1.2/24 |
|
Vlan-int12 |
10.1.1.2/24 |
|
|
Vlan-int13 |
10.4.1.2/24 |
|
Vlan-int13 |
10.3.1.2/24 |
|
SPE 1 |
Loop0 |
2.2.2.9/32 |
SPE 2 |
Loop0 |
3.3.3.9/32 |
|
|
Vlan-int11 |
172.1.1.2/24 |
|
Vlan-int11 |
172.2.1.2/24 |
|
|
Vlan-int12 |
180.1.1.1/24 |
|
Vlan-int12 |
180.1.1.2/24 |
(1) 配置UPE 1
# 配置MPLS基本能力和MPLS LDP能力,建立LDP LSP。
<UPE1> system-view
[UPE1] interface loopback 0
[UPE1-LoopBack0] ip address 1.1.1.9 32
[UPE1-LoopBack0] quit
[UPE1] mpls lsr-id 1.1.1.9
[UPE1] mpls
[UPE1-mpls] quit
[UPE1] mpls ldp
[UPE1-mpls-ldp] quit
[UPE1] interface vlan-interface 11
[UPE1-Vlan-interface11] ip address 172.1.1.1 24
[UPE1-Vlan-interface11] mpls
[UPE1-Vlan-interface11] mpls ldp
[UPE1-Vlan-interface11] quit
# 配置IGP協議,以OSPF為例。
[UPE1] ospf
[UPE1-ospf-1] area 0
[UPE1-ospf-1-area-0.0.0.0] network 172.1.1.0 0.0.0.255
[UPE1-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[UPE1-ospf-1-area-0.0.0.0] quit
[UPE1-ospf-1] quit
# 配置VPN實例vpn1和vpn2,將CE 1和CE 2接入UPE 1。
[UPE1] ip vpn-instance vpn1
[UPE1-vpn-instance-vpn1] route-distinguisher 100:1
[UPE1-vpn-instance-vpn1] vpn-target 100:1 both
[UPE1-vpn-instance-vpn1] quit
[UPE1] ip vpn-instance vpn2
[UPE1-vpn-instance-vpn2] route-distinguisher 100:2
[UPE1-vpn-instance-vpn2] vpn-target 100:2 both
[UPE1-vpn-instance-vpn2] quit
[UPE1] interface vlan-interface 12
[UPE1-Vlan-interface12] ip binding vpn-instance vpn1
[UPE1-Vlan-interface12] ip address 10.2.1.2 24
[UPE1-Vlan-interface12] quit
[UPE1] interface vlan-interface 13
[UPE1-Vlan-interface13] ip binding vpn-instance vpn2
[UPE1-Vlan-interface13] ip address 10.4.1.2 24
[UPE1-Vlan-interface13] quit
# 配置UPE 1與SPE 1建立MP-IBGP對等體,並引入VPN路由。
[UPE1] bgp 100
[UPE1-bgp] peer 2.2.2.9 as-number 100
[UPE1-bgp] peer 2.2.2.9 connect-interface loopback 0
[UPE1-bgp] ipv4-family vpnv4
[UPE1-bgp-af-vpnv4] peer 2.2.2.9 enable
[UPE1-bgp-af-vpnv4] quit
[UPE1-bgp] ipv4-family vpn-instance vpn1
[UPE1-bgp-vpn1] peer 10.2.1.1 as-number 65410
[UPE1-bgp-vpn1] import-route direct
[UPE1-bgp-vpn1] quit
[UPE1-bgp] ipv4-family vpn-instance vpn2
[UPE1-bgp-vpn1] peer 10.4.1.1 as-number 65420
[UPE1-bgp-vpn1] import-route direct
[UPE1-bgp-vpn1] quit
[UPE1-bgp] quit
(2) 配置CE 1
<CE1> system-view
[CE1] interface vlan-interface 12
[CE1-Vlan-interface12] ip address 10.2.1.1 255.255.255.0
[CE1-Vlan-interface12] quit
[CE1] bgp 65410
[CE1-bgp] peer 10.2.1.2 as-number 100
[CE1-bgp] import-route direct
[CE1] quit
(3) 配置CE 2
<CE2> system-view
[CE2] interface vlan-interface 13
[CE2-Vlan-interface13] ip address 10.4.1.1 255.255.255.0
[CE2-Vlan-interface13] quit
[CE2] bgp 65420
[CE2-bgp] peer 10.4.1.2 as-number 100
[CE2-bgp] import-route direct
[CE2] quit
(4) 配置UPE 2
# 配置MPLS基本能力和MPLS LDP能力,建立LDP LSP。
<UPE2> system-view
[UPE2] interface loopback 0
[UPE2-Loopback0] ip address 4.4.4.9 32
[UPE2-Loopback0] quit
[UPE2] mpls lsr-id 4.4.4.9
[UPE2] mpls
[UPE2-mpls] quit
[UPE2] mpls ldp
[UPE2-mpls-ldp] quit
[UPE2] interface vlan-interface 11
[UPE2-Vlan-interface11] ip address 172.2.1.1 24
[UPE2-Vlan-interface11] mpls
[UPE2-Vlan-interface11] mpls ldp
[UPE2-Vlan-interface11] quit
# 配置IGP協議,以OSPF為例。
[UPE2] ospf
[UPE2-ospf-1] area 0
[UPE2-ospf-1-area-0.0.0.0] network 172.2.1.0 0.0.0.255
[UPE2-ospf-1-area-0.0.0.0] network 4.4.4.9 0.0.0.0
[UPE2-ospf-1-area-0.0.0.0] quit
[UPE2-ospf-1] quit
# 配置VPN實例vpn1和vpn2,將CE 3和CE 4接入UPE 2。
[UPE2] ip vpn-instance vpn1
[UPE2-vpn-instance-vpn1] route-distinguisher 300:1
[UPE2-vpn-instance-vpn1] vpn-target 100:1 both
[UPE2-vpn-instance-vpn1] quit
[UPE2] ip vpn-instance vpn2
[UPE2-vpn-instance-vpn2] route-distinguisher 400:2
[UPE2-vpn-instance-vpn2] vpn-target 100:2 both
[UPE2-vpn-instance-vpn2] quit
[UPE2] interface vlan-interface 12
[UPE2-Vlan-interface12] ip binding vpn-instance vpn1
[UPE2-Vlan-interface12] ip address 10.1.1.2 24
[UPE2-Vlan-interface12] quit
[UPE2] interface vlan-interface 13
[UPE2-Vlan-interface13] ip binding vpn-instance vpn2
[UPE2-Vlan-interface13] ip address 10.3.1.2 24
[UPE2-Vlan-interface13] quit
# 配置UPE 2與SPE 2建立MP-IBGP對等體,並引入VPN路由。
[UPE2] bgp 100
[UPE2-bgp] peer 3.3.3.9 as-number 100
[UPE2-bgp] peer 3.3.3.9 connect-interface loopback 0
[UPE2-bgp] ipv4-family vpnv4
[UPE2-bgp-af-vpnv4] peer 3.3.3.9 enable
[UPE2-bgp-af-vpnv4] quit
[UPE2-bgp] ipv4-family vpn-instance vpn1
[UPE2-bgp-vpn1] peer 10.1.1.1 as-number 65430
[UPE2-bgp-vpn1] import-route direct
[UPE2-bgp-vpn1] quit
[UPE2-bgp] ipv4-family vpn-instance vpn2
[UPE2-bgp-vpn1] peer 10.3.1.1 as-number 65440
[UPE2-bgp-vpn1] import-route direct
[UPE2-bgp-vpn1] quit
[UPE2-bgp] quit
(5) 配置CE 3
<CE3> system-view
[CE3] interface vlan-interface 12
[CE3-Vlan-interface12] ip address 10.1.1.1 255.255.255.0
[CE3-Vlan-interface12] quit
[CE3] bgp 65430
[CE3-bgp] peer 10.1.1.2 as-number 100
[CE3-bgp] import-route direct
[CE3] quit
(6) 配置CE 4
<CE4> system-view
[CE4] interface vlan-interface 13
[CE4-Vlan-interface13] ip address 10.3.1.1 255.255.255.0
[CE4-Vlan-interface13] quit
[CE4] bgp 65440
[CE4-bgp] peer 10.3.1.2 as-number 100
[CE4-bgp] import-route direct
[CE4] quit
(7) 配置SPE 1
# 配置MPLS基本能力和MPLS LDP能力,建立LDP LSP。
<SPE1> system-view
[SPE1] interface loopback 0
[SPE1-LoopBack0] ip address 2.2.2.9 32
[SPE1-LoopBack0] quit
[SPE1] mpls lsr-id 2.2.2.9
[SPE1] mpls
[SPE1-mpls] quit
[SPE1] mpls ldp
[SPE1-mpls-ldp] quit
[SPE1] interface vlan-interface 11
[SPE1-Vlan-interface11] ip address 172.1.1.2 24
[SPE1-Vlan-interface11] mpls
[SPE1-Vlan-interface11] mpls ldp
[SPE1-Vlan-interface11] quit
[SPE1] interface vlan-interface 12
[SPE1-Vlan-interface12] ip address 180.1.1.1 24
[SPE1-Vlan-interface12] mpls
[SPE1-Vlan-interface12] mpls ldp
[SPE1-Vlan-interface12] quit
# 配置IGP協議,以OSPF為例。
[SPE1] ospf
[SPE1-ospf-1] area 0
[SPE1-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[SPE1-ospf-1-area-0.0.0.0] network 172.1.1.0 0.0.0.255
[SPE1-ospf-1-area-0.0.0.0] network 180.1.1.0 0.0.0.255
[SPE1-ospf-1-area-0.0.0.0] quit
[SPE1-ospf-1] quit
# 配置VPN實例vpn1和vpn2。
[SPE1] ip vpn-instance vpn1
[SPE1-vpn-instance-vpn1] route-distinguisher 500:1
[SPE1-vpn-instance-vpn1 ] vpn-target 100:1 both
[SPE1-vpn-instance-vpn1] quit
[SPE1] ip vpn-instance vpn2
[SPE1-vpn-instance-vpn2] route-distinguisher 700:1
[SPE1-vpn-instance-vpn2] vpn-target 100:2 both
[SPE1-vpn-instance-vpn2] quit
# 配置SPE 1與UPE 1建立MP-IBGP對等體,指定UPE 1,並引入VPN路由。
[SPE1] bgp 100
[SPE1-bgp] peer 1.1.1.9 as-number 100
[SPE1-bgp] peer 1.1.1.9 connect-interface loopback 0
[SPE1-bgp] peer 1.1.1.9 next-hop-local
[SPE1-bgp] peer 3.3.3.9 as-number 100
[SPE1-bgp] peer 3.3.3.9 connect-interface loopback 0
[SPE1-bgp] ipv4-family vpnv4
[SPE1-bgp-af-vpnv4] peer 3.3.3.9 enable
[SPE1-bgp-af-vpnv4] peer 1.1.1.9 enable
[SPE1-bgp-af-vpnv4] peer 1.1.1.9 upe
[SPE1-bgp-af-vpnv4] quit
[SPE1-bgp]ipv4-family vpn-instance vpn1
[SPE1-bgp-vpn1] quit
[SPE1-bgp]ipv4-family vpn-instance vpn2
[SPE1-bgp-vpn2] quit
[SPE1-bgp] quit
# 配置SPE 1向UPE 1發送通過策略的路由信息,允許CE 3的路由發送給UPE 1。
[SPE1] ip ip-prefix hope index 10 permit 10.1.1.1 24
[SPE1] route-policy hope permit node 0
[SPE1-route-policy] if-match ip-prefix hope
[SPE1-route-policy] quit
[SPE1] bgp 100
[SPE1-bgp] ipv4-family vpnv4
[SPE1-bgp-af-vpnv4] peer 1.1.1.9 upe route-policy hope export
(8) 配置SPE 2
# 配置MPLS基本能力和MPLS LDP能力,建立LDP LSP。
<SPE2> system-view
[SPE2] interface loopback 0
[SPE2-LoopBack0] ip address 3.3.3.9 32
[SPE2-LoopBack0] quit
[SPE2] mpls lsr-id 3.3.3.9
[SPE2] mpls
[SPE2-mpls] quit
[SPE2] mpls ldp
[SPE2-mpls-ldp] quit
[SPE2] interface vlan-interface 12
[SPE2-Vlan-interface12] ip address 180.1.1.2 24
[SPE2-Vlan-interface12] mpls
[SPE2-Vlan-interface12] mpls ldp
[SPE2-Vlan-interface12] quit
[SPE2] interface vlan-interface 11
[SPE2-Vlan-interface11] ip address 172.2.1.2 24
[SPE2-Vlan-interface11] mpls
[SPE2-Vlan-interface11] mpls ldp
[SPE2-Vlan-interface11] quit
# 配置IGP協議,以OSPF為例。
[SPE2] ospf
[SPE2-ospf-1] area 0
[SPE2-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[SPE2-ospf-1-area-0.0.0.0] network 172.2.1.0 0.0.0.255
[SPE2-ospf-1-area-0.0.0.0] network 180.1.1.0 0.0.0.255
[SPE2-ospf-1-area-0.0.0.0] quit
[SPE2-ospf-1] quit
# 配置VPN實例vpn1和vpn2。
[SPE2] ip vpn-instance vpn1
[SPE2-vpn-instance-vpn1] route-distinguisher 600:1
[SPE2-vpn-instance-vpn1 ] vpn-target 100:1 both
[SPE2-vpn-instance-vpn1] quit
[SPE2] ip vpn-instance vpn2
[SPE2-vpn-instance-vpn2] route-distinguisher 800:1
[SPE2-vpn-instance-vpn2] vpn-target 100:2 both
[SPE2-vpn-instance-vpn2] quit
# 配置SPE 2與UPE 2建立MP-IBGP對等體,指定UPE 2,並引入VPN路由。
[SPE2] bgp 100
[SPE2-bgp] peer 4.4.4.9 as-number 100
[SPE2-bgp] peer 4.4.4.9 connect-interface loopback 0
[SPE2-bgp] peer 4.4.4.9 next-hop-local
[SPE2-bgp] peer 2.2.2.9 as-number 100
[SPE2-bgp] peer 2.2.2.9 connect-interface loopback 0
[SPE2-bgp] ipv4-family vpnv4
[SPE2-bgp-af-vpnv4] peer 2.2.2.9 enable
[SPE2-bgp-af-vpnv4] peer 4.4.4.9 enable
[SPE2-bgp-af-vpnv4] peer 4.4.4.9 upe
[SPE2-bgp-af-vpnv4] quit
[SPE2-bgp]ipv4-family vpn-instance vpn1
[SPE2-bgp-vpn1] quit
[SPE2-bgp]ipv4-family vpn-instance vpn2
[SPE2-bgp-vpn2] quit
[SPE2-bgp] quit
# 配置SPE 2向UPE 2發送通過策略的路由信息,允許CE 1的路由發送給UPE 2。
[SPE2] ip ip-prefix hope index 10 permit 10.2.1.1 24
[SPE2] route-policy hope permit node 0
[SPE2-route-policy] if-match ip-prefix hope
[SPE2-route-policy] quit
[SPE2] bgp 100
[SPE2-bgp] ipv4-family vpnv4
[SPE2-bgp-af-vpnv4] peer 4.4.4.9 upe route-policy hope export
l CE 1和CE 2都屬於VPN 1,它們分別接入PE 1和PE 2;
l CE 1和CE 2在同一個OSPF區域中;
l CE 1與CE 2之間的VPN流量通過MPLS骨幹網轉發,不使用OSPF的區域內路由。
圖1-28 OSPF偽連接配置組網圖
|
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
CE 1 |
Vlan-int11 |
100.1.1.1/24 |
CE 2 |
Vlan-int11 |
120.1.1.1/24 |
|
|
Vlan-int13 |
20.1.1.1/24 |
|
Vlan-int12 |
30.1.1.2/24 |
|
PE 1 |
Loop0 |
1.1.1.9/32 |
PE 2 |
Loop0 |
2.2.2.9/32 |
|
|
Loop1 |
3.3.3.3/32 |
|
Loop1 |
5.5.5.5/32 |
|
|
Vlan-int11 |
100.1.1.2/24 |
|
Vlan-int11 |
120.1.1.2/24 |
|
|
Vlan-int12 |
10.1.1.1/24 |
|
Vlan-int12 |
10.1.1.2/24 |
|
Switch A |
Vlan-int11 |
20.1.1.2/24 |
|
|
|
|
|
Vlan-int12 |
30.1.1.1/24 |
|
|
|
(1) 配置用戶網絡上的OSPF
在CE 1、Switch A、CE 2上配置普通OSPF,發布圖1-28中所示各接口的網段地址。具體配置過程略。
配置完成後,CE 1和CE 2應學到到對端Vlan-interface1接口的OSPF路由。
以CE 1為例:
<CE1> display ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
20.1.1.0/24 Direct 0 0 20.1.1.1 Vlan13
20.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
20.1.1.2/32 Direct 0 0 20.1.1.2 Vlan13
30.1.1.0/24 OSPF 10 3124 20.1.1.2 Vlan13
100.1.1.0/24 Direct 0 0 100.1.1.1 Vlan11
100.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
120.1.1.0/24 OSPF 10 3125 20.1.1.2 Vlan13
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
(2) 在骨幹網上配置MPLS L3VPN
# 配置PE 1。
# 配置PE 1的MPLS基本能力和MPLS LDP能力,建立LDP LSP。
<PE1> system-view
[PE1] interface loopback 0
[PE1-LoopBack0] ip address 1.1.1.9 32
[PE1-LoopBack0] quit
[PE1] mpls lsr-id 1.1.1.9
[PE1] mpls
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
[PE1] interface vlan-interface 12
[PE1-Vlan-interface12] ip address 10.1.1.1 24
[PE1-Vlan-interface12] mpls
[PE1-Vlan-interface12] mpls ldp
[PE1-Vlan-interface12] quit
# 配置PE 1的MP-IBGP對等體為PE2。
[PE1] bgp 100
[PE1-bgp] peer 2.2.2.9 as-number 100
[PE1-bgp] peer 2.2.2.9 connect-interface loopback 0
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp-af-vpnv4] peer 2.2.2.9 enable
[PE1-bgp-af-vpnv4] quit
[PE1-bgp] quit
# 配置PE 1的OSPF。
[PE1]ospf 1
[PE1-ospf-1]area 0
[PE1-ospf-1-area-0.0.0.0]network 1.1.1.9 0.0.0.0
[PE1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[PE1-ospf-1-area-0.0.0.0]quit
[PE1-ospf-1]quit
# 配置PE 2的MPLS基本能力和MPLS LDP能力,建立LDP LSP。
<PE2> system-view
[PE2] interface loopback 0
[PE2-LoopBack0] ip address 2.2.2.9 32
[PE2-LoopBack0] quit
[PE2] mpls lsr-id 2.2.2.9
[PE2] mpls
[PE2-mpls] quit
[PE2] mpls ldp
[PE2-mpls-ldp] quit
[PE2] interface vlan-interface 12
[PE2-Vlan-interface12] ip address 10.1.1.2 24
[PE2-Vlan-interface12] mpls
[PE2-Vlan-interface12] mpls ldp
[PE2-Vlan-interface12] quit
# 配置PE 2的MP-IBGP對等體為PE1。
[PE2] bgp 100
[PE2-bgp] peer 1.1.1.9 as-number 100
[PE2-bgp] peer 1.1.1.9 connect-interface loopback 0
[PE2-bgp] ipv4-family vpnv4
[PE2-bgp-af-vpnv4] peer 1.1.1.9 enable
[PE2-bgp-af-vpnv4] quit
[PE2-bgp] quit
# 配置PE 2的OSPF。
[PE2]ospf 1
[PE2-ospf-1]area 0
[PE2-ospf-1-area-0.0.0.0]network 2.2.2.9 0.0.0.0
[PE2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[PE2-ospf-1-area-0.0.0.0]quit
[PE2-ospf-1]quit
(3) 配置PE接入CE
# 配置PE 1接入CE 1。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 100:1
[PE1-vpn-instance-vpn1] vpn-target 1:1
[PE1-vpn-instance-vpn1] quit
[PE1] interface vlan-interface 11
[PE1-Vlan-interface11] ip binding vpn-instance vpn1
[PE1-Vlan-interface11] ip address 100.1.1.2 24
[PE1-Vlan-interface11] quit
[PE1] ospf 100 vpn-instance vpn1
[PE1-ospf-100] domain-id 10
[PE1-ospf-100] area 1
[PE1-ospf-100-area-0.0.0.1] network 100.1.1.0 0.0.0.255
[PE1-ospf-100-area-0.0.0.1] quit
[PE1-ospf-100] quit
[PE2] bgp 100
[PE1-bgp] ipv4-family vpn-instance vpn1
[PE1-bgp-vpn1] import-route ospf 100
[PE1-bgp-vpn1] import-route direct
[PE1-bgp-vpn1] quit
[PE1-bgp] quit
# 配置PE 2接入CE 2。
[PE2] ip vpn-instance vpn1
[PE2-vpn-instance-vpn1] route-distinguisher 100:2
[PE2-vpn-instance-vpn1] vpn-target 1:1
[PE2-vpn-instance-vpn1] quit
[PE2] interface vlan-interface 11
[PE2-Vlan-interface11] ip binding vpn-instance vpn1
[PE2-Vlan-interface11] ip address 120.1.1.2 24
[PE2-Vlan-interface11] quit
[PE2] ospf 100 vpn-instance vpn1
[PE2-ospf-100] domain-id 10
[PE2-ospf-100] area 1
[PE2-ospf-100-area-0.0.0.1] network 120.1.1.0 0.0.0.255
[PE2-ospf-100-area-0.0.0.1] quit
[PE2-ospf-100] quit
[PE2] bgp 100
[PE2-bgp] ipv4-family vpn-instance vpn1
[PE2-bgp-vpn1] import-route ospf 100
[PE2-bgp-vpn1] import-route direct
[PE2-bgp-vpn1] quit
[PE2-bgp] quit
完成上述配置後,在PE設備上執行display ip routing-table vpn-instance命令,可以看到去往對端CE的路由是通過用戶網絡的OSPF路由,不是通過骨幹網的BGP路由。
以PE 1為例:
[PE1] display ip routing-table vpn-instance vpn1
Routing Tables: vpn1
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
20.1.1.0/24 OSPF 10 1563 100.1.1.1 Vlan11
30.1.1.0/24 OSPF 10 3125 100.1.1.1 Vlan11
100.1.1.0/24 Direct 0 0 100.1.1.2 Vlan11
100.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
120.1.1.0/24 OSPF 10 3126 100.1.1.1 Vlan11
(4) 配置Sham-link
# 配置PE 1。
[PE1] interface loopback 1
[PE1-LoopBack1] ip binding vpn-instance vpn1
[PE1-LoopBack1] ip address 3.3.3.3 32
[PE1-LoopBack1] quit
[PE1] ospf 100
[PE1-ospf-100] area 1
[PE1-ospf-100-area-0.0.0.1] sham-link 3.3.3.3 5.5.5.5 cost 10
[PE1-ospf-100-area-0.0.0.1] quit
[PE1-ospf-100] quit
# 配置PE 2。
[PE2] interface loopback 1
[PE2-LoopBack1] ip binding vpn-instance vpn1
[PE2-LoopBack1] ip address 5.5.5.5 32
[PE2-LoopBack1] quit
[PE2] ospf 100
[PE2-ospf-100] area 1
[PE2-ospf-100-area-0.0.0.1] sham-link 5.5.5.5 3.3.3.3 cost 10
[PE2-ospf-100-area-0.0.0.1] quit
[PE2-ospf-100] quit
完成上述配置後,在PE設備上再次執行display ip routing-table vpn-instance命令,可以看到去往對端CE的路由變成了通過骨幹網的BGP路由,並且有去往Sham-link目的地址的路由。
以PE 1為例:
[PE1] display ip routing-table vpn-instance vpn1
Routing Tables: vpn1
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost NextHop Interface
3.3.3.3/32 Direct 0 0 127.0.0.1 InLoop0
5.5.5.5/32 BGP 255 0 2.2.2.9 NULL0
20.1.1.0/24 OSPF 10 1563 100.1.1.1 Vlan11
100.1.1.0/24 Direct 0 0 100.1.1.2 Vlan11
100.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
120.1.1.0/24 BGP 255 0 2.2.2.9 NULL0
在CE設備上執行display ip routing-table命令,可以看到去往對端CE的OSPF路由開銷變為10(為Sham-link配置的開銷),下一跳變為接入PE的Vlan-interface11接口,即去往對端的VPN流量將通過骨幹網轉發。
以CE 1為例:
[CE1] display ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
20.1.1.0/24 Direct 0 0 20.1.1.1 Vlan13
20.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
20.1.1.2/32 Direct 0 0 20.1.1.2 Vlan13
30.1.1.0/24 OSPF 10 1574 100.1.1.2 Vlan11
100.1.1.0/24 Direct 0 0 100.1.1.1 Vlan11
100.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
120.1.1.0/24 OSPF 10 12 100.1.1.2 Vlan11
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在PE上執行display ospf sham-link命令可以看到Sham-link的建立情況。
以PE 1為例:
[PE1] display ospf sham-link
OSPF Process 100 with Router ID 100.1.1.2
Sham Link:
Area NeighborId Source-IP Destination-IP State Cost
0.0.0.1 120.1.1.2 3.3.3.3 5.5.5.5 P-2-P 10
執行display ospf sham-link area命令可以看到對端狀態為Full。
[PE1] display ospf sham-link area 1
OSPF Process 100 with Router ID 100.1.1.2
Sham-Link: 3.3.3.3 --> 5.5.5.5
Neighbor ID: 120.1.1.2 State: Full
Area: 0.0.0.1
Cost: 10 State: P-2-P Type: Sham
Timers: Hello 10, Dead 40, Retransmit 5, Transmit Delay 1
如圖所示,CE 1和CE 2同屬於VPN 1,分別接入PE 1和PE 2,並且CE 1和CE 2複用AS號600。
圖1-29 BGP的AS號替換組網圖
|
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
CE 1 |
Vlan-int11 |
10.1.1.1/24 |
P |
Loop0 |
2.2.2.9/32 |
|
|
Vlan-int12 |
100.1.1.1/24 |
|
Vlan-int11 |
30.1.1.1/24 |
|
PE 1 |
Loop0 |
1.1.1.9/32 |
|
Vlan-int12 |
20.1.1.2/24 |
|
|
Vlan-int11 |
10.1.1.2/24 |
PE 2 |
Loop0 |
3.3.3.9/32 |
|
|
Vlan-int12 |
20.1.1.1/24 |
|
Vlan-int11 |
30.1.1.2/24 |
|
CE 2 |
Vlan-int12 |
10.2.1.1/24 |
|
Vlan-int12 |
10.2.1.2/24 |
|
|
Vlan-int13 |
200.1.1.1/24 |
|
|
|
(1) 配置基本MPLS L3VPN
l 在MPLS骨幹網上配置OSPF,PE和P之間能夠學到對方Loopback接口的路由;
l 在MPLS骨幹網上配置MPLS基本能力和MPLS LDP,建立LDP LSP;
l PE之間建立MP-IBGP對等體關係,發布VPN-IPv4路由;
l 在PE 2上配置VPN 1的VPN實例,接入CE 2;
l 在PE 1上配置VPN 1的VPN實例,接入CE 1;
l PE 1和CE 1、PE 2和CE 2之間配置BGP,將CE的路由引入PE。
完成上述配置後,在CE 2上執行display ip routing-table命令,可以看到CE 2能夠學到CE 1接入PE 1的接口所在網段(10.1.1.0/24)的路由,但沒有到達CE 1內部VPN(100.1.1.0/24)的路由。CE 1上也存在同樣的現象。
<CE2> display ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 BGP 255 0 10.2.1.2 Vlan11
10.1.1.1/32 BGP 255 0 10.2.1.2 Vlan11
10.2.1.0/24 Direct 0 0 10.2.1.1 Vlan11
10.2.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.2.1.2/32 Direct 0 0 10.2.1.2 Vlan11
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
200.1.1.0/24 Direct 0 0 200.1.1.1 InLoop0
200.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
在PE上執行display ip routing-table vpn-instance命令,可以看到PE的VPN實例中有到達對端CE內部VPN的路由。
以PE 2為例:
<PE2> display ip routing-table vpn-instance vpn1
Routing Tables: vpn1
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 BGP 255 0 1.1.1.9 NULL0
10.1.1.1/32 BGP 255 0 1.1.1.9 NULL0
10.2.1.0/24 Direct 0 0 10.2.1.2 Vlan11
10.2.1.1/32 Direct 0 0 10.2.1.1 Vlan11
10.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0
100.1.1.1/32 BGP 255 0 1.1.1.9 NULL0
200.1.1.1/32 BGP 255 0 10.2.1.1 Vlan11
在PE 2上打開BGP的Update報文調試信息開關,可以看到PE 2發布了去往100.1.1.1/32的路由,AS路徑信息為“100 600”。
<PE2> terminal monitor
<PE2> terminal debugging
<PE2> debugging bgp update vpn-instance vpn1 verbose
<PE2> refresh bgp vpn-instance vpn1 all export
*0.4402392 PE2 RM/7/RMDEBUG:
BGP.vpn1: Send UPDATE to 10.2.1.1 for following destinations :
Origin : Incomplete
AS Path : 100 600
Next Hop : 10.2.1.2
100.1.1.1/32,
在CE 2上執行display bgp routing-table peer received-routes命令,可以看到CE 2沒有接收100.1.1.1/32的路由。
<CE2> display bgp routing-table peer 10.2.1.2 received-routes
Total Number of Routes: 4
BGP Local router ID is 10.2.1.1
Status codes: * - valid, ^ - VPN best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 10.1.1.0/24 10.2.1.2 0 100?
*> 10.1.1.1/32 10.2.1.2 0 100?
* 10.2.1.0/24 10.2.1.2 0 0 100?
* 10.2.1.1/32 10.2.1.2 0 0 100?
(2) 配置BGP的AS號替換功能
# 在PE 2上配置BGP的AS號替換功能。
<PE2> system-view
[PE2] bgp 100
[PE2-bgp] ipv4-family vpn-instance vpn1
[PE2-bgp-vpn1] peer 10.2.1.1 substitute-as
[PE2-bgp-vpn1] quit
[PE2-bgp] quit
可以看到PE 2向CE2發布的路由中,100.1.1.1/32的AS路徑信息由“100 600”變為“100 100”:
*0.13498737 PE2 RM/7/RMDEBUG:
BGP.vpn1: Send UPDATE to 10.2.1.1 for following destinations :
Origin : Incomplete
AS Path : 100 100
Next Hop : 10.2.1.2
100.1.1.1/32
再次查看CE 2接收的路由信息和路由表:
<CE2> display bgp routing-table peer 10.2.1.2 received-routes
Total Number of Routes: 5
BGP Local router ID is 10.2.1.1
Status codes: * - valid, ^ - VPN best, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 10.1.1.0/24 10.2.1.2 0 100?
*> 10.1.1.1/32 10.2.1.2 0 100?
* 10.2.1.0/24 10.2.1.2 0 0 100?
* 10.2.1.1/32 10.2.1.2 0 0 100?
*> 100.1.1.1/32 10.2.1.2 0 100 100?
<CE2> display ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 BGP 255 0 10.2.1.2 Vlan12
10.1.1.1/32 BGP 255 0 10.2.1.2 Vlan12
10.2.1.0/24 Direct 0 0 10.2.1.1 Vlan12
10.2.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.2.1.2/32 Direct 0 0 10.2.1.2 Vlan12
100.1.1.1/32 BGP 255 0 10.2.1.2 Vlan12
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
200.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
在PE 1上也配置BGP的AS號替換功能後,CE 1和CE 2的VLAN接口能夠相互Ping通。
<CE1> ping –a 100.1.1.1 200.1.1.1
PING 200.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 200.1.1.1: bytes=56 Sequence=1 ttl=253 time=109 ms
Reply from 200.1.1.1: bytes=56 Sequence=2 ttl=253 time=67 ms
Reply from 200.1.1.1: bytes=56 Sequence=3 ttl=253 time=66 ms
Reply from 200.1.1.1: bytes=56 Sequence=4 ttl=253 time=85 ms
Reply from 200.1.1.1: bytes=56 Sequence=5 ttl=253 time=70 ms
--- 200.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 66/79/109 ms
MPLS L3VPN應用於IPv4組網環境,利用BGP在服務提供商骨幹網上發布VPN的IPv4路由,利用MPLS在服務提供商骨幹網上轉發VPN的IPv4報文。
IPv6 MPLS L3VPN的原理與MPLS L3VPN相同,所不同的是IPv6 MPLS L3VPN利用BGP在服務提供商骨幹網上發布VPN的IPv6路由,利用MPLS在服務提供商骨幹網上轉發VPN的IPv6報文。
IPv6 MPLS L3VPN的典型組網環境如圖2-1所示。目前,IPv6 MPLS L3VPN組網中服務提供商骨幹網應為IPv4網絡。VPN內部及CE和PE之間運行IPv6協議,骨幹網中PE和P設備之間運行IPv4協議。PE需要同時支持IPv4和IPv6協議,連接CE的接口上使用IPv6協議,連接骨幹網的接口上使用IPv4協議。
圖2-1 IPv6 MPLS L3VPN應用組網圖

圖2-2 IPv6 MPLS L3VPN報文轉發示意圖

如圖2-2所示,IPv6 MPLS L3VPN的報文轉發過程為:
(1) Site 1發出一個目的地址為2001:2::1的IPv6報文,由CE 1將報文發送至PE 1。
(2) PE 1根據報文到達的接口及目的地址查找VPN實例的路由表項,匹配後將報文轉發出去,同時打上內層和外層兩個標簽。
(3) MPLS網絡利用報文的外層標簽,將報文傳送到PE 2。(報文在到達PE 2前一跳時已經被剝離外層標簽,到達PE 2時僅含內層標簽)
(4) PE 2根據內層標簽和目的地址查找VPN實例的路由表項,確定報文的出接口,將報文轉發至CE 2。
(5) CE 2根據正常的IPv6轉發過程將報文傳送到目的地。
VPN路由信息的發布過程包括三部分:本地CE到入口PE、入口PE到出口PE、出口PE到遠端CE。完成這三部分後,本地CE與遠端CE之間將建立可達路由,VPN私網路由信息能夠在骨幹網上發布。
CE與直接相連的PE建立鄰接關係後,把本站點的VPN IPv6路由發布給PE。
CE與PE之間可以使用IPv6靜態路由、RIPng、OSPFv3、IPv6 IS-IS、EBGP路由協議。無論使用哪種路由協議,CE發布給PE的都是標準的IPv6路由。
PE從CE學到VPN的IPv6路由信息後,為這些標準IPv6路由增加RD和VPN Target屬性,形成VPN-IPv6路由,存放到為CE創建的VPN實例的路由表中,並觸發MPLS為其分配私網標簽。
入口PE通過MP-BGP把VPN-IPv6路由發布給出口PE。出口PE根據VPN-IPv6路由的Export Target屬性與自己維護的VPN實例的Import Target屬性,決定是否將該路由加入到VPN實例的路由表。
PE之間通過IGP來保證內部的連通性。
與本地CE到入口PE的路由信息交換相同,遠端CE有多種方式可以從出口PE學習VPN路由,包括IPv6靜態路由、RIPng、OSPFv3、IPv6 IS-IS、EBGP路由協議。
目前,IPv6 MPLS L3VPN支持如下組網方案及功能:
l 基本的VPN組網方案
l 跨域VPN-OptionA
l 跨域VPN-OptionC
l 運營商的運營商
表2-1 IPv6 MPLS L3VPN配置任務簡介
|
配置任務 |
詳細配置 |
說明 |
|
配置基本IPv6 MPLS L3VPN |
完成基本IPv6 MPLS L3VPN配置後,即可實現通過MPLS技術構建簡單的IPv6 VPN網絡 如果部署一些特殊的IPv6 MPLS L3VPN組網方案,例如跨域VPN,除了配置基本IPv6 MPLS L3VPN外,還需要根據相應章節進行其他的配置 |
|
|
配置IPv6跨域VPN |
配置IPv6 MPLS L3VPN的關鍵在於管理VPN私網路由在MPLS骨幹網上的發布,包括PE-CE間的路由發布管理以及PE-PE間的路由發布管理。
表2-2 基本IPv6 MPLS L3VPN配置任務簡介
|
配置任務 |
說明 |
詳細配置 |
|
|
配置VPN實例 |
創建VPN實例 |
必選 |
|
|
配置VPN實例與接口關聯 |
必選 |
||
|
配置VPN實例的路由相關屬性 |
可選 |
||
|
配置VPN實例的隧道策略 |
可選 |
||
|
配置LDP實例 |
可選 |
||
|
配置PE-CE間的路由交換 |
必選 |
||
|
配置PE-PE間的路由交換 |
必選 |
||
|
配置BGP-VPNv6子地址族下的路由特性 |
可選 |
||
在配置基本IPv6 MPLS L3VPN之前,需完成以下任務:
l 對MPLS骨幹網(PE、P)配置IGP,實現骨幹網的IP連通性
l 對MPLS骨幹網(PE、P)配置MPLS基本能力
l 對MPLS骨幹網(PE、P)配置MPLS LDP,建立LDP LSP
VPN實例不僅可以隔離VPN私網路由與公網路由,還可以隔離不同VPN實例的路由,這一特點使得VPN實例的使用不限於MPLS L3VPN。
配置VPN實例的操作是在PE或MCE設備上進行的。
VPN實例在實現中與Site關聯。VPN實例不是直接對應於VPN,一個VPN實例綜合了和它所對應Site的VPN成員關係和路由規則。
一個VPN實例隻有配置了RD後才生效。
描述信息用於描述VPN實例,可以用來記錄VPN實例與某個VPN的關係等信息。
表2-3 創建VPN實例
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建VPN實例,並進入VPN實例視圖 |
ip vpn-instance vpn-instance-name |
必選 |
|
配置VPN實例的RD |
route-distinguisher route-distinguisher |
必選 一個VPN實例隻有配置了RD後才生效 |
|
配置VPN實例的描述信息 |
description text |
可選 描述信息用於描述VPN實例,可以用來記錄VPN實例與某個VPN的關係等信息 |
VPN實例配置完成後,還需要與連接CE的接口進行關聯。支持MPLS LDP能力的接口類型都可以與VPN實例相關聯。具體接口類型請參見“MPLS配置指導”中的“MPLS基本配置”。
表2-4 配置VPN實例與接口關聯
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入要關聯接口的接口視圖 |
interface interface-type interface-number |
- |
|
將當前接口與VPN實例關聯 |
ip binding vpn-instance vpn-instance-name |
必選 缺省情況下,接口不關聯任何VPN實例 |
![]()
執行ip binding vpn-instance命令將刪除接口上已經配置的IPv6地址,因此需要重新配置接口的IPv6地址。
VPN路由的發布控製過程如下:
l 當從CE學習到的一條VPN路由引入BGP時,BGP為它關聯一個VPN Target擴展團體屬性列表,通常這個列表是與CE相關聯的VPN實例的輸出路由屬性列表。
l VPN實例根據VPN Target中import-extcommunity確定可被接受並引入此VPN實例的路由。
l VPN實例根據VPN Target中的export-extcommunity對向外發布的路由進行VPN Target屬性的修改。
表2-5 配置VPN實例的路由相關屬性
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入VPN實例視圖 |
ip vpn-instance vpn-instance-name |
- |
|
進入IPv6 VPN視圖 |
ipv6-family |
可選 |
|
配置VPN Target |
vpn-target vpn-target&<1-8> [ both | export-extcommunity | import-extcommunity ] |
必選 |
|
配置支持的最大路由數 |
routing-table limit number { warn-threshold | simply-alert } |
可選 |
|
應用入方向路由策略 |
import route-policy route-policy |
可選 缺省情況下,接收所有VPN Target屬性匹配的路由 |
|
應用出方向路由策略 |
export route-policy route-policy |
可選 缺省情況下,不對發布的路由進行過濾 |
![]()
l VPN實例視圖下配置的路由相關屬性既可以用於IPv4 VPN,也可以用於IPv6 VPN。
l 既可以在VPN實例視圖下,也可以在IPv6 VPN視圖下,配置IPv6 VPN的路由相關屬性。如果同時在兩個視圖下配置了路由相關屬性,則IPv6 VPN采用IPv6 VPN視圖下配置的路由相關屬性。
l 命令vpn-target最多可以配置8個VPN Target;一個VPN實例最多可以配置64個VPN Target。
l 可以配置一個VPN實例支持的最大路由數,以防止PE路由器的入接口有過多的路由。一個PE路由器最多可以支持的路由條數與具體產品有關。
l 為VPN實例配置路由策略之前必須已經創建了路由策略,否則無法對接收和發布的路由進行過濾。
表2-6 配置VPN實例的隧道策略
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建隧道策略,並進入隧道策略視圖 |
tunnel-policy tunnel-policy-name |
必選 |
|
配置隧道的優先級順序和負載分擔條數 |
tunnel select-seq { cr-lsp | lsp } * load-balance-number number |
必選 缺省情況下,按照LSP隧道->CR-LSP隧道的優先級順序選擇隧道,負載分擔條數為1 |
|
退回係統視圖 |
quit |
- |
|
進入VPN實例視圖 |
ip vpn-instance vpn-instance-name |
必選 |
|
進入IPv6 VPN視圖 |
ipv6-family |
可選 |
|
配置VPN實例的隧道策略 |
tnl-policy tunnel-policy-name |
必選 缺省情況下,按照LSP隧道->CR-LSP隧道的優先級順序選擇隧道,負載分擔條數為1 |
:
l 配置的隧道類型不止一種,且負載分擔的條數多於單個類型包含的隧道個數時,會使用不同類型的隧道一起進行負載分擔。
l VPN實例視圖下配置的隧道策略既可以用於IPv4 VPN,也可以用於IPv6 VPN。
l 既可以在VPN實例視圖下,也可以在IPv6 VPN視圖下,配置IPv6 VPN的隧道策略。如果同時在兩個視圖下配置了隧道策略,則IPv6 VPN采用IPv6 VPN視圖下配置的隧道策略。
l 為VPN實例配置隧道策略之前必須先創建隧道策略,否則將采用缺省策略,即按照LSP隧道->CR-LSP隧道的優先級順序選擇隧道,負載分擔條數為1。
LDP實例應用於運營商的運營商(Carriers’ carriers)組網模型中。
本配置任務用來使能VPN實例的LDP能力,創建LDP實例,並在MPLS-LDP-VPN實例視圖下為VPN實例配置LDP參數。
LDP實例的配置方法,請參見“1.3.3 5. 配置LDP實例”。
PE-CE間路由交換可以使用IPv6靜態路由、RIPng、OSPFv3、IPv6 IS-IS和EBGP路由協議。根據實際組網情況選擇一種進行配置即可。
在配置PE-CE間路由交換之前,需要先完成以下任務:
l 在CE上配置連接PE接口的IPv6地址
l 在PE上配置連接CE接口的IPv6地址
表2-7 配置PE-CE間使用IPv6靜態路由
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
為指定VPN實例配置IPv6靜態路由 |
ipv6 route-static ipv6-address prefix-length { interface-type interface-number [ next-hop-address ] | next-hop-address | vpn-instance d-vpn-instance-name nexthop-address } [ preference preference-value ] |
二者必選其一 該配置在PE上進行,CE上的配置方法與普通IPv6靜態路由相同 |
|
ipv6 route-static vpn-instance s-vpn-instance-name&<1-6> ipv6-address prefix-length { interface-type interface-number [ next-hop-address ] | nexthop-address [ public ] | vpn-instance d-vpn-instance-name nexthop-address } [ preference preference-value ] |
![]()
有關IPv6靜態路由的配置請參見“三層技術-IP路由配置指導”中的“IPv6靜態路由配置”。
一個RIPng進程隻能屬於一個VPN實例。如果在啟動RIPng進程時不綁定到VPN實例,則該進程屬於公網進程。
表2-8 配置PE-CE間使用RIPng
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建PE-CE間的RIPng實例,並進入RIPng視圖 |
ripng [ process-id ] vpn-instance vpn-instance-name |
必選 該配置在PE上進行,CE上配置普通RIPng即可 |
|
退回係統視圖 |
quit |
- |
|
進入接口視圖 |
interface interface-type interface-number |
- |
|
在指定的網絡接口上使能RIPng |
ripng process-id enable |
必選 缺省情況下,接口禁用RIPng |
![]()
有關RIPng的介紹和詳細配置,請參見“三層技術-IP路由配置指導”中的“RIPng配置”。
一個OSPFv3進程隻能屬於一個VPN實例。如果在啟動OSPFv3進程時不綁定到VPN實例,則該進程屬於公網進程。
表2-9 配置PE-CE間使用OSPFv3
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建PE-CE間的OSPFv3實例,並進入OSPFv3視圖 |
ospfv3 [ process-id ] vpn-instance vpn-instance-name |
必選 該配置在PE上進行,CE上配置普通OSPFv3即可 |
|
配置Router ID |
router-id router-id |
必選 |
|
退回係統視圖 |
quit |
- |
|
進入接口視圖 |
interface interface-type interface-number |
- |
|
在接口上使能OSPFv3 |
ospfv3 process-id area area-id [ instance instance-id ] |
必選 缺省情況下,接口上沒有使能OSPFv3 該配置在PE上進行 |
![]()
有關OSPFv3的介紹和詳細配置,請參見“三層技術-IP路由配置指導”中的“OSPFv3配置”。
一個IPv6 IS-IS進程隻能屬於一個VPN實例。如果在啟動IPv6 IS-IS進程時不綁定到VPN實例,則該進程屬於公網進程。
表2-10 配置PE-CE間使用IPv6 IS-IS
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
創建PE-CE間的IPv6 IS-IS實例,並進入IS-IS視圖 |
isis [ process-id ] vpn-instance vpn-instance-name |
必選 該配置在PE上進行,CE上配置普通IPv6 IS-IS即可 |
|
配置網絡實體名稱 |
network-entity net |
必選 缺省情況下,沒有配置網絡實體名稱 |
|
使能IS-IS進程的IPv6能力 |
ipv6 enable |
必選 缺省情況下,沒有使能IS-IS路由進程的IPv6能力 |
|
退回係統視圖 |
quit |
- |
|
進入接口視圖 |
interface interface-type interface-number |
- |
|
使能接口IS-IS路由進程的IPv6能力,並指定要關聯的IS-IS進程號 |
isis ipv6 enable [ process-id ] |
必選 缺省情況下,接口上沒有使能IS-IS路由進程的IPv6能力 |
![]()
有關IPv6 IS-IS的介紹和詳細配置,請參見“三層技術-IP路由配置指導”中的“IPv6 IS-IS配置”。
(1) PE上的配置
表2-11 PE上的配置
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
進入IPv6 BGP-VPN實例視圖 |
ipv6-family vpn-instance vpn-instance-name |
必選 |
|
將CE配置為VPN私網EBGP對等體 |
peer ipv6-address as-number as-number |
必選 |
|
引入本端CE路由 |
import-route protocol [ process-id ] [ med med-value | route-policy route-policy-name ] * |
必選 PE需要將到本端CE的路由引入VPN路由表中,以發布給對端PE |
|
配置對發布的路由信息進行過濾 |
filter-policy { acl6-number | ipv6-prefix ipv6-prefix-name } export [ direct | isisv6 process-id | ripng process-id | static ] |
可選 缺省情況下,不對發布的路由信息進行過濾 |
|
配置對接收的路由信息進行過濾 |
filter-policy { acl6-number | ipv6-prefix ipv6-prefix-name } import |
可選 缺省情況下,不對接收的路由信息進行過濾 |
(2) CE上的配置
表2-12 CE上的配置
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
進入IPv6 BGP子地址族視圖 |
ipv6-family |
必選 |
|
將PE配置為EBGP對等體 |
peer ipv6-address as-number as-number |
必選 |
|
配置路由引入 |
import-route protocol [ process-id ] [ med med-value | route-policy route-policy-name ] * |
可選 CE需要將自己所能到達的VPN網段地址發布給接入的PE,通過PE發布給對端CE |
![]()
l 配置IPv6 BGP-VPN實例後,VPN實例中的BGP路由交換與普通的BGP相同。
l IPv6 BGP-VPN實例視圖下的配置命令與IPv6 BGP子地址族視圖下的配置命令相同。上文隻列舉了部分配置命令,更多的配置命令請參見“三層技術-IP路由配置指導”中的“IPv6 BGP配置”。
表2-13 配置PE-PE間的路由交換
|
操作 |
命令 |
說明 |
|
|
進入係統視圖 |
system-view |
- |
|
|
進入BGP視圖 |
bgp as-number |
必選 |
|
|
將對端PE配置為對等體 |
peer ip-address as-number as-number |
必選 |
|
|
指定路由更新報文的源接口 |
peer { group-name | ip-address } connect-interface interface-type interface-number |
必選 缺省情況下,BGP使用最佳路由更新報文的源接口 |
|
|
進入BGP-VPNv6子地址族視圖 |
ipv6-family vpnv6 |
必選 |
|
|
使能對等體交換BGP-VPNv6路由信息 |
peer ip-address enable |
必選 缺省情況下,BGP對等體之間隻能交換IPv4路由信息 |
|
BGP-VPNv6子地址族下的很多路由特性都與BGP IPv6單播路由的特性相同。這些特性根據組網的需求來決定是否選擇。
表2-14 配置BGP-VPNv6子地址族的路由特性
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
將對端PE配置為對等體 |
peer ip-address as-number as-number |
必選 |
|
指定建立TCP連接的接口 |
peer ip-address connect-interface interface-type interface-number |
必選 |
|
進入BGP-VPNv6子地址族視圖 |
ipv6-family vpnv6 |
- |
|
配置本地優先級的缺省值 |
default local-preference value |
可選 缺省情況下,本地優先級的值為100 |
|
配置係統MED的缺省值 |
default med med-value |
可選 缺省情況下,係統MED的缺省值為0 |
|
配置對發布的路由信息進行過濾 |
filter-policy { acl6-number | ipv6-prefix ipv6-prefix-name } export [ direct | isisv6 process-id | ripng process-id | static ] |
可選 缺省情況下,不對發布的路由信息進行過濾 |
|
配置對接收的路由信息進行過濾 |
filter-policy { acl6-number | ipv6-prefix ipv6-prefix-name } import |
可選 缺省情況下,不對接收的路由信息進行過濾 |
|
配置為指定對等體應用過濾策略 |
peer ip-address filter-policy acl6-number { export | import } |
可選 缺省情況下,沒有為對等體應用過濾策略 |
|
為指定對等體應用基於IPv6地址前綴列表的路由過濾策略 |
peer ip-address ipv6-prefix prefix-name { export | import } |
可選 缺省情況下,對等體上不應用基於IPv6地址前綴列表的路由過濾策略 |
|
為從對等體接收的路由分配首選值 |
peer ip-address preferred-value value |
可選 缺省情況下,從對等體接收的路由的首選值為0 |
|
配置發送BGP更新報文時不攜帶私有自治係統號 |
peer ip-address public-as-only |
可選 缺省情況下,發送BGP更新報文時,攜帶私有自治係統號 |
|
為指定對等體配置路由策略 |
peer ip-address route-policy route-policy-name { export | import } |
可選 缺省情況下,對等體沒有應用路由策略 |
|
對接收到的BGP-VPNv6子地址族的BGP路由使能VPN-Target過濾功能 |
policy vpn-target |
可選 缺省情況下,對接收到的BGP-VPNv6子地址族的BGP路由使能VPN-Target過濾功能 |
|
配置將本機作為路由反射器,並將對等體作為路由反射器的客戶 |
peer ip-address reflect-client |
可選 缺省情況下,沒有配置路由反射器及其客戶 |
|
允許客戶到客戶的路由反射 |
reflect between-clients |
可選 缺省情況下,允許客戶到客戶的路由反射 |
|
為路由反射器配置群ID |
reflector cluster-id { cluster-id | ip-address } |
可選 缺省情況下,每個路由反射器都使用自己的Router ID作為群ID 如果一個群中配置了多個路由反射器,請使用本命令為所有的路由反射器配置相同的群ID,以避免產生路由環路 |
|
創建路由反射器的反射策略 |
rr-filter extended-community-list-number |
可選 缺省情況下,路由反射器不會對反射的路由進行過濾 執行本命令後,隻有與本命令配置的擴展團體屬性號匹配的IBGP路由才會被反射 通過在不同的路由反射器上配置不同的反射策略,可以實現路由反射器之間的負載分擔 |
![]()
有關IPv6 BGP的路由特性請參見“三層技術-IP路由配置指導”中的“IPv6 BGP配置”。
如果承載IPv6 VPN路由的MPLS骨幹網跨越多個AS,就需要配置跨域VPN。
跨域VPN有三種解決方案,具體介紹請參見“1.1.6 跨域VPN”。目前,IPv6 MPLS L3VPN隻支持VPN-OptionA和VPN-OptionC。
在配置跨域VPN之前,需完成以下任務:
l 為各AS的MPLS骨幹網分別配置IGP,實現同一AS內骨幹網的IP連通性
l 為各AS的MPLS骨幹網分別配置MPLS基本能力
l 為各AS的MPLS骨幹網分別配置MPLS LDP,建立LDP LSP
![]()
請根據實際應用的IPv6跨域VPN方式,選擇下述配置任務中的對應項。
IPv6跨域VPN-OptionA的實現比較簡單,當PE上的VPN數量及VPN路由數量都比較少時可以采用這種方案。
IPv6跨域VPN-OptionA的配置可以描述為:
l 對各AS分別進行基本IPv6 MPLS L3VPN配置。
l 對於ASBR-PE,將對端ASBR-PE看作自己的CE配置即可。即:IPv6跨域VPN-OptionA方式需要在PE和ASBR-PE上分別配置IPv6 VPN實例,前者用於接入CE,後者用於接入對端ASBR-PE。
具體配置方法,請參見“2.3 配置基本IPv6 MPLS L3VPN”。
![]()
在IPv6跨域VPN-OptionA方式中,對於同一個IPv6 VPN,同一AS內的ASBR-PE和PE上配置的VPN Target應能匹配,即VPN Target的配置應能保證PE(或ASBR-PE)發送的VPN路由能夠被ASBR-PE(或PE)接受;不同AS的PE上配置的VPN Target則不需要匹配。
同一AS內的PE和ASBR-PE之間建立普通的IBGP對等體關係,不同AS的PE之間建立MP-EBGP對等體關係。
同一AS內的PE和ASBR-PE之間應能夠交換帶標簽的路由。
表2-15 配置PE
|
操作 |
命令 |
說明 |
|
進入係統視圖 |
system-view |
- |
|
進入BGP視圖 |
bgp as-number |
- |
|
配置本AS的ASBR-PE為IBGP對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
配置與本AS的ASBR-PE之間能夠交換帶標簽的路由 |
peer { group-name | ip-address } label-route-capability |
必選 缺省情況下,不向IPv4對等體/對等體組發送標簽路由 |
|
將另一AS的PE配置為EBGP對等體 |
peer { group-name | ip-address } as-number as-number |
必選 |
|
進入BGP-VPNv6子地址族視圖 |
ipv6-family vpnv6 |
- |
|
使能EBGP對等體交換BGP-VPNv6路由信息 |
peer ip-address enable |
必選 |
在跨域VPN-OptionC方式中,需要建立一條跨域的VPN LSP,相關PE、ASBR之間發布公網路由時攜帶MPLS標簽信息。此跨域VPN LSP的建立同IPv4 MPLS VPN相同,配置方式參見“1.4.4 配置跨域VPN-OptionC”。
配置在ASBR-PE上應用路由策略:
l 對於從本AS的PE接收的路由,在向對端ASBR-PE發布時,分配MPLS標簽;
l 對於向本AS的PE發布的路由,如果是帶標簽的路由,為其分配新的MPLS標簽。
IPv6跨域VPN路由策略的配置與IPv4 MPLS VPN相同,配置方式參見“1.4.4 配置跨域VPN-OptionC”。
![]()
軟複位BGP連接是指在不斷開BGP鄰居關係的情況下,更新BGP路由信息;複位BGP連接是指斷開並重新建立BGP鄰居關係的情況下,更新BGP路由信息。
當BGP配置變化後,可以通過軟複位或複位BGP連接使新的配置生效。軟複位需要BGP對等體具備路由刷新能力(支持ROUTE-REFRESH消息)。
請在用戶視圖下進行下列操作。
表2-16 複位BGP連接
|
操作 |
命令 |
|
軟複位指定VPN實例的IPv6 BGP連接 |
refresh bgp ipv6 vpn-instance vpn-instance-name { ipv6-address | all | external } { export | import } |
|
軟複位BGP的VPNv6連接 |
refresh bgp vpnv6 { ip-address | all | external | internal } { export | import } |
|
複位指定VPN實例的IPv6 BGP連接 |
reset bgp ipv6 vpn-instance vpn-instance-name { as-number | ipv6-address | all | external } |
|
複位BGP的VPNv6連接 |
reset bgp vpnv6 { as-number | ip-address | all | external | internal } |
在完成上述配置後,在任意視圖下執行display命令可以顯示配置後IPv6 MPLS L3VPN的運行情況,通過查看顯示信息驗證配置的效果。
表2-17 顯示IPv6 MPLS L3VPN的運行狀態
|
操作 |
命令 |
|
顯示與VPN實例相關聯的IPv6路由表 |
display ipv6 routing-table vpn-instance vpn-instance-name [ verbose ] [ | { begin | exclude | include } regular-expression ] |
|
顯示指定VPN實例信息 |
display ip vpn-instance [ instance-name vpn-instance-name ] [ | { begin | exclude | include } regular-expression ] |
|
顯示指定VPN實例的IPv6 FIB信息 |
display ipv6 fib vpn-instance vpn-instance-name [ acl6 acl6-number | ipv6-prefix ipv6-prefix-name ] [ | { begin | exclude | include } regular-expression ] |
|
顯示指定VPN實例中與指定目的IPv6地址匹配的IPv6 FIB信息 |
display ipv6 fib vpn-instance vpn-instance-name ipv6-address [ prefix-length ] [ | { begin | exclude | include } regular-expression ] |
|
顯示PE與PE之間建立的BGP VPNv6對等體的信息 |
display bgp vpnv6 all peer [ ipv4-address verbose | verbose ] [ | { begin | exclude | include } regular-expression ] |
|
顯示指定VPN實例中PE與CE之間建立的IPv6 BGP對等體的信息 |
display bgp vpnv6 vpn-instance vpn-instance-name peer [ ipv6-address verbose | verbose ] [ | { begin | exclude | include } regular-expression ] |
|
顯示所有BGP VPNv6路由信息 |
display bgp vpnv6 all routing-table [ network-address prefix-length [ longer-prefixes ] | peer ip-address { advertised-routes | received-routes } [ statistic ] | statistic ] [ | { begin | exclude | include } regular-expression ] |
|
顯示指定路由標識符的BGP VPNv6路由信息 |
display bgp vpnv6 route-distinguisher route-distinguisher routing-table [ network-address prefix-length ] [ | { begin | exclude | include } regular-expression ] |
|
顯示指定VPN實例的BGP VPNv6路由信息 |
display bgp vpnv6 vpn-instance vpn-instance-name routing-table [ network-address prefix-length [ longer-prefixes ] | peer ipv6-address { advertised-routes | received-routes } ] [ | { begin | exclude | include } regular-expression ] |
![]()
有關查看路由表的命令介紹請參見“三層技術-IP路由命令參考”中的“IP路由基礎命令”。
l CE 1、CE 3屬於VPN 1,CE 2、CE 4屬於VPN 2;
l VPN 1使用的VPN Target屬性為111:1,VPN 2使用的VPN Target屬性為222:2。不同VPN用戶之間不能互相訪問;
l CE與PE之間配置EBGP交換VPN路由信息;
l PE與PE之間配置OSPF實現PE內部的互通、配置MP-IBGP交換VPN路由信息。

|
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
CE 1 |
Vlan-int11 |
2001:1::1/64 |
P |
Loop0 |
2.2.2.9/32 |
|
PE 1 |
Loop0 |
1.1.1.9/32 |
|
Vlan-int12 |
172.2.1.1/24 |
|
|
Vlan-int11 |
2001:1::2/64 |
|
Vlan-int13 |
172.1.1.2/24 |
|
|
Vlan-int13 |
172.1.1.1/24 |
PE 2 |
Loop0 |
3.3.3.9/32 |
|
|
Vlan-int12 |
2001:2::2/64 |
|
Vlan-int12 |
172.2.1.2/24 |
|
CE 2 |
Vlan-int12 |
2001:2::1/64 |
|
Vlan-int11 |
2001:3::2/64 |
|
CE 3 |
Vlan-int11 |
2001:3::1/64 |
|
Vlan-int13 |
2001:4::2/64 |
|
CE 4 |
Vlan-int13 |
2001:4::1/64 |
|
|
|
(1) 在MPLS骨幹網上配置IGP協議,實現骨幹網PE和P的互通
# 配置PE 1。
<PE1> system-view
[PE1] interface loopback 0
[PE1-LoopBack0] ip address 1.1.1.9 32
[PE1-LoopBack0] quit
[PE1] interface vlan-interface 13
[PE1-Vlan-interface13] ip address 172.1.1.1 24
[PE1- Vlan-interface13] quit
[PE1] ospf
[PE1-ospf-1] area 0
[PE1-ospf-1-area-0.0.0.0] network 172.1.1.0 0.0.0.255
[PE1-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[PE1-ospf-1-area-0.0.0.0] quit
[PE1-ospf-1] quit
# 配置P。
<P> system-view
[P] interface loopback 0
[P-LoopBack0] ip address 2.2.2.9 32
[P-LoopBack0] quit
[P] interface vlan-interface 13
[P-Vlan-interface13] ip address 172.1.1.2 24
[P- Vlan-interface13] quit
[P] interface vlan-interface 12
[P-Vlan-interface12] ip address 172.2.1.1 24
[P-Vlan-interface12] quit
[P] ospf
[P-ospf-1] area 0
[P-ospf-1-area-0.0.0.0] network 172.1.1.0 0.0.0.255
[P-ospf-1-area-0.0.0.0] network 172.2.1.0 0.0.0.255
[P-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[P-ospf-1-area-0.0.0.0] quit
[P-ospf-1] quit
# 配置PE 2。
<PE2> system-view
[PE2] interface loopback 0
[PE2-LoopBack0] ip address 3.3.3.9 32
[PE2-LoopBack0] quit
[PE2] interface vlan-interface 12
[PE2-Vlan-interface12] ip address 172.2.1.2 24
[PE2-Vlan-interface12] quit
[PE2] ospf
[PE2-ospf-1] area 0
[PE2-ospf-1-area-0.0.0.0] network 172.2.1.0 0.0.0.255
[PE2-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[PE2-ospf-1-area-0.0.0.0] quit
[PE2-ospf-1] quit
配置完成後,PE 1、P、PE 2之間應能建立OSPF鄰居,執行display ospf peer命令可以看到鄰居達到FULL狀態。執行display ip routing-table命令可以看到PE之間學習到對方的Loopback路由。
以PE 1為例:
[PE1] display ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.9/32 OSPF 10 1 172.1.1.2 Vlan13
3.3.3.9/32 OSPF 10 2 172.1.1.2 Vlan13
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
172.1.1.0/24 Direct 0 0 172.1.1.1 Vlan13
172.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
172.1.1.2/32 Direct 0 0 172.1.1.2 Vlan13
172.2.1.0/24 OSPF 10 1 172.1.1.2 Vlan13
[PE1] display ospf peer verbose
OSPF Process 1 with Router ID 1.1.1.9
Neighbors
Area 0.0.0.0 interface 172.1.1.1(Vlan-interface13)'s neighbors
Router ID: 172.1.1.2 Address: 172.1.1.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: None BDR: None MTU: 1500
Dead timer due in 38 sec
Neighbor is up for 00:02:44
Authentication Sequence: [ 0 ]
Neighbor state change count: 5
(2) 在MPLS骨幹網上配置MPLS基本能力和MPLS LDP,建立LDP LSP
# 配置PE 1。
[PE1] mpls lsr-id 1.1.1.9
[PE1] mpls
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
[PE1] interface vlan-interface 13
[PE1-Vlan-interface13] mpls
[PE1-Vlan-interface13] mpls ldp
[PE1-Vlan-interface13] quit
# 配置P。
[P] mpls lsr-id 2.2.2.9
[P] mpls
[P-mpls] quit
[P] mpls ldp
[P-mpls-ldp] quit
[P] interface vlan-interface 13
[P-Vlan-interface13] mpls
[P-Vlan-interface13] mpls ldp
[P-Vlan-interface13] quit
[P] interface vlan-interface 12
[P-Vlan-interface12] mpls
[P-Vlan0interface12] mpls ldp
[P-Vlan-interface12] quit
# 配置PE 2。
[PE2] mpls lsr-id 3.3.3.9
[PE2] mpls
[PE2-mpls] quit
[PE2] mpls ldp
[PE2-mpls-ldp] quit
[PE2] interface vlan-interface 12
[PE2-Vlan-interface12] mpls
[PE2-Vlan-interface12] mpls ldp
[PE2-Vlan-interface12] quit
上述配置完成後,PE 1、P、PE 2之間應能建立LDP會話,執行display mpls ldp session命令可以看到顯示結果中Status字段為Operational。執行display mpls ldp lsp命令,可以看到LDP LSP的建立情況。
以PE 1為例:
[PE1] display mpls ldp session
LDP Session(s) in Public Network
Total number of sessions: 1
----------------------------------------------------------------
Peer-ID Status LAM SsnRole FT MD5 KA-Sent/Rcv
---------------------------------------------------------------
2.2.2.9:0 Operational DU Passive Off Off 5/5
---------------------------------------------------------------
LAM : Label Advertisement Mode FT : Fault Tolerance
[PE1] display mpls ldp lsp
LDP LSP Information
------------------------------------------------------------------
SN DestAddress/Mask In/OutLabel Next-Hop In/Out-Interface
------------------------------------------------------------------
1 1.1.1.9/32 3/NULL 127.0.0.1 Vlan-interface13/InLoop0
2 2.2.2.9/32 NULL/3 172.1.1.2 -------/Vlan-interface13
3 3.3.3.9/32 NULL/1024 172.1.1.2 -------/Vlan-interface13
------------------------------------------------------------------
A '*' before an LSP means the LSP is not established
A '*' before a Label means the USCB or DSCB is stale
(3) 在PE設備上配置VPN實例,將CE接入PE
# 配置PE 1。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 100:1
[PE1-vpn-instance-vpn1] vpn-target 111:1
[PE1-vpn-instance-vpn1] quit
[PE1] ip vpn-instance vpn2
[PE1-vpn-instance-vpn2] route-distinguisher 100:2
[PE1-vpn-instance-vpn2] vpn-target 222:2
[PE1-vpn-instance-vpn2] quit
[PE1] interface vlan-interface 11
[PE1-Vlan-interface11] ip binding vpn-instance vpn1
[PE1-Vlan-interface11] ipv6 address 2001:1::2 64
[PE1-Vlan-interface11] quit
[PE1] interface vlan-interface 12
[PE1-Vlan-interface12] ip binding vpn-instance vpn2
[PE1-Vlan-interface12] ipv6 address 2001:2::2 64
[PE1-Vlan-interface12] quit
# 配置PE 2。
[PE2] ip vpn-instance vpn1
[PE2-vpn-instance-vpn1] route-distinguisher 200:1
[PE2-vpn-instance-vpn1] vpn-target 111:1
[PE2-vpn-instance-vpn1] quit
[PE2] ip vpn-instance vpn2
[PE2-vpn-instance-vpn2] route-distinguisher 200:2
[PE2-vpn-instance-vpn2] vpn-target 222:2
[PE2-vpn-instance-vpn2] quit
[PE2] interface vlan-interface 11
[PE2-Vlan-interface11] ip binding vpn-instance vpn1
[PE2-Vlan-interface11] ipv6 address 2001:3::2 64
[PE2-Vlan-interface11] quit
[PE2] interface vlan-interface 13
[PE2-Vlan-interface13] ip binding vpn-instance vpn2
[PE2-Vlan-interface13] ipv6 address 2001:4::2 64
[PE2-Vlan-interface13] quit
# 按圖2-3配置各CE的接口IP地址,配置過程略。
配置完成後,在PE設備上執行display ip vpn-instance命令可以看到VPN實例的配置情況。各PE能ping通自己接入的CE。
以PE 1和CE 1為例:
[PE1] display ip vpn-instance
Total VPN-Instances configured : 2
VPN-Instance Name RD Create Time
vpn1 100:1 2006/08/13 09:32:45
vpn2 100:2 2006/08/13 09:42:59
[PE1] ping ipv6 -vpn-instance vpn1 2001:1::1
PING 2001:1::1 : 56 data bytes, press CTRL_C to break
Reply from 2001:1::1
bytes=56 Sequence=1 hop limit=64 time = 1 ms
Reply from 2001:1::1
bytes=56 Sequence=2 hop limit=64 time = 1 ms
Reply from 2001:1::1
bytes=56 Sequence=3 hop limit=64 time = 1 ms
Reply from 2001:1::1
bytes=56 Sequence=4 hop limit=64 time = 1 ms
Reply from 2001:1::1
bytes=56 Sequence=5 hop limit=64 time = 1 ms
--- 2001:1::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/1/1 ms
(4) 在PE與CE之間建立EBGP對等體,引入VPN路由
# 配置CE 1。
<CE1> system-view
[CE1] bgp 65410
[CE1-bgp] ipv6-family
[CE1-bgp-af-ipv6] peer 2001:1::2 as-number 100
[CE1-bgp-af-ipv6] import-route direct
[CE1-bgp-af-ipv6] quit
![]()
另外3個CE設備(CE 2~CE 4)配置與CE 1設備配置類似,配置過程省略。
# 配置PE 1。
[PE1] bgp 100
[PE1-bgp] ipv6-family vpn-instance vpn1
[PE1-bgp-ipv6-vpn1] peer 2001:1::1 as-number 65410
[PE1-bgp-ipv6-vpn1] import-route direct
[PE1-bgp-ipv6-vpn1] quit
[PE1-bgp] ipv6-family vpn-instance vpn2
[PE1-bgp-ipv6-vpn2] peer 2001:2::1 as-number 65420
[PE1-bgp-ipv6-vpn2] import-route direct
[PE1-bgp-ipv6-vpn2] quit
[PE1-bgp] quit
![]()
PE 2的配置與PE 1類似,配置過程省略。
配置完成後,在PE設備上執行display bgp vpnv6 vpn-instance peer命令,可以看到PE與CE之間的BGP對等體關係已建立,並達到Established狀態。
以PE 1與CE 1的對等體關係為例:
[PE1] display bgp vpnv6 vpn-instance vpn1 peer
BGP local router ID : 1.1.1.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
2001:1::1 65410 11 9 0 1 00:06:37 Established
(5) 在PE之間建立MP-IBGP對等體
# 配置PE 1。
[PE1] bgp 100
[PE1-bgp] peer 3.3.3.9 as-number 100
[PE1-bgp] peer 3.3.3.9 connect-interface loopback 0
[PE1-bgp] ipv6-family vpnv6
[PE1-bgp-af-vpnv6] peer 3.3.3.9 enable
[PE1-bgp-af-vpnv6] quit
[PE1-bgp] quit
# 配置PE 2。
[PE2] bgp 100
[PE2-bgp] peer 1.1.1.9 as-number 100
[PE2-bgp] peer 1.1.1.9 connect-interface loopback 0
[PE2-bgp] ipv6-family vpnv6
[PE2-bgp-af-vpnv6] peer 1.1.1.9 enable
[PE2-bgp-af-vpnv6] quit
[PE2-bgp] quit
配置完成後,在PE設備上執行display bgp peer或display bgp vpnv6 all peer命令,可以看到PE之間的BGP對等體關係已建立,並達到Established狀態。
[PE1] display bgp peer
BGP local router ID : 1.1.1.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
3.3.3.9 100 2 6 0 0 00:00:12 Established
(6) 配置完成後的檢驗
在PE設備上執行display ipv6 routing-table vpn-instance命令,可以看到去往對端CE的路由。
以PE 1為例:
[PE1] display ipv6 routing-table vpn-instance vpn1
Routing Table :
Destinations : 3 Routes : 3
Destination: 2001:1::/64 Protocol : Direct
NextHop : 2001:1::2 Preference: 0
Interface : Vlan11 Cost : 0
Destination: 2001:1::2/128 Protocol : Direct
NextHop : ::1 Preference: 0
Interface : InLoop0 Cost : 0
Destination: 2001:2::/64 Protocol : BGP4+
NextHop : ::FFFF:303:309 Preference: 0
Interface : NULL0 Cost : 0
[PE1] display ipv6 routing-table vpn-instance vpn2
Routing Table :
Destinations : 3 Routes : 3
Destination: 2001:3::/64 Protocol : Direct
NextHop : 2001:3::2 Preference: 0
Interface : Vlan12 Cost : 0
Destination: 2001:3::2/128 Protocol : Direct
NextHop : ::1 Preference: 0
Interface : InLoop0 Cost : 0
Destination: 2001:4::/64 Protocol : BGP4+
NextHop : ::FFFF:303:309 Preference: 0
Interface : NULL0 Cost : 0
同一VPN的CE能夠相互Ping通,不同VPN的CE不能相互Ping通。
例如:CE 1能夠Ping通CE 3(2001:3::1),但不能Ping通CE 4(2001:4::1)。
[CE1] ping ipv6 2001:3::1
PING 2001:3::1 : 56 data bytes, press CTRL_C to break
Reply from 2001:3::1
bytes=56 Sequence=1 hop limit=64 time = 1 ms
Reply from 2001:3::1
bytes=56 Sequence=2 hop limit=64 time = 1 ms
Reply from 2001:3::1
bytes=56 Sequence=3 hop limit=64 time = 1 ms
Reply from 2001:3::1
bytes=56 Sequence=4 hop limit=64 time = 1 ms
Reply from 2001:3::1
bytes=56 Sequence=5 hop limit=64 time = 1 ms
--- 2001:3::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/1/1 ms
[CE1] ping ipv6 2001:4::1
PING 2001:4::1 : 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 2001:4::1 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
round-trip min/avg/max = 0/0/0 ms
l CE 1和CE 2屬於同一個VPN。
l CE 1通過AS100的PE 1接入,CE 2通過AS200的PE 2接入。
l 采用OptionA方式實現跨域的IPv6 MPLS L3VPN,即采用VRF-to-VRF方式管理VPN路由。
l 同一個AS內部的MPLS骨幹網使用OSPF作為IGP。
圖2-4 配置跨域VPN-OptionA方式組網圖

|
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
CE 1 |
Vlan-int12 |
2001:1::1/64 |
CE 2 |
Vlan-int12 |
2001:2::1/64 |
|
PE 1 |
Loop0 |
1.1.1.9/32 |
PE 2 |
Loop0 |
4.4.4.9/32 |
|
|
Vlan-int12 |
2001:1::2/64 |
|
Vlan-int12 |
2001:2::2/64 |
|
|
Vlan-int11 |
172.1.1.2/24 |
|
Vlan-int11 |
162.1.1.2/24 |
|
ASBR-PE 1 |
Loop0 |
2.2.2.9/32 |
ASBR-PE 2 |
Loop0 |
3.3.3.9/32 |
|
|
Vlan-int11 |
172.1.1.1/24 |
|
Vlan-int11 |
162.1.1.1/24 |
|
|
Vlan-int12 |
2002:1::1/64 |
|
Vlan-int12 |
2002:1::2/64 |
(1) 在MPLS骨幹網上配置IGP協議,實現骨幹網內互通
本例中采用OSPF,具體配置步驟略。
![]()
需要將作為LSR ID的LoopBack接口的32位地址通過OSPF發布出去。
配置完成後,ASBR-PE與本AS的PE之間應能建立OSPF鄰居,執行display ospf peer命令可以看到鄰居達到FULL狀態,ASBR-PE與本AS的PE之間能學習到對方的Loopback地址。
ASBR-PE與本AS的PE之間能夠互相ping通。
(2) 在MPLS骨幹網上配置MPLS基本能力和MPLS LDP,建立LDP LSP
# 配置PE 1的MPLS基本能力,並在與ASBR-PE 1相連的接口上使能LDP。
<PE1> system-view
[PE1] mpls lsr-id 1.1.1.9
[PE1] mpls
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
[PE1] interface vlan-interface 11
[PE1-Vlan-interface11] mpls
[PE1-Vlan-interface11] mpls ldp
[PE1-Vlan-interface11] quit
# 配置ASBR-PE 1的MPLS基本能力,並在與PE 1相連的接口上使能LDP。
<ASBR-PE1> system-view
[ASBR-PE1] mpls lsr-id 2.2.2.9
[ASBR-PE1] mpls
[ASBR-PE1-mpls] quit
[ASBR-PE1] mpls ldp
[ASBR-PE1-mpls-ldp] quit
[ASBR-PE1] interface vlan-interface 11
[ASBR-PE1-Vlan-interface11] mpls
[ASBR-PE1-Vlan-interface11] mpls ldp
[ASBR-PE1-Vlan-interface11] quit
# 配置ASBR-PE 2的MPLS基本能力,並在與PE 2相連的接口上使能LDP。
<ASBR-PE2> system-view
[ASBR-PE2] mpls lsr-id 3.3.3.9
[ASBR-PE2] mpls
[ASBR-PE2-mpls] quit
[ASBR-PE2] mpls ldp
[ASBR-PE2-mpls-ldp] quit
[ASBR-PE2] interface vlan-interface 11
[ASBR-PE2-Vlan-interface11] mpls
[ASBR-PE2-Vlan-interface11] mpls ldp
[ASBR-PE2-Vlan-interface11] quit
# 配置PE 2的MPLS基本能力,並在與ASBR-PE 2相連的接口上使能LDP。
<PE2> system-view
[PE2] mpls lsr-id 4.4.4.9
[PE2] mpls
[PE2-mpls] quit
[PE2] mpls ldp
[PE2-mpls-ldp] quit
[PE2] interface vlan-interface 11
[PE2-Vlan-interface11] mpls
[PE2-Vlan-interface11] mpls ldp
[PE2-Vlan-interface11] quit
上述配置完成後,同一AS的PE和ASBR-PE之間應該建立起LDP鄰居,在各設備上執行display mpls ldp session命令可以看到顯示結果中Status字段為“Operational”。
(3) 在PE設備上配置VPN實例,將CE接入PE
![]()
同一AS內的ASBR-PE與PE的VPN實例的VPN Target應能匹配,不同AS的PE的VPN實例的VPN Target則不需要匹配。
# 配置CE 1。
<CE1> system-view
[CE1] interface vlan-interface 12
[CE1-Vlan-interface12] ipv6 address 2001:1::1 64
[CE1-Vlan-interface12] quit
# 配置PE 1。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 100:1
[PE1-vpn-instance-vpn1] vpn-target 100:1 both
[PE1-vpn-instance-vpn1] quit
[PE1] interface vlan-interface 12
[PE1-Vlan-interface12] ip binding vpn-instance vpn1
[PE1-Vlan-interface12] ipv6 address 2001:1::2 64
[PE1-Vlan-interface12] quit
# 配置CE 2。
<CE2> system-view
[CE2] interface vlan-interface 12
[CE2-Vlan-interface12] ipv6 address 2001:2::1 64
[CE2-Vlan-interface12] quit
# 配置PE 2。
[PE2] ip vpn-instance vpn1
[PE2-vpn-instance] route-distinguisher 200:2
[PE2-vpn-instance] vpn-target 100:1 both
[PE2-vpn-instance] quit
[PE2] interface vlan-interface 12
[PE2-Vlan-interface12] ip binding vpn-instance vpn1
[PE2-Vlan-interface12] ipv6 address 2001:2::2 64
[PE2-Vlan-interface12] quit
# 配置ASBR-PE 1:創建VPN實例,並將此實例綁定到連接ASBR-PE 2的接口(ASBR-PE 1認為ASBR-PE 2是自己的CE)。
[ASBR-PE1] ip vpn-instance vpn1
[ASBR-PE1-vpn-instance-vpn1] route-distinguisher 100:1
[ASBR-PE1-vpn-instance-vpn1] vpn-target 100:1 both
[ASBR-PE1-vpn-instance-vpn1] quit
[ASBR-PE1] interface vlan-interface 12
[ASBR-PE1-Vlan-interface12] ip binding vpn-instance vpn1
[ASBR-PE1-Vlan-interface12] ipv6 address 2002:1::1 64
[ASBR-PE1-Vlan-interface12] quit
# 配置ASBR-PE 2:創建VPN實例,並將此實例綁定到連接ASBR-PE 1的接口(ASBR-PE 2認為ASBR-PE 1是自己的CE)。
[ASBR-PE2] ip vpn-instance vpn1
[ASBR-PE2-vpn-vpn-vpn1] route-distinguisher 200:1
[ASBR-PE2-vpn-vpn-vpn1] vpn-target 100:1 both
[ASBR-PE2-vpn-vpn-vpn1] quit
[ASBR-PE2] interface vlan-interface 12
[ASBR-PE2-Vlan-interface12] ip binding vpn-instance vpn1
[ASBR-PE2-Vlan-interface12] ipv6 address 2002:1::2 64
[ASBR-PE2-Vlan-interface12] quit
上述配置完成後,在各PE設備上執行display ip vpn-instance命令能正確顯示VPN實例配置。
各PE能ping通CE。ASBR-PE之間也能互相ping通。
(4) 在PE與CE之間建立EBGP對等體,引入VPN路由
# 配置CE 1。
[CE1] bgp 65001
[CE1-bgp] ipv6-family
[CE1-bgp-af-ipv6] peer 2001:1::2 as-number 100
[CE1-bgp-af-ipv6] import-route direct
[CE1-bgp-af-ipv6] quit
# 配置PE 1。
[PE1] bgp 100
[PE1-bgp] ipv6-family vpn-instance vpn1
[PE1-bgp-ipv6-vpn1] peer 2001:1::1 as-number 65001
[PE1-bgp-ipv6-vpn1] import-route direct
[PE1-bgp-ipv6-vpn1] quit
[PE1-bgp] quit
# 配置CE 2。
[CE2] bgp 65002
[CE1-bgp] ipv6-family
[CE2-bgp-af-ipv6] peer 2001:2::2 as-number 200
[CE2-bgp-af-ipv6] import-route direct
[CE2-bgp-af-ipv6] quit
# 配置PE 2。
[PE2] bgp 200
[PE2-bgp] ipv6-family vpn-instance vpn1
[PE2-bgp-ipv6-vpn1] peer 2001:2::1 as-number 65002
[PE2-bgp-ipv6-vpn1] import-route direct
[PE2-bgp-ipv6-vpn1] quit
[PE2-bgp] quit
(5) PE與本AS的ASBR-PE之間建立IBGP對等體,ASBR-PE之間建立EBGP對等體
# 配置PE 1。
[PE1] bgp 100
[PE1-bgp] peer 2.2.2.9 as-number 100
[PE1-bgp] peer 2.2.2.9 connect-interface loopback 0
[PE1-bgp] ipv6-family vpnv6
[PE1-bgp-af-vpnv6] peer 2.2.2.9 enable
[PE1-bgp-af-vpnv6] quit
[PE1-bgp] quit
# 配置ASBR-PE 1。
[ASBR-PE1] bgp 100
[ASBR-PE1-bgp] ipv6-family vpn-instance vpn1
[ASBR-PE1-bgp-ipv6-vpn1] peer 2002:1::2 as-number 200
[ASBR-PE1-bgp-ipv6-vpn1] quit
[ASBR-PE1-bgp] peer 1.1.1.9 as-number 100
[ASBR-PE1-bgp] peer 1.1.1.9 connect-interface loopback 0
[ASBR-PE1-bgp] ipv6-family vpnv6
[ASBR-PE1-bgp-af-vpnv6] peer 1.1.1.9 enable
[ASBR-PE1-bgp-af-vpnv6] quit
[ASBR-PE1-bgp] quit
# 配置ASBR-PE 2。
[ASBR-PE2] bgp 200
[ASBR-PE2-bgp] ipv6-family vpn-instance vpn1
[ASBR-PE2-bgp-ipv6-vpn1] peer 2002:1::1 as-number 100
[ASBR-PE2-bgp-ipv6-vpn1] quit
[ASBR-PE2-bgp] peer 4.4.4.9 as-number 200
[ASBR-PE2-bgp] peer 4.4.4.9 connect-interface loopback 0
[ASBR-PE2-bgp] ipv6-family vpnv6
[ASBR-PE2-bgp-af-vpnv6] peer 4.4.4.9 enable
[ASBR-PE2-bgp-af-vpnv6] quit
[ASBR-PE2-bgp] quit
# 配置PE 2。
[PE2] bgp 200
[PE2-bgp] peer 3.3.3.9 as-number 200
[PE2-bgp] peer 3.3.3.9 connect-interface loopback 0
[PE2-bgp] ipv6-family vpnv6
[PE2-bgp-af-vpnv6] peer 3.3.3.9 enable
[PE2-bgp-af-vpnv6] quit
[PE2-bgp] quit
(6) 配置完成後的檢驗
上述配置完成後,CE之間能學習到對方的接口路由,CE 1和CE 2能夠相互ping通。
l Site 1和Site 2屬於同一個VPN,Site 1通過AS 100的PE 1接入,Site 2通過AS 600的PE 2接入;
l 同一自治係統內的PE設備之間運行IS-IS作為IGP;
l PE 1與ASBR-PE 1間通過MP-IBGP交換帶標簽的IPv4路由;
l PE 2與ASBR-PE 2間通過MP-IBGP交換帶標簽的IPv4路由;
l PE 1與PE 2建立MP-EBGP對等體;
l ASBR-PE 1和ASBR-PE 2上分別配置路由策略,對從對方接收的路由壓入標簽;
l ASBR-PE 1與ASBR-PE 2間通過MP-EBGP交換帶標簽的IPv4路由。
圖2-5 IPv6跨域VPN-OptionC方式組網圖

|
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
PE 1 |
Loop0 |
2.2.2.9/32 |
PE 2 |
Loop0 |
5.5.5.9/32 |
|
|
Loop1 |
2001:1::1/128 |
|
Loop1 |
2001:1::2/128 |
|
|
Vlan-int11 |
1.1.1.2/8 |
|
Vlan-int11 |
9.1.1.2/8 |
|
ASBR-PE 1 |
Loop0 |
3.3.3.9/32 |
ASBR-PE 2 |
Loop0 |
4.4.4.9/32 |
|
|
Vlan-int11 |
1.1.1.1/8 |
|
Vlan-int11 |
9.1.1.1/8 |
|
|
Vlan-int12 |
11.0.0.2/8 |
|
Vlan-int12 |
11.0.0.1/8 |
(1) 配置PE 1
# 在PE 1上運行IS-IS。
<PE1> system-view
[PE1] isis 1
[PE1-isis-1] network-entity 10.111.111.111.111.00
[PE1-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[PE1] mpls lsr-id 2.2.2.9
[PE1] mpls
[PE1-mpls] label advertise non-null
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並使能MPLS和LDP。
[PE1] interface vlan-interface 11
[PE1-Vlan-interface11] ip address 1.1.1.2 255.0.0.0
[PE1-Vlan-interface11] isis enable 1
[PE1-Vlan-interface11] mpls
[PE1-Vlan-interface11] mpls ldp
[PE1-Vlan-interface11] quit
# 創建Loopback0接口,在接口上運行IS-IS。
[PE1] interface loopback 0
[PE1-LoopBack0] ip address 2.2.2.9 32
[PE1-LoopBack0] isis enable 1
[PE1-LoopBack0] quit
# 創建VPN實例,名稱為vpn1,為其配置RD和VPN Target屬性。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 11:11
[PE1-vpn-instance-vpn1] vpn-target 3:3 import-extcommunity
[PE1-vpn-instance-vpn1] vpn-target 3:3 export-extcommunity
[PE1-vpn-instance-vpn1] quit
# 創建Loopback1接口,並將此接口綁定到vpn1。
[PE1] interface loopback 1
[PE1-LoopBack1] ip binding vpn-instance vpn1
[PE1-LoopBack1] ipv6 address 2001:1::1 128
[PE1-LoopBack1] quit
# 在PE 1上運行BGP。
[PE1] bgp 100
# 配置PE 1向IBGP對等體3.3.3.9發布標簽路由及從3.3.3.9接收標簽路由的能力。
[PE1-bgp] peer 3.3.3.9 as-number 100
[PE1-bgp] peer 3.3.3.9 connect-interface loopback 0
[PE1-bgp] peer 3.3.3.9 label-route-capability
# 配置PE 1到EBGP對等體5.5.5.9的最大跳數為10。
[PE1-bgp] peer 5.5.5.9 as-number 600
[PE1-bgp] peer 5.5.5.9 connect-interface loopback 0
[PE1-bgp] peer 5.5.5.9 ebgp-max-hop 10
# 配置對等體5.5.5.9作為VPNv6對等體。
[PE1-bgp] ipv6-family vpnv6
[PE1-bgp-af-vpnv6] peer 5.5.5.9 enable
[PE1-bgp-af-vpnv6] quit
# 將直連路由引入vpn1的路由表。
[PE1-bgp] ipv6-family vpn-instance vpn1
[PE1-bgp-ipv6-vpn1] import-route direct
[PE1-bgp-ipv6-vpn1] quit
[PE1-bgp] quit
(2) 配置ASBR-PE1
# 在ASBR-PE 1上運行IS-IS。
<ASBR-PE1> system-view
[ASBR-PE1] isis 1
[ASBR-PE1-isis-1] network-entity 10.222.222.222.222.00
[ASBR-PE1-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[ASBR-PE1] mpls lsr-id 3.3.3.9
[ASBR-PE1] mpls
[ASBR-PE1-mpls] label advertise non-null
[ASBR-PE1-mpls] quit
[ASBR-PE1] mpls ldp
[ASBR-PE1-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並使能MPLS和LDP。
[ASBR-PE1] interface vlan-interface 11
[ASBR-PE1-Vlan-interface11] ip address 1.1.1.1 255.0.0.0
[ASBR-PE1-Vlan-interface11] isis enable 1
[ASBR-PE1-Vlan-interface11] mpls
[ASBR-PE1-Vlan-interface11] mpls ldp
[ASBR-PE1-Vlan-interface11] quit
# 配置接口Vlan-interface12,並在接口上使能MPLS。
[ASBR-PE1] interface vlan-interface 12
[ASBR-PE1-Vlan-interface12] ip address 11.0.0.2 255.0.0.0
[ASBR-PE1-Vlan-interface12] mpls
[ASBR-PE1-Vlan-interface12] quit
# 創建Loopback0接口,在接口上運行IS-IS。
[ASBR-PE1] interface loopback 0
[ASBR-PE1-LoopBack0] ip address 3.3.3.9 32
[ASBR-PE1-LoopBack0] isis enable 1
[ASBR-PE1-LoopBack0] quit
# 創建路由策略。
[ASBR-PE1] route-policy policy1 permit node 1
[ASBR-PE1-route-policy1] apply mpls-label
[ASBR-PE1-route-policy1] quit
[ASBR-PE1] route-policy policy2 permit node 1
[ASBR-PE1-route-policy2] if-match mpls-label
[ASBR-PE1-route-policy2] apply mpls-label
[ASBR-PE1-route-policy2] quit
# 在ASBR-PE 1上運行BGP,引入IS-IS進程1的路由。
[ASBR-PE1] bgp 100
[ASBR-PE1-bgp] import-route isis 1
# 對向IBGP對等體2.2.2.9發布的路由應用已配置的路由策略policy2。
[ASBR-PE1-bgp] peer 2.2.2.9 as-number 100
[ASBR-PE1-bgp] peer 2.2.2.9 route-policy policy2 export
# 向IBGP對等體2.2.2.9發布標簽路由及從2.2.2.9接收標簽路由的能力。
[ASBR-PE1-bgp] peer 2.2.2.9 connect-interface loopback 0
[ASBR-PE1-bgp] peer 2.2.2.9 label-route-capability
# 對向EBGP對等體11.0.0.1發布的路由應用已配置的路由策略policy1。
[ASBR-PE1-bgp] peer 11.0.0.1 as-number 600
[ASBR-PE1-bgp] peer 11.0.0.1 route-policy policy1 export
# 向EBGP對等體11.0.0.1發布標簽路由及從11.0.0.1接收標簽路由的能力。
[ASBR-PE1-bgp] peer 11.0.0.1 label-route-capability
[ASBR-PE1-bgp] quit
(3) 配置ASBR-PE 2
# 在ASBR-PE 2上運行IS-IS。
<ASBR-PE2> system-view
[ASBR-PE2] isis 1
[ASBR-PE2-isis-1] network-entity 10.222.222.222.222.00
[ASBR-PE2-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[ASBR-PE2] mpls lsr-id 4.4.4.9
[ASBR-PE2] mpls
[ASBR-PE2-mpls] label advertise non-null
[ASBR-PE2-mpls] quit
[ASBR-PE2] mpls ldp
[ASBR-PE2-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並在接口上使能MPLS和LDP。
[ASBR-PE2] interface vlan-interface 11
[ASBR-PE2-Vlan-interface11] ip address 9.1.1.1 255.0.0.0
[ASBR-PE2-Vlan-interface11] isis enable 1
[ASBR-PE2-Vlan-interface11] mpls
[ASBR-PE2-Vlan-interface11] mpls ldp
[ASBR-PE2-Vlan-interface11] quit
# 創建Loopback0接口,在接口上運行IS-IS。
[ASBR-PE2] interface loopback 0
[ASBR-PE2-LoopBack0] ip address 4.4.4.9 32
[ASBR-PE2-LoopBack0] isis enable 1
[ASBR-PE2-LoopBack0] quit
# 配置接口Vlan-interface12,在接口上使能MPLS。
[ASBR-PE2] interface vlan-interface 12
[ASBR-PE2-Vlan-interface12] ip address 11.0.0.1 255.0.0.0
[ASBR-PE2-Vlan-interface12] mpls
[ASBR-PE2-Vlan-interface12] quit
# 創建路由策略。
[ASBR-PE2] route-policy policy1 permit node 1
[ASBR-PE2-route-policy1] apply mpls-label
[ASBR-PE2-route-policy1] quit
[ASBR-PE2] route-policy policy2 permit node 1
[ASBR-PE2-route-policy2] if-match mpls-label
[ASBR-PE2-route-policy2] apply mpls-label
[ASBR-PE2-route-policy2] quit
# 在ASBR-PE 2上運行BGP,引入IS-IS進程1的路由。
[ASBR-PE2] bgp 600
[ASBR-PE2-bgp] import-route isis 1
# 向IBGP對等體5.5.5.9發布標簽路由及從5.5.5.9接收標簽路由的能力。
[ASBR-PE2-bgp] peer 5.5.5.9 as-number 600
[ASBR-PE2-bgp] peer 5.5.5.9 connect-interface loopback 0
[ASBR-PE2-bgp] peer 5.5.5.9 label-route-capability
# 對向IBGP對等體5.5.5.9發布的路由應用已配置的路由策略policy2。
[ASBR-PE2-bgp] peer 5.5.5.9 route-policy policy2 export
# 對向EBGP對等體11.0.0.2發布的路由應用已配置的路由策略policy1。
[ASBR-PE2-bgp] peer 11.0.0.2 as-number 100
[ASBR-PE2-bgp] peer 11.0.0.2 route-policy policy1 export
# 向EBGP對等體11.0.0.2發布標簽路由及從11.0.0.2接收標簽路由的能力。
[ASBR-PE2-bgp] peer 11.0.0.2 label-route-capability
[ASBR-PE2-bgp] quit
(4) 配置PE 2
# 在PE 2上運行IS-IS。
<PE2> system-view
[PE2] isis 1
[PE2-isis-1] network-entity 10.111.111.111.111.00
[PE2-isis-1] quit
# 配置LSR ID,使能MPLS和LDP。
[PE2] mpls lsr-id 5.5.5.9
[PE2] mpls
[PE2-mpls] label advertise non-null
[PE2-mpls] quit
[PE2] mpls ldp
[PE2-mpls-ldp] quit
# 配置接口Vlan-interface11,在接口上運行IS-IS,並使能MPLS和LDP。
[PE2] interface vlan-interface 11
[PE2-Vlan-interface11] ip address 9.1.1.2 255.0.0.0
[PE2-Vlan-interface11] isis enable 1
[PE2-Vlan-interface11] mpls
[PE2-Vlan-interface11] mpls ldp
[PE2-Vlan-interface11] quit
# 創建Loopback0接口,在接口上運行IS-IS。
[PE2] interface loopback 0
[PE2-LoopBack0] ip address 5.5.5.9 32
[PE2-LoopBack0] isis enable 1
[PE2-LoopBack0] quit
# 創建VPN實例,名稱為vpn1,為其配置RD和VPN Target屬性。
[PE2] ip vpn-instance vpn1
[PE2-vpn-instance-vpn1] route-distinguisher 11:11
[PE2-vpn-instance-vpn1] vpn-target 3:3 import-extcommunity
[PE2-vpn-instance-vpn1] vpn-target 3:3 export-extcommunity
[PE2-vpn-instance-vpn1] quit
# 創建Loopback1接口,並將此接口綁定到vpn1。
[PE2] interface loopback 1
[PE2-LoopBack1] ip binding vpn-instance vpn1
[PE2-LoopBack1] ipv6 address 2001:1::2 128
[PE2-LoopBack1] quit
# 在PE 2上運行BGP。
[PE2] bgp 600
# 配置PE 2向IBGP對等體4.4.4.9發布標簽路由及從4.4.4.9接收標簽路由的能力。
[PE2-bgp] peer 4.4.4.9 as-number 600
[PE2-bgp] peer 4.4.4.9 connect-interface loopback 0
[PE2-bgp] peer 4.4.4.9 label-route-capability
# 配置PE 2到EBGP對等體2.2.2.9的最大跳數為10。
[PE2-bgp] peer 2.2.2.9 as-number 100
[PE2-bgp] peer 2.2.2.9 connect-interface loopback 0
[PE2-bgp] peer 2.2.2.9 ebgp-max-hop 10
# 配置對等體2.2.2.9作為VPNv6對等體。
[PE2-bgp] ipv6-family vpnv6
[PE2-bgp-af-vpnv6] peer 2.2.2.9 enable
[PE2-bgp-af-vpnv6] quit
# 將直連路由引入vpn1的路由表。
[PE2-bgp] ipv6-family vpn-instance vpn1
[PE2-bgp-ipv6-vpn1] import-route direct
[PE2-bgp-ipv6-vpn1] quit
[PE2-bgp] quit
配置完成後,在PE2上對PE1進行Ping操作,可以Ping通:
[PE2] ping ipv6 –vpn-instance vpn1 2001:1::1
PING 2001:1::1 : 56 data bytes, press CTRL_C to break
Reply from 2001:1::1
bytes=56 Sequence=1 hop limit=64 time = 1 ms
Reply from 2001:1::1
bytes=56 Sequence=2 hop limit=64 time = 1 ms
Reply from 2001:1::1
bytes=56 Sequence=3 hop limit=64 time = 1 ms
Reply from 2001:1::1
bytes=56 Sequence=4 hop limit=64 time = 1 ms
Reply from 2001:1::1
bytes=56 Sequence=5 hop limit=64 time = 1 ms
--- 2001:1::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/1/1 ms
在PE1上對PE2進行Ping操作,也可以Ping通:
[PE1] ping ipv6 –vpn-instance vpn1 2001:1::2
PING 2001:1::2 : 56 data bytes, press CTRL_C to break
Reply from 2001:1::2
bytes=56 Sequence=1 hop limit=64 time = 1 ms
Reply from 2001:1::2
bytes=56 Sequence=2 hop limit=64 time = 1 ms
Reply from 2001:1::2
bytes=56 Sequence=3 hop limit=64 time = 1 ms
Reply from 2001:1::2
bytes=56 Sequence=4 hop limit=64 time = 1 ms
Reply from 2001:1::2
bytes=56 Sequence=5 hop limit=64 time = 1 ms
--- 2001:1::2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/1/1 ms
在圖2-6中:
l PE 1和PE 2是一級運營商骨幹網的PE設備,為二級運營商提供VPN服務;
l CE 1和CE 2是同一個二級運營商的設備,作為CE接入一級運營商的骨幹網;
l PE 3和PE 4是二級運營商的PE設備,為二級運營商的客戶提供IPv6 MPLS L3VPN服務;
l CE 3和CE 4是二級運營商的客戶。
配置運營商的運營商關鍵在於配置兩類路由的交換:
l 二級運營商VPN內部路由在一級運營商骨幹網上的交換:一級運營商將二級運營商作為自己的CE接入;
l 二級運營商本身客戶的VPN路由在二級運營商PE設備間的交換:需要在二級運營商PE設備(PE 3和PE 4)間建立MP-IBGP對等體關係。
圖2-6 配置Carriers’ carriers配置組網圖

|
設備 |
接口 |
IP地址 |
設備 |
接口 |
IP地址 |
|
CE 3 |
Vlan-int11 |
2001:1::1/64 |
CE 4 |
Vlan-int11 |
2001:2::1/64 |
|
PE 3 |
Loop0 |
1.1.1.9/32 |
PE 4 |
Loop0 |
6.6.6.9/32 |
|
|
Vlan-int11 |
2001:1::2/64 |
|
Vlan-int11 |
2001:2::2/64 |
|
|
Vlan-int12 |
10.1.1.1/24 |
|
Vlan-int12 |
20.1.1.2/24 |
|
CE 1 |
Loop0 |
2.2.2.9/32 |
CE 2 |
Loop0 |
5.5.5.9/32 |
|
|
Vlan-int12 |
10.1.1.2/24 |
|
Vlan-int11 |
21.1.1.2/24 |
|
|
Vlan-int11 |
11.1.1.1/24 |
|
Vlan-int12 |
20.1.1.1/24 |
|
PE 1 |
Loop0 |
3.3.3.9/32 |
PE 2 |
Loop0 |
4.4.4.9/32 |
|
|
Vlan-int11 |
11.1.1.2/24 |
|
Vlan-int12 |
30.1.1.2/24 |
|
|
Vlan-int12 |
30.1.1.1/24 |
|
Vlan-int11 |
21.1.1.1/24 |
(1) 配置一級運營商骨幹網的MPLS L3VPN,使用IS-IS作為骨幹網的IGP協議,PE 1和PE 2之間使能LDP,並建立MP-IBGP對等體關係
# 配置PE 1。
<PE1> system-view
[PE1] interface loopback 0
[PE1-LoopBack0] ip address 3.3.3.9 32
[PE1-LoopBack0] quit
[PE1] mpls lsr-id 3.3.3.9
[PE1] mpls
[PE1-mpls] quit
[PE1] mpls ldp
[PE1-mpls-ldp] quit
[PE1] isis 1
[PE1-isis-1] network-entity 10.0000.0000.0000.0004.00
[PE1-isis-1] quit
[PE1] interface loopback 0
[PE1-LoopBack0] isis enable 1
[PE1-LoopBack0] quit
[PE1] interface vlan-interface 12
[PE1-Vlan-interface12] ip address 30.1.1.1 24
[PE1-Vlan-interface12] isis enable 1
[PE1-Vlan-interface12] mpls
[PE1-Vlan-interface12] mpls ldp
[PE1-Vlan-interface12] mpls ldp transport-address interface
[PE1-Vlan-interface12] quit
[PE1] bgp 100
[PE1-bgp] peer 4.4.4.9 as-number 100
[PE1-bgp] peer 4.4.4.9 connect-interface loopback 0
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp-af-vpnv4] peer 4.4.4.9 enable
[PE1-bgp-af-vpnv4] quit
[PE1-bgp] quit
![]()
PE 2的配置與PE 1類似,配置過程省略。
配置完成後,在PE 1或PE 2上執行display mpls ldp session命令可以看到LDP會話建立成功;執行display bgp peer命令可以看到BGP對等體關係已建立,並達到Established狀態;執行display isis peer命令可以看到IS-IS鄰居關係已建立,狀態為up。
以PE 1為例:
[PE1] display mpls ldp session
LDP Session(s) in Public Network
Total number of sessions: 1
----------------------------------------------------------------
Peer-ID Status LAM SsnRole FT MD5 KA-Sent/Rcv
----------------------------------------------------------------
4.4.4.9:0 Operational DU Active Off Off 378/378
----------------------------------------------------------------
LAM : Label Advertisement Mode FT : Fault Tolerance
[PE1] display bgp peer
BGP local router ID : 3.3.3.9
Local AS number : 100
Total number of peers : 1 Peers in established state : 1
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
4.4.4.9 100 162 145 0 0 02:12:47 Established
[PE1] display isis peer
Peer information for ISIS(1)
----------------------------
System Id Interface Circuit Id State HoldTime Type PRI
0000.0000.0005 Vlan-interface12 001 Up 29s L1L2 --
(2) 配置二級運營商網絡:使用IS-IS作為IGP協議,PE 3和CE 1、PE 4和CE 2之間分別使能LDP
# 配置PE 3。
<PE3> system-view
[PE3] interface loopback 0
[PE3-LoopBack0] ip address 1.1.1.9 32
[PE3-LoopBack0] quit
[PE3] mpls lsr-id 1.1.1.9
[PE3] mpls
[PE3-mpls] quit
[PE3] mpls ldp
[PE3-mpls-ldp] quit
[PE3] isis 2
[PE3-isis-2] network-entity 10.0000.0000.0000.0001.00
[PE3-isis-2] quit
[PE3] interface loopback 0
[PE3-LoopBack0] isis enable 2
[PE3-LoopBack0] quit
[PE3] interface vlan-interface 12
[PE3-Vlan-interface12] ip address 10.1.1.1 24
[PE3-Vlan-interface12] isis enable 2
[PE3-Vlan-interface12] mpls
[PE3-Vlan-interface12] mpls ldp
[PE3-Vlan-interface12] mpls ldp transport-address interface
[PE3-Vlan-interface12] quit
# 配置CE 1。
<CE1> system-view
[CE1] interface loopback 0
[CE1-LoopBack0] ip address 2.2.2.9 32
[CE1-LoopBack0] quit
[CE1] mpls lsr-id 2.2.2.9
[CE1] mpls
[CE1-mpls] quit
[CE1] mpls ldp
[CE1-mpls-ldp] quit
[CE1] isis 2
[CE1-isis-2] network-entity 10.0000.0000.0000.0002.00
[CE1-isis-2] quit
[CE1] interface loopback 0
[CE1-LoopBack0] isis enable 2
[CE1-LoopBack0] quit
[CE1] interface vlan-interface 12
[CE1-Vlan-interface12] ip address 10.1.1.2 24
[CE1-Vlan-interface12] isis enable 2
[CE1-Vlan-interface12] mpls
[CE1-Vlan-interface12] mpls ldp
[CE1-Vlan-interface12] mpls ldp transport-address interface
[CE1-Vlan-interface12] quit
配置完成後,PE 3和CE 1之間應能建立LDP和IS-IS鄰居關係。
![]()
PE 4和CE 2之間的配置與PE 3和CE 1之間的配置類似,配置過程省略。
(3) 配置二級運營商CE接入到一級運營商的PE
# 配置PE 1。
[PE1] ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] route-distinguisher 200:1
[PE1-vpn-instance-vpn1] vpn-target 1:1
[PE1-vpn-instance-vpn1] quit
[PE1] mpls ldp vpn-instance vpn1
[PE1-mpls-ldp-vpn-instance-vpn1] quit
[PE1] isis 2 vpn-instance vpn1
[PE1-isis-2] network-entity 10.0000.0000.0000.0003.00
[PE1-isis-2] import-route bgp allow-ibgp
[PE1-isis-2] quit
[PE1] interface vlan-interface11
[PE1-Vlan-interface11] ip binding vpn-instance vpn1
[PE1-Vlan-interface11] ip address 11.1.1.2 24
[PE1-Vlan-interface11] isis enable 2
[PE1-Vlan-interface11] mpls
[PE1-Vlan-interface11] mpls ldp
[PE1-Vlan-interface11] mpls ldp transport-address interface
[PE1-Vlan-interface11] quit
[PE1] bgp 100
[PE1-bgp] ipv4-family vpn-instance vpn1
[PE1-bgp-vpn1] import isis 2
[PE1-bgp-vpn1] quit
[PE1-bgp] quit
# 配置CE 1。
[CE1] interface vlan-interface11
[CE1-Vlan-interface11] ip address 11.1.1.1 24
[CE1-Vlan-interface11] isis enable 2
[CE1-Vlan-interface11] mpls
[CE1-Vlan-interface11] mpls ldp
[CE1-Vlan-interface11] mpls ldp transport-address interface
[CE1-Vlan-interface11] quit
配置完成後,PE 1和CE 1之間應能建立LDP和IS-IS鄰居關係。
![]()
PE 2和CE 2之間的配置與PE 1和CE 1之間的配置類似,配置過程省略。
(4) 配置二級運營商的客戶接入PE
# 配置CE 3。
<CE3> system-view
[CE3] interface vlan-interface11
[CE3-Vlan-interface11] ipv6 address 2001:1::1 64
[CE3-Vlan-interface11] quit
[CE3] bgp 65410
[CE3-bgp] ipv6-family
[CE3-bgp-af-ipv6] peer 2001:1::2 as-number 100
[CE3-bgp-af-ipv6] import-route direct
[CE3-bgp-af-ipv6] quit
# 配置PE 3。
[PE3] ip vpn-instance vpn1
[PE3-vpn-instance-vpn1] route-distinguisher 100:1
[PE3-vpn-instance-vpn1] vpn-target 1:1
[PE3-vpn-instance-vpn1] quit
[PE3] interface Vlan-interface11
[PE3-Vlan-interface11] ip binding vpn-instance vpn1
[PE3-Vlan-interface11] ipv6 address 2001:1::2 64
[PE3-Vlan-interface11] quit
[PE3] bgp 100
[PE3-bgp] ipv6-family vpn-instance vpn1
[PE3-bgp-ipv6-vpn1] peer 2001:1::1 as-number 65410
[PE3-bgp-ipv6-vpn1] import-route direct
[PE3-bgp-ipv6-vpn1] quit
[PE3-bgp] quit
![]()
PE 4和CE 4之間的配置與PE 3和CE 3之間的配置類似,配置過程省略。
(5) 在二級運營商的PE之間建立MP-IBGP對等體關係,交換二級運營商的客戶的VPN路由
# 配置PE 3。
[PE3] bgp 100
[PE3-bgp] peer 6.6.6.9 as-number 100
[PE3-bgp] peer 6.6.6.9 connect-interface loopback 0
[PE3-bgp] ipv6-family vpnv6
[PE3-bgp-af-vpnv6] peer 6.6.6.9 enable
[PE3-bgp-af-vpnv6] quit
[PE3-bgp] quit
![]()
PE 4的配置與PE 3類似,配置過程省略。
(6) 配置完成後的檢驗
所有配置完成後,在PE 1和PE 2上執行display ip routing-table命令,可以看到PE 1和PE 2的公網路由表中隻有一級運營商網絡的路由。以PE 1為例:
[PE1] display ip routing-table
Routing Tables: Public
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost NextHop Interface
3.3.3.9/32 Direct 0 0 127.0.0.1 InLoop0
4.4.4.9/32 ISIS 15 10 30.1.1.2 Vlan12
30.1.1.0/24 Direct 0 0 30.1.1.1 Vlan12
30.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
30.1.1.2/32 Direct 0 0 30.1.1.2 Vlan12
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在PE 1和PE 2上執行display ip routing-table vpn-instance命令,可以看到VPN路由表中有二級運營商網絡的內部路由。執行display ipv6 routing-table vpn-instance命令,可以看到沒有二級運營商維護的VPN路由。以PE 1為例:
[PE1] display ip routing-table vpn-instance vpn1
Routing Tables: vpn1
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 ISIS 15 20 11.1.1.1 Vlan11
2.2.2.9/32 ISIS 15 10 11.1.1.1 Vlan11
5.5.5.9/32 BGP 255 0 4.4.4.9 NULL0
6.6.6.9/32 BGP 255 0 4.4.4.9 NULL0
10.1.1.0/24 ISIS 15 20 11.1.1.1 Vlan11
11.1.1.0/24 Direct 0 0 11.1.1.1 Vlan11
11.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
11.1.1.2/32 Direct 0 0 11.1.1.2 Vlan11
20.1.1.0/24 BGP 255 0 4.4.4.9 NULL0
21.1.1.0/24 BGP 255 0 4.4.4.9 NULL0
21.1.1.2/32 BGP 255 0 4.4.4.9 NULL0
在CE 1和CE 2上執行display ip routing-table命令,可以看到公網路由表中有二級運營商網絡的內部路由。執行display ipv6 routing-table vpn-instance命令可以看到沒有二級運營商維護的VPN路由。以CE 1為例:
[CE1] display ip routing-table
Routing Tables: Public
Destinations : 16 Routes : 16
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 ISIS 15 10 10.1.1.2 Vlan12
2.2.2.9/32 Direct 0 0 127.0.0.1 InLoop0
5.5.5.9/32 ISIS 15 74 11.1.1.2 Vlan11
6.6.6.9/32 ISIS 15 74 11.1.1.2 Vlan11
10.1.1.0/24 Direct 0 0 10.1.1.2 Vlan12
10.1.1.1/32 Direct 0 0 10.1.1.1 Vlan12
10.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
11.1.1.0/24 Direct 0 0 11.1.1.1 Vlan11
11.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
11.1.1.2/32 Direct 0 0 11.1.1.2 Vlan11
20.1.1.0/24 ISIS 15 74 11.1.1.2 Vlan11
21.1.1.0/24 ISIS 15 74 11.1.1.2 Vlan11
21.1.1.2/32 ISIS 15 74 11.1.1.2 Vlan11
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在PE 3和PE 4上執行display ip routing-table命令,可以看到公網路由表中有二級運營商網絡的內部路由。以PE 3為例:
[PE3] display ip routing-table
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.9/32 Direct 0 0 127.0.0.1 InLoop0
2.2.2.9/32 ISIS 15 10 10.1.1.2 Vlan12
5.5.5.9/32 ISIS 15 84 10.1.1.2 Vlan12
6.6.6.9/32 ISIS 15 84 10.1.1.2 Vlan12
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan12
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.1.2/32 Direct 0 0 10.1.1.2 Vlan12
11.1.1.0/24 ISIS 15 20 10.1.1.2 Vlan12
20.1.1.0/24 ISIS 15 84 10.1.1.2 Vlan12
21.1.1.0/24 ISIS 15 84 10.1.1.2 Vlan12
21.1.1.2/32 ISIS 15 84 10.1.1.2 Vlan12
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
PE 3和PE 4可以相互Ping通:
[PE3] ping 20.1.1.2
PING 20.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 20.1.1.2: bytes=56 Sequence=1 ttl=252 time=127 ms
Reply from 20.1.1.2: bytes=56 Sequence=2 ttl=252 time=97 ms
Reply from 20.1.1.2: bytes=56 Sequence=3 ttl=252 time=83 ms
Reply from 20.1.1.2: bytes=56 Sequence=4 ttl=252 time=70 ms
Reply from 20.1.1.2: bytes=56 Sequence=5 ttl=252 time=60 ms
--- 20.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 60/87/127 ms
CE 3和CE 4可以互相Ping通。
[CE3] ping ipv6 2001:2::1
PING 2001:2::1 : 56 data bytes, press CTRL_C to break
Reply from 2001:2::1
bytes=56 Sequence=1 hop limit=64 time = 1 ms
Reply from 2001:2::1
bytes=56 Sequence=2 hop limit=64 time = 1 ms
Reply from 2001:2::1
bytes=56 Sequence=3 hop limit=64 time = 1 ms
Reply from 2001:2::1
bytes=56 Sequence=4 hop limit=64 time = 1 ms
Reply from 2001:2::1
bytes=56 Sequence=5 hop limit=64 time = 1 ms
--- 2001:2::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/1/1 ms
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!
