目錄
一、組網需求
二、拓撲圖
三、配置思路
四、配置步驟
一、組網需求
某銀行希望通過 MPLS VPN 實作總行和各分行的安全互訪,同時要求分行的 VPN 流量必須通過總行轉發,以實作對流量的監控。此時通過Hub_Spoke組網架構即可實作該需求。Spoke-CE 連接配接分支機構,Hub-CE 連接配接公司總部,實作Spoke-CE 之間的流量經過 Hub-CE 轉發。
二、拓撲圖
三、配置思路
1. 骨幹網上配置 IGP 協定,實作骨幹網 Hub-PE 和 Spoke-PE 的互通。
2. 骨幹網上配置 MPLS 基本能力和 MPLS LDP,建立 LDP LSP 公網隧道。
3. Hub-PE 與 Spoke-PE 間建立 MP-IBGP 對等體關系;Spoke-PE 之間不建立 MP-IBGP 對等體關系,不交換 VPN 路由資訊。
4. Hub-PE上建立兩個VPN執行個體,一個用于接收Spoke-PE發來的路由,其Import Target為200:1;另一個用于向 Spoke-PE 釋出路由,其 VPN 執行個體的 Export Target 為 100:1。
5. Spoke-PE 上建立一個 VPN 執行個體,其 Export Target 為 200:1,Import Target 為 100:1。
6. CE 和 PE 之間使用 EBGP 交換 VPN 路由資訊。Hub-PE 上配置允許接收 AS 重複 1 次的路由,以接收 Hub-CE 釋出的路由。
四、配置步驟
1.在骨幹網上配置 OSPF 協定,實作骨幹網 Hub-PE 和 Spoke-PE 的互通
Hub-PE:
ospf 100 router-id 1.1.1.1
area 0.0.0.0
authentication-mode md5 1 cipher huawei
network 1.1.1.1 0.0.0.0
network 172.16.1.0 0.0.0.255
network 172.31.1.0 0.0.0.255
Spoke-PE1:
ospf 100 router-id 2.2.2.2
area 0.0.0.0
authentication-mode md5 1 cipher huawei
network 2.2.2.2 0.0.0.0
network 172.16.1.0 0.0.0.255
Spoke-PE2:
ospf 100 router-id 3.3.3.3
area 0.0.0.0
authentication-mode md5 1 cipher huawei
network 3.3.3.3 0.0.0.0
network 172.31.1.0 0.0.0.255
配置完成,Hub-PE 和 Spoke-PE 之間建立 OSPF 鄰居關系後,執行 display ospf peer 指令可以看到鄰居狀态為 Full。執行 display ip routing-table 指令可以看到 Hub-PE 和 Spoke-PE 之間學習到對方的 Loopback 路由。
以Hub-PE為例,檢視OSPF鄰居關系:
2.在骨幹網上配置 MPLS 基本能力和 MPLS LDP,建立 LDP LSP
Hub-PE:
mpls lsr-id 1.1.1.1
mpls
label advertise non-null //不支援PHP特性,出節點向倒數第二跳正常配置設定标簽。
mpls ldp
interface GigabitEthernet0/0/0
ip address 172.16.1.1 255.255.255.0
mpls
mpls ldp
interface GigabitEthernet0/0/1
ip address 172.31.1.1 255.255.255.0
mpls
mpls ldp
Spoke-PE1:
mpls lsr-id 2.2.2.2
mpls
label advertise non-null //不支援PHP特性,出節點向倒數第二跳正常配置設定标簽
mpls ldp
interface GigabitEthernet0/0/0
ip address 172.16.1.2 255.255.255.0
mpls
mpls ldp
Spoke-PE2:
mpls lsr-id 3.3.3.3
mpls
label advertise non-null //不支援PHP特性,出節點向倒數第二跳正常配置設定标簽
mpls ldp
interface GigabitEthernet0/0/1
ip address 172.31.1.2 255.255.255.0
mpls
mpls ldp
配置完成後,Hub-PE 和 Spoke-PE 之間應該建立起 LDP 對等體關系,執行 display mpls ldp session 指令可以看到顯示結果中 State 項為“Operational”。執行 display mpls ldp lsp 指令,可以看到 LDP LSP 的建立情況。
以Hub-PE為例,檢視LDP對等體關系:
以Hub-PE為例,檢視LDP LSP建立情況:
Tips:關于mpls視圖下配置PHP特性的小知識
3. 在各 PE 裝置上配置 VPN 執行個體,将 CE 接入 PE
Hub-PE:
ip vpn-instance 1_in
ipv4-family
route-distinguisher 11:22
vpn-target 200:1 import-extcommunity
ip vpn-instance 1_out
ipv4-family
route-distinguisher 22:11
vpn-target 100:1 export-extcommunity
interface GigabitEthernet4/0/0
ip binding vpn-instance 1_in
ip address 10.1.1.2 255.255.255.0
interface GigabitEthernet4/0/1
ip binding vpn-instance 1_out
ip address 10.1.2.2 255.255.255.0
Spoke-PE1:
ip vpn-instance vpn1
ipv4-family
route-distinguisher 11:11
vpn-target 200:1 export-extcommunity
vpn-target 100:1 import-extcommunity
interface GigabitEthernet0/0/1
ip binding vpn-instance vpn1
ip address 172.17.1.1 255.255.255.0
Spoke-PE2:
ip vpn-instance vpn1
ipv4-family
route-distinguisher 22:22
vpn-target 200:1 export-extcommunity
vpn-target 100:1 import-extcommunity
interface GigabitEthernet0/0/2
ip binding vpn-instance vpn1
ip address 172.32.1.1 255.255.255.0
Hub-CE:
interface GigabitEthernet4/0/0
ip address 10.1.1.1 255.255.255.0
interface GigabitEthernet4/0/1
ip address 10.1.2.1 255.255.255.0
Spoke-CE1:
interface GigabitEthernet0/0/1
ip address 172.17.1.2 255.255.255.0
Spoke-CE2:
interface GigabitEthernet0/0/1
ip address 172.32.1.2 255.255.255.0
配置完成後,在 PE 裝置上執行 display ip vpn-instance verbose 指令可以看到 VPN 執行個體的配置情況。各 PE 能用指令 ping -vpn-instance "vpn-name" "ip-address" ping 通自己接入的 CE。
以Hub-PE為例,檢視VPN執行個體:
以Hub-PE為例,ping測接入的CE:
4.在 PE 與 CE 之間建立 EBGP 對等體關系,引入 VPN 路由
Hub-PE:
bgp 100
ipv4-family vpn-instance 1_in
import-route direct
peer 10.1.1.1 as-number 65001
ipv4-family vpn-instance 1_out
import-route direct
peer 10.1.2.1 as-number 65001
peer 10.1.2.1 allow-as-loop
Hub-CE:
bgp 65001
peer 10.1.1.2 as-number 100
peer 10.1.2.2 as-number 100
Spoke-PE1:
bgp 100
ipv4-family vpn-instance vpn1
import-route direct
peer 172.17.1.2 as-number 65002
Spoke-CE1:
bgp 65002
peer 172.17.1.1 as-number 100
Spoke-PE2:
bgp 100
ipv4-family vpn-instance vpn1
import-route direct
peer 172.32.1.2 as-number 65003
Spoke-CE2:
bgp 65003
peer 172.32.1.1 as-number 100
配置完成後,在各 PE 裝置上執行 display bgp vpnv4 all peer 指令,可以看到 PE 與 CE 之間的 BGP 對等體關系已建立,并達到 Established 狀态。
以Hub-PE為例,檢視BGP對等體建立情況:
5.在 Spoke-PE 與 Hub-PE 之間建立 MP-IBGP 對等體關系
Hub-PE:
bgp 100
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack0
ipv4-family vpnv4
policy vpn-target
peer 2.2.2.2 enable
peer 3.3.3.3 enable
Spoke-PE1:
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
ipv4-family vpnv4
policy vpn-target
peer 1.1.1.1 enable
Spoke-PE2:
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
ipv4-family vpnv4
policy vpn-target
peer 1.1.1.1 enable
配置完成後,在各 PE 裝置上執行 display bgp peer 或 display bgp vpnv4 all peer 指令,可以看到 Spoke-PE 與 Hub-PE 之間的 BGP 對等體關系已建立,并達到 Established 狀态。
以Hub-PE為例,檢視BGP對等體建立情況:
6.檢查配置結果
完成上述配置後,Spoke-CE 之間可以互相 Ping 通,使用 Tracert 可以看到 Spoke-CE 之間的流量經過 Hub-CE 轉發,也可以通過 Ping 結果中的 TTL 值推算 Spoke-CE 之間經過的轉發裝置數目。
以Spoke-PE2為源端ping測Spoke-PE1:
以Spoke-PE2為源端跟蹤資料轉發路徑(tracert)Spoke-PE1:
以上就是Hub_Spoke組網的配置實驗,以上内容參考華為官方産品文檔。需要實驗包的小夥伴可以私信我,期待你們的一鍵三連哦!