Wednesday 14 November 2012

BGP: Generating default route:


BGP: Generating default route:

 

·         In BGP, we can generate default route in 2 ways

1.  Advertising “network 0.0.0.0 mask 0.0.0.0: command

2.  Using “default-information originate” command or

·         In the first case, router must have a default-route in its routing table, and then only it can send it over BGP, but it sends the default-route to all neighbors

·         In the second case, we can send default route per neighbor. This doesn’t require having a default route in the routing table.

 

·         Let me take a small topology to configure default route in BGP:

·         R1 – AS 100

·         R2 – AS 200

·         R3 – AS 300

·         R4 – AS 400

 

R1(config-router)#do show ip bgp sum

BGP router identifier 1.1.1.1, local AS number 100

BGP table version is 5, main routing table version 5

4 network entries using 468 bytes of memory

4 path entries using 208 bytes of memory

5/4 BGP path/bestpath attribute entries using 620 bytes of memory

3 BGP AS-PATH entries using 72 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

BGP using 1368 total bytes of memory

BGP activity 4/0 prefixes, 4/0 paths, scan interval 60 secs

 

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

10.1.12.2       4   200       5       8        5    0    0 00:01:05        1

10.1.13.3       4   300       5       8        5    0    0 00:01:15        1

10.1.14.4       4   400       5       8        5    0    0 00:01:29        1

R1(config-router)#do show ip bgp

BGP table version is 5, local router ID is 1.1.1.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 1.1.1.1/32       0.0.0.0                  0         32768 i

*> 2.2.2.2/32       10.1.12.2                0             0 200 i

*> 3.3.3.3/32       10.1.13.3                0             0 300 i

*> 4.4.4.4/32       10.1.14.4                0             0 400 i

R1(config-router)#

 

R4(config-router)#do show ip bgp

BGP table version is 5, local router ID is 4.4.4.4

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 1.1.1.1/32       10.1.14.1                0             0 100 i

*> 2.2.2.2/32       10.1.14.1                              0 100 200 i

*> 3.3.3.3/32       10.1.14.1                              0 100 300 i

*> 4.4.4.4/32       0.0.0.0                  0         32768 i

R4(config-router)#

 

R3(config-router)#do show ip bgp

BGP table version is 5, local router ID is 3.3.3.3

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 1.1.1.1/32       10.1.13.1                0             0 100 i

*> 2.2.2.2/32       10.1.13.1                              0 100 200 i

*> 3.3.3.3/32       0.0.0.0                  0         32768 i

*> 4.4.4.4/32       10.1.13.1                              0 100 400 i

R3(config-router)#

 

R2(config-router)#do show ip bgp

BGP table version is 5, local router ID is 2.2.2.2

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 1.1.1.1/32       10.1.12.1                0             0 100 i

*> 2.2.2.2/32       0.0.0.0                  0         32768 i

*> 3.3.3.3/32       10.1.12.1                              0 100 300 i

*> 4.4.4.4/32       10.1.12.1                              0 100 400 i

R2(config-router)#

 

Observation:

R1 is peering with R2, R3 and R4

R1 has advertised its loopback0 1.1.1.1 into BGP

R2 has advertised its loopback0 2.2.2.2 into BGP

R3 has advertised its loopback0 3.3.3.3 into BGP

 

·         Now, I want R3 and R4 to get a default route from R1 through BGP.

·         For this, first let me create a static route in R1 through R2 and then I will advertise that into BGP, so that R3 and R4 gets that default route.

 

R1(config-router)#network 0.0.0.0 mask 0.0.0.0

R1(config-router)#

R1(config-router)#ip route 0.0.0.0 0.0.0.0 10.1.12.2

R1(config)#

 

·         Now, let me check the BGP routing tables:

 

R1(config)#do show ip bgp

BGP table version is 6, local router ID is 1.1.1.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 0.0.0.0          10.1.12.2                0         32768 i

*> 1.1.1.1/32       0.0.0.0                  0         32768 i

*> 2.2.2.2/32       10.1.12.2                0             0 200 i

*> 3.3.3.3/32       10.1.13.3                0             0 300 i

*> 4.4.4.4/32       10.1.14.4                0             0 400 i

R1(config)#

 

R4(config-router)#do show ip bgp

BGP table version is 6, local router ID is 4.4.4.4

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 0.0.0.0          10.1.14.1                0             0 100 i

