基於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.0.0]