1.11 Troubleshoot internal and external BGP, globally and in a VRF
ENARSI 300-410 v1.1 · 1.0 Layer 3 Technologies
BGP connects autonomous systems and carries enterprise policy. ENARSI troubleshoots iBGP and eBGP sessions (next hop, multihop, private and 4-byte AS numbers, peer groups, timers), the best-path algorithm, a route reflector, and inbound and outbound policy, for IPv4 and IPv6 and inside VRFs.
What you must know
- Configure MP-BGP for IPv4 and IPv6 unicast, and BGP in a VRF.
- Fix sessions: reachability, update-source, ebgp-multihop, next-hop-self, AS numbers, timers.
- Apply the best-path order to a set of paths.
- Configure a route reflector and its clients; know the cluster ID and originator ID.
- Filter and change paths with prefix lists, AS-path ACLs, communities and route maps.
Address families and VRFs
router bgp 65001
bgp router-id 1.1.1.1
no bgp default ipv4-unicast
neighbor 10.0.12.2 remote-as 65002
neighbor 2001:DB8:12::2 remote-as 65002
address-family ipv4 unicast
neighbor 10.0.12.2 activate
network 10.1.0.0 mask 255.255.0.0
address-family ipv6 unicast
neighbor 2001:DB8:12::2 activate
network 2001:DB8:1::/48
address-family ipv4 vrf RED
neighbor 10.0.99.2 remote-as 65099
neighbor 10.0.99.2 activateA neighbour only exchanges the families it is activated in. With no bgp default ipv4-unicast, nothing is activated by default. IPv6 prefixes can also ride an IPv4 session, but then the next hop is an IPv4-mapped address and must be fixed with a route map; peering over IPv6 for IPv6 is simpler. A VRF address family needs an rd in the VRF definition.
Neighbours
! R1
router bgp 65001
neighbor 192.0.2.1 remote-as 65002
neighbor 2.2.2.2 remote-as 65001
neighbor 2.2.2.2 update-source Loopback0
neighbor 2.2.2.2 next-hop-self
R2# show ip bgp summary
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
1.1.1.1 4 65001 14 12 9 0 0 00:08:02 5| Symptom | Cause |
|---|---|
| Idle / Active forever | No route to the peer address, wrong remote-as, ACL dropping TCP 179, or the peer sources from another address |
| eBGP to a loopback stays Idle | TTL 1: add ebgp-multihop 2 (or disable-connected-check) and update-source |
Routes received but not best (no >) | Next hop unreachable: missing next-hop-self on the iBGP edge, or the IGP lacks the external link |
| Session up, then drops every 3 minutes | Hold timer mismatch is negotiated (the lower wins); look for MTU or ACL issues on updates |
% BGP: Bad remote-as | The peer's AS differs, or it uses a 4-byte AS (asdot 1.10 = 65546) you typed in the other notation |
R2 can use the ISP routes (1) only because R1 rewrites the next hop. Private AS numbers (64512–65534, 4200000000–4294967294) are removed toward the ISP with remove-private-as. Route refresh (clear ip bgp * soft) asks the peer to resend after a policy change without resetting. Peer groups and peer templates share configuration between neighbours; members of a peer group share outbound policy.
Best-path order
- Next hop reachable (otherwise the path is never considered).
- Highest weight (Cisco, local to the router).
- Highest local preference (default 100, shared in the AS).
- Locally originated (network, aggregate, redistribute).
- Shortest AS path.
- Lowest origin: IGP (i) < EGP (e) < incomplete (?).
- Lowest MED (only compared between paths from the same neighbouring AS by default).
- eBGP over iBGP.
- Lowest IGP metric to the next hop.
- Oldest eBGP path, then lowest router ID, then lowest neighbour address.
R1# show ip bgp 203.0.113.0
BGP routing table entry for 203.0.113.0/24, version 12
Paths: (2 available, best #2, table default)
65003 65010
10.0.13.3 from 10.0.13.3 (3.3.3.3)
Origin IGP, localpref 100, valid, external
65002 65010
192.0.2.1 from 192.0.2.1 (192.0.2.1)
Origin IGP, localpref 200, valid, external, bestA single route reflector
iBGP does not pass a route learned from one iBGP peer to another (iBGP split horizon), so normally every router needs a session with every other. A route reflector relaxes that: it reflects routes from a client to all other clients and non-clients. Only the RR needs configuration: neighbor 10.0.0.3 route-reflector-client. To prevent loops, the RR adds ORIGINATOR_ID (the RID that first sent it) and CLUSTER_LIST; a router drops a route carrying its own RID or cluster ID.
Filtering and path manipulation
| Goal | Tool | Direction |
|---|---|---|
| Prefer one exit for the whole AS | set local-preference 200 | Inbound, on the preferred edge |
| Prefer one exit on one router | neighbor X weight 200 or set weight | Inbound |
| Make others send traffic to you over one link | set as-path prepend 65001 65001 on the other link | Outbound |
| Hint to a neighbouring AS | set metric 50 (MED) | Outbound |
| Accept only some prefixes | neighbor X prefix-list P in | Inbound |
| Filter by AS | ip as-path access-list 1 permit ^65002$ + filter-list 1 in | Either |
| Mark and act on groups of routes | set community 65001:100 + send-community; match community | Either |
ip as-path access-list 10 permit ^$ ! only routes we originate
router bgp 65001
neighbor 192.0.2.1 filter-list 10 out ! never become transitAfter changing inbound policy, run clear ip bgp <peer> soft in; the new policy applies only to updates received after the change.
Commands
show ip bgp summary / show bgp ipv6 unicast summary | Sessions, state and prefixes received. |
show ip bgp <prefix> | Every path with its attributes and which is best. |
show ip bgp neighbors <ip> [advertised-routes | received-routes] | Session details and what is sent or received. |
show ip bgp vpnv4 vrf <name> / show bgp vrf <name> | A VRF's BGP table. |
clear ip bgp <peer> soft [in|out] | Re-apply policy without resetting the session. |
show ip bgp regexp ^65002_ | Paths whose AS path matches a regex. |
Exam traps
- eBGP to a loopback needs both
update-sourceandebgp-multihop(TTL 1 by default). - iBGP routes with an external next hop are not best until the next hop is reachable.
- Weight never leaves the router; local preference never leaves the AS.
- MED is compared only between paths from the same neighbouring AS unless
bgp always-compare-med. - A neighbour not activated in an address family exchanges nothing in it.
send-communityis off by default, so communities set outbound are stripped.
Check yourself
- Two paths: weight 0/LP 200 and weight 100/LP 100. Which wins?
- Weight 100: weight is checked before local preference.
- R2 receives a route from iBGP but it has no
>. First check? - Is the next hop reachable? Usually
next-hop-selfis missing on the edge router. - What does a route reflector add to stop loops?
- ORIGINATOR_ID and CLUSTER_LIST.
- How do you make the Internet prefer your link through ISP A?
- Prepend your AS on the advertisements to ISP B (outbound), or send a lower MED to the same ISP.
- What AS path regex matches only your own routes?
^$
Labs
- iBGP over loopbacks: a peer group, a route reflector, next-hop-self and eBGP multihop
- BGP path control: local preference, prepending, a no-transit filter and communities
- VRF-Lite: two customers with overlapping addresses, OSPF in one VRF and BGP in the other
- MP-BGP for IPv6: over IPv6, then over an IPv4 session
Try it live: iBGP over loopbacks: a peer group, a route reflector, next-hop-self and eBGP multihop
More topics in 1.0 Layer 3 Technologies
- 1.1 Troubleshoot administrative distance across every routing source
- 1.3 Troubleshoot routing loop prevention: filters, tags, split horizon and poisoned routes
- 1.4 Troubleshoot redistribution between routing protocols and other route sources
- 1.5 Troubleshoot manual and automatic route summarization
- 1.6 Configure and verify policy-based routing
- 1.7 Configure and verify VRF-Lite
- 1.8 Describe how Bidirectional Forwarding Detection works
- 1.9 Troubleshoot EIGRP in classic and named mode, globally and in a VRF