eBGP Two-AS Underlay
Use a shared leaf AS for IPv4 transport and carry EVPN over separate loopback sessions.
Keep transport and EVPN sessions distinct
Every leaf uses AS 65010; both spines use 65000. This keeps the AS plan short, but normal loop prevention rejects a remote leaf route containing local AS 65010. The exceptions above are required for this model and are not general Internet peering advice.
| Physical link | Address at first endpoint | Address at second endpoint |
|---|---|---|
| SPINE1 Ethernet1/1 ↔ LEAF1 Ethernet1/1 | 192.0.2.0/31 | 192.0.2.1/31 |
| SPINE1 Ethernet1/2 ↔ LEAF2 Ethernet1/1 | 192.0.2.2/31 | 192.0.2.3/31 |
| SPINE1 Ethernet1/3 ↔ LEAF3 Ethernet1/1 | 192.0.2.4/31 | 192.0.2.5/31 |
| SPINE1 Ethernet1/4 ↔ LEAF4 Ethernet1/1 | 192.0.2.6/31 | 192.0.2.7/31 |
| SPINE2 Ethernet1/1 ↔ LEAF1 Ethernet1/2 | 192.0.2.8/31 | 192.0.2.9/31 |
| SPINE2 Ethernet1/2 ↔ LEAF2 Ethernet1/2 | 192.0.2.10/31 | 192.0.2.11/31 |
| SPINE2 Ethernet1/3 ↔ LEAF3 Ethernet1/2 | 192.0.2.12/31 | 192.0.2.13/31 |
| SPINE2 Ethernet1/4 ↔ LEAF4 Ethernet1/2 | 192.0.2.14/31 | 192.0.2.15/31 |
| Device | Loopback0 / router ID |
|---|---|
| SPINE1 | 10.255.0.1/32 |
| SPINE2 | 10.255.0.2/32 |
| LEAF1 | 10.255.0.3/32 |
| LEAF2 | 10.255.0.4/32 |
| LEAF3 | 10.255.0.5/32 |
| LEAF4 | 10.255.0.6/32 |
| Device | BGP AS |
|---|---|
| SPINE1 | 65000 |
| SPINE2 | 65000 |
| LEAF1 | 65010 |
| LEAF2 | 65010 |
| LEAF3 | 65010 |
| LEAF4 | 65010 |
Form direct /31 transport peers
LEAF1 · IPv4 direct peers
feature bgp
ip prefix-list INFRA seq 10 permit 10.255.0.0/24 ge 32 le 32
router bgp 65010
router-id 10.255.0.3
address-family ipv4 unicast
network 10.255.0.3/32
maximum-paths 2
neighbor 192.0.2.0
remote-as 65000
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
allowas-in 1
neighbor 192.0.2.8
remote-as 65000
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
allowas-in 1Only loopback /32s within 10.255.0.0/24 pass the infrastructure prefix filter; the network statement originates each device’s existing Loopback0 route. The filter is applied in both directions on direct IPv4 sessions. Overlay EVPN uses different loopback neighbor entries and has separate RT policy.
Resolve AS-path policy deliberately
LEAF1# show bgp ipv4 unicast 10.255.0.4/32
Before exceptions: no accepted path
Candidate remote path would contain 65000 65010
Local leaf AS is 65010SPINE1 · permit advertisement toward same-AS leaf peers
router bgp 65000
neighbor 192.0.2.1
address-family ipv4 unicast
disable-peer-as-checkLEAF1 · accept one controlled occurrence from each spine
router bgp 65010
neighbor 192.0.2.0
address-family ipv4 unicast
allowas-in 1
neighbor 192.0.2.8
address-family ipv4 unicast
allowas-in 1Apply the spine statement to all four leaf neighbors on both spines. Disabling the outbound peer-AS check and allowing the local AS on receive solve different gates. Limit allowas-in to this deliberate leaf–spine design and these sessions; it weakens normal loop rejection. The independent complete recipe includes these scoped settings in both IPv4 and EVPN families where needed.
Install eligible paths, then inspect the IP table
LEAF1# show ip route 10.255.0.4
10.255.0.4/32, ubest/mbest: 2/0
*via 192.0.2.0, [20/0], bgp, external
*via 192.0.2.8, [20/0], bgp, externalThe two candidate AS paths are 65000 65010. The IPv4 family sets maximum-paths 2; other best-path attributes must also be compatible. A BGP table with two received paths alone is not proof both entered the IP forwarding table. Both spines have routes to every leaf loopback, so they can carry outer VXLAN packets.
Retain routes and preserve the VTEP next hop
Both spines · EVPN transit policy
route-map KEEP-VTEP permit 10
set ip next-hop unchanged
router bgp 65000
address-family l2vpn evpn
retain route-target all
nexthop route-map KEEP-VTEPSPINE1 · example LEAF1 loopback session
router bgp 65000
neighbor 10.255.0.3
remote-as 65010
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
route-map KEEP-VTEP outThe leaf EVPN sessions also need allowas-in 1 because a reflected eBGP path can contain the shared leaf AS. The spines disable the outbound peer-AS check in that family too. These are eBGP transit sessions, not iBGP route-reflector-client sessions.
The complete recipe applies the matching policy to every leaf neighbor. retain route-target all lets a non-VTEP transit spine keep routes with no local matching tenant VNI. The outgoing route-map and address-family next-hop policy retain the remote originating VTEP. Ordinary IPv4 transport advertisements still use direct next-hop behavior.
Verify control import and tenant delivery
LEAF1# show bgp l2vpn evpn route-type 2
Remote MAC: 0200.0000.0012
Next hop: 10.255.0.4
Route target: 65000:10010
Encapsulation: VXLAN, VNI 10010The route must import into local VNI 10010 and resolve to LEAF2, not a non-VTEP spine. Send H1 → H2, where hosts use 10.10.10.11–14/24 on Ethernet1/3 of LEAF1–4. For a deliberate wrong-next-hop fault, restore KEEP-VTEP on the spine’s EVPN family and outgoing neighbor policy, then inspect the re-advertised route and actual traffic again.
Complete independent lab configurations
Start with clean isolated lab devices. These are the complete scenario configurations, not changes to apply on top of a different lesson. Physical ports must match the address table. Virtual-image data-plane capabilities can differ from physical switches; these examples have not been executed on live devices.
Download configuration reference
SPINE1
hostname SPINE1
interface loopback0
ip address 10.255.0.1/32
interface Ethernet1/1
no switchport
mtu 9216
ip address 192.0.2.0/31
no shutdown
interface Ethernet1/2
no switchport
mtu 9216
ip address 192.0.2.2/31
no shutdown
interface Ethernet1/3
no switchport
mtu 9216
ip address 192.0.2.4/31
no shutdown
interface Ethernet1/4
no switchport
mtu 9216
ip address 192.0.2.6/31
no shutdown
feature bgp
ip prefix-list INFRA seq 10 permit 10.255.0.0/24 ge 32 le 32
router bgp 65000
router-id 10.255.0.1
address-family ipv4 unicast
network 10.255.0.1/32
maximum-paths 2
neighbor 192.0.2.1
remote-as 65010
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
disable-peer-as-check
neighbor 192.0.2.3
remote-as 65010
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
disable-peer-as-check
neighbor 192.0.2.5
remote-as 65010
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
disable-peer-as-check
neighbor 192.0.2.7
remote-as 65010
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
disable-peer-as-check
nv overlay evpn
route-map KEEP-VTEP permit 10
set ip next-hop unchanged
router bgp 65000
address-family l2vpn evpn
retain route-target all
nexthop route-map KEEP-VTEP
neighbor 10.255.0.3
remote-as 65010
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
route-map KEEP-VTEP out
disable-peer-as-check
neighbor 10.255.0.4
remote-as 65010
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
route-map KEEP-VTEP out
disable-peer-as-check
neighbor 10.255.0.5
remote-as 65010
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
route-map KEEP-VTEP out
disable-peer-as-check
neighbor 10.255.0.6
remote-as 65010
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
route-map KEEP-VTEP out
disable-peer-as-checkSPINE2
hostname SPINE2
interface loopback0
ip address 10.255.0.2/32
interface Ethernet1/1
no switchport
mtu 9216
ip address 192.0.2.8/31
no shutdown
interface Ethernet1/2
no switchport
mtu 9216
ip address 192.0.2.10/31
no shutdown
interface Ethernet1/3
no switchport
mtu 9216
ip address 192.0.2.12/31
no shutdown
interface Ethernet1/4
no switchport
mtu 9216
ip address 192.0.2.14/31
no shutdown
feature bgp
ip prefix-list INFRA seq 10 permit 10.255.0.0/24 ge 32 le 32
router bgp 65000
router-id 10.255.0.2
address-family ipv4 unicast
network 10.255.0.2/32
maximum-paths 2
neighbor 192.0.2.9
remote-as 65010
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
disable-peer-as-check
neighbor 192.0.2.11
remote-as 65010
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
disable-peer-as-check
neighbor 192.0.2.13
remote-as 65010
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
disable-peer-as-check
neighbor 192.0.2.15
remote-as 65010
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
disable-peer-as-check
nv overlay evpn
route-map KEEP-VTEP permit 10
set ip next-hop unchanged
router bgp 65000
address-family l2vpn evpn
retain route-target all
nexthop route-map KEEP-VTEP
neighbor 10.255.0.3
remote-as 65010
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
route-map KEEP-VTEP out
disable-peer-as-check
neighbor 10.255.0.4
remote-as 65010
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
route-map KEEP-VTEP out
disable-peer-as-check
neighbor 10.255.0.5
remote-as 65010
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
route-map KEEP-VTEP out
disable-peer-as-check
neighbor 10.255.0.6
remote-as 65010
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
route-map KEEP-VTEP out
disable-peer-as-checkLEAF1
hostname LEAF1
interface loopback0
ip address 10.255.0.3/32
interface Ethernet1/1
no switchport
mtu 9216
ip address 192.0.2.1/31
no shutdown
interface Ethernet1/2
no switchport
mtu 9216
ip address 192.0.2.9/31
no shutdown
feature bgp
ip prefix-list INFRA seq 10 permit 10.255.0.0/24 ge 32 le 32
router bgp 65010
router-id 10.255.0.3
address-family ipv4 unicast
network 10.255.0.3/32
maximum-paths 2
neighbor 192.0.2.0
remote-as 65000
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
allowas-in 1
neighbor 192.0.2.8
remote-as 65000
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
allowas-in 1
nv overlay evpn
route-map KEEP-VTEP permit 10
set ip next-hop unchanged
router bgp 65010
address-family l2vpn evpn
neighbor 10.255.0.1
remote-as 65000
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
allowas-in 1
neighbor 10.255.0.2
remote-as 65000
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
allowas-in 1
feature nv overlay
feature vn-segment-vlan-based
vlan 10
vn-segment 10010
interface Ethernet1/3
switchport
switchport mode access
switchport access vlan 10
spanning-tree port type edge
no shutdown
interface nve1
no shutdown
source-interface loopback0
host-reachability protocol bgp
member vni 10010
ingress-replication protocol bgp
evpn
vni 10010 l2
rd auto
route-target import 65000:10010
route-target export 65000:10010LEAF2
hostname LEAF2
interface loopback0
ip address 10.255.0.4/32
interface Ethernet1/1
no switchport
mtu 9216
ip address 192.0.2.3/31
no shutdown
interface Ethernet1/2
no switchport
mtu 9216
ip address 192.0.2.11/31
no shutdown
feature bgp
ip prefix-list INFRA seq 10 permit 10.255.0.0/24 ge 32 le 32
router bgp 65010
router-id 10.255.0.4
address-family ipv4 unicast
network 10.255.0.4/32
maximum-paths 2
neighbor 192.0.2.2
remote-as 65000
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
allowas-in 1
neighbor 192.0.2.10
remote-as 65000
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
allowas-in 1
nv overlay evpn
route-map KEEP-VTEP permit 10
set ip next-hop unchanged
router bgp 65010
address-family l2vpn evpn
neighbor 10.255.0.1
remote-as 65000
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
allowas-in 1
neighbor 10.255.0.2
remote-as 65000
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
allowas-in 1
feature nv overlay
feature vn-segment-vlan-based
vlan 10
vn-segment 10010
interface Ethernet1/3
switchport
switchport mode access
switchport access vlan 10
spanning-tree port type edge
no shutdown
interface nve1
no shutdown
source-interface loopback0
host-reachability protocol bgp
member vni 10010
ingress-replication protocol bgp
evpn
vni 10010 l2
rd auto
route-target import 65000:10010
route-target export 65000:10010LEAF3
hostname LEAF3
interface loopback0
ip address 10.255.0.5/32
interface Ethernet1/1
no switchport
mtu 9216
ip address 192.0.2.5/31
no shutdown
interface Ethernet1/2
no switchport
mtu 9216
ip address 192.0.2.13/31
no shutdown
feature bgp
ip prefix-list INFRA seq 10 permit 10.255.0.0/24 ge 32 le 32
router bgp 65010
router-id 10.255.0.5
address-family ipv4 unicast
network 10.255.0.5/32
maximum-paths 2
neighbor 192.0.2.4
remote-as 65000
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
allowas-in 1
neighbor 192.0.2.12
remote-as 65000
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
allowas-in 1
nv overlay evpn
route-map KEEP-VTEP permit 10
set ip next-hop unchanged
router bgp 65010
address-family l2vpn evpn
neighbor 10.255.0.1
remote-as 65000
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
allowas-in 1
neighbor 10.255.0.2
remote-as 65000
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
allowas-in 1
feature nv overlay
feature vn-segment-vlan-based
vlan 10
vn-segment 10010
interface Ethernet1/3
switchport
switchport mode access
switchport access vlan 10
spanning-tree port type edge
no shutdown
interface nve1
no shutdown
source-interface loopback0
host-reachability protocol bgp
member vni 10010
ingress-replication protocol bgp
evpn
vni 10010 l2
rd auto
route-target import 65000:10010
route-target export 65000:10010LEAF4
hostname LEAF4
interface loopback0
ip address 10.255.0.6/32
interface Ethernet1/1
no switchport
mtu 9216
ip address 192.0.2.7/31
no shutdown
interface Ethernet1/2
no switchport
mtu 9216
ip address 192.0.2.15/31
no shutdown
feature bgp
ip prefix-list INFRA seq 10 permit 10.255.0.0/24 ge 32 le 32
router bgp 65010
router-id 10.255.0.6
address-family ipv4 unicast
network 10.255.0.6/32
maximum-paths 2
neighbor 192.0.2.6
remote-as 65000
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
allowas-in 1
neighbor 192.0.2.14
remote-as 65000
address-family ipv4 unicast
prefix-list INFRA in
prefix-list INFRA out
allowas-in 1
nv overlay evpn
route-map KEEP-VTEP permit 10
set ip next-hop unchanged
router bgp 65010
address-family l2vpn evpn
neighbor 10.255.0.1
remote-as 65000
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
allowas-in 1
neighbor 10.255.0.2
remote-as 65000
update-source loopback0
ebgp-multihop 3
address-family l2vpn evpn
send-community
send-community extended
allowas-in 1
feature nv overlay
feature vn-segment-vlan-based
vlan 10
vn-segment 10010
interface Ethernet1/3
switchport
switchport mode access
switchport access vlan 10
spanning-tree port type edge
no shutdown
interface nve1
no shutdown
source-interface loopback0
host-reachability protocol bgp
member vni 10010
ingress-replication protocol bgp
evpn
vni 10010 l2
rd auto
route-target import 65000:10010
route-target export 65000:10010| Host | Address | Gateway |
|---|---|---|
| H1 | 10.10.10.11/24 | none |
| H2 | 10.10.10.12/24 | none |
| H3 | 10.10.10.13/24 | none |
| H4 | 10.10.10.14/24 | none |
Further reading
Key Takeaways
- The two-AS model reuses one leaf AS and one spine AS.
- Outbound peer-AS checking and inbound own-AS rejection are separate gates.
- Exceptions are scoped to this controlled fabric, not arbitrary external peers.
- IPv4 underlay ECMP and EVPN overlay learning remain separate families.
- EVPN transit spines retain RTs and preserve the origin VTEP next hop.