BGP
BGP
Overview
Key Features
BGP Operation
1. Establishing Sessions:
o BGP peers (neighbors) establish a TCP connection on port 179.
o The BGP session goes through several states: Idle, Connect,
OpenSent, OpenConfirm, Established.
o Only in the Established state can BGP peers exchange routing
information.
2. Route Advertisement:
o BGP routers advertise routes to their neighbors using UPDATE
messages.
o These messages can contain new routes, withdrawals of routes, and
path attributes.
3. Keepalive Messages:
o BGP sends periodic keepalive messages to maintain the session and
check the status of the connection.
BGP Attributes
BGP routes are associated with various attributes that influence routing decisions.
The main attributes include:
1. AS Path: A list of ASes that the route has traversed. It helps prevent routing
loops.
2. Next Hop: The IP address of the next hop to reach the destination.
3. Local Preference: Indicates the preferred path for outbound traffic. Higher
values are preferred.
4. Multi-Exit Discriminator (MED): Suggests the preferred path into an AS from
a neighboring AS. Lower values are preferred.
5. Origin: Indicates how the route was learned. Possible values include:
o IGP (Interior Gateway Protocol)
o EGP (Exterior Gateway Protocol)
o Incomplete (learned via another mechanism)
6. Community: A way to group routes and apply routing policies to multiple
prefixes simultaneously.
When BGP receives multiple routes to the same destination, it follows a specific
decision process to select the best route:
1. Highest Local Preference: Prefer the route with the highest Local Preference
attribute.
2. Shortest AS Path: Prefer the route with the shortest AS Path.
3. Lowest Origin Type: Prefer IGP over EGP, and EGP over Incomplete.
4. Lowest Multi-Exit Discriminator (MED): Prefer routes with the lowest MED
value.
5. eBGP over iBGP: Prefer routes learned via eBGP over those learned via
iBGP.
6. Lowest IGP Metric to the Next Hop: If all other criteria are equal, prefer the
route with the lowest IGP metric to the next hop.
7. BGP Router ID: In case of ties, the BGP router ID is used as a tiebreaker.
8. External vs. Internal: eBGP routes are preferred over iBGP routes.
1. Basic Configuration:
3. Configuring MED:
route-map set-med permit 10
set metric 100
exit
neighbor 192.168.1.1 route-map set-med out
show ip bgp
Troubleshooting BGP
debug ip bgp
1. Plan for Scalability: As networks grow, ensure that BGP configurations can
handle increased route counts.
2. Implement Route Filtering: Use prefix lists and route maps to control which
routes are advertised and accepted.
3. Monitor BGP Sessions: Regularly check the health of BGP sessions to
ensure stable routing.
4. Secure BGP Sessions: Use MD5 authentication and prefix filtering to
enhance security.
5. Document Configurations: Keep detailed documentation of BGP
configurations and policies for future reference.
Conclusion
BGP is a critical protocol for inter-domain routing on the Internet. Its policy-based
routing capabilities, along with support for various attributes and features, make it
highly flexible and powerful for managing routing decisions across autonomous
systems. Understanding BGP's operational mechanics, configuration, and
troubleshooting methods is essential for network professionals.