华为CE交换机-配置通过VLAN hand-off实现DCI互联示例

配置通过VLAN hand-off实现DCI互联示例

组网需求

图1所示,分别在数据中心A、数据中心B内配置BGP EVPN协议创建VXLAN隧道,实现各数据中心内部VM之间的通信,Leaf2和Leaf3通过二层子接口方式接入DCI-VTEP1和DCI-VTEP2,DCI-VTEP1和DCI-VTEP2之间配置EVPN协议创建VXLAN隧道,实现数据中心之间的通信。Leaf2/Leaf3将收到的数据中心侧的VXLAN报文进行解封装,然后发送到DCI-VTEP,DCI-VTEP将收到的VLAN报文重新封装成VXLAN报文后发送给对端DCI-VTEP,实现VXLAN隧道对跨数据中心的报文端到端的承载,保证跨数据中心VM之间的通信。

图1 配置通过VLAN hand-off实现DCI互联组网图

华为CE交换机-配置通过VLAN hand-off实现DCI互联示例

本例中interface1、interface2和interface3分别代表100GE1/0/1、100GE1/0/2、100GE1/0/3。

华为CE交换机-配置通过VLAN hand-off实现DCI互联示例

表1 接口的IP地址

设备

接口

IP地址

设备

接口

IP地址

Device1

100GE1/0/1

192.168.50.1/24

Device2

100GE1/0/1

192.168.60.1/24

100GE1/0/2

192.168.1.1/24

100GE1/0/2

192.168.1.2/24

LoopBack0

1.1.1.1/32

LoopBack0

2.2.2.2/32

DCI-VTEP1

100GE1/0/1

192.168.50.2/24

DCI-VTEP2

100GE1/0/1

192.168.60.2/24

100GE1/0/2

-

100GE1/0/2

-

LoopBack0

9.9.9.9/32

LoopBack0

10.10.10.10/32

Spine1

100GE1/0/1

192.168.10.1/24

Spine2

100GE1/0/1

192.168.30.1/24

100GE1/0/2

192.168.20.1/24

100GE1/0/2

192.168.40.1/24

LoopBack0

3.3.3.3/32

LoopBack0

4.4.4.4/32

Leaf1

100GE1/0/1

192.168.10.2/24

Leaf4

100GE1/0/1

192.168.40.2/24

100GE1/0/2

-

100GE1/0/2

-

LoopBack0

5.5.5.5/32

LoopBack0

8.8.8.8/32

Leaf2

100GE1/0/1

192.168.20.2/24

Leaf3

100GE1/0/1

192.168.30.2/24

100GE1/0/2

-

100GE1/0/2

-

100GE1/0/3

-

100GE1/0/3

-

LoopBack0

6.6.6.6/32

LoopBack0

7.7.7.7/32

配置思路

采用如下的思路配置通过VLAN hand-off实现DCI互联:

  1. 配置各节点接口的IP地址。

  2. 配置路由协议,实现各节点之间的互通。

  3. 在数据中心A和数据中心B内配置BGP EVPN协议创建VXLAN隧道;在数据中心A和数据中心B内分别创建IBGP邻居。

  4. 在DCI-VTEP之间配置BGP EVPN协议创建VXLAN隧道。

  5. 在Leaf2、Leaf3、DCI-VTEP1和DCI-VTEP2上配置通过二层子接口方式接入DCI隧道。

