Multi-homing验证方案 —基于EVPN的高可靠方案
1 目标概述
本文主要描述在CX-N的云区组网中,通过EVPN Multi-homing的方案实现一台Server同时在多台交换机上挂载,提供all-active 冗余机制,实现负载均衡、故障收敛等功能。
2 方案拓扑
3 设备角色及地址规划
3.1 设备角色、ASN、管理IP地址规划
设备角色、BGP AS号、设备带外管理地址、环回口地址信息如下表:
3.2 带内管理网络业务IP地址表
带内管理网络互联地址信息入下表:
4 硬件与软件环境
4.1 硬件环境
4.2 软件环境
5 配置过程
5.1 Spine01交换机配置
sonic# configure terminal
#配置互联口
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# ip address 172.62.0.1/30
sonic(config-if-0/0)# interface ethernet 0/4
sonic(config-if-0/4)# ip address 172.62.0.5/30
sonic(config-if-0/4)# interface ethernet 0/8
sonic(config-if-0/8)# ip address 172.62.0.9/30
sonic(config-if-0/8)# interface ethernet 0/12
sonic(config-if-0/12)# ip address 172.62.0.13/30
sonic(config-if-0/12)# q
sonic(config)# interface loopback 0
sonic(config-loif-0)# ip address 172.61.0.9/32
sonic(config-loif-0)#exit
#配置BGP
sonic(config)# route-map FROM_BGP_PEER_V4 permit 65535
sonic(config-route-map)# q
sonic(config)# route-map DEFAULT_EVPN_ROUTE_MAP permit 15
sonic(config-route-map)# q
sonic(config)# router bgp 65209
sonic(config-router)# bgp router-id 172.61.0.9
sonic(config-router)# neighbor PEER_V4_EBGP peer-group
sonic(config-router)# neighbor 172.62.0.2 remote-as 65205
sonic(config-router)# neighbor 172.62.0.2 peer-group PEER_V4_EBGP
sonic(config-router)# neighbor 172.62.0.6 remote-as 65206
sonic(config-router)# neighbor 172.62.0.6 peer-group PEER_V4_EBGP
sonic(config-router)# neighbor 172.62.0.10 remote-as 65207
sonic(config-router)# neighbor 172.62.0.10 peer-group PEER_V4_EBGP
sonic(config-router)# neighbor 172.62.0.14 remote-as 65208
sonic(config-router)# neighbor 172.62.0.14 peer-group PEER_V4_EBGP
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# network 172.61.0.9/32
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 out
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# redistribute connected
sonic(config-router-af)#q
#配置EVPN
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# advertise-all-vni
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP out
sonic(config-router-af)#write
5.2 Spine02交换机配置
sonic# configure terminal
#配置互联口
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# ip address 172.62.0.17/30
sonic(config-if-0/0)# interface ethernet 0/4
sonic(config-if-0/4)# ip address 172.62.0.21/30
sonic(config-if-0/4)# interface ethernet 0/8
sonic(config-if-0/8)# ip address 172.62.0.25/30
sonic(config-if-0/8)# interface ethernet 0/12
sonic(config-if-0/12)# ip address 172.62.0.29/30
sonic(config-if-0/12)# q
sonic(config)# interface loopback 0
sonic(config-loif-0)# ip address 172.61.0.10/32
sonic(config-if-0/12)# exit
#配置BGP
sonic(config)# route-map FROM_BGP_PEER_V4 permit 65535
sonic(config-route-map)# q
sonic(config)# route-map DEFAULT_EVPN_ROUTE_MAP permit 15
sonic(config-route-map)# q
sonic(config)# router bgp 65210
sonic(config-router)# bgp router-id 172.61.0.10
sonic(config-router)# neighbor PEER_V4_EBGP peer-group
sonic(config-router)# neighbor 172.62.0.18 remote-as 65205
sonic(config-router)# neighbor 172.62.0.18 peer-group PEER_V4_EBGP
sonic(config-router)# neighbor 172.62.0.22 remote-as 65206
sonic(config-router)# neighbor 172.62.0.22 peer-group PEER_V4_EBGP
sonic(config-router)# neighbor 172.62.0.26 remote-as 65207
sonic(config-router)# neighbor 172.62.0.26 peer-group PEER_V4_EBGP
sonic(config-router)# neighbor 172.62.0.30 remote-as 65208
sonic(config-router)# neighbor 172.62.0.30 peer-group PEER_V4_EBGP
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# network 172.61.0.10/32
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 out
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# redistribute connected
sonic(config-router-af)#q
#配置EVPN
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# advertise-all-vni
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP out
sonic(config-router-af)#write
5.3 Leaf01交换机配置
sonic# configure terminal
sonic(config)# interface loopback 0
sonic(config-loif-0)# ip address 172.61.0.5/32
#配置互联口
sonic(config)# interface ethernet 0/48
sonic(config-if-0/48)# ip address 172.62.0.2/30
sonic(config-if-0/48)# interface ethernet 0/52
sonic(config-if-0/52)# ip address 172.62.0.18/30
sonic(config-if-0/52)# exit
#配置聚合口
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# exit
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# link-aggregation-group 5
sonic(config-if-0/0)# exit
sonic(config)# interface link-aggregation 6
sonic(config-lagif-6)# exit
sonic(config)# interface ethernet 0/1
sonic(config-if-0/1)# link-aggregation-group 6
sonic(config-if-0/1)# exit
sonic(config)# vlan 100
sonic(config-vlan-100)# vlan 200
sonic(config-vlan-200)# exit
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# switchport trunk vlan 100
sonic(config-lagif-5)# switchport trunk vlan 200
sonic(config-lagif-5)# lacp system-id 00:00:01:00:00:01
sonic(config-lagif-5)# exit
sonic(config)# interface link-aggregation 6
sonic(config-lagif-6)# switchport trunk vlan 100
sonic(config-lagif-6)# switchport trunk vlan 200
sonic(config-lagif-6)# lacp system-id 00:00:01:00:00:02
sonic(config-lagif-6)# exit
sonic(config)# vrf 123
sonic(config-vrf)# exit
sonic(config)# interface vlan 100
sonic(config-vlanif-100)# ip address 100.0.0.1/16
sonic(config-vlanif-100)# mac-address 00:11:22:33:44:55
sonic(config-vlanif-100)# vrf 123
sonic(config-vlanif-100)# interface vlan 200
sonic(config-vlanif-200)# ip address 200.0.0.1/16
sonic(config-vlanif-200)# mac-address 00:11:22:33:44:66
sonic(config-vlanif-200)# vrf 123
sonic(config-vlanif-200)# exit
#配置BGP
sonic(config)# route-map FROM_BGP_PEER_V4 permit 65535
sonic(config-route-map)# exit
sonic(config)# route-map DEFAULT_EVPN_ROUTE_MAP permit 15
sonic(config-route-map)# exit
sonic(config)# router bgp 65205
sonic(config-router)# bgp router-id 172.61.0.5
sonic(config-router)# neighbor PEER_V4_EBGP peer-group
sonic(config-router)# neighbor 172.62.0.1 remote-as 65209
sonic(config-router)# neighbor 172.62.0.1 peer-group PEER_V4_EBGP
sonic(config-router)# neighbor 172.62.0.17 remote-as 65210
sonic(config-router)# neighbor 172.62.0.17 peer-group PEER_V4_EBGP
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# network 172.61.0.5/32
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 out
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# redistribute connected
sonic(config-router-af)# exit
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# advertise-all-vni
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP out
sonic(config-router-af)#exit
sonic(config-router)#exit
#配置EVPN
sonic(config)# interface vxlan 0
sonic(config-vxlanif-0)# source 172.61.0.5
sonic(config-vxlanif-0)# exit
sonic(config)# vlan 100
sonic (config-vlan-100)# vni 100
sonic (config-vlan-100)# exit
sonic(config)# vlan 200
sonic (config-vlan-200)# vni 200
sonic (config-vlan-200)# exit
sonic(config)# vrf 123
sonic(config-vrf)# vni 1000
sonic(config-vrf)# exit
sonic(config)# evpn mh redirect-off
sonic(config)# evpn mh mac-holdtime 0
sonic(config)# evpn mh neigh-holdtime 0
sonic(config)# interface ethernet 0/48
sonic(config-if-0/48)# evpn mh uplink
sonic(config-if-0/48)# exit
sonic(config)# interface ethernet 0/52
sonic(config-if-0/52)# evpn mh uplink
sonic(config-if-0/52)# exit
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# evpn mh es-id 100
sonic(config-lagif-5)# evpn mh es-sys-mac 00:00:01:00:00:01
sonic(config-lagif-5)# interface link-aggregation 6
sonic(config-lagif-6)# evpn mh es-id 200
sonic(config-lagif-6)# evpn mh es-sys-mac 00:00:01:00:00:02
sonic(config-vrf)# write
sonic(config-vrf)# reload
5.4 Leaf02交换机配置
sonic# configure terminal
sonic(config)# interface loopback 0
sonic(config-loif-0)# ip address 172.61.0.6/32
#配置互联口
sonic(config)# interface ethernet 0/48
sonic(config-if-0/48)# ip address 172.62.0.6/30
sonic(config-if-0/48)# interface ethernet 0/52
sonic(config-if-0/52)# ip address 172.62.0.22/30
sonic(config-if-0/52)# exit
#配置聚合口
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# exit
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# link-aggregation-group 5
sonic(config-if-0/0)# exit
sonic(config)# interface link-aggregation 6
sonic(config-lagif-6)# exit
sonic(config)# interface ethernet 0/1
sonic(config-if-0/1)# link-aggregation-group 6
sonic(config-if-0/1)# exit
sonic(config)# vlan 100
sonic(config-vlan-100)# vlan 200
sonic(config-vlan-200)# exit
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# switchport trunk vlan 100
sonic(config-lagif-5)# switchport trunk vlan 200
sonic(config-lagif-5)# lacp system-id 00:00:01:00:00:01
sonic(config-lagif-5)# exit
sonic(config)# interface link-aggregation 6
sonic(config-lagif-6)# switchport trunk vlan 100
sonic(config-lagif-6)# switchport trunk vlan 200
sonic(config-lagif-6)# lacp system-id 00:00:01:00:00:02
sonic(config-lagif-6)# exit
sonic(config)# vrf 123
sonic(config-vrf)# exit
sonic(config)# interface vlan 100
sonic(config-vlanif-100)# ip address 100.0.0.1/16
sonic(config-vlanif-100)# mac-address 00:11:22:33:44:55
sonic(config-vlanif-100)# vrf 123
sonic(config-vlanif-100)# interface vlan 200
sonic(config-vlanif-200)# ip address 200.0.0.1/16
sonic(config-vlanif-200)# mac-address 00:11:22:33:44:66
sonic(config-vlanif-200)# vrf 123
sonic(config-vlanif-200)# exit
#配置BGP
sonic(config)# route-map FROM_BGP_PEER_V4 permit 65535
sonic(config-route-map)# exit
sonic(config)# route-map DEFAULT_EVPN_ROUTE_MAP permit 15
sonic(config-route-map)# exit
sonic(config)# router bgp 65206
sonic(config-router)# bgp router-id 172.61.0.6
sonic(config-router)# neighbor PEER_V4_EBGP peer-group
sonic(config-router)# neighbor 172.62.0.5 remote-as 65209
sonic(config-router)# neighbor 172.62.0.5 peer-group PEER_V4_EBGP
sonic(config-router)# neighbor 172.62.0.21 remote-as 65210
sonic(config-router)# neighbor 172.62.0.21 peer-group PEER_V4_EBGP
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# network 172.61.0.6/32
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 out
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# redistribute connected
sonic(config-router-af)# exit
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# advertise-all-vni
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP out
sonic(config-router-af)#exit
sonic(config-router)#exit
#配置EVPN
sonic(config)# interface vxlan 0
sonic(config-vxlanif-0)# source 172.61.0.6
sonic(config-vxlanif-0)# exit
sonic(config)# vlan 100
sonic (config-vlan-100)# vni 100
sonic (config-vlan-100)# exit
sonic(config)# vlan 200
sonic (config-vlan-200)# vni 200
sonic (config-vlan-200)# exit
sonic(config)# vrf 123
sonic(config-vrf)# vni 1000
sonic(config-vrf)# exit
sonic(config)# evpn mh redirect-off
sonic(config)# evpn mh mac-holdtime 0
sonic(config)# evpn mh neigh-holdtime 0
sonic(config)# interface ethernet 0/48
sonic(config-if-0/48)# evpn mh uplink
sonic(config-if-0/48)# exit
sonic(config)# interface ethernet 0/52
sonic(config-if-0/52)# evpn mh uplink
sonic(config-if-0/52)# exit
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# evpn mh es-id 100
sonic(config-lagif-5)# evpn mh es-sys-mac 00:00:01:00:00:01
sonic(config-lagif-5)# interface link-aggregation 6
sonic(config-lagif-6)# evpn mh es-id 200
sonic(config-lagif-6)# evpn mh es-sys-mac 00:00:01:00:00:02
sonic(config-vrf)# write
sonic(config-vrf)# reload
5.5 Leaf03交换机配置
sonic# configure terminal
sonic(config)# interface loopback 0
sonic(config-loif-0)# ip address 172.61.0.7/32
#配置互联口
sonic(config)# interface ethernet 0/48
sonic(config-if-0/48)# ip address 172.62.0.10/30
sonic(config-if-0/48)# interface ethernet 0/52
sonic(config-if-0/52)# ip address 172.62.0.26/30
sonic(config-if-0/52)# exit
#配置聚合口
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# exit
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# link-aggregation-group 5
sonic(config-if-0/0)# exit
sonic(config)# vlan 100
sonic(config-vlan-100)# exit
sonic(config)# vlan 200
sonic(config-vlan-200)# exit
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# switchport trunk vlan 100
sonic(config-lagif-5)# switchport trunk vlan 200
sonic(config-lagif-5)# lacp system-id 00:00:01:00:00:03
sonic(config-lagif-5)# exit
sonic(config)# vrf 124
sonic(config-vrf)# exit
sonic(config)# interface vlan 100
sonic(config-vlanif-100)# ip address 100.0.0.1/16
sonic(config-vlanif-100)# mac-address 00:11:22:33:44:55 # VLAN MAC
sonic(config-vlanif-100)# vrf 124
sonic(config-vlanif-100)# interface vlan 200
sonic(config-vlanif-200)# ip address 200.0.0.1/16
sonic(config-vlanif-200)# mac-address 00:11:22:33:44:66
sonic(config-vlanif-200)# vrf 124
sonic(config-vlanif-200)# exit
#配置BGP
sonic(config)# route-map FROM_BGP_PEER_V4 permit 65535
sonic(config-route-map)# exit
sonic(config)# route-map DEFAULT_EVPN_ROUTE_MAP permit 15
sonic(config-route-map)# exit
sonic(config)# router bgp 65207
sonic(config-router)# bgp router-id 172.61.0.7
sonic(config-router)# neighbor PEER_V4_EBGP peer-group
sonic(config-router)# neighbor 172.62.0.9 remote-as 65209
sonic(config-router)# neighbor 172.62.0.9 peer-group PEER_V4_EBGP
sonic(config-router)# neighbor 172.62.0.25 remote-as 65210
sonic(config-router)# neighbor 172.62.0.25 peer-group PEER_V4_EBGP
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# network 172.61.0.7/32
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 out
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# redistribute connected
sonic(config-router-af)# exit
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# advertise-all-vni
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP out
sonic(config-router-af)# exit
sonic(config-router)# exit
#配置EVPN
sonic(config)# interface vxlan 0
sonic(config-vxlanif-0)# source 172.61.0.7
sonic(config-vxlanif-0)# exit
sonic(config)# vlan 100
sonic (config-vlan-100)# vni 100
sonic (config-vlan-100)# exit
sonic(config)# vlan 200
sonic (config-vlan-200)# vni 200
sonic (config-vlan-200)# exit
sonic(config)# vrf 124
sonic(config-vrf)# vni 1000
sonic(config-vrf)# exit
sonic(config)# evpn mh redirect-off
sonic(config)# evpn mh mac-holdtime 0
sonic(config)# evpn mh neigh-holdtime 0
sonic(config)# interface ethernet 0/48
sonic(config-if-0/48)# evpn mh uplink
sonic(config-if-0/48)# exit
sonic(config)# interface ethernet 0/52
sonic(config-if-0/52)# evpn mh uplink
sonic(config-if-0/52)# exit
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# evpn mh es-id 300
sonic(config-lagif-5)# evpn mh es-sys-mac 00:00:01:00:00:03
sonic(config-vrf)# write
sonic(config-vrf)# reload
5.6 Leaf04交换机配置
sonic# configure terminal
sonic(config)# interface loopback 0
sonic(config-loif-0)# ip address 172.61.0.8/32
#配置互联口
sonic(config)# interface ethernet 0/48
sonic(config-if-0/48)# ip address 172.62.0.14/30
sonic(config-if-0/48)# interface ethernet 0/52
sonic(config-if-0/52)# ip address 172.62.0.30/30
sonic(config-if-0/52)# exit
#配置聚合口
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# exit
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# link-aggregation-group 5
sonic(config-if-0/0)# exit
sonic(config)# vlan 100
sonic(config-vlan-100)# exit
sonic(config)# vlan 200
sonic(config-vlan-200)# exit
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# switchport trunk vlan 100
sonic(config-lagif-5)# switchport trunk vlan 200
sonic(config-lagif-5)# lacp system-id 00:00:01:00:00:03
sonic(config-lagif-5)# exit
sonic(config)# vrf 124
sonic(config-vrf)# exit
sonic(config)# interface vlan 100
sonic(config-vlanif-100)# ip address 100.0.0.1/16
sonic(config-vlanif-100)# mac-address 00:11:22:33:44:55
sonic(config-vlanif-100)# vrf 124
sonic(config-vlanif-100)# interface vlan 200
sonic(config-vlanif-200)# ip address 200.0.0.1/16
sonic(config-vlanif-200)# mac-address 00:11:22:33:44:66
sonic(config-vlanif-200)# vrf 124
sonic(config-vlanif-200)# exit
#配置BGP
sonic(config)# route-map FROM_BGP_PEER_V4 permit 65535
sonic(config-route-map)# exit
sonic(config)# route-map DEFAULT_EVPN_ROUTE_MAP permit 15
sonic(config-route-map)# exit
sonic(config)# router bgp 65208
sonic(config-router)# bgp router-id 172.61.0.8
sonic(config-router)# neighbor PEER_V4_EBGP peer-group
sonic(config-router)# neighbor 172.62.0.13 remote-as 65209
sonic(config-router)# neighbor 172.62.0.13 peer-group PEER_V4_EBGP
sonic(config-router)# neighbor 172.62.0.29 remote-as 65210
sonic(config-router)# neighbor 172.62.0.29 peer-group PEER_V4_EBGP
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# network 172.61.0.8/32
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map FROM_BGP_PEER_V4 out
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# redistribute connected
sonic(config-router-af)# exit
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# advertise-all-vni
sonic(config-router-af)# neighbor PEER_V4_EBGP activate
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP in
sonic(config-router-af)# neighbor PEER_V4_EBGP route-map DEFAULT_EVPN_ROUTE_MAP out
sonic(config-router-af)# exit
sonic(config-router)# exit
#配置EVPN
sonic(config)# interface vxlan 0
sonic(config-vxlanif-0)# source 172.61.0.8
sonic(config-vxlanif-0)# exit
sonic(config)# vlan 100
sonic (config-vlan-100)# vni 100
sonic (config-vlan-100)# exit
sonic(config)# vlan 200
sonic (config-vlan-200)# vni 200
sonic (config-vlan-200)# exit
sonic(config)# vrf 124
sonic(config-vrf)# vni 1000
sonic(config-vrf)# exit
sonic(config)# evpn mh redirect-off
sonic(config)# evpn mh mac-holdtime 0
sonic(config)# evpn mh neigh-holdtime 0
sonic(config)# interface ethernet 0/48
sonic(config-if-0/48)# evpn mh uplink
sonic(config-if-0/48)# exit
sonic(config)# interface ethernet 0/52
sonic(config-if-0/52)# evpn mh uplink
sonic(config-if-0/52)# exit
sonic(config)# interface link-aggregation 5
sonic(config-lagif-5)# evpn mh es-id 300
sonic(config-lagif-5)# evpn mh es-sys-mac 00:00:01:00:00:03
sonic(config-vrf)# write
sonic(config-vrf)# reload
5.7 Server1及虚机配置
#配置bond0为hash模式
[root@Sever1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
USERCTL=yes
BONDING_OPTS="miimon=100 mode=4 lacp_rate=fast xmit_hash_policy=layer3+4 fail_over_mac=1 "
MASTER=yes
[root@Sever1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens1f0
DEVICE="ens1f0"
BOOTPROTO=none
ONBOOT="yes"
MASTER=bond0
SLAVE=yes
[root@Sever1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens1f1
DEVICE="ens1f1"
BOOTPROTO=none
ONBOOT="yes"
MASTER=bond0
SLAVE=yes
#重新加载bonding模块,重启网络
#添加并绑定网桥
brctl addbr br0
brctl addif br0 bond0
ifconfig br0 up
#启动虚机
virt-install --name VM1 --ram 2048 --vcpus 2 \
--disk path=/opt/CentOS-7-x86_64-GenericCloud.qcow2,size=10,format=qcow2 --accelerate \
--vnc --vncport=5911 --vnclisten=0.0.0.0 \
--network bridge=br0,model=virtio \
--import \
--noautoconsole
#进入虚机,创建Vlan接口及配置IP
ip link add link eth0 name eth0.100 type vlan id 100
ip link add link eth0 name eth0.200 type vlan id 200
ip addr add 100.0.0.2/24 dev eth0.100
ip addr add 200.0.0.2/24 dev eth0.200
ip link set dev eth0.100 up
ip link set dev eth0.200 up
ifconfig eth0.100 hw ether 52:54:00:34:c8:d9
ifconfig eth0.200 hw ether 52:54:00:34:c8:d0
5.8 Server2及虚机配置
#配置bond0为hash模式
[root@Sever2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
USERCTL=yes
BONDING_OPTS="miimon=100 mode=4 lacp_rate=fast xmit_hash_policy=layer3+4 fail_over_mac=1 "
MASTER=yes
[root@Sever2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-
DEVICE="enp2s0f0"
BOOTPROTO=none
ONBOOT="yes"
MASTER=bond0
SLAVE=yes
[root@Sever2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s0f1
DEVICE="enp2s0f1"
BOOTPROTO=none
ONBOOT="yes"
MASTER=bond0
SLAVE=yes
#重新加载bonding模块,重启网络
#添加并绑定网桥
brctl addbr br0
brctl addif br0 bond0
ifconfig br0 up
#启动虚机
virt-install --name VM1 --ram 2048 --vcpus 2 \
--disk path=/opt/CentOS-7-x86_64-GenericCloud.qcow2,size=10,format=qcow2 --accelerate \
--vnc --vncport=5911 --vnclisten=0.0.0.0 \
--network bridge=br0,model=virtio \
--import \
--noautoconsole
#进入虚机,创建Vlan接口及配置IP
ip link add link eth0 name eth0.100 type vlan id 100
ip link add link eth0 name eth0.200 type vlan id 200
ip addr add 100.0.0.3/24 dev eth0.100
ip addr add 200.0.0.3/24 dev eth0.200
ip link set dev eth0.100 up
ip link set dev eth0.200 up
5.9 Server3及虚机配置
#配置bond0为hash模式
[root@Sever3 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
USERCTL=yes
BONDING_OPTS="miimon=100 mode=4 lacp_rate=fast xmit_hash_policy=layer3+4 fail_over_mac=1 "
MASTER=yes
[root@Sever3 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s0f0
DEVICE="enp2s0f0"
BOOTPROTO=none
ONBOOT="yes"
MASTER=bond0
SLAVE=yes
[root@Sever3 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s0f1
DEVICE="enp2s0f1"
BOOTPROTO=none
ONBOOT="yes"
MASTER=bond0
SLAVE=yes
#重新加载bonding模块,重启网络
#添加并绑定网桥
brctl addbr br0
brctl addif br0 bond0
ifconfig br0 up
#启动虚机
virt-install --name VM1 --ram 2048 --vcpus 2 \
--disk path=/opt/CentOS-7-x86_64-GenericCloud.qcow2,size=10,format=qcow2 --accelerate \
--vnc --vncport=5911 --vnclisten=0.0.0.0 \
--network bridge=br0,model=virtio \
--import \
--noautoconsole
#进入虚机,创建Vlan接口及配置IP
ip link add link eth0 name eth0.100 type vlan id 100
ip link add link eth0 name eth0.200 type vlan id 200
ip addr add 100.0.0.4/24 dev eth0.100
ip addr add 200.0.0.4/24 dev eth0.200
ip link set dev eth0.100 up
ip link set dev eth0.200 up
6 查看BGP状态
6.1 Leaf01 BGP状态
6.2 Leaf02 BGP状态
6.3 Leaf03 BGP状态
6.4 Leaf04 BGP状态
6.5 Spine01 BGP状态
6.6 Spine02 BGP状态
7 查看聚合状态
7.1 Leaf01聚合状态
7.2 Leaf02聚合状态
7.3 Leaf03 聚合状态
7.4 Leaf04 聚合状态
8 查看VxLAN隧道状态
8.1 Leaf01状态
8.2 Leaf02状态
8.3 Leaf03 状态
8.4 Leaf04 状态
9 查看EVPN MH状态
9.1 Leaf01状态
9.2 Leaf02状态
9.3 Leaf03 状态
9.4 Leaf04 状态
10 虚机互相访问
Server1上的虚机访问Server2的虚机
Server1上的虚机访问Server3的虚机
Server2上的虚机访问Server3的虚机
11 故障测试
Server1上的虚机持续访问Server3的虚机,中间断开Server1和Leaf1的链路,然后再恢复,观察流量是否有中断。
观察到流量始终没有丢包。
Server1上的虚机持续访问Server3的虚机,中间重启Leaf,然后再恢复,观察流量是否有中断。
在Server1上抓包,可以看到ping包从ens1f1发出,从ens1f0回复
ens1f0对应Leaf1,ens1f1对应的是Leaf2,那我们重启Leaf2,收发包应该都切到Leaf1,到ens1f0
并且中间没有丢包