cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3486
Views
10
Helpful
2
Replies

2-way mutual redistribution - OSPF and BGP

Babak KHorshid
Level 1
Level 1

Hello All, 

I am practising a scenario and I got really frustrated. I am wondering if some one can put me in the right direction  

 

Its a simple OSPF- BGP route filtering (and I'm stuck!) AND a simple MED config on R4 (Which doesn't work!)

bgp.jpg

Lets start with filtering to avoid confusion. I can deal with the MED issue later. 

 

What I am doing is to tag any route from BGP into OSPF. (On router 2 tag with 2222 and on router 3 tag with 3333. )

 

The route-map OSPF2BGP should stop these routes to leak back into BGP and only allow network 1.1.1.1 to redistribute from OSPF into BGP. 


route-map OSPF2BGP deny 5
match tag 3333 2222
route-map OSPF2BGP permit 10
match ip address 10

access-list 10 permit 1.1.1.0 0.0.0.255

 

BUT I do not have the ability to do the same thing while tagging OSPF into BGP. for example if I issue the following:

 

R2(config-route-map)#route-map OSPF2BGP permi 10
R2(config-route-map)#set tag 1111 (So further I could reject this tag on BGP )

 

R2(config-route-map)#router bgp 200
R2(config-router)#redistribute ospf 1 route-map 
I'll get this error

" % "OSPF2BGP" used as redistribute ospf into bgp route-map, set tag not supported " 

 

Then if dont tagg OPSF, I'll end up having the following issue:

#Show ip bgp
* i 1.1.1.1/32 10.1.3.1 2 100 0 ?
*> 10.1.2.1 2 32768 ?
* i 4.4.4.0/24 10.3.4.4 0 100 0 500 ?

R2 has no idea about directly attached 4.4.4.4

 

R2#sho ip route 4.4.4.0
Routing entry for 4.4.4.0/24
Known via "ospf 1", distance 110, metric 1
Tag 3333, type extern 2, forward metric 2
Redistributing via bgp 200
Last update from 10.1.2.1 on FastEthernet1/0, 00:02:46 ago
Routing Descriptor Blocks:
* 10.1.2.1, from 10.3.4.3, 00:02:46 ago, via FastEthernet1/0
Route metric is 1, traffic share count is 1
Route tag 3333
R2#

 

Its leaking from OPSF and the router is picking that up. If i use the Community option the same error would pop up. 

 

Can some one please tell me what am I doing wrong? 

 

The following is the BGP config on devices

R2

router ospf 1
redistribute bgp 200 subnets tag 2222
!
router bgp 200
bgp log-neighbor-changes
redistribute ospf 1 route-map OSPF2BGP
neighbor 10.1.3.3 remote-as 200
neighbor 10.1.3.3 ebgp-multihop 4
neighbor 10.1.3.3 update-source FastEthernet1/0
neighbor 10.2.4.4 remote-as 500
neighbor 10.2.4.4 ebgp-multihop 2
neighbor 10.2.4.4 update-source FastEthernet0/0
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
access-list 10 permit 1.1.1.0 0.0.0.255
!
route-map OSPF2BGP deny 5
match tag 3333 2222
!
route-map OSPF2BGP permit 10
match ip address 10

 

 

 

 

 

 

R3

R3#sho run | b router ospf
router ospf 1
redistribute bgp 200 subnets tag 3333
!
router bgp 200
bgp log-neighbor-changes
redistribute ospf 1 route-map OSPF2BGP
neighbor 10.1.2.2 remote-as 200
neighbor 10.1.2.2 ebgp-multihop 4
neighbor 10.1.2.2 update-source FastEthernet0/0
neighbor 10.3.4.4 remote-as 500
neighbor 10.3.4.4 ebgp-multihop 2
neighbor 10.3.4.4 update-source FastEthernet1/0
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
access-list 10 permit 1.1.1.0 0.0.0.255
!
route-map OSPF2BGP deny 5
match tag 3333 2222
!
route-map OSPF2BGP permit 10
match ip address 10
!

 

 

R4:

router bgp 500
bgp log-neighbor-changes
redistribute connected route-map connected
neighbor 10.2.4.2 remote-as 200
neighbor 10.2.4.2 ebgp-multihop 2
neighbor 10.2.4.2 update-source FastEthernet0/0
neighbor 10.2.4.2 route-map ME out
neighbor 10.3.4.3 remote-as 200
neighbor 10.3.4.3 ebgp-multihop 2
neighbor 10.3.4.3 update-source FastEthernet1/0
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
access-list 10 permit 4.4.4.0 0.0.0.255
access-list 20 permit 1.1.1.1
!
route-map ME permit 10
match ip address 20
set metric 100
!
route-map connected permit 10
match ip address 10

 

 

 

1 Accepted Solution

Accepted Solutions

Hello

By default when bgp is redistributed into ospf the ASN of the bgp will be the route-tag in ospf however when ospf is redistributed into bgp those tags and the origin of those routes will be lost.

sh ip ospf data topol  | in Tag

 

So when you advertise ospf into bgp,  If you add in your route- map to set as-path tag then the tag and origin will be retained and as such you should be able filter on it.

 

 

 

 

 


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

View solution in original post

2 Replies 2

Hello

By default when bgp is redistributed into ospf the ASN of the bgp will be the route-tag in ospf however when ospf is redistributed into bgp those tags and the origin of those routes will be lost.

sh ip ospf data topol  | in Tag

 

So when you advertise ospf into bgp,  If you add in your route- map to set as-path tag then the tag and origin will be retained and as such you should be able filter on it.

 

 

 

 

 


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Thanks Paul for your respond.

So my understanding is when I am advertising from OSPF to BGP, I should have a route-map with set as-path tag.
Then to stop thos route from leaking back to OSPF I can filter them on BGP.

I am going to try that and let you know how did it go.

appreciate your time
Regards
Babak
Review Cisco Networking for a $25 gift card