*> 1.1.1.1/32       10.1.14.1                0             0 100 i

*> 2.2.2.2/32       10.1.14.1                              0 100 200 i

*> 3.3.3.3/32       10.1.14.1                              0 100 300 i

*> 4.4.4.4/32       0.0.0.0                  0         32768 i

R4(config-router)#

 

R3(config-router)#do show ip bgp

BGP table version is 6, local router ID is 3.3.3.3

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 0.0.0.0          10.1.13.1                0             0 100 i

*> 1.1.1.1/32       10.1.13.1                0             0 100 i

*> 2.2.2.2/32       10.1.13.1                              0 100 200 i

*> 3.3.3.3/32       0.0.0.0                  0         32768 i

*> 4.4.4.4/32       10.1.13.1                              0 100 400 i

R3(config-router)#

 

R2(config-router)#do show ip bgp

BGP table version is 6, local router ID is 2.2.2.2

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 0.0.0.0          10.1.12.1                0             0 100 i

*> 1.1.1.1/32       10.1.12.1                0             0 100 i

*> 2.2.2.2/32       0.0.0.0                  0         32768 i

*> 3.3.3.3/32       10.1.12.1                              0 100 300 i

*> 4.4.4.4/32       10.1.12.1                              0 100 400 i

R2(config-router)#

 

Observation:

·         Now, R3 and R4 got default route from R1 through BGP!

 

·         But, R2 also got the same route from R1L

·         So, general advertisement is not good, solution is to use conditional advertisement per neighbor

 

R1(config)#router bgp 100

R1(config-router)#no network 0.0.0.0 mask 0.0.0.0

R1(config-router)#neighbor 10.1.14.4 default-originate

R1(config-router)#neighbor 10.1.13.3 default-originate

R1(config-router)#

 

·         Now, let me check BGP routing tables:

 

R1(config-router)#do show ip bgp

BGP table version is 7, local router ID is 1.1.1.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 1.1.1.1/32       0.0.0.0                  0         32768 i

*> 2.2.2.2/32       10.1.12.2                0             0 200 i

*> 3.3.3.3/32       10.1.13.3                0             0 300 i

*> 4.4.4.4/32       10.1.14.4                0             0 400 i

R1(config-router)#

 

R4(config-router)#do show ip bgp

BGP table version is 8, local router ID is 4.4.4.4

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 0.0.0.0          10.1.14.1                0             0 100 i

*> 1.1.1.1/32       10.1.14.1                0             0 100 i

*> 2.2.2.2/32       10.1.14.1                              0 100 200 i

*> 3.3.3.3/32       10.1.14.1                              0 100 300 i

*> 4.4.4.4/32       0.0.0.0                  0         32768 i

R4(config-router)#

 

R3(config-router)#do show ip bgp

BGP table version is 8, local router ID is 3.3.3.3

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 0.0.0.0          10.1.13.1                0             0 100 i

*> 1.1.1.1/32       10.1.13.1                0             0 100 i

*> 2.2.2.2/32       10.1.13.1                              0 100 200 i

*> 3.3.3.3/32       0.0.0.0                  0         32768 i

*> 4.4.4.4/32       10.1.13.1                              0 100 400 i

R3(config-router)#

 

R2(config-router)#do show ip bgp

BGP table version is 7, local router ID is 2.2.2.2

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 1.1.1.1/32       10.1.12.1                0             0 100 i

*> 2.2.2.2/32       0.0.0.0                  0         32768 i

*> 3.3.3.3/32       10.1.12.1                              0 100 300 i

*> 4.4.4.4/32       10.1.12.1                              0 100 400 i

R2(config-router)#

 

Observation:

·         Now, only R3 and R4 default route from R1!

 

·         But, what if R1 loses its BGP connection to R2????

·         R3 and R4 still gets default route from R1 and we have an issueL

·         Solution is to advertise this default-route conditionally to R3 and R4, only R1 has its connection to R2

 

R1(config)#access-list 12 permit 10.1.12.0 0.0.0.255

R1(config)#route-map TO-R3-R4

R1(config-route-map)#match ip address 12

R1(config-route-map)#router bgp 100

R1(config-router)#

R1(config-router)#no  neighbor 10.1.13.3 default-originate

R1(config-router)#no  neighbor 10.1.14.4 default-originate

