BGP Debug
BGP Debug
Solution
Agenda
• BGP peering issues
• Session not coming up, Session flapping
OSPF OSPF
R1 R2 R3 R1 R2 R3
iBGP eBGP iBGP eBGP
AS65535 AS65534 AS65535 AS65534
R1#
Failed BGP Peering
Blocked process in XR
RP/0/RSP0/CPU0:ASR9010-B# show process bgp
Mon Jun 3 09:47:12.646 EST
• Ensure BGP process is in Run Job Id: 1040
state. PID: 307494
Executable path: /disk0/iosxr-routing-
4.2.3/bin/bgp
• Check for blocked BGP or Instance #: 1
TCP process on the RP / LC Version ID: 00.00.0000
Respawn: ON
using show process blocked Respawn count: 1
command. Max. spawns per minute: 12
Last started: Tue May 28 14:35:50
2013
Process state: Run
Package state: Normal
Started on config: default
. . . .
Failed BGP Peering
Show process bgp (contd. Output)
RP/0/RSP0/CPU0:ASR9010-B# show process bgp
<snip>
10 2 488K 10 Nanosleep 0:00:02:0004 0:00:00:0847 bgp
1049 13 3 488K 10 Receive 0:00:00:0811 6:36:52:0264 bgp
1049 14 3 488K 10 Condvar 14:56:55:0236 9:07:49:0890 bgp
1049 15 0 488K 10 Condvar 14:56:55:0240 25:09:49:0542 bgp
1049 16 3 488K 10 Running 0:00:00:0000 57:53:33:0110 bgp
1049 17 1 488K 10 Receive 0:00:28:0379 0:00:00:0066 bgp
1049 18 1 488K 10 Mutex 13:15:50:0870 3:31:49:0712 bgp
<snip>
• You can also use “show process blocked” to check the blocked
processes
Failed BGP Peering
Packet Capture
Use SPAN on Cisco Switches to get traffic to your sniffer
IOS-XR
- Only supported on ASR-9000
- Use ACLs to control what packets to SPAN
TAC Case Example - 1
BGP Peering down
• Resolution
- Configure both sessions to use same capability i.e. Single-session / Multi-session
- neighbor <ip-addr> transport single-session | multi-session
Scenario 2 - BGP Peer Flapping
Problem Description
iBGP
High CPU
Interface Input-Queue Drops iBGP
AS 65535
BGP Peer Flapping
Notifications
R2#
*Mar 24 20:25:47.262: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down BGP
Notification sent
*Mar 24 20:25:47.262: %BGP-3-NOTIFICATION: sent to neighbor 1.1.1.1 4/0
(hold time expired) 0 bytes
1 Unsupported BGP version The version of BGP the peer is running isn’t compatible with
the local version of BGP
2 Bad Peer AS The AS this peer is locally configured for doesn’t match the
AS the peer is advertising
3 Bad BGP Identifier The BGP router ID is the same as the local BGP router ID
4 Unsupported Optional Parameter There is an option in the packet which the local BGP
speaker doesn’t recognise
6 Unacceptable Hold Time The remote BGP peer has requested a BGP hold time
which is not allowed (too low)
7 Unsupported Capability The peer has asked for support for a feature which the local
router does not support
R1 R5
R2 4000 R3 2000 R4
• Customer reported that the BGP session between R1 & R5 flapped once
in every 3 minutes.
• Issue started after the number of prefixes exchanged was increased from
100 to 100,000.
• Requested “show ip bgp neighbor <nei-ip>”
TAC Case Example - 2
PMTUD
R1 R5
R2 4000 R3 2000 R4
Transport(tcp) path-mtu-discovery is
enabled
• BGP Path MTU Discovery failure.
Datagrams (max data segment is 3960
bytes):
R1#
TAC Case Example - 2
Resolution
• Globally change the TCP MSS negotiation value
- ip tcp mss <mss-value>
• Disable BGP path mtu discovery on the BGP peers under router config mode
- no bgp transport path-mtu-discovery
Agenda
• BGP peering issues
• Session not coming up, Session flapping
CPU utilization for five seconds: 99%/0%; one minute: 28%; five minutes: 17%
. . . .
High CPU due to BGP
BGP Router
PE1
• Customer reported one of the router had PE2
AS65535
become inaccessible RR2
<snip>
1367919: Sep 11 2012 17:34:43: %LINK-3-UPDOWN: Interface GigabitEthernet1/4/36, changed state to down
TAC Case Example - 3
Resolution
• Symptoms
- Malloc Failures
- Slow performance
- Router reloads
High Memory / Memory Leak
Malloc Failures
Sep 20 22:43:01.831 UTC: %SYS-2-MALLOCFAIL: Memory allocation of 65556 bytes
failed from 0x400E04EC, alignment 16
Pool: Processor Free: 8952 Cause: Not enough free memory
Alternate Pool: Reclaimed Free: 25520 Cause: Not enough free memory
-Process= "BGP Router", ipl= 0, pid= 156
-Traceback= 40348B24 403FB928 403FDFA0 403F7238 40F5AC5C 4026B690 406B794C 40682DB0
406833FC 40884688 40884DF4 40885BB4 40F9B160 40885C68 40843E68
• If Malloc error show the process as BGP – doesn’t mean BGP is the culprit
• This error log can be the consequence of insufficient memory or a memory leak
condition
• Run “show memory debug leak [chunk]” to identify a memory leak
High Memory / Memory Leak
Memory Leak in IOS XR
• Use IOS XR memory comparator tool to track any incremental memory leak
• Simple 3 step process
- Show memory compare start 4-5 min gap
- Show memory compare end
- Show memory compare report
RP/0/RP0/CPU0:XR_RTR# show memory compare report
Sun Apr 12 22:28:21.715 PDT
JID name mem before mem after difference mallocs
restart/exit/new
--- ---- ---------- --------- ---------- -------
1088 mibd_interface 232432236 232957764 525528 33753
1086 mibd_entity 1046476 1528332 481856 11
1044 bgp 1037562644 1037827636 264992 425
0 malloc_dump 0 22144 22144 355
<snip>
TAC Case Example - 4
Memory Leak
• Customer reported “show memory” loses about 3-10 Mb of Free memory per
day
• It was noticed that BGP Router process accumulated most of the holding
memory
• Same behavior was noticed even after the reload.
Allocated Freed Holding Process
• Resolution
- Removing the Idle / Admin down neighbors helped overcome the memory leak
Agenda
• BGP peering issues
• Session not coming up, Session flapping
• Symptoms
• Slow convergence RR1
• Updates not replicated to all peers
I’m Slow
BGP Slow-peer
BGP Cache Size & OutQ
• Should be reaching the maximum cache size for that update-group
• OutQ column should show very high OutQ value
RR# show ip bgp vpnv4 all replication
Current Next
Index Members Leader MsgFmt MsgRepl Csize Version Version
1 348 12.123.67.97 1726595727 1938155978 999/1000 1012333000/1012351142
2 2 12.122.78.19 79434677 79398843 0/200 1012351503/1012351503
3 1 199.37.187.24 0 0 0/100 0/0
4 2 12.122.78.249 79219618 97412908 0/200 1012351504/1012351504
• The threshold defines “the threshold time in seconds” to detect a peer as slow
peer.
• The range is 120 seconds to 3600 seconds. Default is 300 seconds.
BGP Slow-peer
Slow peer protection
• Depends on Dynamic Slow Peer feature
• When a slow peer recovery is detected (the peer has converged), the peer will
be moved back to its original group
bgp slow-peer split-update-group dynamic [permanent]
• When “permanent” is not configured, the “slow peer” will be moved to its regular
original update group, after it becomes regular peer (converges).
• If “permanent” is configured, the peer will not be moved to its original update
group automatically
BGP Slow-peer
Syslog Messages
• The below log message will be generated when a peer is detected as dynamic
slow peer.
"bgp neighbor %s in af %d is detected as slow-peer"
• Clear Commands
Clear [ip] bgp <nbr-addr> slow
B 90% D
AS200
AS65000 F
A 5% Provider
C E
BGP Multi-homing
Overview
• More than one link external to the local network
- Usually two external facing routers
• Two design scenarios :
- Multi-homing to the same ISP
- Multi-homing to different ISPs
• Each design categorised into two modes :
- Fail-over mode
- Load-sharing mode
Following examples assume that the multi-homed site has a /19 address block
For your
Best Path Algorithm reference only
• Backup link:
- Outbound – announce /19 with increased metric
- Inbound – received default, and reduce local preference
Multi-Homing with same ISP
Load-Sharing Mode
• This example assumes equal capacity circuits - Unequal capacity circuits
requires more refinement
• Simple - Just receive the default route
- Assumes multi-path feature is enabled on internal routers of receiving AS
• Split /19 and announce as two /20s
- Advertise one with a lower MED and the other with a higher MED on each link
B D
Link-1
AS100 AS200
A F
Link-2
C E
Multi-Homing with two different ISPs
Failover Mode
• One link primary, the other link backup only
D
AS200
B
Internet
AS100
A
C
E
AS300
Multi-Homing with two different ISPs
Load-Sharing Mode
• Use both default from both ISPs for outbound
• For inbound :
Split /19 and announce as two /20s
- one is announced with lengthened AS by prepending and other is announced ‘as is’
on each link
D
AS200
B
Internet
AS100
A
C
E
AS300
TAC Case Example - 6
BGP Multi-Homing
• It was required to prefer router B as the primary router for all outgoing and
incoming traffic.
• In case of any failure, the traffic must automatically be routed to C.
D
AS200
AS100 B
Internet
A
C
E
AS300
TAC Case Example - 6
Resolution
• Making router B the primary HSRP gateway for A will solve the outbound
requirement
• Use of “set as-path prepend” will help solve this problem of inbound
requirement
Router C:
=========
access-list 100 permit <specific_traffic>
route-map foo permit 10
match ip address 1
set as-path prepend 100
!
router bgp 100
neighbor <AS_300_nei> route-map foo out
Agenda
• BGP peering issues
• Session not coming up, Session flapping
• No reachability
• Packet loss
CE1 CE2
BGP in MPLS VPN
Troubleshooting steps
• Verify VRF configuration on both PE routers
- IOS - show run vrf A
• Verify local PE-CE Reachability (PE1 – CE1) & (PE2 – CE2)
• Verify PE to PE loopback reachability
PE1 RR1 PE2
- PE1# ping <PE2_loopback> source lo0
• Verify LSP path between PE routers MPLS VPN
- ping mpls ipv4 <dst> <subnet> CE1 CE2
PE1#sh ip bgp vpnv4 vrf A 100.1.1.1 PE2#sh ip bgp vpnv4 vrf A 100.1.1.1
BGP routing table entry for 1:1:100.1.1.1/32 BGP routing table entry for 1:1:100.1.1.1/32
192.168.10.2 from 0.0.0.0 (1.1.1.1) 1.1.1.1 (metric 21) from 2.2.2.2 (2.2.2.2)
<snip> <snip>
OSPF RT:0.0.0.0:2:0 OSPF ROUTER OSPF RT:0.0.0.0:2:0 OSPF ROUTER
ID:192.168.10.1:0 ID:192.168.10.1:0
mpls labels in/out 100/nolabel Originator: 1.1.1.1, Cluster list: 2.2.2.2
mpls labels in/out nolabel/100
Scenario 7b – RT Constraint Filtering in MPLS VPN
Problem Description
• Customer reported that their resource utilisation on edge routers have increased
with the growth of their SP network where as no extra services has been
deployed on those edge devices
• Symptoms
• Unwanted resource utilisation
PEn
• Performance issues
PE(n-1)
PE2 CE2
CE1 PE1 RR
RR-1 RR-2
VRF- Red VRF- Purple
VRF- Green VRF- Blue
PE-2 Unwanted VRF routes for RR PE-4
• PE-1 and PE-2 advertise VRF Blue, red and green VPN routes to RR-1
• RR-1 send ALL its VPN routes to RR-2.
• VRF-Red routes are really ‘unwanted’ on RR-2 since PE-3 and PE-4 does not have VRF
Red.
RT Constraint Filtering in MPLS VPN
Concept
• By having BGP speakers exchanging the ‘wanted’ Route Targets, this allows
BGP speaker to eliminate advertising ‘unwanted’ VPN routes to its peer.
• The ‘wanted’ Route Targets are called RT membership.
• MP-BGP UPDATE message to propagate RT membership information.
- Peers to advertise their RT membership.
- Restrict advertisement of VPN route based on received RT membership information.
exit-address-family
RT Constraint Filtering in MPLS VPN
Enable RT Constraint on PE
PE-2#sh run | b router bgp 20.0.0.2 20.0.0.1
router bgp 65000
address-family vpnv4 PE-2 RR-1
neighbor 20.0.0.1 activate
neighbor 20.0.0.1 send-community both
exit-address-family
!
address-family rtfilter
neighbor 20.0.0.1 activate
neighbor 20.0.0.1 send-community both
exit-address-family
RT Constraint Capability Exchange
20.0.0.2 20.0.0.1
PE-2 RR-1
AS1RR1
AS100
AS1PE1 AS1PE2
CE1 CE2
100.1.1.0/24 200.1.1.0/24
TAC Case Example - 7
Troubleshooting Done
• Debugging done to see if AS1RR1 was sending the update or not
debug ip bgp vpnv4 unicast update <neighbor> <acl> in IOS
access-list 10 per 100.1.1.0 0.0.0.255
route-policy DEBUG_BGP
if destination in BGP_PREFIX then
pass
else
drop
endif IOS XR
end-policy
prefix-set BGP_PREFIX
100.1.1.0/24
end-set
• It was noticed that there was a missing entry on the vrf import statement
Scenario 8 – BGP PIC
Problem Description
• Customer reported they have a multi-homed Customer. But when the primary
BGP session goes down, it takes time to converge and the customer
experiences a traffic loss
• Symptoms
• Traffic loss
PE2
PE1
AS100
CE1 CE2
PE3
What is PIC and BGP FRR?
• Prefix Independent Convergence (PIC) in CEF and platform whereby cutover to any
backup path happens within sub-seconds and independent of the number of prefixes.
• BGP Fast Re-Route (BGP FRR) – enables BGP to use alternate paths within sub-
seconds after a failure of the primary or active paths.
• Without backup paths available to CEF, convergence is driven from the routing protocols
updating the RIB and CEF one prefix at a time, leading to convergence times directly
proportional to the number of affected prefixes.
• When backup paths are available, CEF can use these to provide constant time and prefix
independent convergence, when a failure affecting a shared path-list occurs.
BGP PIC
PIC edge vs. PIC core
1 2
PE2
3
R1(config-bgp-vrf)bgp advertise-best-external
(on backup PE for PE-CE link protection)
BGP PIC
BGP Output
ASR-1K# sh ip bgp vpnv4 vrf site-111111 2.0.0.0
BGP routing table entry for 65300:111111:2.0.0.0/24, version 150035
Paths: (3 available, best #1, table sie-111111)
Additional-path-install
Advertised to update-groups:
105
Refresh Epoch 1
20570 20570
10.200.1.2 from 10.200.1.2 (10.200.1.2)
Origin incomplete, localpref 100, valid, external, best
Extended Community: RT:64300:111111 , recursive-via-connected
rx pathid: 0, tx pathid: 0x0
<snip>
Refresh Epoch 1
20570 20570
10.10.10.2 from 10.10.10.2 (5.5.5.5)
Origin incomplete, localpref 100, valid, internal, backup/repair
Extended Community: RT:64300:111111 , recursive-via-host
rx pathid: 0, tx pathid: 0
BGP PIC
CEF Output
2.0.0.0/24, epoch 0, flags rib only nolabel, rib defined all labels
recursive via 10.200.1.2
attached to GigabitEthernet0/1/1.200
recursive via 10.10.10.2, repair
attached to GigabitEthernet0/1/0.451
BGP PIC
Show Commands
• BGP
sh ip bgp ipv4 unicast <x.x.x.x>
sh ip bgp vpnv4 unicast vrf FOO <x.x.x.x> (To check if backup/repair is set on a prefix)
sh ip bgp vpnv4 vrf FOO neighbor <neighbor_ip> (shows if PIC is enabled)
• RIB
Show ip route vrf FOO <x.x.x.x>
• CEF
show (ip | ipv6) cef [vrf XX] prefix/mask internal
show monitor event cef (ipv4 | ipv6 | bfd) all
show cef bfd
debug cef bfd
debug cef loadinfo map
debug cef path
debug cef filter fib (ipv4 | ipv6) prefix/mask
TAC Case Example - 8
BGP PIC
• Customer has implemented BGP PIC Edge feature and is also using BFD for
faster failover.
• When the best path fails, the customer does not see the fast convergence
happening
P2 PE4
P3 PE5
TAC Case Example - 8
CEF Output
ASR-1K#sh ip cef vrf site-111111 2.0.0.0 internal
2.0.0.0/30, epoch 0, flags rib only nolabel, rib defined all labels, RIB[B], refcount 6, per-
destination sharing
sources: RIB
<snip>
GigabitEthernet0/1/1.350(21): 10.200.1.2
path 7FA7EB87AB00, path list 7FA7EB611F90, share 1/1, type recursive, for IPv4, flags recursive-
via-connected
recursive via 10.200.1.2[IPv4:sie-111111], fib 7FA7ECBE2558, 1 terminal fib, v4:sie-
111111:10.200.1.2/32
path 7FA7EB87A630, path list 7FA7EB612C10, share 1/1, type adjacency prefix, for IPv4
attached to GigabitEthernet0/1/1.350, adjacency IP adj out of GigabitEthernet0/1/1.350, addr
10.200.1.2 7FA7EB643568
path 7FA7EB879DF0, path list 7FA7EB611F90, share 1/1, type recursive, for IPv4, flags repair,
recursive-via-host, unuseable
recursive via 10.10.10.2[IPv4:sie-111111], repair, fib 7FA7E2E01068, 1 terminal fib, v4:sie-
111111:10.10.10.2/32
<snip>
TAC Case Example - 8
Resolution