cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1832
Views
0
Helpful
9
Replies

Redistribute in OSPF everything learned from a specific BGP Peer

gianluca811
Level 1
Level 1

Hi,

R1 <--BGP----> R2 <---OSPF----> R3

R2 receive routes from R1 trough  BGP. I have to redistribute the same routes to R3 in OSPF. For other reasons the OSPF route must have metric 10000.

I thought to accomplish that with community:

R2

route-map SET-COMMUNITY permit 10
 set community 65001:10000

router bgp 65000
  neighbor IP_R1 remote-as 65001
  neighbor IP_R1 route-map SET-COMMUNITY in

 
route-map FROM_BGP_TO_OSPF permit 10
 match community 65001:10000
 
router ospf 100
   redistribute bgp 65000 metric 10000 subnets route-map FROM_BGP_TO_OSPF

but doesn't work. In R2 is see the 10.100.100.0/24 come in EBGP from R1 but I don't see the route in ospf database, obviusly R3 doeasn't see the route as well.

any advice?

9 Replies 9

Pawan Raut
Level 4
Level 4

Can you provide the output for sh ip bgp 10.100.100.0/24 on R2 I want to see if the community string applied on route or not

look so, the community 4290651920 is what I have in configuration

R1#sh ip bgp 10.100.100.0


  Advertised to update-groups:
     13        
  65001 65002 65003
    R1_IP from R1_IP (customer_IP)
      Origin incomplete, localpref 100, weight 65000, valid, external, best
      Community: 4290651920
  65001 65002 65003, (received-only)
    R1_IP from R1_IP  (customer_IP)
      Origin incomplete, localpref 100, valid, external

Add this in router config issue will resolved.

ip bgp-community new-format

thanks, I will try this evening

If anyone cares to know how the conversion works:

In the output Pawan requested, the community value is 4290651920. This is converted to binary:

4290651920 = 11111111101111100010011100010000

You take the last 2 bytes (the last 16 numbers of that binary number) and convert it back to decimal:

0010011100010000 = 10000

This number is preceded by the decimal conversion of the first two bytes:

1111111110111110 = 65470

So, the community in new format should be: 65470:10000, which is not what you configured. Either I got it wrong, or another AS (65470)  is sending these community values ?

added the command ip bgp-community new-format but doesn't work as well

As said from Rolf maybe the match community is not supported in redistribustion.

I performed a test with next-hop, and on my virtual lab it's working, I will put this evening the configuration on my network and let's see.

Any further advice is welcome!

this is the script

access-list 10 remark my bgp next hop
access-list 10 permit  BGP-R1_IP_NEIG
route-map FROM_BGP_TO_OSPF permit 10
   match ip next-hop 10
router ospf 100
   redistribute bgp 65000 metric 10000 subnets route-map FROM_BGP_TO_OSPF

Hello,

just to be sure, do you have 'ip bgp-community new-format' configured on all routers ?

no is not configured

Rolf Fischer
Level 9
Level 9

Hi,

route-map FROM_BGP_TO_OSPF permit 10
 match community 65001:10000

The match community command requires a community-list:

(config-route-map)#match community ?
  <1-99>     Community-list number (standard)
  <100-500>  Community-list number (expanded)
  WORD       Community-list name

You could try something like this:

ip community-list 1 permit 65001:10000
!
route-map FROM_BGP_TO_OSPF permit 10
 match community 1

I'm not sure if the match community condition is supported for routing protocol redistribution:

http://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/49111-route-map-bestp.html#tables

However, it might be easier and more predictable to use a match ip next-hop or match ip route-source condition instead.

HTH
Rolf

Review Cisco Networking for a $25 gift card