基于EVPN的VxLAN实验
基于EVPN的VxLAN实验
来源 https://www.jianshu.com/p/5d2518e1dabd
参考 https://support.cloudmylab.com/portal/en/kb/articles/vxlan-lab-on-eve-ng
参考 https://www.cisco.com/c/dam/global/zh_cn/products/collateral/switches/nexus-9000-series-switches/guide-c07-734107.pdf
VxLAN是一种overlay技术,将二层以太网帧封装在UDP报文里面,穿过骨干三层underlay IP网络,VxLAN的24 bytes的VNID,使得现有的二层网络得到了很好的扩展,尤其是在云计算大数据时代,是主流的大二层组网方案。VxLAN有两种实现方式:
- 基于组播的VxLAN,它是一种数据驱动式的泛洪与学习(driven flood-&-learn),没有控制面,通过组播来传送VxLAN BUM流量(Broadcast, Unknown Unicast and Multicast)
- 以EVPN作为控制面的VxLAN,EVPN通过MP-BGP来自动发现和认证VTEP邻居,通过MP-BGP来通告主机MAC/IP地址
实验拓扑:构造如下拓扑,来进行以EVPN作为控制面的VxLAN的实验。
实验目的:验证同一VxLAN以及不同VxLAN中的主机可以互通。
实验环境:本实验使用EVE-NG来模拟,VTEP-1/2,和RR均使用NXOS,镜像版本如下
Used images for lab:
nxosv9k-7.0.3.I7.1, x4CPU, 8Gb RAM each
IOL L3 15.4.2T Routers
vIOS L2 15.2 Switches
VPCS VMs
实验步骤:
第一步:完成基本配置,实现同一VxLAN下主机的互通
配置VTEP-1
VTEP-1# show running-config
nv overlay evpn
feature ospf
feature bgp
feature pim
feature interface-vlan
feature vn-segment-vlan-based
feature nv overlay
ip pim rp-address 100.100.100.3 group-list 224.0.0.0/4
ip pim ssm range 232.0.0.0/8
vlan 1,200,210
vlan 200
vn-segment 20000
vlan 210
vn-segment 20010
interface nve1
no shutdown
host-reachability protocol bgp
source-interface loopback0
member vni 20000
mcast-group 230.1.1.1
member vni 20010
mcast-group 230.1.1.2
interface Ethernet1/1
switchport mode trunk
switchport trunk allowed vlan 200,210
interface Ethernet1/2
no switchport
ip address 20.1.1.2/24
ip router ospf 1 area 0.0.0.0
ip pim sparse-mode
no shutdown
interface loopback0
ip address 100.100.100.1/32
ip router ospf 1 area 0.0.0.0
ip pim sparse-mode
router ospf 1
router-id 100.100.100.1
router bgp 100
router-id 100.100.100.1
log-neighbor-changes
address-family ipv4 unicast
address-family l2vpn evpn
neighbor 100.100.100.3
remote-as 100
update-source loopback0
address-family ipv4 unicast
address-family l2vpn evpn
send-community extended
evpn
vni 20000 l2
rd auto
route-target import auto
route-target export auto
vni 20010 l2
rd auto
route-target import auto
route-target export auto
VTEP-1#
配置VTEP-2
VTEP-2# show running-config
nv overlay evpn
feature ospf
feature bgp
feature pim
feature interface-vlan
feature vn-segment-vlan-based
feature nv overlay
ip pim rp-address 100.100.100.3 group-list 224.0.0.0/4
ip pim ssm range 232.0.0.0/8
vlan 1,200,210
vlan 200
vn-segment 20000
vlan 210
vn-segment 20010
interface nve1
no shutdown
host-reachability protocol bgp
source-interface loopback0
member vni 20000
mcast-group 230.1.1.1
member vni 20010
mcast-group 230.1.1.2
interface Ethernet1/1
switchport mode trunk
switchport trunk allowed vlan 200,210
interface Ethernet1/2
no switchport
ip address 30.1.1.2/24
ip router ospf 1 area 0.0.0.0
ip pim sparse-mode
no shutdown
interface loopback0
ip address 100.100.100.2/32
ip router ospf 1 area 0.0.0.0
ip pim sparse-mode
router ospf 1
router-id 100.100.100.2
router bgp 100
router-id 100.100.100.2
log-neighbor-changes
address-family ipv4 unicast
address-family l2vpn evpn
neighbor 100.100.100.3
remote-as 100
update-source loopback0
address-family ipv4 unicast
address-family l2vpn evpn
send-community extended
evpn
vni 20000 l2
rd auto
route-target import auto
route-target export auto
vni 20010 l2
rd auto
route-target import auto
route-target export auto
VTEP-2#
配置RR
RR# show running-config
nv overlay evpn
feature ospf
feature bgp
feature pim
feature interface-vlan
feature vn-segment-vlan-based
feature nv overlay
ip pim rp-address 100.100.100.3 group-list 224.0.0.0/4
ip pim ssm range 232.0.0.0/8
interface Ethernet1/1
no switchport
ip address 20.1.1.1/24
ip router ospf 1 area 0.0.0.0
ip pim sparse-mode
no shutdown
interface Ethernet1/2
no switchport
ip address 30.1.1.1/24
ip router ospf 1 area 0.0.0.0
ip pim sparse-mode
no shutdown
interface loopback0
ip address 100.100.100.3/32
ip router ospf 1 area 0.0.0.0
ip pim sparse-mode
router ospf 1
router-id 100.100.100.3
router bgp 100
router-id 100.100.100.3
log-neighbor-changes
address-family ipv4 unicast
address-family l2vpn evpn
neighbor 100.100.100.1
remote-as 100
update-source loopback0
address-family ipv4 unicast
address-family l2vpn evpn
send-community extended
route-reflector-client
neighbor 100.100.100.2
remote-as 100
update-source loopback0
address-family ipv4 unicast
address-family l2vpn evpn
send-community extended
route-reflector-client
RR#
配置Switch1
Switch1#show running-config
interface GigabitEthernet0/0
switchport trunk encapsulation dot1q
switchport mode trunk
media-type rj45
negotiation auto
!
interface GigabitEthernet0/1
switchport access vlan 200
media-type rj45
negotiation auto
!
interface GigabitEthernet0/2
switchport access vlan 210
media-type rj45
negotiation auto
!
Switch1#
配置Switch2
Switch2#show running-config
interface GigabitEthernet0/0
switchport trunk encapsulation dot1q
switchport mode trunk
media-type rj45
negotiation auto
!
interface GigabitEthernet0/1
switchport access vlan 200
media-type rj45
negotiation auto
!
interface GigabitEthernet0/2
switchport access vlan 210
media-type rj45
negotiation auto
!
Switch2#
VM1 Ping测试VM3
VM1> ping 192.168.1.11
84 bytes from 192.168.1.11 icmp_seq=1 ttl=64 time=35.080 ms
84 bytes from 192.168.1.11 icmp_seq=2 ttl=64 time=19.675 ms
84 bytes from 192.168.1.11 icmp_seq=3 ttl=64 time=17.657 ms
84 bytes from 192.168.1.11 icmp_seq=4 ttl=64 time=24.238 ms
84 bytes from 192.168.1.11 icmp_seq=5 ttl=64 time=16.781 ms
VM1>
VM2 Ping测试VM4
VM2> ping 172.16.1.11
84 bytes from 172.16.1.11 icmp_seq=1 ttl=64 time=47.187 ms
84 bytes from 172.16.1.11 icmp_seq=2 ttl=64 time=20.255 ms
84 bytes from 172.16.1.11 icmp_seq=3 ttl=64 time=20.980 ms
84 bytes from 172.16.1.11 icmp_seq=4 ttl=64 time=18.804 ms
84 bytes from 172.16.1.11 icmp_seq=5 ttl=64 time=26.887 ms
VM2>
查看VTEP-1的EVPN邻居关系
VTEP-1# show bgp l2vpn evpn summary
BGP summary information for VRF default, address family L2VPN EVPN
BGP router identifier 100.100.100.1, local AS number 100
BGP table version is 34, L2VPN EVPN config peers 1, capable peers 1
6 network entries and 6 paths using 1128 bytes of memory
BGP attribute entries [4/640], BGP AS path entries [0/0]
BGP community entries [0/0], BGP clusterlist entries [1/4]
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
100.100.100.3 4 100 62 53 34 0 0 00:39:55 2
VTEP-1#
查看VTEP-2的EVPN邻居关系
VTEP-2# show bgp l2vpn evpn summary
BGP summary information for VRF default, address family L2VPN EVPN
BGP router identifier 100.100.100.2, local AS number 100
BGP table version is 34, L2VPN EVPN config peers 1, capable peers 1
6 network entries and 6 paths using 1128 bytes of memory
BGP attribute entries [4/640], BGP AS path entries [0/0]
BGP community entries [0/0], BGP clusterlist entries [1/4]
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
100.100.100.3 4 100 61 55 34 0 0 00:40:35 2
VTEP-2#
查看RR的EVPN邻居关系
RR# show bgp l2vpn evpn summary
BGP summary information for VRF default, address family L2VPN EVPN
BGP router identifier 100.100.100.3, local AS number 100
BGP table version is 28, L2VPN EVPN config peers 2, capable peers 2
4 network entries and 4 paths using 928 bytes of memory
BGP attribute entries [2/320], BGP AS path entries [0/0]
BGP community entries [0/0], BGP clusterlist entries [0/0]
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
100.100.100.1 4 100 60 54 28 0 0 00:40:48 2
100.100.100.2 4 100 62 51 28 0 0 00:40:57 2
RR#
查看VTEP-1的EVPN路由更新条目
VTEP-1# show bgp l2vpn evpn
BGP routing table information for VRF default, address family L2VPN EVPN
BGP table version is 34, Local Router ID is 100.100.100.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i
njected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 100.100.100.1:32967 (L2VNI 20000)
*>l[2]:[0]:[0]:[48]:[0050.7966.6806]:[0]:[0.0.0.0]/216
100.100.100.1 100 32768 i
*>i[2]:[0]:[0]:[48]:[0050.7966.6808]:[0]:[0.0.0.0]/216
100.100.100.2 100 0 i
Route Distinguisher: 100.100.100.1:32977 (L2VNI 20010)
*>l[2]:[0]:[0]:[48]:[0050.7966.6807]:[0]:[0.0.0.0]/216
100.100.100.1 100 32768 i
*>i[2]:[0]:[0]:[48]:[0050.7966.6809]:[0]:[0.0