跨雲平台與物理專線使用Vxlan實現兩地二層互通,並使用ospf與bgp做底層鏈路主備


Vxlan基礎,已掌握可略過

VXLAN網絡架構

VXLAN是NVO3中的一種網絡虛擬化技術,通過將原主機發出的數據包封裝在UDP中,並使用物理網絡的IP、MAC作為外層頭進行封裝,然后在IP網絡上傳輸,到達目的地后由隧道終結點解封裝並將數據發送給目標主機。

通過VXLAN,虛擬網絡可接入大量租戶,且租戶可以規划自己的虛擬網絡,不需要考慮物理網絡IP地址和廣播域的限制,降低了網絡管理的難度,同時滿足虛擬機遷移和多租戶的需求。

類似於傳統的VLAN網絡,VXLAN網絡也有VXLAN網絡內互訪和VXLAN網絡間互訪。

 

VXLAN網絡內互訪

通過VXLAN技術可以實現在已有三層網絡上構建虛擬二層網絡,實現主機之間的二層互通

 

 

VXLAN網絡內互訪中涉及的概念如下:

  • 網絡標識VNI(VXLAN Network Identifier)

    類似於傳統網絡中的VLAN ID,用於區分VXLAN段,不同VXLAN段的租戶不能直接進行二層通信。一個租戶可以有一個或多個VNI,VNI由24比特組成,支持多達16M的租戶。

  • 廣播域BD(Bridge Domain)

    類似傳統網絡中采用VLAN划分廣播域方法,在VXLAN網絡中通過BD划分廣播域。

    在VXLAN網絡中,將VNI以1:1方式映射到廣播域BD,一個BD就表示着一個廣播域,同一個BD內的主機就可以進行二層互通。

  • VXLAN隧道端點VTEP(VXLAN Tunnel Endpoints)

    VTEP可以對VXLAN報文進行封裝和解封裝。

    VXLAN報文中源IP地址為源端VTEP的IP地址,目的IP地址為目的端VTEP的IP地址。一對VTEP地址就對應着一條VXLAN隧道。在源端封裝報文后通過隧道向目的端VTEP發送封裝報文,目的端VTEP對接收到的封裝報文進行解封裝。

  • 虛擬接入點VAP(Virtual Access Point)

    VXLAN業務接入點,可以基於VLAN或報文流封裝類型接入業務:
    • 基於VLAN接入業務:在VTEP上建立VLAN與BD的一對一或多對一的映射。這樣,當VTEP收到業務側報文后,根據VLAN與BD的映射關系,實現報文在BD內進行轉發。
    • 基於報文流封裝類型接入業務:在VTEP連接下行業務的物理接口上創建二層子接口,並配置不同的流封裝類型,使得不同的接口接入不同的數據報文。同時,將二層子接口與BD進行一一映射。這樣業務側報文到達VTEP后,即會進入指定的二層子接口。即根據二層子接口與BD的映射關系,實現報文在BD內進行轉發。
  • 網絡虛擬邊緣NVE(Network Virtualization Edge)

    NVE是實現網絡虛擬化功能的網絡實體。報文經過NVE封裝轉換后,NVE間就可基於三層基礎網絡建立二層虛擬化網絡。

  • 二層網關

    類似傳統網絡的二層接入設備,在VXLAN網絡中通過二層網關解決租戶接入VXLAN虛擬網絡,也可用於同一VXLAN虛擬網絡的子網通信。

VXLAN網絡間互訪(集中式網關)

不同BD之間的主機不能直接進行二層通信,需要通過VXLAN三層網關實現主機間的三層通信。

集中式網關是指將三層網關集中部署在一台設備上,所有跨子網的流量都經過三層網關進行轉發,實現流量的集中管理。

 

 VXLAN網絡間互訪中涉及的概念如下:

  • 三層網關

    類似傳統網絡中不同VLAN的用戶間不能直接進行二層互訪,不同VNI之間的VXLAN及VXLAN和非VXLAN之間也不能直接相互通信。為了使VXLAN之間,以及VXLAN和非VXLAN之間能夠進行通信,引入了VXLAN三層網關的概念。

    三層網關用於VXLAN虛擬網絡的跨子網通信以及外部網絡的訪問。

  • VBDIF接口

    類似於傳統網絡中采用VLANIF解決不同廣播域互通的方法,在VXLAN中引入了VBDIF的概念。

    VBDIF接口在VXLAN三層網關上配置,是基於BD創建的三層邏輯接口。通過VBDIF接口配置IP地址可實現不同網段的VXLAN間,及VXLAN和非VXLAN的通信,也可實現二層網絡接入三層網絡。

VXLAN網絡間互訪(分布式網關)

