Skip to content

Instantly share code, notes, and snippets.

@roulette6
Last active December 4, 2018 14:20
Show Gist options
  • Save roulette6/92e6d5754f0d903edd16cf90f3f9a438 to your computer and use it in GitHub Desktop.
Save roulette6/92e6d5754f0d903edd16cf90f3f9a438 to your computer and use it in GitHub Desktop.
BGP commands

BGP neighbor states

  • Idle:
    • Trying to initiate a TCP connection and listening for TCP connections from peers
    • Admin disabled (neighbor shutdown)
    • Router is waiting before next retry
  • Connect: BGP initiates the TCP 3-way handshake.
    • If successful, send Open msg and change to OpenSent.
    • If failed, reset the ConnectRetryTimer and move to active state.
  • Active: Trying to establish TCP connection; no BGP messages yet sent
  • OpenSent: TCP connection exists and this router has sent the first message to establish the BGP neighbor relationship
  • OpenConfirm: TCP connection exists, other router has received an Open message but may still reject the relationship
  • Established: After receiving a a keepalive message from peer, the routers are neighbors and can exchange update messages

Configuration commands

add a discard route to share a classful ntwk

Do this if you want to advertise a larger prefix than what is in the routing table.

ip route <classful network> <mask> null0

Configure BGP

router bgp <asn>
  bgp router-id <rid>
  neighbor <ip addr> remote-as <asn>  !-- define a BGP neighbor and its ASN
  neighbor <ip addr> shutdown         !-- suspend neighborship w/o deleting it
  no neighbor <ip addr> shutdown      !-- resume neighborship w/o deleting it
  network <ip addr> [mask <mask>]     !-- route to share. Must be in routing table

Configuring loopback interfaces with BGP

  1. Configure loopback interface on each router

  2. Tell BGP on each router to use the loopback IP address as the source

  3. Configure the BGP neighbor command on each router to refer to the other router's loopback IP address

  4. Make sure each router has IP routes to the neighbor's loopback interface

  5. Configure eBGP multihop

     neighbor <neighbor-ip> update-source <loopback if id>
     neighbor 100.1.1.2 update-source loopback 1
     neighbor <neighbor's loopback ip addr> remote-as <asn>
     neighbor <neighbor ip addr> ebgp-multihop <hops>
    

Verification and troubleshooting commands

show tcp brief              !-- TCP connex at this router incl. BGP
show tcp summary            !-- a line of info for each TCP connex
show ip bgp                 !-- BGP table
show ip bgp summary         !-- basic config for local RT; 1 ln per BGP peer
show ip bgp neighbors <addr> !-- detailed info about neighbor state
show ip bgp neighbors <addr> received-routes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment