BGP Advanced Configuration — Cisco NX-OS
Generate advanced BGP configurations for Cisco NX-OS (Nexus) using peer templates (session + policy), ECMP, BFD, and data center BGP best practices.
What is it?
NX-OS BGP is designed for data center scale — it separates session-level configuration (remote-as, update-source, timers, authentication) from policy-level configuration (route-maps, communities, max-prefix) using two distinct template types: 'template peer-session' for TCP/session attributes and 'template peer-policy' for routing policy attributes. This separation allows a single policy template to be inherited by dozens of neighbors while each neighbor independently inherits its own session template, greatly simplifying configuration at scale. NX-OS defaults differ significantly from IOS: 'no bgp default ipv4-unicast' is the default, neighbors must be explicitly activated under 'address-family ipv4 unicast', and the command syntax differs (e.g., 'redistribute direct' instead of 'redistribute connected', network statements use prefix-length notation). NX-OS BGP also integrates natively with BGP EVPN for VXLAN data center fabrics (see the bgp-evpn template).
When to use
- ·Nexus 9000/7000/5000 data center spine-leaf BGP underlay
- ·BGP-as-IGP designs (replacing OSPF with eBGP in data center fabrics)
- ·Large-scale deployments where peer templates significantly reduce config complexity
- ·VXLAN EVPN overlays (separate bgp-evpn template — this template covers base BGP)
- ·Connecting NX-OS devices to Internet upstream or WAN circuits
- ·Route reflector designs with many iBGP clients in the same data center
When NOT to use
- ·Non-Nexus Cisco platforms — use cisco-ios-bgp for IOS/IOS-XE routers
- ·When you need MPLS L3VPN PE functionality — NX-OS does not support MPLS natively on most platforms
- ·Very small deployments where peer template overhead adds complexity without benefit
How it compares
Prerequisites
- →'feature bgp' must be enabled before any BGP configuration is accepted
- →Loopback interfaces configured for iBGP update-source (loopback0 is standard)
- →For ECMP: 'maximum-paths' and 'maximum-paths ibgp' configured under address-family
- →Peer templates (session + policy) should be defined BEFORE referencing them in neighbor stanzas
- →For BFD: BFD feature must be enabled ('feature bfd') and configured on the interface
Config Generator
Required for ECMP across different upstream ASes
Speeds up FIB update on neighbor loss — reduces convergence time in NX-OS
Configured under address-family ipv4 unicast
Verification commands
show bgp summaryOverview of all BGP sessions — note: NX-OS uses 'show bgp' not 'show ip bgp'
ExpectedState column shows numeric (prefix count) for established sessions
show bgp sessionsSession states for all BGP neighbors with clear state indicators
ExpectedState column: Established, Idle, Active, Connect, OpenSent, OpenConfirm
show bgp neighbors X.X.X.XDetailed neighbor information including capabilities, timers, and counters
ExpectedBGP state = Established, peer templates shown under 'Inherits peer configuration from'
show bgp ipv4 unicastFull BGP table for IPv4 unicast address family
ExpectedBest paths marked with >, valid paths with *
show bgp ipv4 unicast X.X.X.XDetailed path attributes for a specific prefix
ExpectedAll paths with LOCAL_PREF, AS-PATH, NEXT_HOP, MED, ORIGIN
show bgp peer-templateShow all configured peer session and peer policy templates
ExpectedLists all template names with their configured attributes
show bgp neighbors X.X.X.X advertised-routesRoutes being advertised to this neighbor after outbound policy
ExpectedPrefix list with path attributes
show bgp neighbors X.X.X.X received-routesAll routes received from neighbor before policy (requires soft-reconfig)
ExpectedRequires 'soft-reconfiguration inbound always' in peer-policy template
show bgp neighbors X.X.X.X routesRoutes accepted from neighbor after inbound policy
ExpectedFiltered list of prefixes installed from this neighbor
show ip route bgpBGP routes installed in the forwarding table
ExpectedRoutes marked with 'B' for BGP in the routing table
Debug commands
debug bgp eventsBGP session event debugging
WarningUse with caution in production. Run 'no debug all' after.
debug bgp updatesBGP UPDATE message processing
WarningVery verbose. Restrict with 'debug bgp updates neighbor X.X.X.X' if possible.
clear bgp ipv4 unicast X.X.X.X softSoft reset for a specific neighbor without tearing down the session
WarningSafe in production. Hard reset: 'clear bgp ipv4 unicast X.X.X.X'
show bgp event-history errorsNX-OS event history buffer — shows BGP error events without live debug
WarningSafe to run anytime — reads from circular event buffer
Common mistakes & fixes
Further learning
Recommended books to go deeper on this topic.
BGP Design and Implementation
Randy Zhang & Micah Bartell · Cisco Press · The practical BGP bible — iBGP, eBGP, policies, communities, design patterns
Internet Routing Architectures
Sam Halabi · Cisco Press · BGP for ISPs and large enterprise — AS path, route reflectors, confederation