Sunday, August 16, 2015

bgp always-compare-med and bgp deterministic-med



bgp always-compare-med 

R8

ip prefix-list routefromr1 seq 5 permit 11.11.11.11/32

route-map routefromr1 permit 10
 match ip address prefix-list routefromr1
 set metric 100
!
route-map routefromr1 permit 20

router bgp 201
 bgp asnotation dot
 neighbor 98.0.0.9 remote-as 401
 neighbor 98.0.0.9 route-map routefromr1 out

R6

ip prefix-list routefromr1 seq 5 permit 11.11.11.11/32

route-map routefromr1 permit 10
 match ip address prefix-list routefromr1
 set metric 50
!
route-map routefromr1 permit 20

router bgp 1.301
 bgp asnotation dot
 neighbor 96.0.0.9 remote-as 401
 neighbor 96.0.0.9 route-map routefromr1 out

R9

We can see there is no effect of metric in route selection as prefixes are from different AS.
We can change this behavior   by below command

R9(config)#router bgp 401
R9(config-router)#bgp always-compare-med



bgp deterministic-med

 *>i 9.9.9.9/32       16.0.0.6                50    100      0 1.301 401 i
 *                    56.0.0.6               100             0 1.301 401 i

 * i                  28.0.0.8                25    100      0 201 401 i




BGP Best Path MED




R6 
router bgp 1.301
 bgp asnotation dot
 bgp log-neighbor-changes
 network 66.6.6.6 mask 255.255.255.255
 aggregate-address 69.0.0.0 255.224.0.0
 redistribute connected route-map conn
 neighbor 16.0.0.1 remote-as 101
 neighbor 16.0.0.1 next-hop-self
 neighbor 56.0.0.5 remote-as 101
 neighbor 56.0.0.5 route-map MED out

R6#

ip prefix-list dotsix seq 5 permit 69.1.1.0/24
ip prefix-list dotsix seq 10 permit 69.2.1.0/24
!
route-map MED permit 10
 match ip address prefix-list dotsix
 set metric 100
!
route-map MED permit 20


R5


R1


R3


R4 MED is Non-Transitive attribute 
 * i 69.0.0.0/11      28.0.0.2                 0    100      0 101 1.301 i
 *>                   3.3.3.3                                0 101 1.301 i
 * i 69.3.1.0/24      28.0.0.2                 0    100      0 101 1.301 ?
 *>                   3.3.3.3                                0 101 1.301 ?
 * i 69.4.1.0/24      28.0.0.2                 0    100      0 101 1.301 ?
 *>                   3.3.3.3                                0 101 1.301 ?

Saturday, August 15, 2015

BGP - Best path origin





R2 Before

 *>i 39.1.4.0/24      3.3.3.3                  0    100      0 ?
 * i 40.1.1.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                                        0 201 i
 * i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                                        0 201 i
 * i 40.1.3.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                                        0 201 i
 * i 40.1.4.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                                        0 201 i

R1- Before

 *>i 40.1.1.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                        0    100            0 201 i
 *>i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                           0    100      0 201 i
 *>i 40.1.3.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                          0    100      0 201 i
 *>i 40.1.4.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                           0    100      0 201 i
 *>i 44.4.4.4/32      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                          0    100      0 201 i


R3


router bgp 101
 bgp asnotation dot
 bgp log-neighbor-changes
 network 33.3.3.3 mask 255.255.255.255
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 send-community
 neighbor 4.4.4.4 route-map org in





ip prefix-list dottwo seq 5 permit 40.1.2.0/24

route-map org permit 10
 match ip address prefix-list dottwo
 set origin incomplete
!
route-map org permit 20

*>  40.1.1.0/24      4.4.4.4                  0             0 201 i
 *   40.1.2.0/24      4.4.4.4                  0             0 201 ?   { origin code changed to incomplete}
 *>i                  2.2.2.2                        0    100      0 201 i
 *>  40.1.3.0/24      4.4.4.4                  0             0 201 i
 *>  40.1.4.0/24      4.4.4.4                  0             0 201 i


R1- After

 *>i 40.1.1.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 i
 *>i 40.1.2.0/24      2.2.2.2                  0    100      0 201 i    { from R2 only}
 *>i 40.1.3.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 i
 *>i 40.1.4.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 i
 *>i 44.4.4.4/32      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 i

