华为交换机同网段用户VXLAN配置举例

发布时间 2023-11-08 01:09:46作者: Sawyerhan

组网需求

如图所示,某企业在不同的数据中心中都拥有自己的VM,服务器1上的VM1属于VLAN10,服务器2上的VM1属于VLAN20,且位于同网段。现需要通过VXLAN隧道实现不同数据中心相同VM的互通。

 配置思路

采用如下思路配置同网段用户通过VXLAN隧道互通:

  1. 分别在Device1、Device2和Device3上配置路由协议,保证网络三层互通。
  2. 分别在Device1和Device3上配置业务接入点实现区分业务流量。
  3. 分别在Device1和Device3上配置VXLAN隧道实现转发业务流量。

数据准备

为完成此配置例,需准备如下的数据:

  • VM所属的VLAN ID分别是VLAN10和VLAN20。
  • 网络中设备互连的接口IP地址。
  • 网络中使用的IGP(Internal Gateway Protocol)路由类型是OSPF(Open Shortest Path First)。
  • 广播域BD ID是10。
  • VXLAN网络标识VNI ID是5010。操作步骤

操作步骤

配置路由协议

分别配置Device1、Device2和Device3各接口IP地址。

配置Device1

<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 gigabitethernet 1/0/1
[*Device1-GigabitEthernet1/0/1] ip address 192.168.1.1 24
[*Device1-GigabitEthernet1/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

 Device2、Device3的配置与Device1配置类似

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=254 time=5 ms
    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=254 time=2 ms
    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=254 time=2 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=254 time=3 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=254 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

 分别在Device1、Device3上配置业务接入点

配置Device1

[~Device1] bridge-domain 10
[*Device1-bd10] quit
[*Device1] interface gigabitethernet1/0/2.1 mode l2
[*Device1-GigabitEthernet1/0/2.1] encapsulation dot1q vid 10
[*Device1-GigabitEthernet1/0/2.1] rewrite pop single
[*Device1-GigabitEthernet1/0/2.1] bridge-domain 10
[*Device1-GigabitEthernet1/0/2.1] quit
[*Device1] commit

 Device3的配置与Device1配置类似

分别在Device1、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 4.4.4.4
[*Device1-Nve1] quit
[*Device1] commit

 Device3的配置与Device1配置类似

检查配置结果

上述配置成功后,在Device1、Device3上执行display vxlan vni命令可查看到VNI的状态是Up;执行display vxlan tunnel命令可查看到VXLAN隧道的信息。以Device1显示为例。

[~Device1] display vxlan vni
Number of vxlan vni: 1
VNI            BD-ID            State
---------------------------------------
5010           10               up
[~Device1] display vxlan tunnel
Number of vxlan tunnel : 1
Tunnel ID   Source           Destination      State  Type    Uptime
-------------------------------------------------------------------
4026531842  2.2.2.2          4.4.4.4          up     static 0028h16m

 配置完成后,同网段用户通过VXLAN隧道可以互通