Re: BGP conditional advertise not working.

From: Narbik Kocharians (narbikk@gmail.com)
Date: Tue Feb 17 2009 - 23:43:21 ARST


Mahesh,

Sorry for the long post, but try to lab this up and you will see how it
works:

*Lab Setup:*

X Configure R1 to have two point-to-point frame-relay connections, one
connecting R1 to R2, and the other connecting R1 to R3.

X R2 and R3 should be configured with a single frame-relay
point-to-point connection to R1.

* *

*Ip addressing:*

*R1: AS 100*

Frame-relay connection to R2 = 10.1.12.1 /24

Frame-relay connection to R3 = 10.1.13.1 /24

Lo0 = 1.1.1.1 /8

*R2: AS 200*

Frame-relay connection to R1 = 10.1.12.2 /24

Lo0 = 2.2.2.2 /8

*R3: AS 300*

Frame-relay connection to R1 = 10.1.13.3 /24

Lo0 = 3.3.3.3 /8

*Task 1*

Configure EBGP peer sessions as follows:

X R1 to have an EBGP peer session to R2 and R3

X R2 and R3 to have an EBGP peer session to R1

* *

*On R1*

R1(config)#router bgp 100

R1(config-router)#no auto

R1(config-router)#neighbor 10.1.12.2 remote-as 200

R1(config-router)#neighbor 10.1.13.3 remote-as 300

*On R2*

R2(config)#router bgp 200

R2(config-router)#no au

R2(config-router)#neighbor 10.1.12.1 remote-as 100

*On R3*

R3(config-if)#router bgp 300

R3(config-router)#no au

R3(config-router)#neighbor 10.1.13.1 remote-as 100

*To verify the configuration:*

* *

*On R1*

*R1#Show ip bgp summary*

BGP router identifier 1.1.1.1, local AS number 100

BGP table version is 1, main routing table version 1

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

10.1.12.2 4 200 3 3 1
   0
0 00:00:56 0

10.1.13.3 4 300 4 4 1
   0
0 00:00:20 0

*Task 2*

* *

Configure R1, R2 and R3 to advertise their loopback0 interface in BGP. **

* *

*On R1*

R1(config-router)#router bgp 100

R1(config-router)#network 1.0.0.0

*On R2*

R2(config-router)#router bgp 200

R2(config-router)#network 2.0.0.0

*On R3*

R3(config)#router bgp 300

R3(config-router)#network 3.0.0.0

*To verify the configuration:*

* *

*On R3*

*R3#Show ip bgp*

BGP table version is 4, local router ID is 150.1.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.0.0.0 10.1.13.1 0 0
100 i

*> 2.0.0.0 10.1.13.1
  0 100 200 i

*> 3.0.0.0 0.0.0.0 0 32768
i

*Task 3*

Configure R1 as follows:

If network 2.0.0.0 is up and it's advertised to R1, R1 should take the
following actions:

X R1 should NOT advertise it's network 1.0.0.0 /8 to R3.

X R1 should ONLY advertise network 2.0.0.0 /8 to R3

However, if network 2.0.0.0 /8 is down, then R1 should take the following
actions:

X R1 should advertise network 1.0.0.0 /8 to R3.

X R1 should remove network 2.0.0.0 /8 from it's BGP table.

* *

*Before configuring this task you should verify the current BGP table of
these routers:*

*R1#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.0.0.0 0.0.0.0 0
32768 i

*> 2.0.0.0 10.1.12.2 0
0 200 i

*> 3.0.0.0 10.1.13.3 0
0 300 i

*R2#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.0.0.0 10.1.12.1 0
          0 100 i

*> 2.0.0.0 0.0.0.0 0
32768 i

*> 3.0.0.0 10.1.12.1
                             0 100 300 i

*R3#Show ip bgp*

BGP table version is 7, 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.0.0.0 10.1.13.1 0
0 100 i

*> 2.0.0.0 10.1.13.1
                              0 100 200 i

*> 3.0.0.0 0.0.0.0 0
32768 i

* *

*To conditionally advertise selected routes we can use the following
commands:*

* *

X *Advertise-map*

X *Non-exist-map*

X *Exist-map *

* *

*This situation calls for the use of the "advertise-map" and non-exist-map"
as follows:*

* *

*On R1*

R1(config)#access-list 1 permit 1.0.0.0 0.255.255.255

R1(config)#access-list 2 permit 2.0.0.0 0.255.255.255

R1(config)#route-map *ADV* permit 10

R1(config-route-map)#match ip addr 1

R1(config-route-map)#exit

