Basic BGP peers diagnostics

Post ID: 5
/ bgp / basic-bgp-peers-diagnostics

March 15, 2019
(Updated: March 19, 2019)
#cisco #juniper #bird #routes #bgp #cisjunbird

Cisco, Juniper, BIRD: One of the most frequent tasks in the administration of BGP interactions is basic diagnostics of the state of BGP peers: session state, accepted routes, advertised routes. The BGP protocol is the main and in fact the only used nowadays protocol for interaction between AS (autonomous systems). Accepted routes from an external BGP peer are an ability for your traffic to leave your autonomous system to the outside, to the resources of third-party providers. Routes that you announce are an ability for traffic from external networks to be delivered to your autonomous system, to your consumers.

Checking all BGP-session status

Firstly, you need to check the state of your BGP-session – is it in up, down or another state?

Cisco:

Cetus# show ip bgp summary        # IPv4-sessions
Cetus# show bgp ipv4 unicast summary          # the same, IPv4-sessions, new style
Cetus# show bgp ipv6 unicast summary         # IPv6 sessions

Juniper:

Juniper> show bgp summary 

BIRD

BIRD> show protocols

Cisco# show bgp summary
BGP router identifier 195.209.62.245, local AS number 12722             # ID and ASn of this router
BGP table version is 30700908, main routing table version 30700908
756642 network entries using 187647216 bytes of memory
972837 path entries using 116740440 bytes of memory
166800/132739 BGP path/bestpath attribute entries using 41366400 bytes of memory
160500 BGP AS-PATH entries using 7229590 bytes of memory
2 BGP ATTR_SET entries using 80 bytes of memory
7585 BGP community entries using 1349790 bytes of memory
139 BGP extended community entries using 7204 bytes of memory
831 BGP route-map cache entries using 53184 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 354393824 total bytes of memory
BGP activity 1469287/648111 prefixes, 11459337/10421970 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.70.0.205     4       201706       0       0        1    0    0 never    Idle (Admin)     # this session is disabled in the configuration
31.28.19.1      4        29076       0       0        1    0    0 never    Idle (Admin)
31.28.19.254    4        29076       0       0        1    0    0 never    Idle (Admin)
45.63.95.157    4        65535   30753 4721230 30700868    0    0 3w3d            0   # this session is UP 3 weeks and 3 days, 0 routes received
45.77.76.135    4        65535       0       0        1    0    0 20:59:59 Idle     # this session is DOWN 20 hours 59 mins, problem on the other side
82.144.64.249   4        25355 4368773 4693912 30700395    0    0 3w3d            4
195.209.44.50   4       199278   39482 4731874 30700395    0    0 3w3d            5
195.209.44.62   4        61293  420494 5014692 30700395    0    0 3w3d            3
195.209.63.217  4        12722 8201278   82719 30700923    0    0 3w3d       495637
195.209.63.218  4        12722 5105722   82740 30700923    0    0 3w3d       477151   # this session is up, 477151 routes received

Cisco#show bgp ipv6 unicast summary 
BGP router identifier 195.209.62.245, local AS number 12722
BGP table version is 56236793, main routing table version 56236793
64530 network entries using 17552160 bytes of memory
64530 path entries using 9292320 bytes of memory
23150/23147 BGP path/bestpath attribute entries using 5741200 bytes of memory
160286 BGP AS-PATH entries using 7216730 bytes of memory
2 BGP ATTR_SET entries using 80 bytes of memory
7554 BGP community entries using 1345026 bytes of memory
138 BGP extended community entries using 7164 bytes of memory
270 BGP route-map cache entries using 17280 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 41171880 total bytes of memory
BGP activity 1469330/648134 prefixes, 11459722/10422317 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2001:19F0:5:AD1:5400:FF:FE78:9606
                4        65535       0       0        1    0    0 21:02:09 Idle    # IPv6 session is UP
2A00:13C0:3:1::1F1C:1301
                4        29076   67741    1207 56236776    0    0 17:34:43    64526



Juniper> show bgp summary
Groups: 10 Peers: 14 Down peers: 2
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0
                 2284261     756618          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