R2

 *>  40.1.1.0/24      28.0.0.8                               0 201 i
 * i                  3.3.3.3                  0    100      0 201 i
 *>  40.1.2.0/24      28.0.0.8                               0 201 i  { No prefix from R3}
 *>  40.1.3.0/24      28.0.0.8                               0 201 i
 * i                  3.3.3.3                  0    100      0 201 i
 *>  40.1.4.0/24      28.0.0.8                               0 201 i
 * i                  3.3.3.3                  0    100      0 201 i




BGP Best Path - AS path





R1

 * i 40.1.1.0/24      2.2.2.2                  0    100      0 201 i
 *>i                  3.3.3.3                  0    100      0 201 i
 * i 40.1.2.0/24      2.2.2.2                  0    100      0 201 i
 *>i                  3.3.3.3                  0    100      0 201 i
 * i 40.1.3.0/24      2.2.2.2                  0    100      0 201 i
 *>i                  3.3.3.3                  0    100      0 201 i
 * i 40.1.4.0/24      2.2.2.2                  0    100      0 201 i
 *>i                  3.3.3.3                  0    100      0 201 i
 * i 44.4.4.4/32      2.2.2.2                  0    100      0 201 i
 *>i                  3.3.3.3                  0    100      0 201 i

R2

 * i 40.1.1.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 i
 * i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 i
 * i 40.1.3.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 i

R5

*>i 40.1.1.0/24      28.0.0.8                 0    100      0 201 i
 * i                  3.3.3.3                  0    100      0 201 i
 *>i 40.1.2.0/24      28.0.0.8                 0    100      0 201 i
 * i                  3.3.3.3                  0    100      0 201 i
 *>i 40.1.3.0/24      28.0.0.8                 0    100      0 201 i
 * i                  3.3.3.3                  0    100      0 201 i
 *>i 40.1.4.0/24      28.0.0.8                 0    100      0 201 i


R8

ip prefix-list dot seq 5 permit 40.1.2.0/24
ip prefix-list dot seq 10 permit 40.1.1.0/24
!
route-map ASPATH permit 10
 match ip address prefix-list dot
 set as-path prepend 201 201 201
!
route-map ASPATH permit 30

R8(config)#router bgp 201
R8(config-router)#neighbor 28.0.0.2 route-map ASPATH out

after applying the configuration 

R2

 *>i 40.1.1.0/24      3.3.3.3                  0    100      0 201 i
 *                    28.0.0.8                               0 201 201 201 201 i
 *>i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 *                    28.0.0.8                               0 201 201 201 201 i
 * i 40.1.3.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 i
 * i 40.1.4.0/24      3.3.3.3                  0    100      0 201 i

R1

 *>i 40.1.1.0/24      3.3.3.3                  0    100      0 201 i
 *>i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 * i 40.1.3.0/24      2.2.2.2                  0    100      0 201 i
 *>i                  3.3.3.3                  0    100      0 201 i
 * i 40.1.4.0/24      2.2.2.2                  0    100      0 201 i
 *>i                  3.3.3.3                  0    100      0 201 i

R5

 *>i 40.1.1.0/24      3.3.3.3                  0    100      0 201 i
 *>i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 *>i 40.1.3.0/24      28.0.0.8                 0    100      0 201 i
 * i                  3.3.3.3                  0    100      0 201 i
 *>i 40.1.4.0/24      28.0.0.8                 0    100      0 201 i
 * i                  3.3.3.3                  0    100      0 201 i

Case-1 ...if Local-pref for 40.1.1.0/24 is increased then.......

R2:-

R2#sh run | sec bgp
router bgp 101
 bgp log-neighbor-changes
 neighbor 28.0.0.8 remote-as 201
 neighbor 28.0.0.8 route-map localp in


ip prefix-list dotone seq 5 permit 40.1.1.0/24

route-map localp permit 10
 match ip address prefix-list dotone
 set local-preference 200
!
route-map localp permit 20
!


     Network          Next Hop            Metric LocPrf Weight Path

 *>  40.1.1.0/24      28.0.0.8                      200      0 201 201 201 201 i
 { preferred over R3 even As-path is long}
 *>i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 *                    28.0.0.8                               0 201 201 201 201 i
 * i 40.1.3.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 i
 * i 40.1.4.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 i
 --More--

R1

*>i 40.1.1.0/24      2.2.2.2                  0    200      0 201 201 201 201 i
 *>i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 *>i 40.1.3.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 i
 *>i 40.1.4.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 i


