Redistribute in OSPF everything learned from a specific BGP Peer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 12:38 AM - edited 03-05-2019 07:21 AM
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?
- Labels:
-
Routing Protocols
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 12:49 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 01:02 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 02:43 AM
Add this in router config issue will resolved.
ip bgp-community new-format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 02:44 AM
thanks, I will try this evening
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 04:57 AM
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2016 02:00 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 01:49 AM
Hello,
just to be sure, do you have 'ip bgp-community new-format' configured on all routers ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 02:29 AM
no is not configured
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 11:40 AM
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:
However, it might be easier and more predictable to use a match ip next-hop or match ip route-source condition instead.
HTH
Rolf
