組網需求
如圖14-5所示,某企業在不同的數據中心都擁有自己的VM,服務器1的VM1屬於VLAN 10,服務器3的VM1屬於VLAN 30,服務器2上的VM1屬於VLAN 20。服務器1和服務器2位於不同網段,服務器3和服務器2位於相同網段。現需要通過VXLAN網關實現不同數據中心相同名稱VM的互通。
配置思路
-
分別在Device1、Device2和Device3上配置路由協議,保證網絡三層互通。
-
分別在Device1和Device3上配置業務接入點實現區分業務流量。
-
分別在Device1、Device2和Device3上配置VXLAN隧道轉發業務流量。
-
在Device2上配置VXLAN三層網關,實現不同網段用戶通過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。
配置注意事項
CE6855HI、CE6856HI和CE7855EI作為VXLAN三層網關時,只能使用VBDIF接口接入VXLAN網絡,否則會導致VXLAN報文無法正常轉發。
配置VXLAN舉例的相關約束已經在操作步驟中加以說明。如果還想了解更多約束,請參見VXLAN配置注意事項。
操作步驟
- 配置路由協議
# 配置Device1。Device2和Device3的配置與Device1類似,這里不再贅述。配置OSPF時,注意需要發布轉發器的32位Loopback接口地址。
<HUAWEI> system-view [~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擴展功能(僅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上配置VXLAN隧道
# 配置Device1。
[~Device1] bridge-domain 10 [~Device1-bd10] vxlan vni 5010 [*Device1-bd10] quit [*Device1] interface nve 1 [*Device1-Nve1] source 2.2.2.2 [*Device1-Nve1] vni 5010 head-end peer-list 3.3.3.3 [*Device1-Nve1] quit [*Device1] bridge-domain 20 [*Device1-bd20] vxlan vni 5020 [*Device1-bd20] quit [*Device1] interface nve 1 [*Device1-Nve1] vni 5020 head-end peer-list 3.3.3.3 [*Device1-Nve1] vni 5020 head-end peer-list 4.4.4.4 [*Device1-Nve1] quit [*Device1] commit
# 配置Device2。
[~Device2] bridge-domain 10 [*Device2-bd10] vxlan vni 5010 [*Device2-bd10] quit [*Device2] interface nve 1 [*Device2-Nve1] source 3.3.3.3 [*Device2-Nve1] vni 5010 head-end peer-list 2.2.2.2 [*Device2-Nve1] quit [*Device2] bridge-domain 20 [*Device2-bd20] vxlan vni 5020 [*Device2-bd20] quit [*Device2] interface nve 1 [*Device2-Nve1] source 3.3.3.3 [*Device2-Nve1] vni 5020 head-end peer-list 2.2.2.2 [*Device2-Nve1] vni 5020 head-end peer-list 4.4.4.4 [*Device2-Nve1] quit [*Device2] commit
# 配置Device3。
[~Device3] bridge-domain 20 [~Device3-bd20] vxlan vni 5020 [*Device3-bd20] quit [*Device3] interface nve 1 [*Device3-Nve1] source 4.4.4.4 [*Device3-Nve1] vni 5020 head-end peer-list 3.3.3.3 [*Device3-Nve1] vni 5020 head-end peer-list 2.2.2.2 [*Device3-Nve1] quit [*Device3] commit
- 在Device2上配置業務環回口。(僅CE6850HI、CE6850U-HI、CE6851HI、CE6860EI、CE7850EI、CE8850EI、CE8860EI需要配置此步驟)
[~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
- 檢查配置結果
上述配置成功后,在Device1、Device2、Device3上執行display vxlan tunnel命令可查看到VXLAN隧道的信息;執行display vxlan vni命令可查看到VNI的狀態是Up。以Device2顯示為例。
[~Device2] display vxlan tunnel Number of vxlan tunnel : 2 Tunnel ID Source Destination State Type Uptime ----------------------------------------------------------------------------------- 4026531841 3.3.3.3 2.2.2.2 up static 0035h21m 4026531842 3.3.3.3 4.4.4.4 up static 0036h21m
[~Device2] display vxlan vni Number of vxlan vni : 2 VNI BD-ID State --------------------------------------- 5010 10 up 5020 20 up
配置完成后,不同服務器中的VM1可以相互通信。
配置文件
-
Device1的配置文件
# sysname Device1 # assign forward nvo3 acl extend enable //僅CE6870EI、CE6875EI需要配置此步驟 # bridge-domain 10 vxlan vni 5010 # bridge-domain 20 vxlan vni 5020 # 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 3.3.3.3 vni 5020 head-end peer-list 3.3.3.3 vni 5020 head-end peer-list 4.4.4.4 # 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 //僅CE6870EI、CE6875EI需要配置此步驟 # bridge-domain 10 vxlan vni 5010 # bridge-domain 20 vxlan vni 5020 # 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 Eth-Trunk1 //僅CE6850HI、CE6850U-HI、CE6851HI、CE6860EI、CE7850EI、CE8850EI、CE8860EI需要配置此步驟 service type tunnel # 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 10GE1/0/4 //僅CE6850HI、CE6850U-HI、CE6851HI、CE6860EI、CE7850EI、CE8850EI、CE8860EI需要配置此步驟 eth-trunk 1 # 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 2.2.2.2 vni 5020 head-end peer-list 2.2.2.2 vni 5020 head-end peer-list 4.4.4.4 # 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 //僅CE6870EI、CE6875EI需要配置此步驟 # bridge-domain 20 vxlan vni 5020 # 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 2.2.2.2 vni 5020 head-end peer-list 3.3.3.3 # 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
-