R1(config)#route-map *NotThere* permit 10

R1(config-route-map)#match ip addr 2

R1(config-route-map)#exit

*To prevent confusion you should select meaningful names for the route-maps.
Note the access-list numbers and the names of the route-map. *

R1(config)#router bgp 100

R1(config-router)#neighbor 10.1.13.3 advertise-map *ADV* non-exist-map *
NotThere*

*The neighbor command has the following route-maps:*

X *The advertise-map  Specifies the name of the route-map that will be
advertised if the condition of the non-exist-map is met.*

* *

X *Non-exist-map  specifies the name of the route-map that will be
compared to the advertise-map. If the condition is met and no match occurs,
the route will be advertised. If a match occurs, then the condition is NOT
met, and the route is withdrawn*.

*Note if network 2.0.0.0 is up, then network 1.0.0.0 should NOT be
advertised to R3, since all the networks are up and advertised, R1 should
withdraw it's network (1.0.0.0 /8):*

*On R1*

*R1#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.0.0.0 0.0.0.0 0
32768 i

*> 2.0.0.0 10.1.12.2 0
0 200 i

*> 3.0.0.0 10.1.13.3 0
0 300 i

*Note the following reveals that R1 does NOT advertise it's network (1.0.0.0
/8) to R3:*

*R1#Show ip bgp neighbors 10.1.13.3 advertised-routes*

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

*> 2.0.0.0 10.1.12.2 0
0 200 i

*Note the output of the following command reveals that the bgp table of R3
does not have network 1.0.0.0 /8:*

*On R3*

*R3#Show ip bgp*

BGP table version is 34, 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

*> 2.0.0.0 10.1.13.1
0 100 200 i

*> 3.0.0.0 0.0.0.0 0
32768 i

*To test the condition:*

*On R2*

R2(config)#int lo0

R2(config-if)#shut

*The output of the following "Show" command reveals that network 2.0.0.0 is
DOWN; therefore, R1 should advertise its network (1.0.0.0 /8) to R3. It may
take few seconds for this policy to get implemented*:

*On R1*

*R1#Show ip bgp neighbors 10.1.13.3 advertised-routes*

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.0.0.0 0.0.0.0 0
32768 i**

*Note network 1.0.0.0 is advertised to R3.*

I hope this helped.

On Tue, Feb 17, 2009 at 4:21 PM, Dale Shaw <dale.shaw@gmail.com> wrote:

> Hi,
>
> On Wed, Feb 18, 2009 at 9:23 AM, Mahesh Shivaswamy
> <maheshs.cisco@gmail.com> wrote:
> > I am not sure why is R2 advertising prefix 136.1.29.0/24 when the
> > route 136.1.23.0/24 exist in the routing table ???
>
> Here are my recent notes on BGP conditional advertisement:
>
> bgp conditional advertisement
>
> - prefixes matched in advertise-map and exist/non-exist map must exist
> (or not) in the *BGP* table
> however: they do not need to be locally originated (e.g. R1 can
> match routes received from R2 and advertise (or not) to R3
> and: the validity of the prefix in the BGP table (i.e. RIB-failure)
> doesn't matter. if there's there, and using exist-map, the condition
> is met.
> - when using 'exist' map, prefixes matched by advertise-map are
> advertised when exist-map condition is met
> example: advertise 1.0.0.0/8 (advertise-map) from BGP table when
> 3.20.20.0/24 (exist-map) exists in BGP table
> - when exist 'non-exist' map, prefixes matched by advertise-map are
> advertised when non-exist-map condition is met
> example: advertise 1.0.0.0/8 (advertise-map) from BGP table when
> 3.20.20.0/24 (non-exist-map) does NOT exist in BGP table
> - prefixes matched in advertise-map are the only prefixes affected --
> other prefixes that may exist are advertised (or not) as normal
> - when dealing with conditional advertisement tasks, always consider
> what will happen normally (without any config)
>
> I think the first point is probably where you are getting tripped up.
>
> cheers,
> Dale
>
>
> Blogs and organic groups at http://www.ccie.net
>
> _______________________________________________________________________
> Subscription information may be found at:
> http://www.groupstudy.com/list/CCIELab.html
>
>
>
>
>
>
>
>

--
Narbik Kocharians
CCSI#30832, CCIE# 12410 (R&S, SP, Security)
www.MicronicsTraining.com
www.Net-Workbooks.com
Sr. Technical Instructor

Blogs and organic groups at http://www.ccie.net



This archive was generated by hypermail 2.1.4 : Sun Mar 01 2009 - 09:44:11 ARST