R6

 *>  40.1.1.0/24      1.1.1.1                                0 101 201 201 201 201 i
 *                            5.5.5.5                                0 101 201 201 201 201 i
 *>  40.1.2.0/24      1.1.1.1                                0 101 201 i
 *                             5.5.5.5                                0 101 201 i
 *   40.1.3.0/24      1.1.1.1                                0 101 201 i

AS-PATH is well known mandatory attribute.

Case 3- if we want to ignore AS-PATH attribute in best selection




R2(config)#router bgp 101

R2(config-router)#bgp bestpath as-path ignore

{ This command is is hidden command in cisco IOS , but it is accepted}

    Network          Next Hop            Metric LocPrf Weight Path

 *>  40.1.1.0/24      28.0.0.8                      200      0 201 201 201 201 i
 * i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 201 201 201 i
 * i 40.1.3.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 i
 * i 40.1.4.0/24      3.3.3.3                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 i
 * i 44.4.4.4/32      3.3.3.3                  0    100      0 201 i

R1

 *>i 40.1.1.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 201 201 201 i
 *>i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 201 201 201 i
 *>i 40.1.3.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 i
 *>i 40.1.4.0/24      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 i
 *>i 44.4.4.4/32      3.3.3.3                  0    100      0 201 i
 * i                  2.2.2.2                  0    100      0 201 


R5



*>i 40.1.1.0/24      3.3.3.3                  0    100      0 201 i
 * i                  28.0.0.8                 0    100      0 201 201 201 201 i
 *>i 40.1.2.0/24      3.3.3.3                  0    100      0 201 i
 * i                  28.0.0.8                 0    100      0 201 201 201 201 i
 * i 40.1.3.0/24      3.3.3.3                  0    100      0 201 i
 *>i                  28.0.0.8                 0    100      0 201 i
 * i 40.1.4.0/24      3.3.3.3                  0    100      0 201 i
 *>i                  28.0.0.8                 0    100      0 201 i
 * i 44.4.4.4/32      3.3.3.3                  0    100      0 201 i

BGP- Best Path LocalPref






R3



router bgp 101
 neighbor 4.4.4.4 remote-as 201
 neighbor 4.4.4.4 ebgp-multihop 255
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 send-community
 neighbor 4.4.4.4 route-map localp in

route-map localp permit 10
 match ip address prefix-list dottwo
 set local-preference 300
!
route-map localp permit 20

Sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path

 *>i 40.1.1.0/24      28.0.0.8                 0    200      0 201 i
{local Pref 200 preferred , this is preferred   from R8}
 *                            4.4.4.4                  0                 0 201 i

 * i 40.1.2.0/24      28.0.0.8                 0    100      0 201 i
 *>                         4.4.4.4                  0     300      0 201 i  
{local Pref 300 is preferred , This is preferred from R4}

 * i 40.1.3.0/24      28.0.0.8                 0    100      0 201 i
 *>                          4.4.4.4                  0                0 201 i
 * i 40.1.4.0/24      28.0.0.8                 0    100      0 201 i
 *>                          4.4.4.4                  0                0 201 i
 * i 44.4.4.4/32      28.0.0.8                 0    100      0 201 i
 *>                          4.4.4.4                  0                0 201 i

R2

R2#sh run | sec bgp
router bgp 101
 bgp log-neighbor-changes
 neighbor 28.0.0.8 remote-as 201
 neighbor 28.0.0.8 route-map localp in


ip prefix-list dotone seq 5 permit 40.1.1.0/24

route-map localp permit 10
 match ip address prefix-list dotone
 set local-preference 200
!
route-map localp permit 20
!

Sh ip bgp

 *>  40.1.1.0/24      28.0.0.8                      200      0 201 i { from R8}
 *>i 40.1.2.0/24      4.4.4.4                  0    300      0 201 i  { from R4}
 *                    28.0.0.8                               0 201 i
 * i 40.1.3.0/24      4.4.4.4                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 i
 * i 40.1.4.0/24      4.4.4.4                  0    100      0 201 i
 *>                   28.0.0.8                               0 201 i




R1

 *>i 40.1.1.0/24      2.2.2.2                  0    200      0 201 i    { from R2}
 *>i 40.1.2.0/24      3.3.3.3                  0    300      0 201 i     {from R3}
 * i 40.1.3.0/24      2.2.2.2                  0    100      0 201 i
 *>i                  3.3.3.3                  0         100      0 201 i
 * i 40.1.4.0/24      2.2.2.2                  0    100      0 201 i
 *>i                  3.3.3.3                  0          100      0 201 i





Thursday, August 13, 2015

BGP :- Route filtering






