BGP Lab Tips

  • unsuppress -map – use this with a route-map that contain specific routes you wish a neighbour to know in case you are summarising using, say, the aggregate-address command.
  • Weight and Local Preference will affect how traffic leaves your AS
  • MED and AS-PREPEND will affect how traffic enters your AS
  • send-community both is needed when setting BGP attributes like no-export
  • Condition-map uses reverse logic. We check to see if a route does NOT exist before we advertise.

 

Advertisements

BGP Crib Notes

These are my ‘crib notes’ that I’ve made to serve as a last minute refresher. Please forgive the grammer / spelling as I did not develop these notes with publishing in mind

BGP

***theory***

  • Facts
  • BGP current version 4 and designed to route IP through Autonomous Systems. Is capable of MD5 Authentication
  • Two flavours: i-bgp (Routers in the same AS) and e-bgp
  • BGP uses TCP 179 to maintain neighbour / peer relationships
  • Routing policies are based on BGP attributes
  • Neighbours are manually configured. BGP is SLOW so be patient when configuring! NETWORKS are manual and so not advertised by default
  • Hello messages sent every 60 seconds.
  • Holddown is 180 seconds
    • Starts in IDLE state
    • Active – It’s a bad thing if it stuck in Active. Otherwise okay
    • Open sent – Sent a open session message to neighbour
    • Open Confirmed – When open message is received from neighbour
    • Established – Peer successful!
    • Reason to run BGP 1) You are a ISP 2) You have 2 Primary links to separate ISPs.
    • Rule of synchronisation: Routes learned in bgp must exist in the internal routing table before being advertise to remote peers. This is for scenario if there is a router in the AS not using BGP – Quite rare.
      • Turn sync off if every router is running bgp
      • Rule of split horizon – Rules learned via iBgp will never be sent to another iBGP peer as it assumes all routers are fully meshed, however that not always feasible in very large networks to have fully meshed connection. So we use route reflectors.
      • Route Reflectors: helps to get around the split horizon rule! Instead of a full mesh, one router can reflect routers careful of loops though!
      • Confederations: Allow for sub-AS systems using private AS numbers (64.512 – 65,535)
      • Peer Groups: create a template statement for number of neighbours! Simplifies the neighbour statement by using a tag word – groups same statements
      • Summarisation: aggregate-address 172.0.0.0 255.0.0.0 summary-only. Show ip bgp will have a s notated next to it to show it’s  been surpressed
        • use surpress-map to summarise address and then on the neighbour statement use the unsurpress-map statement to get full routes while other neighbours will get the summarisation. Use accless lists and route maps!
        • Distribute lists – suppresses route updates via access list and can narrow down to neighbour using neighbour 1.1.1.1 distribute-list 10 out. Can also use the following
          • Prefix list – used to fix short coming of old access list but named access list can be resequenced
          • Attributes: Highest Weight > Highest Local Pref > Routes that the router originated > Shortest AS PATH > Lowest Origin Code > Lowest MED > EBGP over IBGP >…
            • Well Known – Must be supported on all BGP routers
              • Mandatory – Must be included in ALL bgp updates
                • AS-Path: Prepends each AS and used for Loop prevention (if it sees it own AS in the prepend)
                • Next Hop: IP address of the next hop. Causes problems on NBMA multipoint networks like Frame Relay. Way to fix it is put as point to point link.
                • Origin: where did it come from?
                  • IGP (I)
                  • EGP  (E)– Old version and you will NEVER see this
                  • Unknown ? – Very COMMON, especially in redistribution.
            • Discretionary – Up to you
              • Local Preference: Gives you control over preferred routers beng learned. Higher is better. 
              • Atomic Aggregate: Informs a router that a route has been summarised.
  • Optional – Does not have to be supported
    • Transitive – Will travel all systems
      • Aggregator
      • Community – Tagging routes
      • Non Transitive  – Will not propagate all systems
        • Weight: Cisco. Control routes on the same router (higher is better). Weight does not affect the routing policy of other routers
        • MED: Tries to suggest entry points into your AS. E.g. suggest to upstream AS router to come into your network through the router you choose.  (lower is better)
        • Communities: use neighbour 1.1.1.1 send community and then the route map others there will be issues
          • Internet: default, bo tag
          • Local AS: Will not advertise outside local AS including confederations
          • No Advertise: Wont advertise to peer even IBGP – like a secret
          • None – Strips community tags
          • Route Manipulation
            • Local Preference: can set a local preference to prefer routes, however this propagates through the whole AS
            • Weight: Same as above, but stays local to router and doesn’t affect routing decision for other routers in the AS
            • Multihoming
              • Single Provider – dual link to same upstream router – Very rare to use BGP. Create two static routes (floating). May use BGP for keepalives
              • Real single provider.
              • Configuration
                • Always good to setup relationship between loopback addresses
                • Using loop back addresses
                  • Ebgp multihop  2– must uses this for ebgp relationships that uses loopback addresses.
                  • Update-source – must uses this for ebgp relationships that uses loopback addresses.
                  • Neighbour 192.167.34.1 next hop self – tells iBgp routers that it can access routers via this router
  • Network – must match the subnet, not like other protocols where advertisement is sent via that network and includes that network by using MASK keyword
  • Next hop = 0.0.0.0 means it is us / this router
  • * but no > – If there is no best route, it means the rule of synchronisation is in play
  • Show ip bgp regexp ^2005 – shows all routes in AS 2500. Can use in the access list!
    • ^ – Begins with
    • $ – ends with
    • . – something
    • _ – beginning / end of string and blank space

BGP Crib Notes

These are my ‘crib notes’ that I’ve made to serve as a last minute refresher. Please forgive the grammer / spelling as I did not develop these notes with publishing in mind.

BGP

***theory***

  • Must specify neighbour & do soft reset when making BGP changes
  • About: Used between internet and ISP. It is an EGP. Supports CIDR, VLSM, SUMMARISATION. It is a PATH VECTOR protocol.  BGP sends attributes in their updates
  • Uses TCP port 179 and does not need to be directly connected or same subnet / AS. Only one instance of BGP on a router
  • i-BGP – peer in same AS. E-BGP – peer in different AS. eBGP should be directly connected. Ibgp does not need to be.
  • When to use? If connecting to more than 1 ISP (multihoming) & concern on link for sending & receiving. If you are an ISP & if your policy is different from your ISP
  • Best Practice: Do no auto & no synchronisation under BGP process(see syn rule below) .Use loopback interface to establish relationships. Must use ebgp multi-hop and update source command so router knows how to get to loopback address. Also create static route so router know how to route to remote loopback address if no IGP running
  • BGP FAILING – Check AS number is correct > check ebgp multihop > open TCP port 179
  • Transitive AS – AS 500 talks to AS 200 via AS 100. AS 100 is a transitive AS
  • Network command – unlike IGP, where network command enables interface with that address to advertise. BGP uses network command to purely advertise networks
  • Next Hop Self command –Also needed for loopback interfaces. Needed because some routes may be inaccessible e.g. R3 connects to LAN A. R3 advertises this to R2 (Ebgp). R2 advertise this to R1 with the next hop address of R3 (Ibgp). R1 doesn’t have R3 as next hop. This is solved by next hop self, so R2 advertise itself as next hop to R1 in order to get to R3 then LAN A. Put this command on R2
  • Third Party Next Hop – BGP Speak is allowed to advertise the IP address of an internal peer as the next hop address IF the external peer is receiving the route has a subnet in common with the internal peer
  • iBGP rules: Ibgp routers does not send updates to every single iBGP neighbour. When an IBGP speaker learns a router for Ibgp peer, it will only advertise this to eBGP neighbour/ Because iBGP routers do not advertise routes from one internal router to another internal router. This means every AS needs to be fully meshed in order for full advertisements However full meshed is sometimes not possible so use rule of synchronisation.
  • Synchronisation: if AS is a transit area and also non bgp speaks in transit area. If AS500 talks to AS200 via AS100, then AS100 is a transit AS. R2 and R4 are iBGP neighbours but are connected to R3 which is not a BGP router. R2 speaks to R4 via R3. R4 will advertise AS200 to AS500 but problem is that if AS500 sends to AS200, R3 in AS100 will drop it as it has no route. Rule of Synchronisation states do not advertise a route unless all neighbours in that transit AS (AS100) knows how to route, therefore R4 won’t advertise AS200 to AS500 unless R2, R4 and R3 all know how to get to these AS’s. TURN this off if fully meshed. Rule of Sync is not ideal.
    • Turn off Synchronisation if 1) all routers in the AS are running BGP 2) If there a full mesh 3) If the AS is not a transit AS
    • BGP Split Horizon: 1 iBGP peer can’t lean about a path from 1 iBGP peer & then advertise it to another iBGP peer. Therefore BGP speaker requires full mesh which is not practical as it too much administration, tcp session, too much bandwidth etc. To get round this use Route Reflectors
    • Route Reflectors: advertise from one iBGP peer to another iBGP peer (contrary to split horizon). IBGP peer that sends route to route reflectors are known as route reflector clients. Client sends to route reflector. Route reflector reflects the advertisement to another Ibgp peer. It like a partial mesh . also RR routers sends an originator-ID, that way if it sees it own ID it disgard the packet to avoid loops & is how it bypass split horizon
      • RR sends updates to all clients and non client peers if the updates was learnt from  a RR CLIENT
      • RR sends updates to all clients and non client peers if the update was learnt from a Ebgp peer
      • RR sends updates to all clients in the cluster if the update was learnt from a non-client peer
      • Clusters: are a combination of route reflectors & clients. Must strategically place RR and consider resources and position.
      • BGP Peer Groups: Reduces resource & config needed for neighbour relationships. Name is locally significant & not passed to other routers
      • BGP Confederations: One step further than peer groups. It a logical grouping of AS. Confederation 321 could represent AS 123, 7,99. AS 6 will see this as 321. & would use this as the remote-as command. Done under BGP process
      • Route Map – use for setting MED or weight and preferring one route to a destination etc. Use with IP Access Lists
      • Prefix list: Used as a better alternative to controlling in/out updates in BGP. Apply to neighbour command
      • Route loops – AS PATH, if router sees it own AS in update, it will discard it
      • Private AS numbers – 64512 – 65535 (not advertised to external networks )
      • Route Table
        • Origin codes (?) = from redistribute
        • * = valid route
        • > = best route
        • *> = valid and best route – this would be the best route cause it valid and best
        • BGP States
          • Idle – Initial state. It waiting for a start event, waiting for TCP connection
          • Connect – Waiting for TCP connection response
          • Active – like eigrp, this is not good. TCP connection response not received & no relationship
          • Opensent – TCP connection response received and determined BGP state (i or ebgp)
          • Openconfirmed – waiting for keepalive
          • Established – relationship complete and updates are sent
          • BGP Message types
            • Open – holdtime & RID. Sent between peers once connection is established
            • Keepalive – Keeps neighbour relationship alive
            • Update – BGP path & attributes. Sent when attributes changed or routes are lost
            • Notfication – sent when error detected & termination of peer
            • Route refresh  – request routing information
            • Attributes: Weight (cisco propierity & locally significant to the router & not advertised) > Local Pref (100 by default if not shown & local to routers in that AS – IBGP peers) > Self Originated > AS Path > Origin Code > lowest MED > eBGP over iBGP
              • Well Known mandatory: AS PATH, origin, Next Hop (in all updates)
              • Well known discretionary: Local pref, atomic  aggregate
              • Optional transitive aggregator, community
              • Optional non-transitive (this attribute stays local AS & connected remote AS, will not be sent in update to other non connected remote AS): lowest MED (tries to influence better links). MED can be done via Route Map

***commands***

Show ip bgp neighbours

  • Show neighbours, remote AS, BGP peer type, State Active (acti ve is not good), show if route reflector client, show last reset & why

Show ip bgp summary

  • About the local router. Shows neighbours, AS number, sent/received msgs, shows how long the link has been up

Show ip bgp x.x.x.x

  • Really good to see issues with route table e.g. inaccessible

Show IP BGP destination address x.x.x.x

  • Good to see if route metric does not make sense in the attribute list. Sometimes show as inaccessible (no ip connectivity) use BGP next hop self command

Aggregate-address x.x.x.x. x.x.x.x summary-only

  • Under BGP process, route summarisation. Without summary only, it will send the summary and specific routes#

Clear ip bgp * soft

  • Soft reset