技術分享
雙 Nexus 9336C vPC + BGP EVPN Anycast Gateway:不靠 Stack 的 Gateway HA 設計
兩台 Nexus 9336C 仍以 vPC 架構運作,讓下方 Nexus 93180 透過 Port-Channel 雙上聯;三層 Gateway 則不依賴 Stack 或 VRRP / HSRP,而是由 BGP EVPN Anycast Gateway 提供 Active / Active Gateway HA。
傳統 Stack 交換器可以把多台設備視為一台邏輯交換器,SVI Gateway 只需要配置一次;但 Nexus 9336C 這類資料中心交換器不走 Stack。實務上常見做法是兩台 9336C 跑 vPC,下方 Nexus 93180 透過 Port-Channel / vPC 上聯,三層 Gateway 則用 BGP EVPN Anycast Gateway 取代 VRRP / HSRP。
資料來源:Server Plus 技術筆記 · 2026-07-11
Stack 交換器為什麼容易做 Gateway HA
一般企業交換器如果支援 Stack,兩台或多台交換器會被合併成一台邏輯交換器。VLAN、Trunk、LACP 與 SVI Gateway 都在同一個控制平面上設定。
因此 Gateway HA 很直覺:只要在這台邏輯交換器上設定一個 SVI Gateway,下游設備看到的就是同一個預設閘道。即使其中一台實體交換器故障,Stack 邏輯上仍然維持該 Gateway。
interface vlan 10
description USER-SUBNET-GW
ip address 192.0.2.254/24Nexus 9336C 的思路不是 Stack
Cisco Nexus 9336C 這類資料中心交換器通常不走傳統 Stack 架構。兩台 9336C 會各自保留獨立控制平面,再透過 vPC、Peer-Link、Keepalive 與 EVPN 控制平面協同運作。
在這個架構裡,9336C pair 作為 Spine / Aggregation 層;下方 Nexus 93180 access switch 透過 Port-Channel / vPC 上聯到兩台 9336C。vPC 解決的是二層雙上聯與鏈路 HA,但不代表兩台 9336C 變成一台 Stack。