Filtering with Prefix-list

R4

ip prefix-list Filter seq 5 deny 40.1.2.0/24
ip prefix-list Filter seq 10 permit 0.0.0.0/0 le 32

!
router bgp 201
 bgp log-neighbor-changes
 network 40.1.1.0 mask 255.255.255.0
 network 40.1.2.0 mask 255.255.255.0
 network 40.1.3.0 mask 255.255.255.0
 network 40.1.4.0 mask 255.255.255.0
 neighbor 3.3.3.3 prefix-list Filter out


R3

R3#sh ip bgp | in 40|44
 *>  40.1.1.0/24      4.4.4.4                  0             0 201 i
 * i 40.1.2.0/24      28.0.0.8                 0    100      0 201 i
 *>  40.1.3.0/24      4.4.4.4                  0             0 201 i
 *>  40.1.4.0/24      4.4.4.4                  0             0 201 i

 *>  44.4.4.4/32      4.4.4.4                  0             0 201 i


Standard Access-Lists

R4

router bgp 201

 bgp log-neighbor-changes
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 distribute-list 20 out

access-list 20 deny   40.1.2.0 0.0.0.255
access-list 20 permit any


R3#sh ip bgp | in 40|44
 *   40.1.1.0/24      4.4.4.4                  0             0 201 i
 * i 40.1.2.0/24      28.0.0.8                 0    100      0 201 i
 *   40.1.3.0/24      4.4.4.4                  0             0 201 i
 *   40.1.4.0/24      4.4.4.4                  0             0 201 i
 *   44.4.4.4/32      4.4.4.4                  0             0 201 i

R3#


Extended Access-Lists


R4

access-list 101 deny   ip host 40.1.2.0 host 255.255.255.0

access-list 101 permit ip any any

router bgp 201
 bgp log-neighbor-changes
 network 40.1.1.0 mask 255.255.255.0
 network 40.1.2.0 mask 255.255.255.0
 network 40.1.3.0 mask 255.255.255.0
 network 40.1.4.0 mask 255.255.255.0
 network 44.4.4.4 mask 255.255.255.255
 neighbor 3.3.3.3 remote-as 101
 neighbor 3.3.3.3 ebgp-multihop 255
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 distribute-list 101 out

R3

R3#sh ip bgp | in 40|44
 *   40.1.1.0/24      4.4.4.4                  0             0 201 i
 * i 40.1.2.0/24      28.0.0.8                 0    100      0 201 i
 *   40.1.3.0/24      4.4.4.4                  0             0 201 i
 *   40.1.4.0/24      4.4.4.4                  0             0 201 i
 *   44.4.4.4/32      4.4.4.4                  0             0 201 i

R3#



Path Filtering with BGP Regular Expressions


Objective- 1:- Filter out prefixes originated from 1.301 in R4

R4

R4 Before Applying  Filter list

R4#sh ip bgp regexp _1.301$
BGP table version is 17, local router ID is 44.4.4.4

     Network          Next Hop            Metric LocPrf Weight Path
 *>  69.0.0.0/11      3.3.3.3                                0 101 1.301 i
R4#


Now As-Path filter list

ip as-path access-list 1 deny _1.301$   Prefix originated from 1.301

ip as-path access-list 1 permit .*

route-map ASPATH permit 10
 match as-path 1

R4(config)#router bgp 201
R4(config-router)# nei 3.3.3.3  route-map ASPATH in


Objective- 2:- Filter out prefixes originated from 201 in R3

R3 

Before Applying rules,

R3#sh ip bgp
BGP table version is 141, local router ID is 39.1.4.1

     Network          Next Hop            Metric LocPrf Weight Path
 * i 8.8.8.8/32       28.0.0.8                 0    100      0 201 i
 *>                   4.4.4.4                                0 201 i
 *>  33.3.3.3/32      0.0.0.0                  0         32768 i
 *>  39.1.0.0/19      0.0.0.0                            32768 i
 *>  39.1.1.0/24      0.0.0.0                  0         32768 ?
 *>  39.1.2.0/24      0.0.0.0                  0         32768 ?
 *>  39.1.3.0/24      0.0.0.0                  0         32768 ?
 *>  39.1.4.0/24      0.0.0.0                  0         32768 ?
 * i 40.1.1.0/24      28.0.0.8                 0    100      0 201 i
 *>                   4.4.4.4                  0             0 201 i
 * i 40.1.2.0/24      28.0.0.8                 0    100      0 201 i
 *>                   4.4.4.4                  0             0 201 i
 * i 40.1.3.0/24      28.0.0.8                 0    100      0 201 i
 *>                   4.4.4.4                  0             0 201 i
 * i 40.1.4.0/24      28.0.0.8                 0    100      0 201 i
     Network          Next Hop            Metric LocPrf Weight Path
 *>                   4.4.4.4                  0             0 201 i
 * i 44.4.4.4/32      28.0.0.8                 0    100      0 201 i
 *>                   4.4.4.4                  0             0 201 i
 *>i 55.5.5.5/32      5.5.5.5                  0    100      0 i
 *>i 69.0.0.0/11      1.1.1.1                  0    100      0 1.301 i
 *>i 69.1.1.0/24      1.1.1.1                  0    100      0 ?
 *>i 111.111.111.111/32
                       1.1.1.1                  0    100      0 i