31.44.187.100         50817     110999      19068       0      11  6d 2:37:48 1825/69868/69868/0   0/0/0/0   # this session is UP
31.44.187.254         50817     124100      22236       0       7 1w0d 3:00:14 8241/69546/69546/0   0/0/0/0
178.18.227.100        50952     789150      46257       0       3 2w0d 17:51:19 26444/88123/88123/0  0/0/0/0
195.209.32.114        39678          0          0       0       3 13w5d 10:49:38 Connect  # trying to connect
195.209.37.42         51916          0          0       0       0 18w0d 4:49:05 Idle        # this session experiencing problems, check remote side or link
195.209.37.138        51916      71715    8801975       0      11 3w3d 21:37:04 1/1/1/0              0/0/0/0
195.209.44.58         61293     420518    9754367       0       3 3w3d 22:03:56 3/3/3/0              0/0/0/0
195.209.63.218        12722    5105789    8171494       0      11 3w3d 22:00:36 260940/477158/477158/0 0/0/0/0
195.209.63.220        12722      82717    8201047       0       1 3w3d 22:01:12 22/42/28/0           0/0/0/0

BIRD> # show bgp summary
bird> show protocols
Name       Proto      Table      State  Since         Info
device1    Device     ---        up     2018-10-22 13:38:08
static1    Static     master4    up     2018-10-22 13:38:08
R12722x773206538 BGP        ---        up     2019-02-19 21:21:51  Established    # session with peer named R12722x773206538 are established
R199278x773206544 BGP        ---        up     2019-02-19 21:22:16  Established
R25355x773206540 BGP        ---        up     2019-02-19 21:22:14  Established
R5537x773206543 BGP        ---        up     2019-02-16 00:56:17  Established
R61960x773206542 BGP        ---        up     2019-02-19 21:21:54  Established

Checking state of the specific BGP peer

Then, you can check specific peer you are interested

Cisco# show ip bgp neighbors < ip-address >

Juniper# show bgp neighbor < ip-address >

BIRD#
show protocols < peer name > # short output for peer show protocols all < peer name > # detailed output for specific peer

Cisco#show  ip bgp neighbors 195.209.63.217
BGP neighbor is 195.209.63.217,  remote AS 12722, internal link
 Member of peer-group JUNIPERS for session parameters
  BGP version 4, remote router ID 195.209.62.231
  BGP state = Established, up for 3w3d
  Last read 00:00:01, last write 00:00:04, hold time is 90, keepalive interval is 30 seconds
  Neighbor sessions:
    1 active, is not multisession capable (disabled)
  Neighbor capabilities:
    Route refresh: advertised and received(new)
    Four-octets ASN Capability: advertised and received
    Address family IPv4 Unicast: advertised and received
    Graceful Restart Capability: received
      Remote Restart timer is 120 seconds
      Address families advertised by peer:
        none
    Enhanced Refresh Capability: advertised
    Multisession Capability:
    Stateful switchover support enabled: NO for session 1
  Message statistics:
    InQ depth is 0
    OutQ depth is 0

                         Sent       Rcvd
    Opens:                  1          1
    Notifications:          0          0
    Updates:             4839    8125901
    Keepalives:         77902      77637
    Route Refresh:          0          0
    Total:              82742    8203539
  Default minimum time between advertisement runs is 0 seconds

 For address family: IPv4 Unicast
  Session: 195.209.63.217
  BGP table version 30709553, neighbor version 30709553/0
  Output queue size : 0
  Index 4, Advertise bit 3
  4 update-group member
  JUNIPERS peer-group member
  Community attribute sent to this neighbor
  Slow-peer detection is disabled
  Slow-peer split-update-group dynamic is disabled
  Interface associated: (none)
                                 Sent       Rcvd
Juniper> show bgp neighbor 85.112.122.1
Peer: 85.112.122.1+179 AS 25478 Local: 85.112.122.150+64144 AS 12722
  Group: WIX                   Routing-Instance: master
  Forwarding routing-instance: master
  Type: External    State: Established    Flags: 
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: Cease
  Export: [ WIX.RM.out ] Import: [ WIX.RM.in ]
  Options: 
  Options: 
  Holdtime: 90 Preference: 170
  Number of flaps: 4
  Last flap event: Stop
  Error: ′Hold Timer Expired Error′ Sent: 1 Recv: 0
  Error: ′Cease′ Sent: 1 Recv: 2
  Peer ID: 85.112.122.1    Local ID: 195.209.62.231    Active Holdtime: 90
  Keepalive Interval: 30         Group index: 7    Peer index: 0    SNMP index: 41
  I/O Session Thread: bgpio-0 State: Enabled
  BFD: enabled, down
  Local Interface: ae2101.3018
  NLRI for restart configured on peer: inet-unicast
  NLRI advertised by peer: inet-unicast
  NLRI for this session: inet-unicast
  Peer supports Refresh capability (2)
  Stale routes from peer are kept for: 300
  Peer does not support Restarter functionality
  NLRI that restart is negotiated for: inet-unicast
  NLRI of received end-of-rib markers: inet-unicast
  NLRI of all end-of-rib markers sent: inet-unicast
  Peer does not support LLGR Restarter or Receiver functionality
  Peer supports 4 byte AS extension (peer-as 25478)
  Peer does not support Addpath
  Table inet.0 Bit: 20000
    RIB State: BGP restart is complete
    Send state: in sync
    Active prefixes:              257585
    Received prefixes:            744923
    Accepted prefixes:            744923
    Suppressed due to damping:    0
    Advertised prefixes:          8
  Last traffic (seconds): Received 17922590 Sent 2150955 Checked 17922590
  Input messages:  Total 11139937       Updates 11058656        Refreshes 0     Octets 1221515122
  Output messages: Total 77678  Updates 12      Refreshes 0     Octets 1476290
  Output Queue[1]: 0            (inet.0, inet-unicast)
