Application Note Monitoring and Troubleshooting BGP Neighbor Sessions Juniper Networks, Inc. 1194 North Mathilda Avenue Sunnyvale, CA 94089 USA 408 745 2000 or 888 JUNIPER www.juniper.net Part Number: 350011-001 04/02
Contents Purpose....................................................................... 3 Procedure..................................................................... 3 General Tips................................................................... 7 References.................................................................... 8 Copyright 2002, Juniper Networks, Inc.
Purpose This application note provides procedures on monitoring and troubleshooting BGP neighbor sessions. It is intended to help network operations monitor and troubleshoot BGP neighbor sessions using Juniper Networks router tools. Procedure The following are procedures to monitor and troubleshoot BGP neighbor sessions. These procedures include and explain output from the Juniper Networks router. 1. To display information about BGP and its neighbors, use the show bgp summary command: user@router> show bgp summary Groups: 9 Peers: 11 Down Peers: 4 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 153860 76382 0 0 0 0 inet.2 21982 10991 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State Active/ Received/Damped 192.168.0.79 333 22529860 206760 0 0 10w1d13h 76365/76896/0 10991/10991/0 192.168.0.80 333 22837563 206765 0 1 1w5d13h 1/76896/0 0/10991/0 192.168.34.30 55555 0 0 0 0 10w1d13h Idle 192.168.35.90 65444 39041 230925 0 263 1w6d14h 5/7/0 0/0/0 192.168.36.106 4444 203712 6880118 0 23 2w4d22h 7/56/0 0/0/0 192.168.254.38 6666 0 0 0 0 10w1d13h Idle 192.168.254.50 65315 206038 6890696 0 2 1w0d6h 1/1/0 0/0/0 192.168.254.54 65099 0 0 0 0 10w1d13h Idle 192.168.254.66 65339 206039 6768468 0 1 2w6d23h 1/1/0 0/0/0 192.168.254.254 65333 22254 827665 0 7 5d 20:14:18 2/3/0 0/0/0 10.233.157.127 65333 0 0 0 0 1w0d18h Idle For the status of the BGP neighbor session, look at the State #Active/Received/Damped column for the BGP neighbor session in question (far right). If the BGP neighbor session is in the Established state, the column lists the number of paths received from the BGP neighbor, the number of paths received that are active and used for forwarding traffic, and the number of damped paths. If the BGP neighbor session is in a state other than Established, use the ping and show route commands to verify network connectivity to the BGP neighbor. Copyright 2002, Juniper Networks, Inc. 3
2. If there is network connectivity to the BGP neighbor but the BGP neighbor session is still not established, check the BGP neighbor configuration on the local and remote router. To check the BGP neighbor configuration on the local Juniper router, use the show bgp neighbor <address> command. user@router> show bgp neighbor 192.168.35.90 Peer: 192.168.35.90+31471 AS 65444 Local: 192.168.35.89+179 AS 333 Type: External State: Established Flags: <> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: Hold Timer Expired Error Export: [ deny-routes our-routes ] Import: [ Client_A.AS65444 set-local-pref ] Options: <Preference HoldTime Dampening Keepalive> Keepalive interval: 30 Holdtime: 90 Preference: 170 Number of flaps: 263 Error: "Hold Timer Expired Error" Sent: 3 Recv: 0 Error: "Cease" Sent: 258 Recv: 0 Peer ID: 192.168.166.1 Local ID: 192.168.3.81 Active Holdtime: 90 NLRI advertised by peer: NLRI for this session: unicast Table inet.0 Bit: 5 Active Prefixes: 5 Received Prefixes: 7 Suppressed due to damping: 0 Table inet.2 Bit: 10004 Active Prefixes: 0 Received Prefixes: 0 Suppressed due to damping: 0 Last traffic (seconds): Received 11 Sent 6 Checked 11 Input messages: Total 39170 Updates 8 Octets 744520 Output messages: Total 232105 Updates 222349 Octets 15514364 Output Queue[0]: 0 Output Queue[1]: 0 Route Queue Timer: unset Route Queue: empty 3. To display the paths received from the BGP neighbor, use the show route receive-protocol bgp <address> terse command. user@router> show route receive-protocol bgp 192.168.35.90 terse inet.0:77045 destinations,77045 routes(77007 active, 0 holddown, 53 hidden) Prefix Nexthop MED Lclpref AS path * 10.24.176.0/24 192.168.35.90 65444 I * 10.72.190.0/24 192.168.35.90 65444 I 192.168.178.0/24 192.168.35.90 65444 I * 192.168.4.0/24 192.168.35.90 65444 I * 192.168.5.0/24 192.168.35.90 65444 I 192.168.36.0/22 192.168.35.90 65444 I * 192.168.166.0/24 192.168.35.90 65444 I inet.2:10995 destinations, 10995 routes (10995 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path The entries that have a + or * in front of them are paths received that are active and used for forwarding traffic. If the number of paths received from the BGP neighbor is not correct, check the BGP neighbor configuration on the remote router. Copyright 2002, Juniper Networks, Inc. 4
4. If you want to determine why a route entry received from the BGP neighbor is not active, use the show route <destination prefix> detail command to display detailed route information. user@router> show route 192.168.178.0/24 detail inet.0: 77176 destinations, 77176 routes (77138 active, 0 holddown, 53 hidden) 192.168.178.0/24 (3 entries, 1 announced) *BGP Preference: 170/-81 Source: 192.168.0.79 Nexthop: 192.168.27.25 via so-0/3/0.0, selected State: <Active Int Ext> Local AS: 333 Peer AS: 333 Age: 2:36:23 Metric: 82 Metric2: 61 Task: BGP_333.192.168.0.79+179 Announcement bits (3): 0-KRT 2-BGP.0.0.0.0+179 3-BGP_Sync_Any AS path: 1234 65444 I <Originator> Aggregator: 65444 192.168.166.1 Cluster list: 0.0.31.200 0.0.159.125 Communities: 333:888 333:889 BGP next hop: 192.168.4.10 Localpref: 80 Router ID: 192.168.0.79 BGP Preference: 170/-81 Source: 192.168.0.80 Nexthop: 192.168.27.25 via so-0/3/0.0, selected State: <NotBest Int Ext> Local AS: 333 Peer AS: 333 Age: 2:36:23 Metric: 82 Metric2: 61 Task: BGP_333.192.168.0.80+179 AS path: 1234 65444 I <Originator> Aggregator: 65444 192.168.166.1 Cluster list: 0.0.31.200 0.0.159.125 Communities: 333:888 333:889 BGP next hop: 192.168.4.10 Localpref: 80 Router ID: 192.168.0.80 BGP Preference: /-123 Nexthop: 192.168.35.90 via t3-4/3/0.0, selected State: <Hidden Ext> Local AS: 333 Peer AS: 65444 Age: 1w6d 16:02:53 Task: BGP_65444.192.168.35.90+31471 AS path: 65444 I Aggregator: 65444 192.168.166.1 Localpref: 100 Router ID: 192.168.166.1 Look at the state flag for the path in question. If the flag is NotBest, the path is not the best path for the destination prefix. If the flag is Hidden, the path is not used because of routing policy, an unresolved next hop, or a damped path. Copyright 2002, Juniper Networks, Inc. 5
5. If a path from a BGP neighbor is not active because of routing policy, you can view the policy by typing show policy <policy-name>. The import and export policies applied to a BGP neighbor session is displayed in the show bgp neighbor <address> command output. user@router> show policy Client_A.AS65444 Policy Client_A.AS65444: from 10.24.176.0/24 10.72.190.0/24 192.168.166.0/24 192.168.45.0/24 192.168.136.0/24 192.168.81.0/24 192.168.77.0/24 192.168.4.0/24 192.168.5.0/24 then next policy ---- then reject 6. To display the routes advertised to the BGP neighbor, use the show route advertising-protocol bgp <address> command: user@router> show route advertising-protocol bgp 192.168.35.90 inet.0: 77166 destinations, 77166 routes (77126 active, 0 holddown, 55 hidden) Prefix Nexthop MED Lclpref AS path 10.16.244.0/22 Self 20 6789 I 10.23.26.0/23 Self 12345 3931 3561 11906 I 10.24.176.0/24 192.168.35.90 65444 I 10.26.226.0/23 Self 0 222 3914 11123 I 10.0.0.0/8 Self 65179 65179 65179 65179 65179 65179 65179 65179 65179 714 I 10.48.9.0/24 Self 0 65521 I 10.48.10.0/24 Self 0 6789 I 10.48.12.0/24 Self 0 6789 I 10.48.20.0/22 Self 0 65521 I 10.48.24.0/22 Self 0 65521 I 10.48.80.0/23 Self 0 I 10.48.82.0/23 Self 20 6789 I 10.48.82.0/24 Self 6789 13414 I 10.48.84.0/24 Self 0 6789 I 10.48.112.0/20 Self 0 I 10.48.112.0/21 Self 6789 13414 I 10.48.144.0/20 Self 65521 I 10.48.152.0/22 Self 0 65521 I 10.48.192.0/20 Self 0 I 24.49.16.0/20 Self 0 65521 I 24.49.240.0/20 Self 0 65521 I 24.50.0.0/19 Self 0 65521 I 24.124.0.0/18 Self 10 12345 12345 I 24.132.0.0/17 Self 0 222 1136 1136 8209 8209 I 24.238.0.0/19 Self 0 I Copyright 2002, Juniper Networks, Inc. 6
General Tips 7. Confirm: When you have resolved a BGP neighbor session problem, you can confirm that you are advertising and receiving the correct BGP routing information by using the show route advertising protocol bgp <address> command and the show route receive-protocol bgp <address> command. The following are two useful commands for troubleshooting BGP in general. 1. Type show route aspath-regex <regular-expression> to display entries in the routing table that match the specified BGP AS path regular expression. The following command displays any routes that has AS 8888 in the AS-PATH attribute. See the JUNOS Internet Software Configuration Guide for more information about AS path regular expression. user@router> show route aspath-regex ".* 8888.*" inet.0: 77998 destinations, 77998 routes (77153 active, 0 holddown, 30670 hidden) 172.16.0.0/19 *[BGP/170] 18:47:31, localpref 100 AS path: 3456 8888 I > to 192.168.239.146 via t3-5/1/1.0 [BGP] 18:46:56, localpref 100 AS path:6789 6789 6789 6789 6789 6789 6789 6789 3456 8888 I > to 192.168.239.2 via t3-2/2/3.0 inet.2: 10908 destinations, 10908 routes (10908 active, 0 holddown, 0 hidden) iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) 2. Type show route community <as-number:community-value> to display entries in the routing table that are members of a BGP community. The following command displays any routes that belong to the 333:300 community. user@router> show route community 333:300 inet.0: 77997 destinations, 77997 routes (77114 active, 0 holddown, 30730 hidden) 172.16.128.0/19 *[BGP/170] 4w4d 00:45:25, localpref 100 AS path: 123 73 I > to 192.168.239.90 via so-7/0/0.0 192.168.151.0/24 *[BGP/170] 01:27:39, MED 0, localpref 100 AS path: 123 8071 I > to 192.168.239.90 via so-7/0/0.0 172.16.0.0/16 *[BGP/170] 2d 22:36:36, localpref 100, from 192.168.0.67 AS path: 3456 I > to 192.168.26.37 via so-0/0/0.0 [BGP/170] 2d 22:36:38, localpref 100, from 192.168.0.68 AS path: 3456 I > to 192.168.26.37 via so-0/0/0.0 192.168.137.32/30 *[BGP/170] 1w1d 07:47:14, localpref 100, from 192.168.0.67 AS path: 12345 I > to 192.168.26.37 via so-0/0/0.0 [BGP/170] 1w1d 07:47:14, localpref 100, from 192.168.0.68 AS path: 12345 I > to 192.168.26.37 via so-0/0/0.0 inet.2: 10906 destinations, 10906 routes (10906 active, 0 holddown, 0 hidden) iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) Copyright 2002, Juniper Networks, Inc. 7
References JUNOS Internet Software Configuration Guide Copyright 2002, Juniper Networks, Inc. All rights reserved. Juniper Networks is registered in the U.S. Patent and Trademark Office and in other countries as a trademark of Juniper Networks, Inc. Broadband Cable Processor, G10, Internet Processor, JUNOS, JUNOScript, M5, M10, M20, M40, M40e, M160, M-series, T640, and T-series, are trademarks of Juniper Networks, Inc. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners. All specifications are subject to change without notice. Juniper Networks assumes no responsibility for any inaccuracies in this document. Juniper Networks reserves the right to change, modify, transfer, or otherwise revise this publication without notice. Copyright 2002, Juniper Networks, Inc. 8