R3

ip as-path access-list 1 deny ^201_
ip as-path access-list 1 permit .*

route-map ASPATH permit 10
 match as-path 1

router bgp 101
neighbor 4.4.4.4 ebgp-multihop 255
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 send-community
 neighbor 4.4.4.4 route-map ASPATH inneighbor 4.4.4.4 ebgp-multihop 255
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 send-community
 neighbor 4.4.4.4 route-map ASPATH in


*******************************
All prefix from As 201 from nei 4.4.4.4 are not in BGP table

R3#sh ip bgp regexp ^201_
BGP table version is 11, local router ID is 39.1.4.1
     Network          Next Hop            Metric LocPrf Weight Path
 * i 8.8.8.8/32       28.0.0.8                 0    100      0 201 i
 * i 40.1.1.0/24      28.0.0.8                 0    100      0 201 i
 * i 40.1.2.0/24      28.0.0.8                 0    100      0 201 i
 * i 40.1.3.0/24      28.0.0.8                 0    100      0 201 i
 * i 40.1.4.0/24      28.0.0.8                 0    100      0 201 i
 * i 44.4.4.4/32      28.0.0.8                 0    100      0 201 i


R3
router bgp 101
 bgp asnotation dot
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 101
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 route-map ASPATH in

No prefix from AS 201



Filtering With Maximum Prefix


R6

Before applying the Rule  R6 have prefix from R1 and R5

R6


R6(config-router)# nei 1.1.1.1 maximum-prefix 9
%BGP-4-MAXPFX: Number of prefixes received from 1.1.1.1 (afi 0) reaches 9, max 9

R6(config-router)#^Z

R6(config-router)# nei 1.1.1.1 maximum-prefix 8
%BGP-3-MAXPFXEXCEED: Number of prefixes received from 1.1.1.1 (afi 0): 9 exceeds limit 8
R6(config-router)#^Z
R6#
%BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down Peer over prefix limit


Sh ip bgp 
     Network          Next Hop            Metric LocPrf Weight Path
 *>  11.11.11.11/32   5.5.5.5                                0 101 i
 *>  33.3.3.3/32      5.5.5.5                                0 101 i
 *>  39.1.0.0/19      5.5.5.5                                0 101 i
 *>  39.1.1.0/24      5.5.5.5                                0 101 ?
 *>  39.1.2.0/24      5.5.5.5                                0 101 ?
 *>  39.1.3.0/24      5.5.5.5                                0 101 ?
 *>  39.1.4.0/24      5.5.5.5                                0 101 ?
 *>  55.5.5.5/32      5.5.5.5                  0             0 101 i

By default it will drop the connection 

R6(config-router)# nei 1.1.1.1 maximum-prefix 20 50

NO warning message

R6(config-router)# nei 1.1.1.1 maximum-prefix 20  40
R6(config-router)#
%BGP-4-MAXPFX: Number of prefixes received from 1.1.1.1 (afi 0) reaches 9, max 20

at 40%  of max , it will show a message, 

R6(config-router)# nei 1.1.1.1 maximum-prefix 8 warning-only
R6(config-router)#
%BGP-3-MAXPFXEXCEED: Number of prefixes received from 1.1.1.1 (afi 0): 9 exceeds limit 8

Now it is showing only warning no neighborship down.


with Community

Community 

Wednesday, August 12, 2015

BGP - Conditional Route Advertisement






Case -1 ADVRTISE-MAP   with EXIST-MAP 















R1


