Showing posts with label BGP. Show all posts
Showing posts with label BGP. Show all posts

Sunday, August 16, 2015

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

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#



  

BGP- Route Injection




R1

router bgp 101
 bgp asnotation dot
 bgp log-neighbor-changes
 bgp inject-map ORIGIN exist-map LEARNED

ip prefix-list ORIG seq 5 permit 69.1.1.0/24

route-map ORIGIN permit 10
 set ip address prefix-list ORIG


ip prefix-list ROUTE seq 5 permit 69.0.0.0/11
!
ip prefix-list ROUTE-SOURCE seq 5 permit 6.6.6.6/32


route-map LEARNED permit 10
 match ip address prefix-list ROUTE
 match ip route-source prefix-list ROUTE-SOURCE
!

R1#sh ip bgp  | sec 69
 * i 69.0.0.0/11        6.6.6.6                  0    100      0 1.301 i
 *>  69.1.1.0/24      6.6.6.6                                     0 ?
R1#


R1#sh ip bgp injected-paths
BGP table version is 16, local router ID is 11.11.11.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  69.1.1.0/24      6.6.6.6                                0 ?
R1#

R3

R3#sh ip bgp | in 69
 *>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 ?
R3#




Monday, August 10, 2015

BGP- Community -2





R6
route-map commun permit 10
 match ip address 1
 set community no-export
!
route-map commun permit 20
 match ip address 4
 set community no-advertise
!
route-map commun permit 30
 match ip address 5
 set community 200:100
!
route-map commun permit 59
 set community none
!
!
access-list 1 permit 69.1.0.0 0.0.255.255
access-list 4 permit 69.3.0.0 0.0.255.255
access-list 5 permit 69.2.0.0 0.0.255.255

----------------------------

router bgp 1.301
 bgp asnotation dot
 bgp log-neighbor-changes
 network 66.6.6.6 mask 255.255.255.255
 redistribute connected route-map permit
 neighbor 1.1.1.1 remote-as 101
 neighbor 1.1.1.1 ebgp-multihop 2
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 1.1.1.1 send-community
 neighbor 1.1.1.1 route-map commun out

----------------------------------------
R1

'R1#sh ip bgp | in 69
 *>  69.1.0.0/16      6.6.6.6                  0             0 1.301 ?
 *>  69.2.0.0/16      6.6.6.6                  0             0 1.301 ?
 *>  69.3.0.0/16      6.6.6.6                  0             0 1.301 ?
 *>  69.4.0.0/16      6.6.6.6                  0             0 1.301 ?
R1#
R1(config)#ip bgp-community new-format



R1#sh ip bgp 69.1.1.1  |  in Community
      Community: no-export
R1#sh ip bgp 69.2.1.1  |  in Community
      Community: 200:100
R1#sh ip bgp 69.3.1.1  |  in Community
      Community: no-advertise
R1#sh ip bgp 69.4.1.1  |  in Community
R1#
----------------------------------------

router bgp 101
 neighbor 3.3.3.3 route-reflector-client
 neighbor 3.3.3.3 next-hop-self
 neighbor 3.3.3.3 send-community

R3
R3#sh ip bgp | in 69
 *>i 69.1.0.0/16      1.1.1.1                  0    100      0 1.301 ?
 *>i 69.2.0.0/16      1.1.1.1                  0    100      0 1.301 ?
 *>i 69.4.0.0/16      1.1.1.1                  0    100      0 1.301 ?
R3#
R3#sh ip bgp 69.1.0.0 | in Community
      Community: no-export
R3#sh ip bgp 69.2.0.0 | in Community
      Community: 200:100
R3#sh ip bgp 69.4.0.0 | in Community
R4

R4#sh ip bgp | in 69
 *>  69.2.0.0/16      3.3.3.3                                0 101 65837 ?
 *>  69.4.0.0/16      3.3.3.3                                0 101 65837 ?
R4#

R3#sh ip bgp 69.2.0.0 | in Community
      Community: 200:100


Case  2:-

Now we want to advertise 69.1.0.0 to R4 and change community of 69.2.0.0 from 200:100 to 300:400

R3

****To match community , Community list is must**
ip community-list 10 permit 200:100

access-list 10 permit 69.1.0.0 0.0.255.255

route-map Commchange permit 10
 match community 10
 set community 300:400

!
route-map Commchange permit 20
 match ip address 10
 set community none
!
route-map Commchange permit 30
router bgp 101
neighbor 1.1.1.1 route-map Commchange in

R3#sh ip bgp | in  69
 *>i 69.1.0.0/16      1.1.1.1                  0    100      0 1.301 ?
 *>i 69.2.0.0/16      1.1.1.1                  0    100      0 1.301 ?
 *>i 69.4.0.0/16      1.1.1.1                  0    100      0 1.301 ?
R3#
R3#sh ip bgp 69.1.1.0 | in Community
    No community attached now with 69.1.0.0
R3#sh ip bgp 69.2.1.0 | in Community
      Community: 300:400
R3#sh ip bgp 69.4.1.0 | in Community
R3#

R4

We can see 69.1.0.0 in R4

R4#sh ip bgp | in 69
 *>  69.1.0.0/16      3.3.3.3                                0 101 65837 ?
 *>  69.2.0.0/16      3.3.3.3                                0 101 65837 ?
 *>  69.4.0.0/16      3.3.3.3                                0 101 65837 ?
R4#
R4#sh ip bgp 69.1.0.0
BGP routing table entry for 69.1.0.0/16, version 39
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  101 65837
    3.3.3.3 from 3.3.3.3 (39.1.4.1)
      Origin incomplete, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0

R4#sh ip bgp 69.2.0.0
BGP routing table entry for 69.2.0.0/16, version 41
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  101 65837
    3.3.3.3 from 3.3.3.3 (39.1.4.1)
      Origin incomplete, localpref 100, valid, external, best
      Community: 300:400
      rx pathid: 0, tx pathid: 0x0