Cisco IOS XR BGP Configuration: iBGP and eBGP Step by Step - 夜莺博客

Cisco IOS XR BGP Configuration: iBGP and eBGP Step by Step

Cisco IOS XR keeps the familiar router bgp model but removes one of classic IOS's conveniences: there is no default address family, so every address family you want to use must be explicitly configured both globally and under each neighbor. New XR engineers usually trip on exactly this point when a BGP session stays idle. This article walks through a minimal iBGP and eBGP setup on IOS XR with the verification commands that confirm each session and prefix.

IOS XR BGP Basics

  • Configure router bgp <as>, then add an address-family ipv4 unicast block globally; nothing is activated by default.
  • Neighbor statements are entered in a submode: neighbor <ip> then remote-as, then an address-family block under the neighbor with the policies.
  • Advertise local prefixes with the network statement inside the address family.
  • All changes need an explicit commit — there is no implicit save.

Configuration Example: iBGP and eBGP

The example below mirrors the classic PE1/PE2 (iBGP, AS 1) with CE1 (eBGP, AS 2) topology. Loopbacks are used for the iBGP session, and an eBGP route to CE1 is learned over the direct link.

RP/0/RSP0/CPU0:PE1# configure
RP/0/RSP0/CPU0:PE1(config)# router bgp 1
RP/0/RSP0/CPU0:PE1(config-bgp)# address-family ipv4 unicast
RP/0/RSP0/CPU0:PE1(config-bgp-af)# network 192.168.1.1/32
RP/0/RSP0/CPU0:PE1(config-bgp-af)# exit
RP/0/RSP0/CPU0:PE1(config-bgp)# neighbor 10.1.1.2
RP/0/RSP0/CPU0:PE1(config-bgp-nbr)# remote-as 1
RP/0/RSP0/CPU0:PE1(config-bgp-nbr)# update-source Loopback0
RP/0/RSP0/CPU0:PE1(config-bgp-nbr)# address-family ipv4 unicast
RP/0/RSP0/CPU0:PE1(config-bgp-nbr-af)# exit
RP/0/RSP0/CPU0:PE1(config-bgp-nbr)# exit
RP/0/RSP0/CPU0:PE1(config-bgp)# neighbor 172.16.1.2
RP/0/RSP0/CPU0:PE1(config-bgp-nbr)# remote-as 2
RP/0/RSP0/CPU0:PE1(config-bgp-nbr)# address-family ipv4 unicast
RP/0/RSP0/CPU0:PE1(config-bgp-nbr-af)# exit
RP/0/RSP0/CPU0:PE1(config-bgp-nbr)# exit
RP/0/RSP0/CPU0:PE1(config-bgp)# exit
RP/0/RSP0/CPU0:PE1(config)# commit

The iBGP neighbor uses update-source Loopback0 because the loopback is what both routers advertise; the eBGP neighbor to CE1 runs over the directly connected 172.16.1.0/30 link. Note that eBGP on directly connected links does not need ebgp-multihop, but a loopback-based eBGP session would.

Routing Policy vs Classic IOS Filtering

IOS XR does not use neighbor ... route-map; filtering is done with route policies attached inside the neighbor address-family:

route-policy PASS
  pass
end-policy
!
router bgp 1
 neighbor 172.16.1.2
  remote-as 2
  address-family ipv4 unicast
   route-policy PASS in
   route-policy PASS out
  !
 !
!

For large configurations, session groups, neighbor groups and af-groups provide template inheritance so you do not repeat per-neighbor policy. Group templates are covered in the IOS XR routing guides; the group model is one of the biggest structural differences from classic IOS.

Verification

show bgp summary
show bgp ipv4 unicast summary
show bgp ipv4 unicast neighbors 172.16.1.2
show bgp ipv4 unicast
show run router bgp

Check the St/PfxRcd column: an iBGP/eBGP neighbor in the Established state with received prefixes is the success indicator. If a session stays Idle or Active, re-check that the address family exists under both the global BGP config and the neighbor, that the router ID is set (loopback or bgp router-id), and that TCP 179 is reachable — the same discipline covered for BGP neighbor flapping root causes. For OSPF-to-BGP interplay on XR see our IOS XR OSPF configuration examples.

原文链接:https://community.cisco.com/t5/networking-knowledge-base/bgp-basic-configuration-on-ios-xr-ibgp-and-ebgp/ta-p/3145638