Wednesday, August 12, 2015

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








 

Monday, August 3, 2015

BGP - Summerization


Method 1














Method 2

Summary only












R6#sh ip bgp 69.1.1.1

BGP routing table entry for 69.1.1.0/24, version 89
Paths: (1 available, best #1, table default, Advertisements suppressed by an aggregate.)
  Not advertised to any peer

R6#sh ip bgp 69.0.0.0
BGP routing table entry for 69.0.0.0/11, version 40
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     3
  Refresh Epoch 1
  Local, (aggregated by 1.301 69.4.1.1)
    0.0.0.0 from 0.0.0.0 (69.4.1.1)
      Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic-aggregate, best
      rx pathid: 0, tx pathid: 0x0
R6#

R4#sh ip bgp 69.0.0.0
BGP routing table entry for 69.0.0.0/11, version 694
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  101 1.301, (aggregated by 1.301 69.4.1.1)
    3.3.3.3 from 3.3.3.3 (39.1.4.1)
      Origin IGP, localpref 100, valid, external, atomic-aggregate, best

      rx pathid: 0, tx pathid: 0x0

 *>  69.0.0.0/11      3.3.3.3                                0 101 1.301 i




g
g

R4#sh ip bgp 69.0.0.0
BGP routing table entry for 69.0.0.0/11, version 726
Paths: (1 available, best #1, table default)
Not advertised to any peer
Refresh Epoch 1
101, (aggregated by 101 39.1.4.1)
3.3.3.3 from 3.3.3.3 (39.1.4.1)
Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, best
rx pathid: 0, tx pathid: 0x0

R4#





















 continue
wi

Saturday, August 1, 2015

BGP - AutoSummary




Case 1...

Config in R3

router bgp 101
 bgp log-neighbor-changes
 network 33.0.0.0
 neighbor 1.1.1.1 remote-as 101
 neighbor 1.1.1.1 update-source Loopback0
..........
R3#

No auto-summary is configured so BGP will require exact Network mask which is present in the routing table.
 So in this case  33.0.0.0/8 will not be advertise in the  BGP update.

R1#sh ip bgp
BGP table version is 21, local router ID is 1.1.1.1
!!!!!!!
     Network          Next Hop            Metric LocPrf Weight Path
 * i 4.4.4.4/32       4.4.4.4                  0    100      0 201 i
 * i 44.4.4.4/32      4.4.4.4                  0    100      0 201 i
 *>i 55.5.5.5/32      5.5.5.5                  0    100      0 i
 * i 66.6.6.6/32      6.6.6.6                  0    100      0 1.301 i
 *>                   6.6.6.6                  0             0 1.301 i
R1#

 Now Auto-summary will be configured.

Config in R3....

R3#sh run | sec bgp
router bgp 101
 bgp log-neighbor-changes
 network 33.0.0.0
 neighbor 1.1.1.1 remote-as 101
 neighbor 1.1.1.1 update-source Loopback0
 ............
 auto-summary


Network 33.0.0.0/8  classfull  advertised . Auto-summary  will  do
this .

see  in R1

R1#sh ip bgp


     Network          Next Hop            Metric LocPrf Weight Path
 * i 4.4.4.4/32       4.4.4.4                  0    100      0 201 i
 *>i 33.0.0.0         3.3.3.3                  0    100      0 i           Classful network for 33.0.0.0/8 will be advertised.
 * i 44.4.4.4/32      4.4.4.4                  0    100      0 201 i
 *>i 55.5.5.5/32      5.5.5.5                  0    100      0 i
 *>  66.6.6.6/32      6.6.6.6                  0             0 1.301 i
 * i                  6.6.6.6                  0    100      0 1.301 i

R1#




Case 2   





































































if any individual network is advertised , in Auto-summary case it will be advertised too.

R3(config)#router bgp 101

R3(config-router)#net 39.1.1.0 mask 255.255.255.0

in R1 

Sh ip bgp

 *>i 39.0.0.0         3.3.3.3                  0    100      0 ?

 *>i 39.1.1.0/24      3.3.3.3                  0    100      0 i