操作步骤

  1. 配置各节点接口的IP地址。 

    # 配置Device1。其他设备的配置过程与Device1类似,在此不再赘述,具体请参考配置脚本。

    <HUAWEI> system-view
    [~HUAWEI] sysname Device1
    [*HUAWEI] commit
    [~Device1] interface loopback 0
    [*Device1-LoopBack0] ip address 1.1.1.1 32
    [*Device1-LoopBack0] quit
    [*Device1] interface 100ge 1/0/1
    [*Device1-100GE1/0/1] undo portswitch
    [*Device1-100GE1/0/1] ip address 192.168.50.1 24
    [*Device1-100GE1/0/1] quit
    [*Device1] interface 100ge 1/0/2
    [*Device1-100GE1/0/2] undo portswitch
    [*Device1-100GE1/0/2] ip address 192.168.1.1 24
    [*Device1-100GE1/0/2] quit
    [*Device1] commit

     

  2. 配置路由协议,实现路由互通。 

    # 配置Spine1。Spine2、Device1、Device2的配置过程与Spine1类似,在此不再赘述,具体请参考配置脚本。

    <HUAWEI> system-view
    [~HUAWEI] sysname Spine1
    [*HUAWEI] commit
    [~Spine1] ospf 1
    [*Spine1-ospf-1] area 0
    [*Spine1-ospf-1-area-0.0.0.0] network 3.3.3.3 0.0.0.0
    [*Spine1-ospf-1-area-0.0.0.0] network 192.168.10.0 0.0.0.255
    [*Spine1-ospf-1-area-0.0.0.0] network 192.168.20.0 0.0.0.255
    [*Spine1-ospf-1-area-0.0.0.0] quit
    [*Spine1-ospf-1] quit
    [*Spine1] commit

    # 配置Leaf1。Leaf2、Leaf3、Leaf4、DCI-VTEP1、DCI-VTEP2的配置过程与Leaf1类似,在此不再赘述,具体请参考配置脚本。

    <HUAWEI> system-view
    [~HUAWEI] sysname Leaf1
    [*HUAWEI] commit
    [~Leaf1] ospf 1
    [*Leaf1-ospf-1] area 0
    [*Leaf1-ospf-1-area-0.0.0.0] network 5.5.5.5 0.0.0.0
    [*Leaf1-ospf-1-area-0.0.0.0] network 192.168.10.0 0.0.0.255
    [*Leaf1-ospf-1-area-0.0.0.0] quit
    [*Leaf1-ospf-1] quit
    [*Leaf1] bgp 100
    [*Leaf1-bgp] ipv4-family unicast
    [*Leaf1-bgp-af-ipv4] peer 6.6.6.6 enable
    [*Leaf1-bgp-af-ipv4] quit
    [*Leaf1-bgp] quit
    [*Leaf1] commit

     

  3. 在数据中心A和数据中心B内配置BGP EVPN协议,创建VXLAN隧道。
    1. 配置VXLAN业务接入点。 

      # 配置Leaf1。

      [~Leaf1] bridge-domain 10
      [*Leaf1-bd10] quit
      [*Leaf1] interface 100GE 1/0/2.1 mode l2
      [*Leaf1-100GE1/0/2.1] encapsulation dot1q vid 10
      [*Leaf1-100GE1/0/2.1] bridge-domain 10
      [*Leaf1-100GE1/0/2.1] quit
      [*Leaf1] commit

      Leaf2、Leaf3、Leaf4的配置过程与Leaf1类似,在此不再赘述,具体请参考配置脚本。

       

    2. 在Leaf1、Leaf2、Leaf3和Leaf4上使能EVPN作为VXLAN控制平面。 

      # 配置Leaf1。

      [~Leaf1] evpn-overlay enable
      [*Leaf1] commit

      Leaf2、Leaf3和Leaf4的配置过程与Leaf1类似,在此不再赘述,具体请参考配置脚本。

       

    3. 在Leaf1和Leaf2之间、在Leaf3和Leaf4之间配置IBGP EVPN对等体关系。 

      # 配置Leaf1。

      [~Leaf1] bgp 100
      [*Leaf1-bgp] peer 6.6.6.6 as-number 100
      [*Leaf1-bgp] peer 6.6.6.6 connect-interface LoopBack 0
      [*Leaf1-bgp] l2vpn-family evpn
      [*Leaf1-bgp-af-evpn] peer 6.6.6.6 enable
      Warning: This operation will reset the peer session. Continue? [Y/N]: y
      [*Leaf1-bgp-af-evpn] quit
      [*Leaf1-bgp] quit
      [*Leaf1] commit

      Leaf2、Leaf3和Leaf4的配置过程与Leaf1类似,在此不再赘述,具体请参考配置脚本。

       

    4. 配置EVPN实例。 

      # 配置Leaf1。

      [~Leaf1] bridge-domain 10
      [~Leaf1-bd10] vxlan vni 10
      [*Leaf1-bd10] evpn
      [*Leaf1-bd10-evpn] route-distinguisher 10:1
      [*Leaf1-bd10-evpn] vpn-target 11:1
      [*Leaf1-bd10-evpn] quit
      [*Leaf1-bd10] quit
      [*Leaf1] commit

      Leaf2、Leaf3、Leaf4的配置过程与Leaf1类似,在此不再赘述,具体请参考配置脚本。

       

    5. 在Leaf上使能头端复制功能。 

      # 配置Leaf1。

      [~Leaf1] interface nve 1
      [*Leaf1-Nve1] source 5.5.5.5
      [*Leaf1-Nve1] vni 10 head-end peer-list protocol bgp
      [*Leaf1-Nve1] quit
      [*Leaf1] commit

      Leaf2、Leaf3、Leaf4的配置过程与Leaf1类似,在此不再赘述,具体请参考配置脚本。

       

    6. 在Leaf1和Leaf2之间、Leaf3和Leaf4之间配置发布IRB类型的路由。 

      # 配置Leaf1。

      [~Leaf1] bgp 100
      [~Leaf1-bgp] l2vpn-family evpn
      [~Leaf1-bgp-af-evpn] peer 6.6.6.6 advertise irb
      [*Leaf1-bgp-af-evpn] quit
      [*Leaf1-bgp] quit
      [*Leaf1] commit

      Leaf2、Leaf3、Leaf4的配置过程与Leaf1类似,在此不再赘述,具体请参考配置脚本。

       

  4. 在DCI-VTEP之间配置BGP EVPN协议,创建VXLAN隧道。
    1. 在DCI-VTEP1和DCI-VTEP2上使能EVPN作VXLAN控制平面功能。 

      # 配置DCI-VTEP1。

      <HUAWEI> system-view
      [~HUAWEI] sysname DCI-VTEP1
      [*HUAWEI] commit
      [~DCI-VTEP1] evpn-overlay enable
      [*DCI-VTEP1] commit

      DCI-VTEP2的配置过程与DCI-VTEP1类似,在此不再赘述,具体请参考配置脚本。

       

    2. 在DCI-VTEP1和DCI-VTEP2之间配置EBGP EVPN对等体关系。 

      # 配置DCI-VTEP1。

      [~DCI-VTEP1] bgp 100
      [*DCI-VTEP1-bgp] peer 10.10.10.10 as-number 200
      [*DCI-VTEP1-bgp] peer 10.10.10.10 connect-interface LoopBack 0
      [*DCI-VTEP1-bgp] peer 10.10.10.10 ebgp-max-hop 255
      [*DCI-VTEP1-bgp] l2vpn-family evpn
      [*DCI-VTEP1-bgp-af-evpn] peer 10.10.10.10 enable
      Warning: This operation will reset the peer session. Continue? [Y/N]: y
      [*DCI-VTEP1-bgp-af-evpn] quit
      [*DCI-VTEP1-bgp] quit
      [*DCI-VTEP1] commit

      DCI-VTEP2的配置过程与DCI-VTEP1类似,在此不再赘述,具体请参考配置脚本。

       

    3. 在DCI-VTEP上配置EVPN实例 

      # 配置DCI-VTEP1。

      [~DCI-VTEP1] bridge-domain 10
      [*DCI-VTEP1-bd10] vxlan vni 10
      [*DCI-VTEP1-bd10] evpn
      [*DCI-VTEP1-bd10-evpn] route-distinguisher 10:5
      [*DCI-VTEP1-bd10-evpn] vpn-target 33:3
      [*DCI-VTEP1-bd10-evpn] quit
      [*DCI-VTEP1-bd10] quit
      [*DCI-VTEP1] commit

      DCI-VTEP2的配置过程与DCI-VTEP1类似,在此不再赘述,具体请参考配置脚本。

       

    4. 在DCI-VTEP上使能头端复制功能 

      # 配置DCI-VTEP1。

      [~DCI-VTEP1] interface nve 1
      [*DCI-VTEP1-Nve1] source 9.9.9.9
      [*DCI-VTEP1-Nve1] vni 10 head-end peer-list protocol bgp
      [*DCI-VTEP1-Nve1] quit
      [*DCI-VTEP1] commit

      DCI-VTEP2的配置过程与DCI-VTEP1类似,在此不再赘述,具体请参考配置脚本。

       

    5. 在DCI-VTEP1和DCI-VTEP2之间配置发布IRB类型的路由 

      # 配置DCI-VTEP1。

      [~DCI-VTEP1] bgp 100
      [~DCI-VTEP1-bgp] l2vpn-family evpn
      [~DCI-VTEP1-bgp-af-evpn] peer 10.10.10.10 advertise irb
      [*DCI-VTEP1-bgp-af-evpn] quit
      [*DCI-VTEP1-bgp] quit
      [*DCI-VTEP1] commit

      DCI-VTEP2的配置过程与DCI-VTEP1类似,在此不再赘述,具体请参考配置脚本。

       

  5. 配置VLAN接入VXLAN隧道 

    # 配置Leaf2。

    [~Leaf2] interface 100GE 1/0/3.1 mode l2
    [*Leaf2-100GE1/0/3.1] encapsulation dot1q vid 10
    [*Leaf2-100GE1/0/3.1] bridge-domain 10
    [*Leaf2-100GE1/0/3.1] quit
    [*Leaf2] commit

    Leaf3、DCI-VTEP1、DCI-VTEP2的配置过程与Leaf2类似,在此不再赘述,具体请参考配置脚本。

     

