配置分布式网关部署方式的VXLAN示例(BGP EVPN方式)
通过典型的应用场景描述了如何配置VXLAN分布式网关示例。
组网需求
VXLAN分布式网关可解决VXLAN集中式网关的转发路径不优化、三层网关ARP表项规格瓶颈问题。
如图16-22所示,某企业在不同的数据中心中都拥有自己的VM,服务器1上的VM1属于VLAN 10,服务器2上的VM1属于VLAN 20,且位于不同网段。现需要通过VXLAN分布式网关实现不同数据中心相同VM的互通。
设备 |
接口 |
IP地址 |
---|---|---|
Device1 |
GigabitEthernet 0/1/0 |
192.168.3.2/24 |
GigabitEthernet 0/1/1 |
192.168.2.2/24 |
|
LoopBack0 |
1.1.1.1/32 |
|
Device2 |
GigabitEthernet 0/1/0 |
192.168.2.1/24 |
LoopBack0 |
2.2.2.2/32 |
|
Device3 |
GigabitEthernet 0/1/0 |
192.168.3.1/24 |
LoopBack0 |
3.3.3.3/32 |
配置思路
- 分别在Device1与Device2、Device3间配置IGP路由协议。
- 分别在Device2和Device3上配置业务接入点实现区分业务流量。
- 在Device2和Device3上建立与Device1之间的BGP EVPN对等体关系。
- 在Device1上建立与Device2和Device3之间的BGP EVPN对等体关系,并配置反射器功能。
- 在Device2和Device3上配置VPN实例和EVPN实例。
- 分别在Device2、Device3上使能头端复制功能。
- 在Device2、Device3上配置VXLAN三层网关。
- 在Device1与Device2、Device3之间配置BGP对邻居发布IRB类型的路由。
数据准备
为完成此配置例,需准备如下的数据:
- VM所属的VLAN ID分别是VLAN 10和VLAN 20。
- 网络中设备互连的接口IP地址。
- 广播域BD ID分别是BD 10和BD 20。
- VXLAN网络标识VNI ID分别是VNI 10和VNI 20。
- VPN实例下VXLAN网络标识VNI ID是VNI 5010。
操作步骤
- 配置IGP路由协议
按图16-22分别配置Device1、Device2和Device3各接口IP地址。
# 配置Device1。
<HUAWEI> system-view
[~HUAWEI] sysname Device1
[*HUAWEI] commit
[~Device1] isis 1
[*Device1-isis-1] network-entity 10.0000.0000.0001.00
[*Device1-isis-1] quit
[*Device1] commit
[~Device1] interface loopback 0
[*Device1-LoopBack0] ip address 1.1.1.1 32
[*Device1-LoopBack0] isis enable 1
[*Device1-LoopBack0] quit
[*Device1] interface GigabitEthernet0/1/0
[*Device1-GigabitEthernet0/1/0] ip address 192.168.3.2 24
[*Device1-GigabitEthernet0/1/0] isis enable 1
[*Device1-GigabitEthernet0/1/0] quit
[*Device1] interface GigabitEthernet0/1/1
[*Device1-GigabitEthernet0/1/1] ip address 192.168.2.2 24
[*Device1-GigabitEthernet0/1/1] isis enable 1
[*Device1-GigabitEthernet0/1/1] quit
[*Device1] commit
Device2、Device3的其他配置与Device1配置类似,这里不再赘述。具体配置过程略,请参考配置文件。
- 分别在Device2、Device3上配置业务接入点
# 配置Device2。
[~Device2] bridge-domain 10
[*Device2-bd10] quit
[*Device2] interface GigabitEthernet0/1/1.1 mode l2
[*Device2-GigabitEthernet0/1/1.1] encapsulation dot1q vid 10
[*Device2-GigabitEthernet0/1/1.1] rewrite pop single
[*Device2-GigabitEthernet0/1/1.1] bridge-domain 10
[*Device2-GigabitEthernet0/1/1.1] quit
[*Device2] commit
Device3的配置与Device2配置类似,这里不再赘述。具体配置过程略,请参考配置文件。
- 在Device2和Device3上建立与Device1之间的BGP EVPN对等体关系# 在Device2上配置BGP EVPN对等体关系。
[~Device2] bgp 100
[*Device2-bgp] peer 1.1.1.1 as-number 100
[*Device2-bgp] peer 1.1.1.1 connect-interface LoopBack0
[*Device2-bgp] l2vpn-family evpn
[*Device2-bgp-af-evpn] policy vpn-target
[*Device2-bgp-af-evpn] peer 1.1.1.1 enable
[*Device2-bgp-af-evpn] peer 1.1.1.1 advertise encap-type vxlan
[*Device2-bgp-af-evpn] quit
[*Device2-bgp] quit
[*Device2] commit
Device3的配置与Device2配置类似,这里不再赘述。具体配置过程略,请参考配置文件。
- 在Device1上建立与Device2和Device3之间的BGP EVPN对等体关系,并配置反射器功能,指定Device2和Device3作为反射器的客户机# 在Device1上配置BGP EVPN对等体关系。
[~Device1] bgp 100
[*Device1-bgp] peer 2.2.2.2 as-number 100
[*Device1-bgp] peer 2.2.2.2 connect-interface LoopBack0
[*Device1-bgp] peer 3.3.3.3 as-number 100
[*Device1-bgp] peer 3.3.3.3 connect-interface LoopBack0
[*Device1-bgp] l2vpn-family evpn
[*Device1-bgp-af-evpn] peer 2.2.2.2 enable
[*Device1-bgp-af-evpn] peer 2.2.2.2 advertise encap-type vxlan
[*Device1-bgp-af-evpn] peer 2.2.2.2 reflect-client
[*Device1-bgp-af-evpn] peer 3.3.3.3 enable
[*Device1-bgp-af-evpn] peer 3.3.3.3 advertise encap-type vxlan
[*Device1-bgp-af-evpn] peer 3.3.3.3 reflect-client
[*Device1-bgp-af-evpn] undo policy vpn-target
[*Device1-bgp-af-evpn] quit
[*Device1-bgp] quit
[*Device1] commit
- 在Device2和Device3上配置VPN实例和EVPN实例
# 配置Device2。
[~Device2] ip vpn-instance vpn1
[*Device2-vpn-instance-vpn1] vxlan vni 5010
[*Device2-vpn-instance-vpn1] ipv4-family
[*Device2-vpn-instance-vpn1-af-ipv4] route-distinguisher 11:11
[*Device2-vpn-instance-vpn1-af-ipv4] vpn-target 11:1 evpn
[*Device2-vpn-instance-vpn1-af-ipv4] quit
[*Device2-vpn-instance-vpn1] quit
[*Device2] evpn vpn-instance evrf3 bd-mode
[*Device2-evpn-instance-evrf3] route-distinguisher 10:1
[*Device2-evpn-instance-evrf3] vpn-target 11:1
[*Device2-evpn-instance-evrf3] quit
[*Device2] bridge-domain 10
[*Device2-bd10] vxlan vni 10 split-horizon-mode
[*Device2-bd10] evpn binding vpn-instance evrf3
[*Device2-bd10] quit
[*Device2] commit
Device3的配置与Device2配置类似,这里不再赘述。具体配置过程略,请参考配置文件。
- 分别在Device2、Device3上使能头端复制功能# 在Device2上使能头端复制功能。
[~Device2] interface nve 1
[*Device2-Nve1] source 2.2.2.2
[*Device2-Nve1] vni 10 head-end peer-list protocol bgp
[*Device2-Nve1] quit
[*Device2] commit
Device3的配置与Device2配置类似,这里不再赘述。具体配置过程略,请参考配置文件。
- 在Device2、Device3上配置VXLAN三层网关
# 配置Device2。
[~Device2] interface Vbdif10
[*Device2-Vbdif10] ip binding vpn-instance vpn1
[*Device2-Vbdif10] ip address 10.1.1.1 255.255.255.0
[*Device2-Vbdif10] arp distribute-gateway enable
[*Device2-Vbdif10] arp collect host enable
[*Device2-Vbdif10] quit
[*Device2] commit
Device3的配置与Device2配置类似,这里不再赘述,要注意Device2的Vbdif接口的IP地址要与Device3的属于不同网段。具体配置过程略,请参考配置文件。
- 在Device1与Device2、Device3之间配置BGP对邻居发布IRB类型的路由
# 配置Device1。
[~Device1] bgp 100
[~Device1-bgp] l2vpn-family evpn
[~Device1-bgp-af-evpn] peer 2.2.2.2 advertise irb
[*Device1-bgp-af-evpn] peer 3.3.3.3 advertise irb
[*Device1-bgp-af-evpn] quit
[*Device1-bgp] quit
[*Device1] commit
# 配置Device2。
[~Device2] bgp 100
[~Device2-bgp] l2vpn-family evpn
[~Device2-bgp-af-evpn] peer 1.1.1.1 advertise irb
[*Device2-bgp-af-evpn] quit
[*Device2-bgp] quit
[*Device2] commit
Device3的配置与Device2配置类似,这里不再赘述。具体配置过程略,请参考配置文件。
- 检查配置结果
上述配置成功后,在Device2、Device3上执行display vxlan tunnel命令可查看到VXLAN隧道的信息。以Device2显示为例。
[*Device2] display vxlan tunnel
Number of vxlan tunnel : 1 Tunnel ID Source Destination State Type Uptime -------------------------------------------------------------------- 4026531841 2.2.2.2 3.3.3.3 up dynamic 0026h29m
执行display bgp evpn all routing-table命令可查看EVPN路由信息。
[*Device2]display bgp evpn all routing-table Local AS number : 100 BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped, x - best external, a - add path, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete EVN address family: Number of Mac Routes: 2 Route Distinguisher: 10:1 Network(EthTagId/MacAddrLen/MacAddr/IpAddrLen/IpAddr) NextHop *> 0:48:00e0-fc00-0002:0:0.0.0.0 0.0.0.0 Route Distinguisher: 20:1 Network(EthTagId/MacAddrLen/MacAddr/IpAddrLen/IpAddr) NextHop *>i 0:48:00e0-fc00-0003:0:0.0.0.0 3.3.3.3 EVN address family: Number of Inclusive Multicast Routes: 2 Route Distinguisher: 10:1 Network(EthTagId/IpAddrLen/OriginalIp) NextHop *> 0:32:2.2.2.2 0.0.0.0 Route Distinguisher: 20:1 Network(EthTagId/IpAddrLen/OriginalIp) NextHop *>i 0:32:3.3.3.3 3.3.3.3
配置完成后,不同服务器中的VM1可以相互通信。可在分布式网关Device2上对Server2的VM1进行ping:
[~Device2] ping -vpn-instance vpn1 10.2.1.10 PING 10.2.1.10: 300 data bytes, press CTRL_C to break Reply from 10.2.1.10: bytes=300 Sequence=1 ttl=254 time=30 ms Reply from 10.2.1.10: bytes=300 Sequence=2 ttl=254 time=30 ms Reply from 10.2.1.10: bytes=300 Sequence=3 ttl=254 time=30 ms Reply from 10.2.1.10: bytes=300 Sequence=4 ttl=254 time=30 ms Reply from 10.2.1.10: bytes=300 Sequence=5 ttl=254 time=30 ms --- 10.2.1.10 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 30/30/30 ms
配置文件
Device1的配置文件
# sysname Device1 # isis 1 network-entity 10.0000.0000.0001.00 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.3.2 255.255.255.0 isis enable 1 # interface GigabitEthernet0/1/1 undo shutdown ip address 192.168.2.2 255.255.255.0 isis enable 1 # interface LoopBack0 ip address 1.1.1.1 255.255.255.255 isis enable 1 # bgp 100 peer 2.2.2.2 as-number 100 peer 2.2.2.2 connect-interface LoopBack0 peer 3.3.3.3 as-number 100 peer 3.3.3.3 connect-interface LoopBack0 # l2vpn-family evpn undo policy vpn-target peer 2.2.2.2 enable peer 2.2.2.2 advertise encap-type vxlan peer 2.2.2.2 advertise irb peer 2.2.2.2 reflect-client peer 3.3.3.3 enable peer 3.3.3.3 advertise encap-type vxlan peer 3.3.3.3 advertise irb peer 3.3.3.3 reflect-client # return
Device2的配置文件
# sysname Device2 # isis 1 network-entity 10.0000.0000.0002.00 # ip vpn-instance vpn1 ipv4-family route-distinguisher 11:11 apply-label per-instance vpn-target 11:1 export-extcommunity evpn vpn-target 11:1 import-extcommunity evpn vxlan vni 5010 # evpn vpn-instance evrf3 bd-mode route-distinguisher 10:1 vpn-target 11:1 export-extcommunity vpn-target 11:1 import-extcommunity # bridge-domain 10 vxlan vni 10 split-horizon-mode evpn binding vpn-instance evrf3 # interface Vbdif10 ip binding vpn-instance vpn1 ip address 10.1.1.1 255.255.255.0 arp collect host enable arp distribute-gateway enable # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.2.1 255.255.255.0 isis enable 1 # interface GigabitEthernet0/1/1.1 mode l2 encapsulation dot1q vid 10 rewrite pop single bridge-domain 10 # interface LoopBack0 ip address 2.2.2.2 255.255.255.255 isis enable 1 # interface Nve1 source 2.2.2.2 vni 10 head-end peer-list protocol bgp # bgp 100 peer 1.1.1.1 as-number 100 peer 1.1.1.1 connect-interface LoopBack0 # l2vpn-family evpn policy vpn-target peer 1.1.1.1 enable peer 1.1.1.1 advertise encap-type vxlan peer 1.1.1.1 advertise irb # return
Device3的配置文件
# sysname Device3 # isis 1 network-entity 10.0000.0000.0003.00 # ip vpn-instance vpn1 ipv4-family route-distinguisher 22:22 apply-label per-instance vpn-target 11:1 export-extcommunity evpn vpn-target 11:1 import-extcommunity evpn vxlan vni 5010 # evpn vpn-instance evrf3 bd-mode route-distinguisher 20:1 vpn-target 11:1 export-extcommunity vpn-target 11:1 import-extcommunity # bridge-domain 20 vxlan vni 20 split-horizon-mode evpn binding vpn-instance evrf3 # interface Vbdif20 ip binding vpn-instance vpn1 ip address 10.2.1.1 255.255.255.0 arp collect host enable arp distribute-gateway enable # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.3.1 255.255.255.0 isis enable 1 # interface GigabitEthernet0/1/1.1 mode l2 encapsulation dot1q vid 20 rewrite pop single bridge-domain 20 # interface LoopBack0 ip address 3.3.3.3 255.255.255.255 isis enable 1 # interface Nve1 source 3.3.3.3 vni 20 head-end peer-list protocol bgp # bgp 100 peer 1.1.1.1 as-number 100 peer 1.1.1.1 connect-interface LoopBack0 # l2vpn-family evpn policy vpn-target peer 1.1.1.1 enable peer 1.1.1.1 advertise encap-type vxlan peer 1.1.1.1 advertise irb # return