Saturday 1 February 2020

BGP NLRI Advertisements


Here we are going to learn and understand about the Network Statement.

R1#sh ip route ospf
     150.2.0.0/32 is subnetted, 1 subnets
O       150.2.2.2 [110/2] via 155.1.123.2, 01:08:54, FastEthernet2/0
     150.3.0.0/32 is subnetted, 1 subnets
O       150.3.3.3 [110/2] via 155.1.123.3, 01:08:54, FastEthernet2/0

R1#sh ip route connected
     155.1.0.0/24 is subnetted, 2 subnets
C       155.1.16.0 is directly connected, Serial1/0
C       155.1.123.0 is directly connected, FastEthernet2/0
     150.1.0.0/24 is subnetted, 1 subnets
C       150.1.1.0 is directly connected, Loopback0

Here am going to publish this 150.1.1.0/24, 150.2.2.0/24 and 150.3.3.0/24 network in  BGP. So lets do it.

R1#sh ip bgp regexp ^$
BGP table version is 19, local router ID is 150.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
*> 150.1.1.0/24     0.0.0.0                  0         32768 i

Amazed only 150.1.1.0/24 network is advertising to others peers but not the other network but why??
Because the bgp network statement mask should match the network in the routing table.
Lets have a look on network statement under the bgp section.
R1#sh run | s router bgp
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 network 150.1.1.0 mask 255.255.255.0
 network 150.2.2.0 mask 255.255.255.0
 network 150.3.3.0 mask 255.255.255.0
 neighbor iBGP_Peer peer-group
 neighbor iBGP_Peer remote-as 100
 neighbor iBGP_Peer update-source Loopback0
 neighbor 150.2.2.2 peer-group iBGP_Peer
 neighbor 150.3.3.3 peer-group iBGP_Peer
 neighbor 155.1.16.6 remote-as 600
 no auto-summary

And now cross check with our routing table. You will now understand 150.1.1.0/24 is listed but 150.2.2.2/32 and 150.3.3.3/32 network is listed
To overcome this we can do two different things. Whether change the network statement or publish the correct network statement into the ospf domain.

Here am going to change the ip ospf network.
R2(config)#int lo 0
R2(config-if)#ip ospf network point-to-point

R3(config)#int lo 0
R3(config-if)#ip ospf network point-to-point

Now lets look into BGP routing table.
R1#sh ip bgp regexp ^$
BGP table version is 24, local router ID is 150.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
*> 150.1.1.0/24          0.0.0.0                  0            32768 i
*> 150.2.2.0/24     155.1.123.2              2            32768 i
*> 150.3.3.0/24     155.1.123.3              2            32768 I

See we got all the network which we published in BGP. But if u take a deep look in the above network  you are getting metric value as non zero.
But how bgp got metric value as we knew we didn't configure any metric.
The answer is we got the metric from the IGP.

R1#sh ip route 150.2.2.2
Routing entry for 150.2.2.0/24
  Known via "ospf 1", distance 110, metric 2, type intra area
  Advertised by bgp 100
  Last update from 155.1.123.2 on FastEthernet2/0, 00:15:35 ago
  Routing Descriptor Blocks:
  * 155.1.123.2, from 150.2.2.2, 00:15:35 ago, via FastEthernet2/0
      Route metric is 2, traffic share count is 1

R1#sh ip route 150.3.3.3
Routing entry for 150.3.3.0/24
  Known via "ospf 1", distance 110, metric 2, type intra area
  Advertised by bgp 100
  Last update from 155.1.123.3 on FastEthernet2/0, 00:15:48 ago
  Routing Descriptor Blocks:
  * 155.1.123.3, from 150.3.3.3, 00:15:48 ago, via FastEthernet2/0
      Route metric is 2, traffic share count is 1

The metric(MED) field is copied with the IGP metric value.

Redistribute Statement
Now we are going to redistribute the eigrp route into bgp network o R4.

R4(config)#router bgp 400
R4(config-router)#redistribute eigrp 1

R4(config-router)#do sh ip bgp regex ^$
BGP table version is 48, local router ID is 150.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
*> 4.1.0.0/24       0.0.0.0                  0         32768 i
*> 4.2.0.0/24       0.0.0.0                  0         32768 i
*> 4.3.0.0/24       0.0.0.0                  0         32768 i
*> 44.4.4.0/24      0.0.0.0                  0         32768 ?
*> 44.5.4.0/24      0.0.0.0                  0         32768 ?
*> 44.6.4.0/24      0.0.0.0                  0         32768 ?
*> 150.4.4.0/24     0.0.0.0                  0         32768 ?
*> 150.5.5.0/24     155.1.45.5         2297856         32768 ?
*> 155.1.45.0/24    0.0.0.0                  0         32768 ?

See if we just redistribute the eigrp it will redistribute all the prefixes learned via eigrp and plus the eigrp enabled interface. To over come this am going to create route map and going to advertise only the 44.x.x.x/24 network.

R4(config)#ip prefix-list 44 permit 44.4.4.0/24
R4(config)#ip prefix-list 44 permit 44.5.4.0/24
R4(config)#ip prefix-list 44 permit 44.6.4.0/24

R4(config)#route-map 44_network
R4(config-route-map)#match ip address prefix-list 44

R4(config)#router bgp 400
R4(config-router)#redistribute eigrp 1 route-map 44_network

Now lets check the router R4 what all route they are generating.
R4#sh ip bgp regexp ^$
BGP table version is 33, local router ID is 150.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
*> 4.1.0.0/24       0.0.0.0                  0         32768 i
*> 4.2.0.0/24       0.0.0.0                  0         32768 i
*> 4.3.0.0/24       0.0.0.0                  0         32768 i
*> 44.4.4.0/24      0.0.0.0                  0         32768 ?
*> 44.5.4.0/24      0.0.0.0                  0         32768 ?
*> 44.6.4.0/24      0.0.0.0                  0         32768 ?

R4#sh ip bgp | in \?
Origin codes: i - IGP, e - EGP, ? - incomplete
*> 44.4.4.0/24      0.0.0.0                  0         32768 ?
*> 44.5.4.0/24      0.0.0.0                  0         32768 ?
*> 44.6.4.0/24      0.0.0.0                  0         32768 ?


? Symbol denotes that the network is redistributed into bgp.

No comments:

Post a Comment