vPC 仍然存在,但 Gateway HA 不靠 VRRP
這個設計不是不用 vPC。相反地,兩台 9336C 仍然跑 vPC,93180 也可以透過 Port-Channel 同時上聯到兩台 9336C,取得鏈路備援與頻寬利用。
差異在於三層 Gateway 的 HA。傳統做法可能會在兩台 9336C 的 SVI 上跑 VRRP 或 HSRP,讓其中一台成為 Active Gateway;但在 EVPN Anycast Gateway 設計中,兩台 9336C 可以使用相同的 Gateway IP / MAC,對下方 93180 與伺服器提供 Active / Active Gateway。
- vPC 負責 9336C pair 與 93180 access switch 的雙上聯
- Peer-Link 與 Keepalive 維持 vPC pair 狀態
- Anycast Gateway 負責 SVI Gateway 的 Active / Active HA
- BGP EVPN / VXLAN 負責 VNI 與主機可達資訊同步
9336C vPC pair 的基礎設定
這段設定節錄呈現 9336C vPC pair 的基本角色:啟用 VXLAN EVPN 相關功能、建立 vPC domain、配置 Peer-Link,並讓 93180 access switch 透過 Port-Channel 雙上聯。
feature bgp
feature fabric forwarding
feature interface-vlan
feature vn-segment-vlan-based
feature lacp
feature vpc
feature nv overlay
vpc domain 100
peer-switch
peer-gateway
layer3 peer-router
peer-keepalive destination 10.255.0.1 source 10.255.0.2 vrf KEEPALIVE
ip arp synchronize
interface port-channel1000
description VPC-PEER-LINK
switchport
switchport mode trunk
spanning-tree port type network
vpc peer-link
interface port-channel1100
description N93180-ACCESS-UPLINK
switchport
switchport mode trunk
mtu 9216
vpc 1100Anycast Gateway 放在 9336C pair 上
Anycast Gateway 的重點是:兩台 9336C 在同一個 VLAN / Subnet 上提供相同的 Gateway IP 與 Gateway MAC。下方 93180 access switch 或伺服器不需要知道哪台是 Active,因為 Gateway 能由 9336C pair 以 Active / Active 方式承接。SVI subnet 則透過 OSPF 宣告給上層 ASR 或 Juniper MX;在該 SVI 上設定 passive-interface,可公告路由但不在用戶 VLAN 內建立 OSPF adjacency。
這和 VRRP / HSRP 的 Active / Standby 思路不同。對 VLAN 數量較多、租戶網段較多、需要大量 SVI Gateway 的資料中心環境來說,可以減少每個 VLAN 維護 FHRP group 的負擔。
fabric forwarding anycast-gateway-mac 0200.0000.0001
vlan 10
name TENANT-A-WEB
vn-segment 10010
vlan 20
name TENANT-A-APP
vn-segment 10020
vlan 999
name TENANT-A-L3VNI
vn-segment 50999
vrf context TENANT-A
vni 50999
rd auto
address-family ipv4 unicast
route-target both auto
route-target both auto evpn
interface Vlan10
description TENANT-A-WEB-GW
no shutdown
vrf member TENANT-A
no ip redirects
ip address 192.0.2.254/24
no ipv6 redirects
ip ospf passive-interface
ip router ospf 100 area 0.0.0.0
fabric forwarding mode anycast-gateway
interface Vlan20
description TENANT-A-APP-GW
no shutdown
vrf member TENANT-A
no ip redirects
ip address 198.51.100.254/24
no ipv6 redirects
ip ospf passive-interface
ip router ospf 100 area 0.0.0.0
fabric forwarding mode anycast-gateway
interface Vlan999
description TENANT-A-L3VNI
no shutdown
vrf member TENANT-A
ip forwardNVE 與 EVPN 控制平面
NVE 介面負責 VXLAN Overlay,BGP EVPN 則負責同步 MAC、IP、VNI 與主機可達資訊。在 vPC VXLAN 設計中,兩台 9336C 可以有各自的 VTEP 來源位址,並依設計使用共同的 anycast VTEP 位址。
這個段落的重點是三個對應關係:VLAN 對應 L2 VNI、VRF 對應 L3 VNI,Gateway SVI 啟用 anycast-gateway。
interface loopback0
description VTEP-SOURCE
ip address 10.255.255.11/32
ip address 10.255.255.10/32 secondary
interface nve1
no shutdown
host-reachability protocol bgp
source-interface loopback0
member vni 10010
suppress-arp
ingress-replication protocol bgp
member vni 10020
suppress-arp
ingress-replication protocol bgp
member vni 50999 associate-vrf
evpn
vni 10010 l2
rd auto
route-target import auto
route-target export auto
vni 10020 l2
rd auto
route-target import auto
route-target export auto為什麼比 VRRP / HSRP 適合這種場景
如果只有少量 VLAN,VRRP 或 HSRP 仍然是可行且容易理解的設計。但在 9336C pair 承接多個 93180 access switch、VLAN 與租戶網段逐漸增加時,FHRP group 的設定與維護會變成負擔。
BGP EVPN Anycast Gateway 的價值,是讓 9336C pair 維持 vPC 雙上聯架構,同時把 Gateway HA 從 Active / Standby 改成 Active / Active。對下方 93180 與伺服器來說,Gateway IP 維持一致;對網路團隊來說,不需要為每個 VLAN 維護一組 VRRP / HSRP 狀態。
- 不需要傳統 Stack,也能讓 Gateway 具備 HA
- 保留 vPC 給 93180 access switch 做 Port-Channel 雙上聯
- Gateway IP / MAC 在 9336C pair 上保持一致
- 降低多 VLAN 環境下 VRRP / HSRP group 維護成本
- 適合以雙 9336C 作為 Spine / Aggregation 的小型資料中心設計
結論
這個架構的重點不是「不用 vPC」,而是「vPC 解決雙上聯,Anycast Gateway 解決三層 Gateway HA」。兩台 Nexus 9336C 不像傳統 Stack 交換器可以合併成單一邏輯設備,因此不能用 Stack 的思維看待 Gateway。
在 9336C pair 下方接 93180 access switch 的設計中,BGP EVPN Anycast Gateway 讓 Gateway HA 以 Active / Active 方式運作,也比每個 VLAN 都配置 VRRP / HSRP 更適合後續擴充。
相關服務
FAQ
常見問題
這個架構還需要 vPC 嗎?
需要。vPC 仍然用來讓 Nexus 93180 access switch 或下游設備透過 Port-Channel 雙上聯到兩台 9336C。Anycast Gateway 解決的是三層 Gateway HA,不是取代 vPC 的鏈路聚合功能。
Anycast Gateway 和 VRRP / HSRP 最大差異是什麼?
VRRP / HSRP 通常是 Active / Standby Gateway;Anycast Gateway 則讓 9336C pair 使用相同 Gateway IP / MAC,以 Active / Active 方式提供 Gateway,並透過 EVPN / VXLAN 控制平面同步端點與 VNI 資訊。
93180 下方主機的 Gateway 實際在哪裡處理?
在這個設計裡,93180 主要作為 access switch 透過 Port-Channel / vPC 上聯到 9336C pair;SVI Gateway 與 Anycast Gateway 放在 9336C pair 上,由兩台 9336C 以相同 Gateway IP / MAC 承接三層轉送。
