Sunday, January 22, 2012

BGP NLRI ADVERTISEMENTS (NETWORK STATEMENT & REDISTRIBUTE)

BGP NLRI (NETWORK LAYER REACHABILITY INFORMATION) ADVERTISEMENTS
-----------------------------------------------------------------
BGP NLRI can be originated by
  - network statements
      - require an exact match in the routing table
  - redistribute statement
      - fairly standard redistribution one of things to watch out for by default it  
        will not redistribute ospf external you need to manually tell it to        
redistribute ospf external routes
  - agregate-address statement
      -requires at least one subnet in the BGP table first
  - BGP Inject MAP statement
      - opposite of Aggregation
BGP Network Statement
----------------------
- Originates prefixes with origin of IGP (i)
- Requires exact match in the routing table
   - does not have to be connected prefix can be learned via IGP
-without adding the mask keyword it will asssume a classfull mask
sh ip bgp regexpr ^$  - shows you network generate in local AS can be useful for
verifying network statement

When you do a network statement you may see different metric values in  metric/med
field. This is basically because it will bring in the IGP originated route
metric/cost into BGP for connected routes the metric is zero. THe med value is non
transitive value when you send this to other AS it will not be carried in the update.
BGP Redistribute Statement
---------------------------
Origin prefixes with origin code of incomplete (?)
Originates classfull summary if auto summary is enabled
AUtomatically carries the IHP metric to the med field of the BGP update
It will not redistribute ospf external by default
redistribute ospf "pid" match internal external
TO be redistributed as normal the route has to be in the routing table
NO seed metric is required as IGP metric is inherited
You can filter redistribution
for example
ip prefix-list EIGRP-TO-BGP permit 10.10.10.0/24
router-map EIGRP-TO-BGP
match ip address prefix-list EIGRP-TO-BGP
router bgp 100
redistribute eigrp 4 route-map EIGRP-TO-BGP

sh ip bgp | in /? - will give a list in the bgp table of incomplete routes

LAB
----
For the LAB we have multiple AS i will start by putting a  few routes into the bgp
process




I will use the network statement to inject the routes for AS 100 loopback so r6,r4,r1
we will do this on r1

r1(config)#router bgp 100
r1(config-router)#network 6.6.6.6 mask 255.255.255.0
% BGP: Incorrect network or mask configured
r1(config-router)#network 6.6.6.6 mask 255.255.255.255
r1(config-router)#network 4.4.4.4 mask 255.255.255.255
r1(config-router)#network 1.1.1.1 mask 255.255.255.255
r1(config-router)#

I tried to inject 6.6.6.6 it with a incorrect mask and it threw up an error


r1#sh ip bgp
BGP table version is 8, 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
*> 4.4.4.4/32       155.0.146.4         156160         32768 i
*> 6.6.6.6/32       155.0.146.6         156160         32768 i

if we look at r1 sh ip bgp
we have all the routes in the bgp table notice the metric is different
for the connected route 1.1.1.1 it defaults to metric/med defaults to 0.0.0.0 also
the next hop is local 0.0.0.0
for the non-connected  recieved from other hosts we are learning the routes via eigrp
we inherit the metric from eigrp of 156160 we do see the relevant next hops

if we notice on r3 we are recieving the routes

r3#sh ip bgp
BGP table version is 62, 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       1.1.1.1                  0             0 100 i
*> 4.4.4.4/32       1.1.1.1             156160             0 100 i
*> 6.6.6.6/32       1.1.1.1             156160             0 100 i

on r2
------

r2#sh ip bgp
BGP table version is 25, local router ID is 12.12.12.12
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       5.5.5.5                                0 400 300 100 i
*> 4.4.4.4/32       5.5.5.5                                0 400 300 100 i
*> 6.6.6.6/32       5.5.5.5                                0 400 300 100 i
r2#

the metric is gone it is non transitive parameter so we do not recieve
notice at the end we have i this is the origin code of igp which is preference to a
redistribute route

if we had received other routes from other AS this command would filter down to the
local
r1#sh ip bgp regexp ^$
BGP table version is 8, 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
*> 4.4.4.4/32       155.0.146.4         156160         32768 i
*> 6.6.6.6/32       155.0.146.6         156160         32768 i

BGP Redistribution
-------------------

we will try redistributing routes from r4

s4(config)#router bgp 400
s4(config-router)#redistribute eigrp 1
s4(config-router)#exit
s4(config)#exit

notice we do not need specify a metric as it will inherit a metric

s4#sh ip bg
01:53:53: %SYS-5-CONFIG_I: Configured from console by consolep
BGP table version is 111, local router ID is 2.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       155.0.108.2        2300672         32768 ?
*> 2.1.1.1/32       155.0.108.2        2305792         32768 ?
*> 2.2.2.2/32       155.0.108.2        2300672         32768 ?
*> 2.3.3.0/24       155.0.108.2        2306048         32768 ?
*> 2.4.4.4/32       0.0.0.0                  0         32768 ?
*> 3.3.3.3/32       155.0.108.2        2300672         32768 ?
*> 4.4.4.4/32       155.0.108.2        2300672         32768 ?
*> 5.5.5.5/32       155.0.108.2         143616         32768 ?
*> 6.6.6.6/32       155.0.108.2        2303232         32768 ?
*> 12.12.12.12/32   155.0.108.2        2300672         32768 ?
*> 22.2.2.0/24      155.0.108.2         143360         32768 ?
*> 155.0.0.0/24     155.0.108.2        2172672         32768 ?
*> 155.0.13.0/24    155.0.108.2        2684672         32768 ?
*> 155.0.23.0/24    155.0.108.2        2684672         32768 ?
*> 155.0.45.0/24    155.0.108.2        2172672         32768 ?
*> 155.0.58.0/24    155.0.108.2          15616         32768 ?
*> 155.0.67.0/24    155.0.108.2        2177792         32768 ?
   Network          Next Hop            Metric LocPrf Weight Path
*> 155.0.79.0/24    155.0.108.2        2178048         32768 ?
*> 155.0.108.0/24   0.0.0.0                  0         32768 ?
*> 155.0.146.0/24   155.0.108.2        2175232         32768 ?
s4#

notice the origin code is ? which stands for incomplete this is redistributed routes
notice all the different metrics that have been inherented from the IGP

we could filter this down so we do not advertise all the routes say all we want to
advertises is 155.0.79.0/24

we firstly create a prefix-list to match the route

s4(config)#ip prefix-list INTOBGP permit 155.0.79.0/24
and then a route-map

s4(config)#route-map EIGRPTOBGP permit 10
s4(config-route-map)#match ip address prefix-list INTOBGP


s4(config)#router bgp 400
s4(config-router)#no redistribute eigrp 1
s4(config-router)#redistribute eigrp 1 route-map EIGRPTOBGP
s4(config-router)#

s4#sh ip bgp
BGP table version is 141, local router ID is 2.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
*>i1.1.1.1/32       1.1.1.1                  0    100      0 100 i
*>i4.4.4.4/32       1.1.1.1             156160    100      0 100 i
*>i6.6.6.6/32       1.1.1.1             156160    100      0 100 i
*> 155.0.79.0/24    155.0.108.2        2178048         32768 ?
s4#

we are recieving the routes from r1 but otherwise we are only advertising
155.0.79.0/24

s4#sh ip bgp neighbors 5.5.5.5 advertised-routes
BGP table version is 144, local router ID is 2.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
*> 155.0.79.0/24    155.0.108.2        2178048         32768 ?
Total number of prefixes 1
s4#











   

No comments:

Post a Comment