10-17-2018 10:30 PM - edited 10-17-2018 10:37 PM
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!)
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
Solved! Go to Solution.
10-18-2018 03:50 AM - edited 10-18-2018 03:51 AM
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.
10-18-2018 03:50 AM - edited 10-18-2018 03:51 AM
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.
10-18-2018 06:12 PM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide