Showing posts with label bgp. Show all posts
Showing posts with label bgp. Show all posts

Sunday, April 7, 2013

BGP MISCELLANEOUS

  • neighbor a.b.c.d TTL-security hops
- remember to enable the feature on both ends of peering, else session will not come up.
 
R1#sh bgp sum
BGP router identifier 150.1.1.1, local AS number 146
BGP table version is 270, main routing table version 270
40 network entries using 5280 bytes of memory
68 path entries using 3536 bytes of memory
19/12 BGP path/bestpath attribute entries using 3192 bytes of memory
6 BGP AS-PATH entries using 144 bytes of memory
2 BGP community entries using 48 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
Bitfield cache entries: current 2 (at peak 5) using 64 bytes of memory
BGP using 12264 total bytes of memory
Dampening enabled. 0 history paths, 0 dampened paths
BGP activity 148/108 prefixes, 1818/1750 paths, scan interval 60 secs

Neighbor        V        AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
155.1.0.5       4        200    8037    8197      270    0    0 01:28:49       19
155.1.13.3      4        200    7861    8092        0    0    0 00:00:45 Active
155.1.146.4     4        146    8469    8269      270    0    0 3d23h          30
155.1.146.6     4        146    7820    8186      270    0    0 3d23h          17
R1#config t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#router bgp 200
BGP is already running; AS is 146
R1(config)#router bgp 146
R1(config-router)#nei 155.1.13.3 ttl hop 1
R1(config-router)#
.Apr  8 00:34:46.955: %BGP-5-ADJCHANGE: neighbor 155.1.13.3 Up
R1(config-router)#



    BGP ORF (Outbound Route Filtering)

    The BGP Prefix-Based Outbound Route Filtering feature is enabled through the advertisement of ORF capabilities to peer routers. The advertisement of the ORF capability indicates that a BGP speaker will accept a prefix list from a neighbor and apply the prefix list to locally configured ORFs (if any exist).

    When this capability is enabled, the BGP speaker can install the inbound prefix list filter to the remote peer as an outbound filter, which reduces unwanted routing updates.


    - ORF is a BGP capability (Code 3), can be send only, receive only, or send AND receive, aka both.
    - prefix-list MUST be applied 'in' on the sender side.
    clear ip bgp * soft in prefix-filter to propagate the config.
     

    R1#sh run | i bgp|1.13.3    
    router bgp 146
     bgp router-id 150.1.1.1
     bgp log-neighbor-changes
     bgp dampening route-map DAMP
     neighbor 155.1.13.3 remote-as 200
     neighbor 155.1.13.3 local-as 100 no-prepend replace-as
     neighbor 155.1.13.3 send-community
     neighbor 155.1.13.3 capability orf prefix-list receive
     neighbor 155.1.13.3 advertisement-interval 0
     neighbor 155.1.13.3 soft-reconfiguration inbound
    ip bgp-community new-format
    R1#


    R3#sh run | i bgp|1.13.1
    router bgp 200
     bgp always-compare-med
     bgp log-neighbor-changes
     bgp deterministic-med
     bgp dampening 4
     neighbor 155.1.13.1 remote-as 100
     neighbor 155.1.13.1 send-community both
     neighbor 155.1.13.1 capability orf prefix-list send
     neighbor 155.1.13.1 soft-reconfiguration inbound
     neighbor 155.1.13.1 prefix-list ORF-SEND in
     neighbor 155.1.13.1 route-map COM200 in
    ip bgp-community new-format
    R3#


    Verification:

    R3#sh ip pref det ORF-SEND
    ip prefix-list ORF-SEND:
       count: 3, range entries: 1, sequences: 5 - 15, refcount: 3
       seq 5 deny 112.0.0.0/8 (hit count: 1, refcount: 1)
       seq 10 deny 114.0.0.0/8 (hit count: 1, refcount: 2)
       seq 15 permit 0.0.0.0/0 le 32 (hit count: 38, refcount: 1)
    R3#


    R1#sh ip bgp ne 155.1.13.3 received pref
    Address family: IPv4 Unicast
    ip prefix-list 155.1.13.3: 3 entries
       seq 5 deny 112.0.0.0/8
       seq 10 deny 114.0.0.0/8
       seq 15 permit 0.0.0.0/0 le 32
    R1#

    R1#sh ip bgp ne 155.1.13.3 | i ORF
        Outbound Route Filter (ORF) type (128) Prefix-list:
      Outbound Route Filter (ORF): received (3 entries)
        ORF prefix-list:                      2        n/a
    R1#
    R1#
    R1#sh run | i orf
     neighbor 155.1.0.5 capability orf prefix-list receive
     neighbor 155.1.13.3 capability orf prefix-list receive
    R1#
     

    R1#debug ip bgp 155.1.13.3 updates
    BGP updates debugging is on for neighbor 155.1.13.3 for address family: IPv4 Unicast
    R1#



    Friday, April 5, 2013

    Dampening Saga

    Terms used describing route dampening:


    • Flap—A route is available, then unavailable, or vice versa; WITHDRAW/UPDATE
    • History state—After a route flaps once, it is assigned a penalty and put into history state, meaning the router does not have the best path, based on historical information.
    • Penalty—Each time a route flaps, the router configured for route dampening in another autonomous system assigns the route a penalty of 1000. Penalties are cumulative. The penalty for the route is stored in the BGP routing table until the penalty exceeds the suppress limit. At that point, the route state changes from history to damp.
    • Damp state—In this state, the route has flapped so often that the router will not advertise this route to BGP neighbors.
    • Suppress limit—A route is suppressed when its penalty exceeds this limit. The default value is 2000.
    • Half-life—Once the route has been assigned a penalty, the penalty is decreased by half after the half-life period (which is 15 minutes by default). The process of reducing the penalty happens every 5 seconds.
    • Reuse limit—As the penalty for a flapping route decreases and falls below this reuse limit, the route is unsuppressed. That is, the route is added back to the BGP table and once again used for forwarding. The default reuse limit is 750. The process of unsuppressing routes occurs at 10-second increments. Every 10 seconds, the router finds out which routes are now unsuppressed and advertises them to the world.
    • Maximum suppress limit—This value is the maximum amount of time a route can be suppressed. The default value is four times the half-life.
    The routes external to an autonomous system learned via iBGP are not dampened. This policy prevent the iBGP peers from having a higher penalty for routes external to the autonomous system.

    Note the following:

    MaxPenalty = ReuseLimit * 2 ^ (MaxSupressTime / HalfLife) 

        Penalty :1000
        Suppress Limit: 10000
        Reuse Limit: 1500
        Half-Life: 30 Minutes
        Maximum Suppress-Limit: 60 Minutes


    bash:$> echo $(( 1500*2 ** (60/30) ))
    6000
    bash:$>  


    route flap causes a penalty of 1000. When the penalty reaches 10,000, the prefix gets dampened. However, the maximum penalty that can be assigned is 6000. This means we will never incur a penalty significant enough to dampen the prefix.







    • Each time an eBGP route flaps, it gets 1000 penalty points (this cannot be configured or changed). 
    • iBGP routes are not dampened.
    • A route also never dampened for more time than the maximum suppress limit.
    • An unreachable route with a flap history is put in the history state. It stays in the BGP table but only to maintain the flap history (marked with h in the BGP table).
    • A penalty is applied on the individual path in the BGP table, not on the IP prefix.
    • clear ip bgp * is regarded as a flap, which could cause that path to be suppressed.
    • clear ip bgp * [soft] in is not regarded as a flap to neighbors.