PermitANY
Cisco NX-OSConfig1 downloads

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.

↓ example.txt

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

vs Cisco IOS BGPNX-OS uses peer templates (session + policy) instead of peer-groups. Commands differ: 'redistribute direct' vs 'redistribute connected', 'show bgp' vs 'show ip bgp', 'network X/prefix_len' vs 'network X mask Y'. NX-OS defaults to no IPv4 unicast activation.
vs Cisco IOS XR BGPIOS XR uses neighbor-groups and requires route-policy (RPL) for all policies — no route-maps. NX-OS supports both route-maps (simpler) and is better suited for data center vs IOS XR's SP carrier focus.
vs OSPF in Data CenterBGP-as-IGP (eBGP between leaf/spine) is increasingly preferred over OSPF in large data centers for simpler policy control, easier troubleshooting with 'show bgp', and direct integration with EVPN.

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 summary

Overview 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 sessions

Session states for all BGP neighbors with clear state indicators

ExpectedState column: Established, Idle, Active, Connect, OpenSent, OpenConfirm

show bgp neighbors X.X.X.X

Detailed neighbor information including capabilities, timers, and counters

ExpectedBGP state = Established, peer templates shown under 'Inherits peer configuration from'

show bgp ipv4 unicast

Full BGP table for IPv4 unicast address family

ExpectedBest paths marked with >, valid paths with *

show bgp ipv4 unicast X.X.X.X

Detailed path attributes for a specific prefix

ExpectedAll paths with LOCAL_PREF, AS-PATH, NEXT_HOP, MED, ORIGIN

show bgp peer-template

Show all configured peer session and peer policy templates

ExpectedLists all template names with their configured attributes

show bgp neighbors X.X.X.X advertised-routes

Routes being advertised to this neighbor after outbound policy

ExpectedPrefix list with path attributes

show bgp neighbors X.X.X.X received-routes

All 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 routes

Routes accepted from neighbor after inbound policy

ExpectedFiltered list of prefixes installed from this neighbor

show ip route bgp

BGP routes installed in the forwarding table

ExpectedRoutes marked with 'B' for BGP in the routing table

Debug commands

debug bgp events

BGP session event debugging

WarningUse with caution in production. Run 'no debug all' after.

debug bgp updates

BGP 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 soft

Soft 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 errors

NX-OS event history buffer — shows BGP error events without live debug

WarningSafe to run anytime — reads from circular event buffer

Common mistakes & fixes

Symptom'feature bgp' not configured — BGP commands not available
CauseNX-OS requires explicit feature enablement before BGP commands are accepted
FixRun 'feature bgp' in global configuration mode first
SymptomNeighbor configured but not activating routes
CauseNX-OS defaults to 'no bgp default ipv4-unicast' — neighbors must be explicitly activated under 'address-family ipv4 unicast'
FixEnsure 'address-family ipv4 unicast' exists under the neighbor or is included in the inherited peer-policy template
SymptomNetwork statement not working — routes not advertised
CauseNX-OS uses prefix-length notation: 'network 10.0.0.0/24' not 'network 10.0.0.0 mask 255.255.255.0'
FixUse CIDR notation in the network statement: 'network X.X.X.X/prefix_len'
SymptomRedistribute connected not working
CauseNX-OS uses 'redistribute direct' — not 'redistribute connected' as in IOS
FixUse 'redistribute direct route-map POLICY-NAME' under address-family ipv4 unicast
SymptomPeer-policy template not applying to neighbor
CauseThe 'inherit peer-policy' command requires a sequence number in NX-OS
FixUse 'inherit peer-policy TEMPLATE-NAME 1' — the trailing '1' is the sequence number and is mandatory
SymptomCommunity attributes not forwarded
Cause'send-community' is disabled by default for all neighbors and templates
FixAdd 'send-community both' to the peer-policy template or directly under the neighbor
SymptomBFD not detecting neighbor failure
Cause'feature bfd' not enabled or BFD not configured on the physical interface
FixEnable 'feature bfd', add 'bfd' under the neighbor stanza, and configure BFD on the interface: 'bfd interval 300 min_rx 300 multiplier 3'

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

Related configs