配置三段式VXLAN实现三层互通示例
通过配置三段式VXLAN隧道,实现不同数据中心的VM之间三层互通。
组网需求
如图16-23所示,数据中心A和数据中心B规划在不同的BGP AS域,在数据中心内部配置BGP EVPN协议创建分布式网关VXLAN隧道,实现同一数据中心VMa1和VMa2之间的互通、VMb1和VMb2之间的互相通信,通过在Leaf2和Leaf3之间配置BGP EVPN协议创建VXLAN隧道,实现数据中心A和数据中心B之间的互相通信(例如VMa1和VMb2之间互相通信)。
设备 |
接口 |
IP地址 |
设备 |
接口 |
IP地址 |
---|---|---|---|---|---|
Device1 |
GE 0/1/0 |
192.168.50.1/24 |
Device2 |
GE 0/1/0 |
192.168.60.1/24 |
GE 0/2/0 |
192.168.1.1/24 |
GE 0/2/0 |
192.168.1.2/24 |
||
LoopBack1 |
1.1.1.1/32 |
LoopBack1 |
2.2.2.2/32 |
||
Spine1 |
GE 0/1/0 |
192.168.10.1/24 |
Spine2 |
GE 0/1/0 |
192.168.30.1/24 |
GE 0/2/0 |
192.168.20.1/24 |
GE 0/2/0 |
192.168.40.1/24 |
||
LoopBack1 |
3.3.3.3/32 |
LoopBack1 |
4.4.4.4/32 |
||
Leaf1 |
GE 0/1/0 |
192.168.10.2/24 |
Leaf4 |
GE 0/1/0 |
192.168.40.2/24 |
GE 0/2/0 |
- |
GE 0/2/0 |
- |
||
LoopBack1 |
5.5.5.5/32 |
LoopBack1 |
8.8.8.8/32 |
||
Leaf2 |
GE 0/1/0 |
192.168.20.2/24 |
Leaf3 |
GE 0/1/0 |
192.168.30.2/24 |
GE 0/2/0 |
- |
GE 0/2/0 |
- |
||
GE 0/3/0 |
192.168.50.2/24 |
GE 0/3/0 |
192.168.60.2/24 |
||
LoopBack1 |
6.6.6.6/32 |
LoopBack1 |
7.7.7.7/32 |
配置思路
采用如下的思路配置跨AS的三段式VXLAN:
配置各节点IP地址。
配置IGP实现各节点之间的互通。
配置静态路由实现数据中心之间的互通。
在数据中心A和数据中心B内配置BGP EVPN协议创建分布式网关VXLAN隧道。
在Leaf2和Leaf3上配置BGP EVPN协议创建VXLAN隧道。
操作步骤
- 配置各节点接口的IP地址及Loopback接口的地址
具体配置过程请参考配置文件。
- 配置IGP,本示例使用OSPF
具体配置过程请参考配置文件。
- 配置静态路由实现数据中心之间的互通。
具体配置过程请参考配置文件。
- 数据中心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 00:11:01 4026531842 6.6.6.6 7.7.7.7 up dynamic 00:12:11
在Leaf上执行display ip routing-table vpn-instance vpn1命令可查看IP路由信息。以Leaf1的显示为例:
[~Leaf1] display ip routing-table vpn-instance vpn1
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : vpn1 Destinations : 8 Routes : 8 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.1 Vbdif10 10.1.1.1/32 Direct 0 0 D 127.0.0.1 Vbdif10 10.1.1.255/32 Direct 0 0 D 127.0.0.1 Vbdif10 10.20.1.0/24 IBGP 255 0 RD 6.6.6.6 VXLAN 10.30.1.0/24 IBGP 255 0 RD 6.6.6.6 VXLAN 10.40.1.0/24 IBGP 255 0 RD 6.6.6.6 VXLAN 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
配置完成后,VMa1和VMb2之间可以互相通信。
配置文件
Spine1的配置文件
# sysname Spine1 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.10.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown 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
Leaf1的配置文件
# sysname Leaf1 # evpn vpn-instance evrf1 bd-mode route-distinguisher 10:1 vpn-target 11:1 export-extcommunity vpn-target 11:1 import-extcommunity # ip vpn-instance vpn1 ipv4-family route-distinguisher 11:11 apply-label per-instance vpn-target 1:1 export-extcommunity vpn-target 11:1 export-extcommunity evpn vpn-target 1:1 import-extcommunity vpn-target 11:1 import-extcommunity evpn vxlan vni 5010 # bridge-domain 10 vxlan vni 10 split-horizon-mode evpn binding vpn-instance evrf1 # interface Vbdif10 ip binding vpn-instance vpn1 ip address 10.1.1.1 255.255.255.0 arp distribute-gateway enable arp collect host enable # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.10.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown # interface GigabitEthernet0/2/0.1 mode l2 encapsulation dot1q vid 10 rewrite pop single 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 peer 6.6.6.6 as-number 100 peer 6.6.6.6 connect-interface LoopBack1 # ipv4-family unicast undo synchronization peer 6.6.6.6 enable # ipv4-family vpn-instance vpn1 import-route direct advertise l2vpn evpn # l2vpn-family evpn undo policy vpn-target peer 6.6.6.6 enable peer 6.6.6.6 advertise irb peer 6.6.6.6 advertise encap-type vxlan # 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 vpn-instance evrf1 bd-mode route-distinguisher 10:1 vpn-target 11:1 export-extcommunity vpn-target 11:1 import-extcommunity # ip vpn-instance vpn1 ipv4-family route-distinguisher 11:11 apply-label per-instance vpn-target 1:1 export-extcommunity vpn-target 11:1 export-extcommunity evpn vpn-target 1:1 import-extcommunity vpn-target 11:1 import-extcommunity evpn vxlan vni 5010 # bridge-domain 20 vxlan vni 20 split-horizon-mode evpn binding vpn-instance evrf1 # interface Vbdif20 ip binding vpn-instance vpn1 ip address 10.20.1.1 255.255.255.0 arp distribute-gateway enable arp collect host enable # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.20.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown # interface GigabitEthernet0/2/0.1 mode l2 encapsulation dot1q vid 20 rewrite pop single bridge-domain 20 # interface GigabitEthernet0/3/0 undo shutdown 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 100 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 ebgp-max-hop 255 peer 7.7.7.7 connect-interface LoopBack1 # ipv4-family unicast undo synchronization peer 5.5.5.5 enable peer 7.7.7.7 enable # ipv4-family vpn-instance vpn1 import-route direct advertise l2vpn evpn # l2vpn-family evpn undo policy vpn-target peer 5.5.5.5 enable peer 5.5.5.5 advertise irb peer 5.5.5.5 advertise encap-type vxlan peer 5.5.5.5 import reoriginate 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 advertise encap-type vxlan peer 7.7.7.7 import reoriginate 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 # ip route-static 7.7.7.7 255.255.255.255 192.168.50.1 ip route-static 192.168.1.0 255.255.255.0 192.168.50.1 ip route-static 192.168.60.0 255.255.255.0 192.168.50.1 # return
Spine2的配置文件
# sysname Spine2 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.30.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown 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
Leaf3的配置文件
# sysname Leaf3 # evpn vpn-instance evrf1 bd-mode route-distinguisher 10:1 vpn-target 11:1 export-extcommunity vpn-target 11:1 import-extcommunity # ip vpn-instance vpn1 ipv4-family route-distinguisher 11:11 apply-label per-instance vpn-target 1:1 export-extcommunity vpn-target 11:1 export-extcommunity evpn vpn-target 1:1 import-extcommunity vpn-target 11:1 import-extcommunity evpn vxlan vni 5010 # bridge-domain 10 vxlan vni 10 split-horizon-mode evpn binding vpn-instance evrf1 # interface Vbdif10 ip binding vpn-instance vpn1 ip address 10.30.1.1 255.255.255.0 arp distribute-gateway enable arp collect host enable # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.30.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown # interface GigabitEthernet0/2/0.1 mode l2 encapsulation dot1q vid 10 rewrite pop single bridge-domain 10 # interface GigabitEthernet0/3/0 undo shutdown 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 200 peer 6.6.6.6 as-number 100 peer 6.6.6.6 ebgp-max-hop 255 peer 6.6.6.6 connect-interface LoopBack1 peer 8.8.8.8 as-number 200 peer 8.8.8.8 connect-interface LoopBack1 # ipv4-family unicast undo synchronization peer 6.6.6.6 enable peer 8.8.8.8 enable # ipv4-family vpn-instance vpn1 import-route direct advertise l2vpn evpn # l2vpn-family evpn undo policy vpn-target peer 6.6.6.6 enable peer 6.6.6.6 advertise irb peer 6.6.6.6 advertise encap-type vxlan peer 6.6.6.6 import reoriginate 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 advertise encap-type vxlan peer 8.8.8.8 import reoriginate 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 # ip route-static 6.6.6.6 255.255.255.255 192.168.60.1 ip route-static 192.168.1.0 255.255.255.0 192.168.60.1 ip route-static 192.168.50.0 255.255.255.0 192.168.60.1 # return
Leaf4的配置文件
# sysname Leaf4 # evpn vpn-instance evrf1 bd-mode route-distinguisher 10:1 vpn-target 11:1 export-extcommunity vpn-target 11:1 import-extcommunity # ip vpn-instance vpn1 ipv4-family route-distinguisher 11:11 apply-label per-instance vpn-target 1:1 export-extcommunity vpn-target 11:1 export-extcommunity evpn vpn-target 1:1 import-extcommunity vpn-target 11:1 import-extcommunity evpn vxlan vni 5010 # bridge-domain 20 vxlan vni 20 split-horizon-mode evpn binding vpn-instance evrf1 # interface Vbdif20 ip binding vpn-instance vpn1 ip address 10.40.1.1 255.255.255.0 arp distribute-gateway enable arp collect host enable # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.40.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown # interface GigabitEthernet0/2/0.1 mode l2 encapsulation dot1q vid 20 rewrite pop single 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 peer 7.7.7.7 as-number 200 peer 7.7.7.7 connect-interface LoopBack1 # ipv4-family unicast undo synchronization peer 7.7.7.7 enable # ipv4-family vpn-instance vpn1 import-route direct advertise l2vpn evpn # l2vpn-family evpn undo policy vpn-target peer 7.7.7.7 enable peer 7.7.7.7 advertise irb peer 7.7.7.7 advertise encap-type vxlan # 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
Device1的配置文件
# sysname Device1 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.50.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 192.168.1.1 255.255.255.0 # interface LoopBack1 ip address 1.1.1.1 255.255.255.255 # ip route-static 6.6.6.6 255.255.255.255 192.168.50.2 ip route-static 7.7.7.7 255.255.255.255 192.168.1.2 ip route-static 192.168.60.0 255.255.255.0 192.168.1.2 # return
Device2的配置文件
# sysname Device2 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.60.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 192.168.1.2 255.255.255.0 # interface LoopBack1 ip address 2.2.2.2 255.255.255.255 # ip route-static 6.6.6.6 255.255.255.255 192.168.1.1 ip route-static 7.7.7.7 255.255.255.255 192.168.60.2 ip route-static 192.168.50.0 255.255.255.0 192.168.1.1 # return