How to Determine that BGP Is Working on a Junos Network
Perhaps you sometimes find it hard to tell whether BGP is really working. The key to finding out if the session you configured is established is the show bgp neighbor command.
The show bgp neighbor command shows a lot of information, most of which isn’t terribly relevant most of the time, but you do need to focus on a couple of important fields in the output, especially when determining whether a successful connection was established. Here, focus on only the first four lines of output:
mike@router1> show bgp neighbor Peer: 10.245.245.1+179 AS 200 Local: 10.245.245.3+3770 AS 100 Type: External State: Established Flags: <ImportEval Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None
The basic part of determining whether a peering session is up is to identify the state of the session. In this case, the state is Established, which means the BGP configuration worked.
Other possible states include the following:
idle: This is the starting point for BGP sessions prior to any messages being exchanged. If you see an idle state, you probably just need to wait until BGP begins sending messages.
connect: connect indicates that BGP messages are being exchanged and BGP is waiting for the underlying TCP connection to be established. This state means that things are either in progress or they’ve stalled on the TCP side of things.
active: The most misleading of the state names, active does not mean that the BGP session is active; it means that BGP is actively looking for its peer. A common cause for these types of issues is misconfiguration, so check your AS numbers and make sure that they’re configured correctly.
OpenSent and OpenConfirm: These are transition states while BGP is negotiating. If you see these states, just enter the show bgp neighbor command a second time and see whether the states have transitioned to Established.
Depending on the state value, you can use the peering information at the top of the output to determine whether the peering address and autonomous system (AS) number are configured correctly.
Remember that the BGP configuration on both sides of the peering session must be correct to establish the session correctly, so if you’re having problems, the issue may not reside on your router but with the peer it is trying to connect to.