配置集中式網關部署方式的VXLAN示例(BGP EVPN方式)
適用產品和版本
CE12800、CE12800E、CE8800、CE7800、CE6800(除CE6850EI、CE6810EI、CE6810LI外)系列產品V200R001C00或更高版本。
組網需求
如圖1-10所示,某企業在不同的數據中心中都擁有自己的VM,服務器1上的VM1屬於VLAN 10,服務器2上的VM1屬於VLAN 20,服務器3上的VM1屬於VLAN 30。服務器1和服務器2位於不同網段,服務器3和服務器2位於相同網段。現需要通過VXLAN三層網關實現不同數據中心相同VM的互通。
圖1-10 配置不同網段用戶通過VXLAN三層網關通信組網圖
![華為交換機配置集中式網關部署方式的VXLAN(BGP EVPN方式)](http://p2.ttnews.xyz/loading.gif)
配置思路
採用如下思路配置不同網段用戶通過VXLAN三層網關通信:
- 分別在Device1、Device2和Device3上配置路由協議,保證網絡三層互通。
- 分別在Device1和Device3上配置業務接入點實現區分業務流量。
- 使能EVPN作VXLAN控制平面功能。
- 配置BGP EVPN對等體關係。
- 配置EVPN實例。
- 配置頭端複製功能。
- 在Device2上配置VXLAN三層網關。
數據準備
為完成此配置例,需準備如下的數據:
- VM所屬的VLAN ID分別是VLAN 10、VLAN 20和VLAN 30。
- 網絡中設備互連的接口IP地址。
- 網絡中使用的IGP(Internal Gateway Protocol)路由類型是OSPF(Open Shortest Path First)。
- 廣播域BD ID分別是BD 10和BD 20。
- VXLAN網絡標識VNI ID分別是VNI 5010和VNI 5020。
- EVPN實例的RD值為11:1、12:1、21:1、23:1和31:2,RT值為1:1和2:2。
操作步驟
- 配置路由協議# 配置Device1。Device2和Device3的配置與Device1類似,這裡不再贅述。配置OSPF時,注意需要發佈轉發器的32位Loopback接口地址。
[~HUAWEI] sysname Device1
[*HUAWEI] commit
[~Device1] interface loopback 1
[*Device1-LoopBack1] ip address 2.2.2.2 32
[*Device1-LoopBack1] quit
[*Device1] interface 10ge 1/0/1
[*Device1-10GE1/0/1] undo portswitch
[*Device1-10GE1/0/1] ip address 192.168.1.1 24
[*Device1-10GE1/0/1] quit
[*Device1] ospf
[*Device1-ospf-1] area 0
[*Device1-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0
[*Device1-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[*Device1-ospf-1-area-0.0.0.0] quit
[*Device1-ospf-1] quit
[*Device1] commit
# OSPF成功配置後,Device之間可通過OSPF協議發現對方的Loopback接口的IP地址,並能互相ping通。以Device1 ping Device3的顯示為例。
[~Device1] ping 4.4.4.4
PING 4.4.4.4: 56 data bytes, press CTRL_C to break
Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=253 time=5 ms
Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=253 time=2 ms
Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=253 time=2 ms
Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=253 time=3 ms
Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=253 time=3 ms
--- 4.4.4.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 2/3/5 ms
配置VXLAN隧道模式並使能VXLAN的ACL擴展功能(僅CE12800、CE6870EI、CE6875EI設備需要配置此步驟)
# 配置Device1。Device2和Device3的配置與Device1類似,這裡不再贅述。
[~Device1] ip tunnel mode vxlan
[*Device1] assign forward nvo3 acl extend enable
[*Device1] commit
說明:
配置VXLAN隧道模式、使能VXLAN的ACL擴展功能後,需要保存配置並重啟設備才能生效,您可以選擇立即重啟或完成所有配置後再重啟。
分別在Device1、Device3上配置業務接入點
# 配置Device1。Device3的配置與Device1類似,這裡不再贅述。
[~Device1] bridge-domain 10
[*Device1-bd10] quit
[*Device1] interface 10ge 1/0/2.1 mode l2
[*Device1-10GE1/0/2.1] encapsulation dot1q vid 10
[*Device1-10GE1/0/2.1] bridge-domain 10
[*Device1-10GE1/0/2.1] quit
[*Device1] bridge-domain 20
[*Device1-bd20] quit
[*Device1] interface 10ge 1/0/3.1 mode l2
[*Device1-10GE1/0/3.1] encapsulation dot1q vid 30
[*Device1-10GE1/0/3.1] bridge-domain 20
[*Device1-10GE1/0/3.1] quit
[*Device1] commit
分別在Device1、Device2、Device3上使能EVPN作VXLAN控制平面功能
# 配置Device1。Device2和Device3的配置與Device1類似,這裡不再贅述。
[~Device1] evpn-overlay enable
[*Device1] commit
配置BGP EVPN對等體關係
# 配置Device1。Device2和Device3的配置與Device1類似,這裡不再贅述。
[~Device1] bgp 100
[*Device1-bgp] peer 3.3.3.3 as-number 100
[*Device1-bgp] peer 3.3.3.3 connect-interface LoopBack1
[*Device1-bgp] peer 4.4.4.4 as-number 100
[*Device1-bgp] peer 4.4.4.4 connect-interface LoopBack1
[*Device1-bgp] l2vpn-family evpn
[*Device1-bgp-af-evpn] peer 3.3.3.3 enable
[*Device1-bgp-af-evpn] peer 4.4.4.4 enable
[*Device1-bgp-af-evpn] quit
[*Device1-bgp] quit
[*Device1] commit
分別在Device1、Device2和Device3上配置EVPN實例
# 配置Device1。Device2和Device3的配置與Device1類似,這裡不再贅述。
[~Device1] bridge-domain 10
[~Device1-bd10] vxlan vni 5010
[*Device1-bd10] evpn
[*Device1-bd10-evpn] route-distinguisher 11:1
[*Device1-bd10-evpn] vpn-target 1:1
[*Device1-bd10-evpn] quit
[*Device1-bd10] quit
[*Device1] bridge-domain 20
[*Device1-bd20] vxlan vni 5020
[*Device1-bd20] evpn
[*Device1-bd20-evpn] route-distinguisher 12:1
[*Device1-bd20-evpn] vpn-target 2:2
[*Device1-bd20-evpn] quit
[*Device1-bd20] quit
[*Device1] commit
配置頭端複製功能
# 配置Device1。Device2和Device3的配置與Device1類似,這裡不再贅述。
[~Device1] interface nve 1
[*Device1-Nve1] source 2.2.2.2
[*Device1-Nve1] vni 5010 head-end peer-list protocol bgp
[*Device1-Nve1] vni 5020 head-end peer-list protocol bgp
[*Device1-Nve1] quit
[*Device1] commit
在Device2上配置業務環回口(CE12800、CE12800E、CE6855HI、CE6856HI、CE6865EI、CE6870EI、CE6875EI、CE6880EI、CE7855EI不需要配置此步驟)
[~Device2] interface eth-trunk 1
[*Device2-Eth-Trunk1] service type tunnel
[*Device2-Eth-Trunk1] quit
[*Device2] interface 10ge 1/0/4
[*Device2-10GE1/0/4] eth-trunk 1
[*Device2-10GE1/0/4] quit
[*Device2] commit
在Device2上配置VXLAN三層網關
[~Device2] interface vbdif 10
[*Device2-Vbdif10] ip address 192.168.10.10 24
[*Device2-Vbdif10] quit
[*Device2] interface vbdif 20
[*Device2-Vbdif20] ip address 192.168.20.10 24
[*Device2-Vbdif20] quit
[*Device2] commit
驗證配置結果
上述配置成功後,執行display vxlan tunnel命令可查看到VXLAN隧道的信息;在Device1、Device2、Device3上執行display vxlan vni命令可查看到VNI的狀態是Up。以Device1顯示為例。
[~Device1] display vxlan tunnel
Number of vxlan tunnel : 2
Tunnel ID Source Destination State Type Uptime
-----------------------------------------------------------------------------------
4026531843 2.2.2.2 3.3.3.3 up dynamic 0035h21m
4026531844 2.2.2.2 4.4.4.4 up dynamic 0036h21m
[~Device1] display vxlan vni
Number of vxlan vni : 2
VNI BD-ID State
---------------------------------------
5010 10 up
5020 20 up
配置完成後,不同服務器中的VM1可以相互通信。
配置文件
配置文件以CE12800交換機為例。
Device1的配置文件
#
sysname Device1
#
assign forward nvo3 acl extend enable
#
evpn-overlay enable
#
bridge-domain 10
vxlan vni 5010
evpn
route-distinguisher 11:1
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
bridge-domain 20
vxlan vni 5020
evpn
route-distinguisher 12:1
vpn-target 2:2 export-extcommunity
vpn-target 2:2 import-extcommunity
#
interface 10GE1/0/1
undo portswitch
ip address 192.168.1.1 255.255.255.0
#
interface 10GE1/0/2.1 mode l2
encapsulation dot1q vid 10
bridge-domain 10
#
interface 10GE1/0/3.1 mode l2
encapsulation dot1q vid 30
bridge-domain 20
#
interface LoopBack1
ip address 2.2.2.2 255.255.255.255
#
interface Nve1
source 2.2.2.2
vni 5010 head-end peer-list protocol bgp
vni 5020 head-end peer-list protocol bgp
#
bgp 100
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack1
peer 4.4.4.4 as-number 100
peer 4.4.4.4 connect-interface LoopBack1
#
ipv4-family unicast
peer 3.3.3.3 enable
peer 4.4.4.4 enable
#
l2vpn-family evpn
policy vpn-target
peer 3.3.3.3 enable
peer 4.4.4.4 enable
#
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
Device2的配置文件
#
sysname Device2
#
assign forward nvo3 acl extend enable
#
evpn-overlay enable
#
bridge-domain 10
vxlan vni 5010
evpn
route-distinguisher 21:1
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
bridge-domain 20
vxlan vni 5020
evpn
route-distinguisher 23:1
vpn-target 2:2 export-extcommunity
vpn-target 2:2 import-extcommunity
#
interface Vbdif10
ip address 192.168.10.10 255.255.255.0
#
interface Vbdif20
ip address 192.168.20.10 255.255.255.0
#
interface 10GE1/0/1
undo portswitch
ip address 192.168.1.2 255.255.255.0
#
interface 10GE1/0/2
undo portswitch
ip address 192.168.2.1 255.255.255.0
#
interface LoopBack1
ip address 3.3.3.3 255.255.255.255
#
interface Nve1
source 3.3.3.3
vni 5010 head-end peer-list protocol bgp
vni 5020 head-end peer-list protocol bgp
#
bgp 100
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack1
peer 4.4.4.4 as-number 100
peer 4.4.4.4 connect-interface LoopBack1
#
ipv4-family unicast
peer 2.2.2.2 enable
peer 4.4.4.4 enable
#
l2vpn-family evpn
policy vpn-target
peer 2.2.2.2 enable
peer 4.4.4.4 enable
#
ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
return
Device3的配置文件
#
sysname Device3
#
assign forward nvo3 acl extend enable
#
evpn-overlay enable
#
bridge-domain 20
vxlan vni 5020
evpn
route-distinguisher 31:2
vpn-target 2:2 export-extcommunity
vpn-target 2:2 import-extcommunity
#
interface 10GE1/0/1
undo portswitch
ip address 192.168.2.2 255.255.255.0
#
interface 10GE1/0/2.1 mode l2
encapsulation dot1q vid 20
bridge-domain 20
#
interface LoopBack1
ip address 4.4.4.4 255.255.255.255
#
interface Nve1
source 4.4.4.4
vni 5020 head-end peer-list protocol bgp
#
bgp 100
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack1
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack1
#
ipv4-family unicast
peer 2.2.2.2 enable
peer 3.3.3.3 enable
#
l2vpn-family evpn
policy vpn-target
peer 2.2.2.2 enable
peer 3.3.3.3 enable
#
ospf 1
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 192.168.2.0 0.0.0.255
#
return
閱讀更多 網絡觀察家 的文章