bird> show protocols all R12722x773206538
Name       Proto      Table      State  Since         Info
R12722x773206538 BGP        ---        up     2019-02-19 21:21:51  Established

bird> show protocols all R12722x773206538
Name       Proto      Table      State  Since         Info
R12722x773206538 BGP        ---        up     2019-02-19 21:21:51  Established   
  Description:    RECONN - RECONN peer 1
  BGP state:          Established
    Neighbor address: 46.22.50.10
    Neighbor AS:      12722
    Neighbor ID:      195.209.62.231
    Local capabilities
      Multiprotocol
        AF announced: ipv4
      Route refresh
      Graceful restart
      4-octet AS numbers
      Enhanced refresh
    Neighbor capabilities
      Multiprotocol
        AF announced: ipv4
      Route refresh
      Graceful restart
      4-octet AS numbers
    Session:          external route-server AS4
    Source address:   46.22.50.1
    Hold timer:       71.815/90
    Keepalive timer:  0.255/30
  Channel ipv4
    State:          UP
    Table:          master4
    Preference:     100
    Input filter:   bgp_in_AS12722
    Output filter:  ACCEPT
    Import limit:   10000
      Action:       restart
    Routes:         26 imported, 70 exported
    Route change stats:     received   rejected   filtered    ignored   accepted
      Import updates:             33          0          5          0         28
      Import withdraws:            2          0        ---          5          2
      Export updates:            111         30          0        ---         81
      Export withdraws:            4        ---        ---        ---          2
    BGP Next hop:   46.22.50.1

Cheking routes from BGP peer

Well, if the session is established, we can check which routes we receive from our BGP peer

Cisco# show ip bgp neighbors < ip-address > routes

Juniper# show route receive-protocol bgp < peer ip-address >

BIRD#
show route protocol < peer name > # short output for peer show route protocol < peer name > all # detailed

Cisco#show ip bgp neighbors 195.209.63.217 routes 
BGP table version is 30866234, local router ID is 195.209.62.245
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i 1.0.4.0/24       195.209.63.217        1599    110      0 6939 4826 38803 56203 i
 *>i 1.0.4.0/22       195.209.63.217        1599    110      0 6939 4826 38803 56203 i
 *>i 1.0.5.0/24       195.209.63.217        1599    110      0 6939 4826 38803 56203 i
 *>i 1.0.6.0/24       195.209.63.217        1599    110      0 6939 4826 38803 56203 i
 *>i 1.0.7.0/24       195.209.63.217        1599    110      0 6939 4826 38803 56203 i
 *>i 1.0.16.0/24      195.209.63.217         290     60      0 20764 174 2519 i
 *>i 1.0.64.0/18      195.209.63.217         300     60      0 20485 2497 7670 18144 i
 *>i 1.0.129.0/24     195.209.63.217        1600    110      0 6939 4651 23969 i
 *>i 1.1.8.0/24       195.209.63.217         300     60      0 20485 4134 i
 *>i 1.1.20.0/24      195.209.63.217                 60      0 31500 4637 133948 i
 *>i 1.1.64.0/19      195.209.63.217         420     60      0 10026 2519 i
 *>i 1.1.103.0/24     195.209.63.217         420     60      0 10026 2519 i
 *>i 1.1.104.0/24     195.209.63.217         420     60      0 10026 2519 i
 *>i 1.1.105.0/24     195.209.63.217         420     60      0 10026 2519 i
 *>i 1.1.106.0/24     195.209.63.217         420     60      0 10026 2519 i
 ...

Juniper> show route receive-protocol bgp 31.28.19.254 

inet.0: 761027 destinations, 1990142 routes (761024 active, 1 holddown, 2 hidden)
  Prefix		  Nexthop	       MED     Lclpref    AS path
  0.0.0.0/0               31.28.19.100                            29076 I