router bgp 101
 bgp asnotation dot
 bgp log-neighbor-changes
 network 11.11.11.11 mask 255.255.255.255
  neighbor 3.3.3.3 remote-as 101
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 route-reflector-client
 neighbor 3.3.3.3 next-hop-self
 neighbor 3.3.3.3 advertise-map ADVERTISE exist-map NON

{ if 69.0.0.0/11 is present in BGP table , we will advertise 11.11.11.11/32 to neighbor, otherwise will drop}

int lo10
ip add 11.11.11.11 255.255.255.255

ip prefix-list ADD seq 5 permit 11.11.11.11/32
!
ip prefix-list NON seq 5 permit 69.0.0.0/11
!
route-map ADVERTISE permit 10
 match ip address prefix-list ADD
!
route-map NON permit 10
 match ip address prefix-list NON

R6

router bgp 1.301
 bgp asnotation dot
 bgp log-neighbor-changes
 network 66.6.6.6 mask 255.255.255.255
 aggregate-address 69.0.0.0 255.224.0.0     {Advertising summary route }

 R1 
 
we can see status is advertise as 69.0.0.0/11 is in bgp table.
 
R1#sh ip bgp nei 3.3.3.3 | in Condition-map
  Condition-map NON, Advertise-map ADVERTISE, status: Advertise

R3

R3#sh ip bgp | in 11
 *>i 11.11.11.11/32   1.1.1.1                  0    100      0 i
 *>i 69.0.0.0/11      1.1.1.1                  0    100      0 1.301 i
 *>i 111.111.111.111/32

Now we are removing aggregate address from R6

R6

R6(config)#router bgp 1.301
R6(config-router)#no  aggregate-address 69.0.0.0 255.224.0.0

R1 

R1#sh ip bgp | in 69
 * i 69.1.1.0/24      6.6.6.6                  0    100      0 1.301 ?
 * i 69.2.1.0/24      6.6.6.6                  0    100      0 1.301 ?
 * i 69.3.1.0/24      6.6.6.6                  0    100      0 1.301 ?
 * i 69.4.1.0/24      6.6.6.6                  0    100      0 1.301 ?
R1#

We can see now it is withdraw status as 69.0.0.0/11 is not present in bgp table.

R1#sh ip bgp nei 3.3.3.3 | in Condition-map
  Condition-map NON, Advertise-map ADVERTISE, status: Withdraw
R3

R3#sh ip bgp | in 11
 *>i 111.111.111.111/32           No BGP prefix  for 69.0.0.0/11 and 11.11.11.11/32

Case 2-ADVRTISE-MAP   with NON-EXIST-MAP 

R1


router bgp 101

 neighbor 3.3.3.3 remote-as 101

 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 route-reflector-client
 neighbor 3.3.3.3 next-hop-self
 neighbor 3.3.3.3 advertise-map ADVERTISE non-exist-map NON

{ if 69.0.0.0/11 is not present in BGP table , we will advertise 11.11.11.11/32 to neighbor, otherwise will drop}



R1
we can see status is advertise as 69.0.0.0/11 is  not in bgp table.


R1#sh ip bgp nei 3.3.3.3 | in Condition-map
  Condition-map NON, Advertise-map ADVERTISE, status: Advertise
R1#

As we don't have 69.0.0.0/11 in bgp table status is advertise

R1#sh ip bgp | in 69
 * i 69.1.1.0/24      6.6.6.6                  0    100      0 1.301 ?
 * i 69.2.1.0/24      6.6.6.6                  0    100      0 1.301 ?
 * i 69.3.1.0/24      6.6.6.6                  0    100      0 1.301 ?
 * i 69.4.1.0/24      6.6.6.6                  0    100      0 1.301 ?
R1#

R3
 
R3#sh ip bgp | in 11

 *>i 11.11.11.11/32   1.1.1.1                  0    100      0 i 
 *>i 111.111.111.111/32

Now 69.0.0.0/11 will be advertise in R6 so it would be in R1 bgp table

R6
 
R6(config-router)#router bgp 1.301
R6(config-router)#  aggregate-address 69.0.0.0 255.224.0.0

R1
 
R1#sh ip bgp | in 69
 * i 69.0.0.0/11      6.6.6.6                  0    100      0 1.301 i

R1#sh ip bgp nei 3.3.3.3 | in Condition-map
  Condition-map NON, Advertise-map ADVERTISE, status: Withdraw

R3

We can see no 11.11.11.11/32 in bgp table
 
R3#sh ip bgp | in 11
 *>i 69.0.0.0/11      1.1.1.1                  0    100      0 1.301 i
 *>i 111.111.111.111/32
R3#