BGP / Routing Cheatsheet
Quick reference for BGP and routing commands covering BGP configuration, attributes, route-maps, prefix-lists, communities, troubleshooting, OSPF, and EIGRP
69 commands
router bgp {ASN}Start BGP process
router bgp 65001neighbor {ip} remote-as {ASN}Define BGP neighbor
neighbor 10.0.0.2 remote-as 65002network {prefix} mask {mask}Advertise network in BGP
network 192.168.1.0 mask 255.255.255.0neighbor {ip} update-source {iface}Set update source interface
neighbor 10.0.0.2 update-source Loopback0neighbor {ip} ebgp-multihop {ttl}Set eBGP multihop
neighbor 10.0.0.2 ebgp-multihop 2neighbor {ip} next-hop-selfSet next-hop to self
neighbor 10.0.0.2 next-hop-selfneighbor {ip} password {key}Set MD5 authentication for neighbor
neighbor 10.0.0.2 password SecretKey123neighbor {ip} shutdownDisable BGP neighbor
neighbor 10.0.0.2 shutdownneighbor {ip} timers {keepalive} {hold}Set BGP timers
neighbor 10.0.0.2 timers 10 30bgp router-id {ip}Set BGP router ID
bgp router-id 1.1.1.1bgp log-neighbor-changesLog neighbor state changes
bgp log-neighbor-changesno synchronizationDisable IGP synchronization
no synchronizationneighbor {ip} weight {n}Set Weight attribute (local preference)
neighbor 10.0.0.2 weight 200bgp default local-preference {n}Set default Local Preference
bgp default local-preference 200set local-preference {n}Set Local Preference in route-map
set local-preference 150set as-path prepend {ASN}Prepend ASN to AS-PATH
set as-path prepend 65001 65001set metric {n}Set MED (Multi-Exit Discriminator)
set metric 100set origin {igp|egp|incomplete}Set Origin attribute
set origin igpbgp bestpath as-path ignoreIgnore AS-PATH length in best path
bgp bestpath as-path ignorebgp always-compare-medCompare MED across different ASes
bgp always-compare-medmaximum-paths {n}Set maximum equal-cost paths
maximum-paths 4route-map {name} permit {seq}Create route-map permit entry
route-map FILTER permit 10route-map {name} deny {seq}Create route-map deny entry
route-map FILTER deny 20match ip address prefix-list {name}Match using prefix list
match ip address prefix-list MY-PREFIXESmatch as-path {acl}Match by AS-PATH
match as-path 10match community {list}Match by community
match community COMMUNITY-LISTneighbor {ip} route-map {name} inApply route-map inbound
neighbor 10.0.0.2 route-map FILTER inneighbor {ip} route-map {name} outApply route-map outbound
neighbor 10.0.0.2 route-map FILTER outip prefix-list {name} permit {prefix}Permit prefix
ip prefix-list MY-LIST permit 10.0.0.0/8ip prefix-list {name} deny {prefix}Deny prefix
ip prefix-list MY-LIST deny 0.0.0.0/0ip prefix-list {name} permit {prefix} le {n}Permit prefix with max length
ip prefix-list MY-LIST permit 10.0.0.0/8 le 24ip prefix-list {name} permit {prefix} ge {n}Permit prefix with min length
ip prefix-list MY-LIST permit 0.0.0.0/0 ge 8ip prefix-list {name} seq {n} permit {prefix}Permit prefix with sequence number
ip prefix-list MY-LIST seq 10 permit 192.168.0.0/16neighbor {ip} prefix-list {name} inApply prefix list inbound
neighbor 10.0.0.2 prefix-list FILTER inneighbor {ip} prefix-list {name} outApply prefix list outbound
neighbor 10.0.0.2 prefix-list FILTER outshow ip prefix-list {name}Show prefix list contents
show ip prefix-list MY-LISTset community {value}Set community value
set community 65001:100set community {value} additiveAdd to existing communities
set community 65001:200 additiveset community no-exportSet no-export community
set community no-exportset community no-advertiseSet no-advertise community
set community no-advertiseset community local-ASSet local-AS community
set community local-ASip community-list standard {name} permit {val}Create standard community list
ip community-list standard COMM permit 65001:100ip bgp-community new-formatDisplay communities in AA:NN format
ip bgp-community new-formatneighbor {ip} send-communitySend communities to neighbor
neighbor 10.0.0.2 send-community bothshow ip bgp summaryShow BGP neighbor summary
show ip bgp summaryshow ip bgpShow BGP table
show ip bgpshow ip bgp neighbors {ip}Show specific neighbor details
show ip bgp neighbors 10.0.0.2show ip bgp neighbors {ip} received-routesShow routes received from neighbor
show ip bgp neighbors 10.0.0.2 received-routesshow ip bgp neighbors {ip} advertised-routesShow routes advertised to neighbor
show ip bgp neighbors 10.0.0.2 advertised-routesshow ip bgp {prefix}Show details for specific prefix
show ip bgp 192.168.1.0/24clear ip bgp *Reset all BGP sessions
clear ip bgp *clear ip bgp {ip} soft inSoft reset inbound policy for neighbor
clear ip bgp 10.0.0.2 soft indebug ip bgp updatesEnable BGP update debugging
debug ip bgp updatesshow ip route bgpShow BGP learned routes
show ip route bgprouter ospf {id}Start OSPF process
router ospf 1network {ip} {wildcard} area {id}Assign network to OSPF area
network 10.0.0.0 0.0.0.255 area 0ip ospf cost {n}Set interface OSPF cost
ip ospf cost 10area {id} stubConfigure stub area
area 1 stubarea {id} nssaConfigure NSSA area
area 2 nssashow ip ospf neighborShow OSPF neighbors
show ip ospf neighborshow ip ospf databaseShow OSPF database
show ip ospf databaseredistribute bgp {ASN} subnetsRedistribute BGP into OSPF
redistribute bgp 65001 subnetsrouter eigrp {ASN}Start EIGRP process
router eigrp 100network {ip} {wildcard}Configure EIGRP network
network 10.0.0.0 0.0.0.255no auto-summaryDisable auto-summary
no auto-summaryeigrp router-id {ip}Set EIGRP router ID
eigrp router-id 1.1.1.1show ip eigrp neighborsShow EIGRP neighbors
show ip eigrp neighborsshow ip eigrp topologyShow EIGRP topology table
show ip eigrp topologyredistribute bgp {ASN}Redistribute BGP into EIGRP
redistribute bgp 65001