* 1.0.0.0/24              31.28.19.100         4                  13335 I
  1.0.4.0/22              31.28.19.100         5                  6939 4826 38803 56203 I
  1.0.4.0/24              31.28.19.100         5                  6939 4826 38803 56203 I
  1.0.5.0/24              31.28.19.100         5                  6939 4826 38803 56203 I
  1.0.6.0/24              31.28.19.100         5                  6939 4826 38803 56203 I
  1.0.7.0/24              31.28.19.100         5                  6939 4826 38803 56203 I
  1.0.16.0/24             31.28.19.184                            1299 2497 2519 2519 I
  1.0.64.0/18             31.28.19.100         0                  6939 10026 2519 7670 18144 I
* 1.0.128.0/17            31.28.19.100         0                  38040 23969 I
* 1.0.128.0/18            31.28.19.100         0                  38040 23969 I
* 1.0.128.0/19            31.28.19.100         0                  38040 23969 I
* 1.0.128.0/24            31.28.19.100         0                  38040 23969 ?
  1.0.129.0/24            31.28.19.100         5                  6939 4651 23969 I
* 1.0.131.0/24            31.28.19.100         0                  38040 23969 ?
  1.0.132.0/22            31.28.19.100         0                  38040 23969 ?
* 1.0.136.0/24            31.28.19.100         0                  38040 23969 ?
...

bird> show route protocol R5537x773206543
Table master4:
194.85.196.0/22      unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS47595i]
	via 46.22.50.15 on eth1
31.177.82.0/23       unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS48287i]
	via 46.22.50.15 on eth1
31.177.88.0/21       unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS48287i]
	via 46.22.50.15 on eth1
194.85.192.0/22      unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS47595i]
	via 46.22.50.15 on eth1
31.177.92.0/22       unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS48287i]
	via 46.22.50.15 on eth1
31.177.80.0/21       unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS48287i]
	via 46.22.50.15 on eth1
31.177.72.0/21       unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS48287i]
	via 46.22.50.15 on eth1
...	



bird> show route protocol R5537x773206543 all
Table master4:
194.85.196.0/22      unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS47595i]
	via 46.22.50.15 on eth1
	Type: BGP univ
	BGP.origin: IGP
	BGP.as_path: 5537 48287 47595
	BGP.next_hop: 46.22.50.15
	BGP.local_pref: 100
	BGP.community: (47595,10600) (48287,5003) (48287,50102)
31.177.82.0/23       unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS48287i]
	via 46.22.50.15 on eth1
	Type: BGP univ
	BGP.origin: IGP
	BGP.as_path: 5537 48287
	BGP.next_hop: 46.22.50.15
	BGP.local_pref: 100
	BGP.community: (48287,50200)
31.177.88.0/21       unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS48287i]
	via 46.22.50.15 on eth1
        Type: BGP univ
        BGP.origin: IGP
        BGP.as_path: 5537 48287
        BGP.next_hop: 46.22.50.15
        BGP.local_pref: 100
        BGP.community: (48287,50201)
194.85.192.0/22      unicast [R5537x773206543 2019-02-16 00:56:23] * (100) [AS47595i]
        via 46.22.50.15 on eth1
        Type: BGP univ
        BGP.origin: IGP
        BGP.as_path: 5537 48287 47595
...


Cheking routes announced to BGP peer

Finally check what routes we announce to our BGP peer

Cisco# show ip bgp neighbors < ip-address > routes

Juniper# show route receive-protocol bgp < peer ip-address >

BIRD#
show route protocol < peer name > # short output for peer show route protocol < peer name > all # detailed

Cisco# sh ip bgp neighbors 195.209.63.217 advertised-routes 
BGP table version is 34698136, local router ID is 195.209.62.245
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  5.45.80.0/22     195.209.63.83           20         32768 i
 *>  5.45.81.105/32   172.31.255.1             0         32768 ?
 *>  37.252.0.0/23    195.209.63.83           20         32768 i
 *>  46.22.48.0/20    0.0.0.0                  0         32768 i
 *>  77.72.80.0/23    195.209.37.82            0    180      0 42288 42288 42288 42288 42288 42288 42288 42288 i
 *>  80.253.4.0/22    195.209.37.18            0    150      0 8441 i
 *>  82.144.64.0/19   82.144.64.249            0    150      0 25355 i
 *>  85.31.123.0/24   91.224.127.50            0    150      0 39678 i
 *>  85.31.124.0/24   91.224.127.50            0    150      0 39678 i
 *>  85.92.118.0/24   195.209.44.42                 180      0 198770 i
 *>  87.239.104.0/21  195.209.63.83           20         32768 i
 *>  87.239.144.0/21  195.209.63.83           20         32768 i
 *>  89.110.64.0/18   195.209.63.83           20         32768 i
 *>  91.105.232.0/21  0.0.0.0                  0         32768 6870 e
 *>  91.224.126.0/23  0.0.0.0                  0         32768 i
 *>  91.241.12.0/24   91.224.126.254           0    180      0 59459 59459 59459 59459 59459 59459 ?
 *>  91.241.13.0/24   91.224.127.250                180      0 59459 ?
 *>  93.170.76.0/24   195.209.63.83           20         32768 i