分布式網關是指將VXLAN二層網關和三層網關部署在同一台設備上,VTEP設備既作為VXLAN網絡中的二層網關設備,與主機對接,用於解決終端租戶接入VXLAN虛擬網絡的問題。同時也作為VXLAN網絡中的三層網關設備,實現跨子網的終端租戶通信,以及外部網絡的訪問。僅BGP EVPN方式部署VXLAN網絡時支持分布式網關。

 

 VXLAN分布式網關具有如下特點:

  • 同一個VTEP節點既可以做VXLAN二層網關,也可以做VXLAN三層網關,部署靈活。
  • VTEP節點只需要學習自身連接服務器的ARP表項,而不必像集中式三層網關一樣,需要學習所有服務器的ARP表項,解決了集中式三層網關帶來的ARP表項瓶頸問題,網絡規模擴展能力強

VXLAN報文封裝格式

原始報文在封裝過程中先被添加一個VXLAN幀頭,再被封裝在UDP報頭中,並使用承載網絡的IP、MAC地址作為外層頭進行封裝。

報文封裝格式

  

 

 

 

現網實現方案

拓撲

  

 

 

 

 

 

 拓撲描述

  兩個pop點均為IDC機房,擁有完整架構,以上拓撲主要摘出Vxlan相關設備,Site-1與Site-2間通過物理專線直連,同時兩個Site同時使用物理專線接入華為雲,在華為雲購買雲連接並配置路由打通兩個站點

  華為雲與站點間使用靜態路由方式(國內雲平台BGP是偽BGP,不能根據線下通告的路由自動同步),直連專線鏈路使用ospf互聯,site-2接入互聯網

需求

  -  兩個站點服務器二層互通

  -  site-2互聯網ip可以在site-1使用

  -  優先使用雲聯網,直連專線做備用

  -  主備倒換控制在毫秒級

需求分析

  -  需求1要求兩個site間實現二層互通,可以使用VPLS VLL Vxlan技術實現

  -  需求2可以使用跨雲平台GRE隧道或Vxlan技術實現

  -  需求3與需求4根據需求1 2 來指定倒換方案

  -  現網core設備為juniper mx系列,系統版本不支持RPM聯動靜態路由,也不支持跨條BFD檢測,故無法使用浮動靜態路由方式來做兩端Vtep ip互通

  -  同時雲平台線路非直連不能建立ospf peer,所以也不能使用ospf主備路由方式做負載

  綜上,由於接入雲平台所以不能建立完整mpls lsp 如果使用VPLS或VLL只能使用GRE承載PW會增大額外開銷,且需求2還需獨立實現,綜合考慮最終選擇使用Vxlan技術實現,根據最后兩條分析決定跨雲平台建立bgp與直連專線ospf兩個協議間做主備。

方案配置

  地址規划

設備 loopback地址 物理專線互聯地址 雲平台互聯地址
Site1-core 192.168.39.5/32 10.38.0.1/30 10.39.0.1/30
Site2-core 192.168.39.21/32 10.38.0.2/30 10.39.0.5/30
Vtep-1 192.168.39.1/30 10.40.0.2/30  
Vtep-2 192.168.39.17/30 10.40.0.6/30  

  配置

    基礎線路主備  

#Site1-core
set protocols bgp group Vxlan type external
set protocols bgp group Vxlan neighbor 192.168.39.21 multihop ttl 10
set protocols bgp group Vxlan neighbor 192.168.39.21 local-address 192.168.39.5
set protocols bgp group Vxlan neighbor 192.168.39.21 import Vxlanin
set protocols bgp group Vxlan neighbor 192.168.39.21 export Vxlanout
set protocols bgp group Vxlan neighbor 192.168.39.21 peer-as 65500
set protocols bgp group Vxlan neighbor 192.168.39.21 local-as 65501
set protocols bgp group Vxlan neighbor 192.168.39.21 bfd-liveness-detection minimum-interval 100
set protocols bgp group Vxlan neighbor 192.168.39.21 bfd-liveness-detection minimum-receive-interval 100
set protocols bgp group Vxlan neighbor 192.168.39.21 bfd-liveness-detection multiplier 3

set policy-options policy-statement Vxlanin term Vxlan from route-filter 192.168.39.17/32 exact
set policy-options policy-statement Vxlanin term Vxlan then accept
set policy-options policy-statement Vxlanin term 99 then reject

set policy-options policy-statement Vxlanout term Vxlan from route-filter 192.168.39.1/32 exact
set policy-options policy-statement Vxlanout term Vxlan then accept
set policy-options policy-statement Vxlanout term 99 then reject