R1(config-router)#neighbor 10.1.13.3 default-originate route-map TO-R3-R4

R1(config-router)#neighbor 10.1.14.4 default-originate route-map TO-R3-R4

R1(config-router)#

 

·         Now, let me shut the R1-R2 link and see what happens to the default route:

 

R1#debug ip bgp updates

BGP updates debugging is on for address family: IPv4 Unicast

R1#

 

R1(config)#int ser1/0

R1(config-if)#shut

R1(config-if)#

*Mar  1 00:45:07.235: BGP(0): no valid path for 2.2.2.2/32

*Mar  1 00:45:07.239: %BGP-5-ADJCHANGE: neighbor 10.1.12.2 Down Interface flap

R1(config-if)#

*Mar  1 00:45:07.243: BGP(0): nettable_walker 2.2.2.2/32 no best path

*Mar  1 00:45:07.243: BGP(0): 10.1.13.3 send unreachable 2.2.2.2/32

*Mar  1 00:45:07.243: BGP(0): 10.1.13.3 send UPDATE 2.2.2.2/32 -- unreachable

*Mar  1 00:45:07.343: BGP(0): 10.1.13.3 send unreachable 0.0.0.0/0

*Mar  1 00:45:07.343: BGP(0): 10.1.13.3 enqueued default-originate update

*Mar  1 00:45:07.343: BGP(0): 10.1.14.4 send unreachable 0.0.0.0/0

*Mar  1 00:45:07.343: BGP(0): 10.1.14.4 enqueued default-originate update

*Mar  1 00:45:07.347: BGP(0): updgrp 2 - 10.1.13.3 updates replicated for neighbors: 10.1.14.4

R1(config-if)#

*Mar  1 00:45:09.215: %LINK-5-CHANGED: Interface Serial1/0, changed state to administratively down

*Mar  1 00:45:10.215: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down

R1(config-if)#do u all

All possible debugging has been turned off

R1(config-if)#

 

R4(config-router)#do show ip bgp

BGP table version is 10, local router ID is 4.4.4.4

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 1.1.1.1/32       10.1.14.1                0             0 100 i

*> 3.3.3.3/32       10.1.14.1                              0 100 300 i

*> 4.4.4.4/32       0.0.0.0                  0         32768 i

R4(config-router)#

 

R3(config-router)#do show ip bgp

BGP table version is 10, local router ID is 3.3.3.3

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 1.1.1.1/32       10.1.13.1                0             0 100 i

*> 3.3.3.3/32       0.0.0.0                  0         32768 i

*> 4.4.4.4/32       10.1.13.1                              0 100 400 i

R3(config-router)#

 

Observation:

·         Default route is not there in R3 and R4 now.

 

·         Now, let me make R1-R2 interface up:

 

R1(config-if)#no shut

R1(config-if)#

*Mar  1 00:50:00.395: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up

R1(config-if)#

*Mar  1 00:50:00.423: BGP(0): 10.1.13.3 enqueued default-originate update

*Mar  1 00:50:00.427: BGP(0): 10.1.14.4 enqueued default-originate update

R1(config-if)#

*Mar  1 00:50:01.399: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up

R1(config-if)#do u all

All possible debugging has been turned off

R1(config-if)#

 

R4(config-router)#do show ip bgp

BGP table version is 12, local router ID is 4.4.4.4

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 0.0.0.0          10.1.14.1                0             0 100 i

*> 1.1.1.1/32       10.1.14.1                0             0 100 i

*> 2.2.2.2/32       10.1.14.1                              0 100 200 i

*> 3.3.3.3/32       10.1.14.1                              0 100 300 i

*> 4.4.4.4/32       0.0.0.0                  0         32768 i

R4(config-router)#

 

R3(config-router)#do show ip bgp

BGP table version is 12, local router ID is 3.3.3.3

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 0.0.0.0          10.1.13.1                0             0 100 i

*> 1.1.1.1/32       10.1.13.1                0             0 100 i

*> 2.2.2.2/32       10.1.13.1                              0 100 200 i

*> 3.3.3.3/32       0.0.0.0                  0         32768 i

*> 4.4.4.4/32       10.1.13.1                              0 100 400 i

R3(config-router)#

 

Observation:

·         Now, R3 and R4 have default routes back in their routing tables!

No comments:

Post a Comment