配置跨AS的Segment VXLAN实现三层互通
组网需求
如图1所示,数据中心A和数据中心B规划在不同的BGP AS域,在数据中心内部配置BGP EVPN协议创建分布式网关VXLAN隧道,实现同一数据中心VMa1和VMa2之间、VMb1和VMb2之间的互相通信,通过在Leaf2和Leaf3之间配置BGP EVPN协议创建VXLAN隧道,实现数据中心A和数据中心B之间的互相通信(例如VMa1和VMb2之间互相通信)。
本例中interface1、interface2和interface3分别代表100GE1/0/1、100GE1/0/2、100GE1/0/3。

|
设备 |
接口 |
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 |
||
|
LoopBack1 |
1.1.1.1/32 |
LoopBack1 |
2.2.2.2/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 |
||
|
LoopBack1 |
3.3.3.3/32 |
LoopBack1 |
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 |
- |
||
|
LoopBack1 |
5.5.5.5/32 |
LoopBack1 |
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 |
192.168.50.2/24 |
100GE1/0/3 |
192.168.60.2/24 |
||
|
LoopBack1 |
6.6.6.6/32 |
LoopBack1 |
7.7.7.7/32 |
操作步骤
- 配置各节点接口的IP地址。
# 配置Device1。其他设备的配置过程与Device1类似,在此不再赘述,具体请参考配置脚本。
<HUAWEI> system-view [~HUAWEI] sysname Device1 [*HUAWEI] commit [~Device1] interface loopback 1 [*Device1-LoopBack1] ip address 1.1.1.1 32 [*Device1-LoopBack1] 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
- 配置路由协议,实现各节点之间的互通。
# 配置Spine1。Spine2、Leaf1、Leaf4的配置过程与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
# 配置Leaf2。Leaf3、Device1、Device2的配置过程与Leaf2类似,在此不再赘述,具体请参考配置脚本。
<HUAWEI> system-view [~HUAWEI] sysname Leaf2 [*HUAWEI] commit [~Leaf2] ospf 1 [*Leaf2-ospf-1] area 0 [*Leaf2-ospf-1-area-0.0.0.0] network 6.6.6.6 0.0.0.0 [*Leaf2-ospf-1-area-0.0.0.0] network 192.168.20.0 0.0.0.255 [*Leaf2-ospf-1-area-0.0.0.0] quit [*Leaf2-ospf-1] quit [*Leaf2] bgp 20 [*Leaf2-bgp] peer 192.168.50.1 as-number 10 [*Leaf2-bgp] ipv4-family unicast [*Leaf2-bgp-af-ipv4] network 6.6.6.6 255.255.255.255 [*Leaf2-bgp-af-ipv4] peer 192.168.50.1 enable [*Leaf2-bgp-af-ipv4] quit [*Leaf2-bgp] quit [*Leaf2] commit
- 数据中心A和数据中心B内配置BGP EVPN方式建立VXLAN隧道。
- 在Leaf2和Leaf3上配置BGP EVPN协议创建VXLAN隧道。
检查配置结果
在Leaf上执行display vxlan tunnel命令,可查看到VXLAN隧道的信息。以Leaf2显示为例。
[~Leaf2] display vxlan tunnel
Number of vxlan tunnel : 2
Tunnel ID Source Destination State Type Uptime
-----------------------------------------------------------------------------------
4026531841 6.6.6.6 5.5.5.5 up dynamic 0035h21m
4026531842 6.6.6.6 7.7.7.7 up dynamic 0035h25m
配置完成后,VMa1和VMb2之间可以互相通信。
配置脚本
-
# 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 LoopBack1 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
-
# sysname Leaf1 # evpn-overlay enable # ip vpn-instance vpn1 ipv4-family route-distinguisher 20:1 vpn-target 100:5010 export-extcommunity evpn vpn-target 100:5010 import-extcommunity evpn vxlan vni 5010 # bridge-domain 10 vxlan vni 10 # evpn route-distinguisher 10:1 vpn-target 100:10 export-extcommunity vpn-target 100:5010 export-extcommunity vpn-target 100:10 import-extcommunity # interface Vbdif10 ip binding vpn-instance vpn1 ip address 10.10.1.1 255.255.255.0 vxlan anycast-gateway enable arp collect host enable # 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 LoopBack1 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 instance evpn1 peer 6.6.6.6 as-number 100 peer 6.6.6.6 connect-interface LoopBack1 # 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
-
# sysname Leaf2 # evpn-overlay enable # ip vpn-instance vpn1 ipv4-family route-distinguisher 20:2 vpn-target 100:5010 export-extcommunity evpn vpn-target 300:5010 export-extcommunity evpn vpn-target 100:5010 import-extcommunity evpn vpn-target 300:5010 import-extcommunity evpn vxlan vni 5010 # bridge-domain 20 vxlan vni 20 # evpn route-distinguisher 10:2 vpn-target 100:20 export-extcommunity vpn-target 100:5010 export-extcommunity vpn-target 300:5010 export-extcommunity vpn-target 100:20 import-extcommunity # interface Vbdif20 ip binding vpn-instance vpn1 ip address 10.20.1.1 255.255.255.0 vxlan anycast-gateway enable arp collect host enable # 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 20 bridge-domain 20 # interface 100GE1/0/3 undo portswitch ip address 192.168.50.2 255.255.255.0 # interface LoopBack1 ip address 6.6.6.6 255.255.255.255 # interface Nve1 source 6.6.6.6 vni 20 head-end peer-list protocol bgp # bgp 20 peer 192.168.50.1 as-number 10 # ipv4-family unicast network 6.6.6.6 255.255.255.255 peer 192.168.50.1 enable # bgp 100 instance evpn1 peer 5.5.5.5 as-number 100 peer 5.5.5.5 connect-interface LoopBack1 peer 7.7.7.7 as-number 200 peer 7.7.7.7 connect-interface LoopBack1 peer 7.7.7.7 ebgp-max-hop 255 # l2vpn-family evpn policy vpn-target peer 5.5.5.5 enable peer 5.5.5.5 advertise irb peer 5.5.5.5 import reoriginate peer 5.5.5.5 advertise route-reoriginated evpn mac-ip peer 5.5.5.5 advertise route-reoriginated evpn ip peer 7.7.7.7 enable peer 7.7.7.7 advertise irb peer 7.7.7.7 import reoriginate peer 7.7.7.7 advertise route-reoriginated evpn mac-ip peer 7.7.7.7 advertise route-reoriginated evpn ip # 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
-
# 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 LoopBack1 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
-
# sysname Leaf3 # evpn-overlay enable # ip vpn-instance vpn1 ipv4-family route-distinguisher 20:3 vpn-target 200:5010 export-extcommunity evpn vpn-target 300:5010 export-extcommunity evpn vpn-target 200:5010 import-extcommunity evpn vpn-target 300:5010 import-extcommunity evpn vxlan vni 5010 # bridge-domain 10 vxlan vni 10 # evpn route-distinguisher 10:3 vpn-target 200:10 export-extcommunity vpn-target 200:5010 export-extcommunity vpn-target 300:5010 export-extcommunity vpn-target 200:10 import-extcommunity # interface Vbdif10 ip binding vpn-instance vpn1 ip address 10.30.1.1 255.255.255.0 vxlan anycast-gateway enable arp collect host enable # 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 undo portswitch ip address 192.168.60.2 255.255.255.0 # interface LoopBack1 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 30 peer 192.168.60.1 as-number 10 # ipv4-family unicast network 7.7.7.7 255.255.255.255 peer 192.168.60.1 enable # bgp 200 instance evpn1 peer 6.6.6.6 as-number 100 peer 6.6.6.6 connect-interface LoopBack1 peer 6.6.6.6 ebgp-max-hop 255 peer 8.8.8.8 as-number 200 peer 8.8.8.8 connect-interface LoopBack1 # l2vpn-family evpn policy vpn-target peer 6.6.6.6 enable peer 6.6.6.6 advertise irb peer 6.6.6.6 import reoriginate peer 6.6.6.6 advertise route-reoriginated evpn mac-ip peer 6.6.6.6 advertise route-reoriginated evpn ip peer 8.8.8.8 enable peer 8.8.8.8 advertise irb peer 8.8.8.8 import reoriginate peer 8.8.8.8 advertise route-reoriginated evpn mac-ip peer 8.8.8.8 advertise route-reoriginated evpn ip # 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
-
# sysname Leaf4 # evpn-overlay enable # ip vpn-instance vpn1 ipv4-family route-distinguisher 20:4 vpn-target 200:5010 export-extcommunity evpn vpn-target 200:5010 import-extcommunity evpn vxlan vni 5010 # bridge-domain 20 vxlan vni 20 # evpn route-distinguisher 10:4 vpn-target 200:20 export-extcommunity vpn-target 200:5010 export-extcommunity vpn-target 200:20 import-extcommunity # interface Vbdif20 ip binding vpn-instance vpn1 ip address 10.40.1.1 255.255.255.0 vxlan anycast-gateway enable arp collect host enable # 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 20 bridge-domain 20 # interface LoopBack1 ip address 8.8.8.8 255.255.255.255 # interface Nve1 source 8.8.8.8 vni 20 head-end peer-list protocol bgp # bgp 200 instance evpn1 peer 7.7.7.7 as-number 200 peer 7.7.7.7 connect-interface LoopBack1 # 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
-
# 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 LoopBack1 ip address 1.1.1.1 255.255.255.255 # bgp 10 peer 192.168.1.2 as-number 10 peer 192.168.50.2 as-number 20 # ipv4-family unicast peer 192.168.1.2 enable peer 192.168.1.2 next-hop-local peer 192.168.50.2 enable # return
-
# 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 LoopBack1 ip address 2.2.2.2 255.255.255.255 # bgp 10 peer 192.168.1.1 as-number 10 peer 192.168.60.2 as-number 30 # ipv4-family unicast peer 192.168.1.1 enable peer 192.168.1.1 next-hop-local peer 192.168.60.2 enable # return