BGP & Routing Reference

// bgp states · attributes · cisco · juniper · ospf · eigrp
STATE 1
Idle
Initial state. BGP refuses all connections. Waiting for Start event.
STATE 2
Connect
Waiting for TCP connection to complete. If it fails, moves to Active.
STATE 3
Active
TCP connection failed. Trying to initiate new TCP connection to peer.
STATE 4
OpenSent
TCP connected. OPEN message sent, waiting for OPEN from peer.
STATE 5
OpenConfirm
OPEN received and valid. Waiting for KEEPALIVE or NOTIFICATION.
STATE 6
Established
Peering session up. UPDATE messages exchanged. Routes being shared.
# Stuck in Active = TCP can't reach peer. Check: # 1. IP reachability (can you ping the peer IP?) # 2. Firewall blocking TCP port 179 # 3. Correct neighbor IP configured # 4. TTL — eBGP requires TTL=1 by default (use ebgp-multihop if needed)
OPEN Sent after TCP — negotiates BGP version, AS, hold time, Router ID KEEPALIVE Sent every ~60s to maintain session (hold timer default 180s) UPDATE Advertises new routes or withdraws old ones — carries path attributes NOTIFICATION Sent on error — includes error code and closes session
AttributeTypeDescription & Manipulation
WEIGHTCisco LocalCisco-only. Highest preferred. Set per-neighbor. Not advertised.
LOCAL_PREFWell-knownHigher = preferred. Shared within iBGP AS. Controls egress path.
AS_PATHWell-knownList of ASes route has traversed. Shorter = preferred. Used for loop prevention.
ORIGINWell-knownIGP (i) > EGP (e) > Incomplete (?). How route entered BGP.
MEDOptionalMulti-Exit Discriminator. Lower = preferred. Influences inbound traffic from neighbour AS.
NEXT_HOPWell-knownIP address of next hop router. Must be reachable.
COMMUNITYOptionalTag routes for policy. Common: NO_EXPORT (65535:65281), NO_ADVERTISE (65535:65282).
ATOMIC_AGGRWell-knownIndicates route has been aggregated — path info may be lost.
1. Highest WEIGHT (Cisco only) 2. Highest LOCAL_PREF 3. Locally originated route preferred 4. Shortest AS_PATH 5. Lowest ORIGIN (IGP < EGP < Incomplete) 6. Lowest MED 7. eBGP over iBGP 8. Lowest IGP metric to NEXT_HOP 9. Oldest eBGP route 10. Lowest Router ID 11. Lowest neighbor IP address

Basic eBGP peering configuration:

router bgp 65001 bgp router-id 1.1.1.1 neighbor 203.0.113.1 remote-as 65002 neighbor 203.0.113.1 description ISP-PEER network 192.168.1.0 mask 255.255.255.0 no auto-summary

iBGP with route reflector:

router bgp 65001 neighbor 10.0.0.2 remote-as 65001 neighbor 10.0.0.2 route-reflector-client neighbor 10.0.0.2 next-hop-self
show ip bgp summary # peer states and prefix counts show ip bgp # full BGP table show ip bgp 192.168.1.0 # specific prefix detail show ip bgp neighbors # detailed neighbor info show ip bgp neighbors 203.0.113.1 routes # routes from specific peer show ip route bgp # BGP routes in RIB show ip bgp regexp _65002_ # routes via AS 65002 clear ip bgp * soft # soft reset all peers debug ip bgp # BGP debug (use carefully) show ip ospf neighbor # OSPF neighbors show ip ospf database # OSPF LSDB show ip route ospf # OSPF routes show ip eigrp neighbors # EIGRP neighbors show ip eigrp topology # EIGRP topology table
# Edit mode set routing-options autonomous-system 65001 set protocols bgp group EBGP type external set protocols bgp group EBGP peer-as 65002 set protocols bgp group EBGP neighbor 203.0.113.1 set protocols bgp group EBGP export EXPORT-POLICY commit
show bgp summary # peer states show bgp neighbor # detailed neighbor show route protocol bgp # BGP routes in RIB show route 192.168.1.0/24 detail # prefix detail show route receive-protocol bgp 203.0.113.1 # routes received show route advertising-protocol bgp 203.0.113.1 # routes sent clear bgp neighbor 203.0.113.1 soft # soft reset show ospf neighbor # OSPF neighbors show ospf database # OSPF LSDB show route protocol ospf # OSPF routes
# OSPF Neighbor States Down → No hellos received Init → Hello received, but router's own ID not in hello 2-Way → Bidirectional communication (DR/BDR election happens here) ExStart → Master/slave election for DBD exchange Exchange → DBD packets being exchanged Loading → LSR/LSU packets exchanged Full → ✓ Fully adjacent — LSDB synchronized
# Cisco OSPF basic config router ospf 1 router-id 1.1.1.1 network 192.168.1.0 0.0.0.255 area 0 passive-interface GigabitEthernet0/1 # don't send hellos on LAN # OSPF area types Area 0 Backbone — all other areas must connect here Stub No external LSAs — uses default route instead NSSA Stub but allows limited external routes (Type 7 LSA) Totally Stub No inter-area or external LSAs
ProtocolTypeAlgorithmMetricBest For
BGPPath VectorBest Path SelectionPath AttributesInternet routing, multi-homing, large enterprise
OSPFLink StateDijkstra (SPF)Cost (bandwidth)Enterprise IGP, fast convergence, scalable
EIGRPAdvanced D-VDUALBandwidth + DelayCisco-only shops, easy config, fast failover
RIP v2Distance VectorBellman-FordHop count (max 15)Small/legacy networks only
IS-ISLink StateDijkstra (SPF)CostISP/carrier networks, large scale
StaticManualAdministrativeSimple topologies, last-resort routes
Connected 0 (most trusted) Static 1 eBGP 20 EIGRP 90 OSPF 110 IS-IS 115 RIP 120 iBGP 200 (least trusted)