检查配置结果

上述配置成功后,在Leaf上执行display vxlan tunnel命令,可以看到建立的VXLAN隧道信息。以Leaf1的显示为例:

[~Leaf1] display vxlan tunnel
Number of vxlan tunnel : 1
Tunnel ID   Source                Destination           State  Type     Uptime
-----------------------------------------------------------------------------------
4026531842  5.5.5.5               8.8.8.8               up     dynamic  00:10:16

配置完成后,VMa1和VMb2之间可以互相通信。

配置脚本

  • Spine1的配置文件

    #
    sysname Spine1
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 192.168.10.1 255.255.255.0
    #
    interface 100GE1/0/2
     undo portswitch
     ip address 192.168.20.1 255.255.255.0
    #
    interface LoopBack0
     ip address 3.3.3.3 255.255.255.255
    #
    ospf 1
     area 0.0.0.0
      network 3.3.3.3 0.0.0.0
      network 192.168.10.0 0.0.0.255
      network 192.168.20.0 0.0.0.255
    #
    return
  • Leaf1的配置文件

    #
    sysname Leaf1
    #
    evpn-overlay enable
    #
    bridge-domain 10
     vxlan vni 10
     #
     evpn
      route-distinguisher 10:1
      vpn-target 11:1 export-extcommunity
      vpn-target 11:1 import-extcommunity
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 192.168.10.2 255.255.255.0
    #
    interface 100GE1/0/2.1 mode l2
     encapsulation dot1q vid 10
     bridge-domain 10
    #
    interface LoopBack0
     ip address 5.5.5.5 255.255.255.255
    #
    interface Nve1
     source 5.5.5.5
     vni 10 head-end peer-list protocol bgp
    #
    bgp 100
     peer 6.6.6.6 as-number 100
     peer 6.6.6.6 connect-interface LoopBack0
     #
     ipv4-family unicast
      peer 6.6.6.6 enable
     #
     l2vpn-family evpn
      policy vpn-target
      peer 6.6.6.6 enable
      peer 6.6.6.6 advertise irb
    #
    ospf 1
     area 0.0.0.0
      network 5.5.5.5 0.0.0.0
      network 192.168.10.0 0.0.0.255
    #
    return
  • Leaf2的配置文件

    #
    sysname Leaf2
    #
    evpn-overlay enable
    #
    bridge-domain 10
     vxlan vni 10
     #
     evpn
      route-distinguisher 10:2
      vpn-target 11:1 export-extcommunity
      vpn-target 11:1 import-extcommunity
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 192.168.20.2 255.255.255.0
    #               
    interface 100GE1/0/2.1 mode l2
     encapsulation dot1q vid 10
     bridge-domain 10
    #
    interface 100GE1/0/3.1 mode l2
     encapsulation dot1q vid 10
     bridge-domain 10
    #
    interface LoopBack0
     ip address 6.6.6.6 255.255.255.255
    #               
    interface Nve1  
     source 6.6.6.6 
     vni 10 head-end peer-list protocol bgp
    #
    bgp 100
     peer 5.5.5.5 as-number 100
     peer 5.5.5.5 connect-interface LoopBack0 
     #
     ipv4-family unicast
      peer 5.5.5.5 enable
     #
     l2vpn-family evpn
      policy vpn-target
      peer 5.5.5.5 enable
      peer 5.5.5.5 advertise irb
    #
    ospf 1
     area 0.0.0.0
      network 6.6.6.6 0.0.0.0
      network 192.168.20.0 0.0.0.255
    #
    return
  • Spine2的配置文件

    #
    sysname Spine2
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 192.168.30.1 255.255.255.0
    #
    interface 100GE1/0/2
     undo portswitch
     ip address 192.168.40.1 255.255.255.0
    #
    interface LoopBack0
     ip address 4.4.4.4 255.255.255.255
    #
    ospf 1
     area 0.0.0.0
      network 4.4.4.4 0.0.0.0
      network 192.168.30.0 0.0.0.255
      network 192.168.40.0 0.0.0.255
    #
    return
  • Leaf3的配置文件

    #
    sysname Leaf3
    #
    evpn-overlay enable
    #
    bridge-domain 10
     vxlan vni 10
     #
     evpn
      route-distinguisher 10:3
      vpn-target 22:2 export-extcommunity
      vpn-target 22:2 import-extcommunity
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 192.168.30.2 255.255.255.0
    #               
    interface 100GE1/0/2.1 mode l2
     encapsulation dot1q vid 10
     bridge-domain 10
    #
    interface 100GE1/0/3.1 mode l2
     encapsulation dot1q vid 10
     bridge-domain 10
    #
    interface LoopBack0
     ip address 7.7.7.7 255.255.255.255
    #               
    interface Nve1  
     source 7.7.7.7 
     vni 10 head-end peer-list protocol bgp
    #
    bgp 200
     peer 8.8.8.8 as-number 200
     peer 8.8.8.8 connect-interface LoopBack0
     #
     ipv4-family unicast
      peer 8.8.8.8 enable
     #
     l2vpn-family evpn
      policy vpn-target
      peer 8.8.8.8 enable
      peer 8.8.8.8 advertise irb
    #
    ospf 1
      area 0.0.0.0
      network 7.7.7.7 0.0.0.0
      network 192.168.30.0 0.0.0.255
    #
    return
  • Leaf4的配置文件

    #
    sysname Leaf4
    #
    evpn-overlay enable
    #
    bridge-domain 10
     vxlan vni 10
     #
     evpn
      route-distinguisher 10:4
      vpn-target 22:2 export-extcommunity
      vpn-target 22:2 import-extcommunity
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 192.168.40.2 255.255.255.0
    #
    interface 100GE1/0/2.1 mode l2
     encapsulation dot1q vid 10
     bridge-domain 10
    #
    interface LoopBack0
     ip address 8.8.8.8 255.255.255.255
    #
    interface Nve1
     source 8.8.8.8
     vni 10 head-end peer-list protocol bgp
    #
    bgp 200 
     peer 7.7.7.7 as-number 200
     peer 7.7.7.7 connect-interface LoopBack0
     #
     ipv4-family unicast
      peer 7.7.7.7 enable
     # 
     l2vpn-family evpn
      policy vpn-target
      peer 7.7.7.7 enable
      peer 7.7.7.7 advertise irb
    #
    ospf 1
     area 0.0.0.0
      network 8.8.8.8 0.0.0.0
      network 192.168.40.0 0.0.0.255
    #
    return
  • DCI-VTEP1的配置文件
    #
    sysname DCI-VTEP1
    #
    evpn-overlay enable
    #
    bridge-domain 10
     vxlan vni 10
     #
     evpn
      route-distinguisher 10:5
      vpn-target 33:3 export-extcommunity
      vpn-target 33:3 import-extcommunity
    #               
    interface 100GE1/0/1
     undo portswitch
     ip address 192.168.50.2 255.255.255.0
    #               
    interface 100GE1/0/2.1 mode l2
     encapsulation dot1q vid 10
     bridge-domain 10
    #               
    interface LoopBack0
     ip address 9.9.9.9 255.255.255.255
    #               
    interface Nve1  
     source 9.9.9.9 
     vni 10 head-end peer-list protocol bgp
    #               
    bgp 100
     peer 10.10.10.10 as-number 200
     peer 10.10.10.10 connect-interface LoopBack0
     peer 10.10.10.10 ebgp-max-hop 255
     #
     ipv4-family unicast
      peer 10.10.10.10 enable
     #
     l2vpn-family evpn
      policy vpn-target
      peer 10.10.10.10 enable
      peer 10.10.10.10 advertise irb
    #
    ospf 1
     area 0.0.0.0
      network 9.9.9.9 0.0.0.0
      network 192.168.50.0 0.0.0.255
    #
    return
  • DCI-VTEP2的配置文件
    #
    sysname DCI-VTEP2
    #
    evpn-overlay enable
    #
    bridge-domain 10
     vxlan vni 10
     #
     evpn
      route-distinguisher 11:6
      vpn-target 33:3 export-extcommunity
      vpn-target 33:3 import-extcommunity
    #               
    interface 100GE1/0/1
     undo portswitch
     ip address 192.168.60.2 255.255.255.0
    #               
    interface 100GE1/0/2.1 mode l2
     encapsulation dot1q vid 10
     bridge-domain 10
    #               
    interface LoopBack0
     ip address 10.10.10.10 255.255.255.255
    #               
    interface Nve1  
     source 10.10.10.10 
     vni 10 head-end peer-list protocol bgp
    #               
    bgp 200
     peer 9.9.9.9 as-number 100
     peer 9.9.9.9 connect-interface LoopBack0
     peer 9.9.9.9 ebgp-max-hop 255
     #
     ipv4-family unicast
      peer 9.9.9.9 enable
     #
     l2vpn-family evpn
      policy vpn-target
      peer 9.9.9.9 enable
      peer 9.9.9.9 advertise irb
    #
    ospf 1
     area 0.0.0.0
      network 10.10.10.10 0.0.0.0
      network 192.168.60.0 0.0.0.255
    #
    return
  • Device1的配置文件

    #
    sysname Device1
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 192.168.50.1 255.255.255.0
    #
    interface 100GE1/0/2
     undo portswitch
     ip address 192.168.1.1 255.255.255.0
    #
    interface LoopBack0
     ip address 1.1.1.1 255.255.255.255
    #
    ospf 1
     area 0.0.0.0
      network 1.1.1.1 0.0.0.0
      network 192.168.1.0 0.0.0.255
      network 192.168.50.0 0.0.0.255
    #
    return
  • Device2的配置文件

    #
    sysname Device2
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 192.168.60.1 255.255.255.0
    #
    interface 100GE1/0/2
     undo portswitch
     ip address 192.168.1.2 255.255.255.0
    #
    interface LoopBack0
     ip address 2.2.2.2 255.255.255.255
    #
    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
      network 192.168.60.0 0.0.0.255
    #
    return
上一篇 对端GRE地址ping不通
下一篇 Apache 虚拟主机账号密码访问权限设置方法