...
Juniper> show route advertising-protocol bgp 109.239.134.181 

inet.0: 761853 destinations, 2294276 routes (761851 active, 0 holddown, 16 hidden)
  Prefix		  Nexthop	       MED     Lclpref    AS path
* 5.45.80.0/22            Self                 20                 I
* 37.252.0.0/23           Self                 20                 I
* 46.22.48.0/20           Self                 20                 I
* 80.253.4.0/22           Self                                    8441 I
* 85.31.123.0/24          Self                                    39678 I
* 85.31.124.0/24          Self                                    39678 I
* 87.239.104.0/21         Self                 20                 I
* 87.239.144.0/21         Self                 20                 I
* 89.110.64.0/18          Self                 20                 I
* 91.105.232.0/21         Self                                    6870 E
* 91.224.126.0/23         Self                 20                 I
* 91.241.12.0/24          Self                                    59459 59459 59459 59459 59459 59459 ?
* 91.241.13.0/24          Self                                    59459 ?
* 146.120.110.0/24        Self                 20                 I
* 185.4.64.0/22           Self                 20                 I
* 185.12.152.0/23         Self                                    61293 I
* 185.12.152.0/24         Self                                    61293 I
* 185.12.153.0/24         Self                                    61293 I
...

bird> show route export R5537x773206543
Table master4:
193.203.40.0/22      unicast [R12722x773206538 2019-03-13 15:53:28] * (100) [AS12722i]
	via 46.22.50.10 on eth1
194.33.180.0/24      unicast [R12722x773206538 2019-03-13 15:53:28] * (100) [AS12722i]
	via 46.22.50.10 on eth1
193.26.18.0/24       unicast [R12722x773206538 2019-03-13 15:53:28] * (100) [AS12722i]
	via 46.22.50.10 on eth1
146.120.110.0/24     unicast [R12722x773206538 2019-03-13 15:53:27] * (100) [AS12722i]
	via 46.22.50.10 on eth1
91.241.13.0/24       unicast [R12722x773206538 2019-03-13 15:53:26] * (100) [AS59459?]
	via 46.22.50.10 on eth1
91.241.12.0/24       unicast [R12722x773206538 2019-03-13 15:53:26] * (100) [AS59459?]
	via 46.22.50.10 on eth1
46.22.48.0/20        unicast [R12722x773206538 2019-03-13 15:53:25] * (100) [AS12722i]
	via 46.22.50.10 on eth1
...	
	
	
	
bird> show route export R5537x773206543 all
Table master4:
193.203.40.0/22      unicast [R12722x773206538 2019-03-13 15:53:28] * (100) [AS12722i]
	via 46.22.50.10 on eth1
	Type: BGP univ
	BGP.origin: IGP
	BGP.as_path: 12722
	BGP.next_hop: 46.22.50.10
	BGP.med: 20
	BGP.local_pref: 100
194.33.180.0/24      unicast [R12722x773206538 2019-03-13 15:53:28] * (100) [AS12722i]
	via 46.22.50.10 on eth1
	Type: BGP univ
	BGP.origin: IGP
	BGP.as_path: 12722
	BGP.next_hop: 46.22.50.10
	BGP.med: 20
	BGP.local_pref: 100
193.26.18.0/24       unicast [R12722x773206538 2019-03-13 15:53:28] * (100) [AS12722i]
	via 46.22.50.10 on eth1
        Type: BGP univ
        BGP.origin: IGP
        BGP.as_path: 12722
        BGP.next_hop: 46.22.50.10
        BGP.local_pref: 100
146.120.110.0/24     unicast [R12722x773206538 2019-03-13 15:53:27] * (100) [AS12722i]
        via 46.22.50.10 on eth1
        Type: BGP univ
        BGP.origin: IGP
        BGP.as_path: 12722
--More--


Twitter Insta Facebk BLOG