set protocols ospf area 0.0.0.0 interface xe-0/0/1.33 bfd-liveness-detection minimum-receive-interval 100
set protocols ospf area 0.0.0.0 interface xe-0/0/1.33 bfd-liveness-detection multiplier 3
set protocols ospf area 0.0.0.0 interface xe-0/0/1.33 bfd-liveness-detection transmit-interval minimum-interval 100
set protocols ospf area 0.0.0.0 interface xe-0/0/2.100 bfd-liveness-detection minimum-receive-interval 100
set protocols ospf area 0.0.0.0 interface xe-0/0/2.100 bfd-liveness-detection multiplier 3
set protocols ospf area 0.0.0.0 interface xe-0/0/2.100 bfd-liveness-detection transmit-interval minimum-interval 100

set routing-options static route 192.168.39.21/32 next-hop 10.39.0.2
set routing-options static route 192.168.39.1/32 next-hop 10.40.0.2

#Site2-core
set protocols bgp group Vxlan type external
set protocols bgp group Vxlan family inet unicast rib-group fbf-group
set protocols bgp group Vxlan neighbor 192.168.39.5 multihop ttl 10
set protocols bgp group Vxlan neighbor 192.168.39.5 local-address 192.168.39.21
set protocols bgp group Vxlan neighbor 192.168.39.5 import Vxlanin
set protocols bgp group Vxlan neighbor 192.168.39.5 export Vxlanout
set protocols bgp group Vxlan neighbor 192.168.39.5 peer-as 65501
set protocols bgp group Vxlan neighbor 192.168.39.5 local-as 65500
set protocols bgp group Vxlan neighbor 192.168.39.5 bfd-liveness-detection minimum-interval 100
set protocols bgp group Vxlan neighbor 192.168.39.5 bfd-liveness-detection minimum-receive-interval 100
set protocols bgp group Vxlan neighbor 192.168.39.5 bfd-liveness-detection multiplier 3

set policy-options policy-statement Vxlanin term Vxlan from route-filter 192.168.39.1/32 exact
set policy-options policy-statement Vxlanin term Vxlan then accept
set policy-options policy-statement Vxlanin term 99 then reject
set policy-options policy-statement Vxlanout term Vxlan from route-filter 192.168.39.17/32 exact
set policy-options policy-statement Vxlanout term Vxlan then accept
set policy-options policy-statement Vxlanout term 99 then reject

set protocols ospf area 0.0.0.0 interface xe-0/0/1.33 bfd-liveness-detection minimum-receive-interval 100
set protocols ospf area 0.0.0.0 interface xe-0/0/1.33 bfd-liveness-detection multiplier 3
set protocols ospf area 0.0.0.0 interface xe-0/0/1.33 bfd-liveness-detection transmit-interval minimum-interval 100

set routing-options static route 192.168.39.5/32 next-hop 10.39.0.6
set routing-options static route 192.168.39.17/32 next-hop 10.40.0.6


set protocols ospf area 0.0.0.0 interface xe-0/0/2.100 bfd-liveness-detection minimum-receive-interval 100
set protocols ospf area 0.0.0.0 interface xe-0/0/2.100 bfd-liveness-detection multiplier 3
set protocols ospf area 0.0.0.0 interface xe-0/0/2.100 bfd-liveness-detection transmit-interval minimum-interval 100

Vxlan配置

  

#Vtep-1

interface LoopBack1
 ip address 192.168.39.1 255.255.255.252
 ospf network-type broadcast
 ospf enable 1 area 0.0.0.0

bridge-domain 590
 l2 binding vlan 520
 vxlan vni 1001
bridge-domain 600
 l2 binding vlan 590
 vxlan vni 1002

interface Nve1
 source 192.168.39.1
 vni 1001 head-end peer-list 192.168.39.17
 vni 1002 head-end peer-list 192.168.39.17

interface XGigabitEthernet0/0/3
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 520  590

#Vtep-2
interface LoopBack1
 ip address 192.168.39.17 255.255.255.252
 ospf network-type broadcast
 ospf enable 1 area 0.0.0.0

bridge-domain 590
 l2 binding vlan 520
 vxlan vni 1001
bridge-domain 600
 l2 binding vlan 590
 vxlan vni 1002

interface Nve1
 source 192.168.39.17
 vni 1001 head-end peer-list 192.168.39.1
 vni 1002 head-end peer-list 192.168.39.1

interface XGigabitEthernet0/0/3
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan  590

以上配置可實現兩個Site中服務器打上vlan 590標簽就可實現二層互通,Vtep-1服務器打上vlan 520就可以使用Vtep-2互聯網地址

注意由於封裝了Vxlan頭部,物理線路包括雲平台MTU需要調整,最小調整為1550,或者服務器端MTU調整為1450,否則會影響傳輸效率,實測10G帶寬最大利用率為10%


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM