BGP Cheat Sheet
BGP Cheat Sheet
Basic Concepts
- BGP (Border Gateway Protocol): The protocol used to exchange routing information between different autonomous systems (AS).
- Autonomous System (AS): A collection of IP networks and routers under a single organization's control.
- BGP Peers: Routers that exchange BGP routing information.
- BGP Session: TCP connection between BGP peers (port 179).
BGP States
1. Idle
2. Connect
3. Active
4. OpenSent
5. OpenConfirm
6. Established
BGP Attributes
- AS_PATH: List of ASs a route has traversed.
- NEXT_HOP: Next hop IP address for the route.
- LOCAL_PREF: Indicates the preferred exit point from the AS.
- MED (Multi-Exit Discriminator): Suggests preferred entry point to an AS.
- COMMUNITY: A way to group routes for routing decisions.
BGP Configuration Commands (Cisco)
Basic Configuration:
router bgp
neighbor remote-as
neighbor description
Example:
router bgp 65001
neighbor 192.168.1.1 remote-as 65002
neighbor 192.168.1.1 description "Peer Router"
Advertise a Network:
network mask
Example:
network 10.0.0.0 mask 255.255.255.0
Viewing BGP Information (Cisco)
- Show BGP Summary:
show ip bgp summary
- Show BGP Routes:
show ip bgp
- Show BGP Neighbor Details:
show ip bgp neighbors
BGP Route Filtering
- Disallow Specific Routes:
neighbor filter-list in
- Using Route Maps:
route-map permit
match
set
BGP Timers
Adjust BGP Keepalive and Hold Timers:
neighbor timers
Example:
neighbor 192.168.1.1 timers 30 90
BGP Best Path Selection Criteria
1. Highest Weight (Cisco-specific)
2. Highest Local Preference
3. Shortest AS Path
4. Lowest Origin Type (IGP < EGP < Incomplete)
5. Lowest MED
6. EBGP over IBGP
7. Lowest IGP metric to NEXT_HOP
8. Oldest route (if all else is equal)
9. Lowest BGP router ID (if all else is equal)
Common BGP Commands for Troubleshooting
- Check BGP Neighbors:
show ip bgp neighbors
- BGP Route Information:
show ip bgp
- Check BGP Updates:
show ip bgp updates