In this guide
What BGP does
Border Gateway Protocol (BGP-4) is a path-vector routing protocol. It exchanges reachability information between autonomous systems and is also widely used inside large networks where policy control and route scale matter.
eBGP and iBGP
eBGP is used between different autonomous systems. iBGP distributes BGP-learned routes inside the same AS. iBGP has additional rules around route propagation, next-hop handling and full-mesh or route-reflector designs.
Path attributes
| Attribute | Typical purpose | Selection direction |
|---|---|---|
| LOCAL_PREF | Choose the preferred exit from an AS | Higher |
| AS_PATH | Records AS traversal and helps prevent loops | Shorter is commonly preferred |
| ORIGIN | Describes how the route entered BGP | IGP before EGP before incomplete |
| MED | Signal a preferred entry point to a neighbouring AS | Lower, subject to comparison rules |
| NEXT_HOP | Identifies the next-hop address | Must be resolvable |
| COMMUNITY | Attach policy metadata to routes | Policy dependent |
Best-path selection
Exact order varies by implementation and configuration. A common sequence considers highest LOCAL_PREF, shortest AS_PATH, lowest ORIGIN code, lowest MED where applicable, eBGP over iBGP, lowest IGP cost to the next hop and then implementation-specific tie-breakers.
Use the BGP Route Analyzer to compare candidate paths and see which attribute becomes decisive in the simplified model.
Policy and filtering
Production BGP requires explicit policy. Prefix filters, maximum-prefix limits, AS-path filters, communities, route maps/policies and controlled redistribution reduce the risk of accepting or advertising unintended routes. RPKI Route Origin Validation can provide an additional signal about whether an announcement is consistent with a published Route Origin Authorisation.
Communities
BGP communities carry policy metadata. Standard, extended and large communities are used by network operators to communicate intent between routing policy stages. Their meaning is local to the operator or agreed between peers, so always consult the relevant provider or organisation's documentation.
Troubleshooting
- Confirm the BGP session state and transport reachability.
- Check that the expected prefix is received or advertised.
- Inspect inbound and outbound policy and prefix filters.
- Verify LOCAL_PREF, AS_PATH, MED, communities and next-hop reachability.
- Check whether the route is present in the BGP table but rejected from the main routing table.
- Check the forwarding table and return path separately.
Standards and references
- RFC 4271 — BGP-4.
- RFC 1997 — BGP Communities Attribute.
- RFC 8092 — BGP Large Communities.
- RFC 6811 — BGP Prefix Origin Validation.