2013年7月16日星期二

why external ospf routes not redistributed into BGP

Question:

we have here R1, R2 Cisco 3560 Price and R3 that are in ospf 1 area 0.
we have ebgp session from R1 to BGP1 and R2 to BGP2.
we have default route in R1 and R2 pointing to FW (172.17.1.4) that are propagated with default-info originate in OSPF and BGP too.
behind the firewall there is a subnet 10.166.245.0/24 and there is a static route: 10.166.245.0 255.255.255.0 172.17.1.4 tag 1000

typically the config from R1 or R2 is:

!
router ospf 1
log-adjacency-changes
redistribute connected subnets route-map CONNECTED-2-OSPF
redistribute static subnets route-map STATIC-2-OSPF
redistribute bgp 65000 subnets route-map BGP-2-OSPF
passive-interface default
no passive-interface FastEthernet0/0
network 2.2.2.0 0.0.0.255 area 0
!
router bgp 65000
no synchronization
bgp log-neighbor-changes
network 0.0.0.0
redistribute ospf 1  route-map OSPF-2-BGP
neighbor 2.2.2.2 remote-as 65000
neighbor 2.2.2.2 soft-reconfiguration inbound
neighbor 10.10.10.1 remote-as 7000
neighbor 10.10.10.1 soft-reconfiguration inbound
default-information originate
no auto-summary
!
ip route 0.0.0.0 0.0.0.0 172.17.1.4
ip route 10.166.245.0 255.255.255.0 172.17.1.4 tag 1000

!
!
route-map STATIC-2-OSPF permit 10
match tag 1000
!
route-map CONNECTED-2-OSPF permit 10
match interface Vlan4
!
route-map BGP-2-OSPF permit 10
set tag 50
!
route-map OSPF-2-BGP deny 10
match tag 50
!
route-map OSPF-2-BGP permit 20
match route-type internal external
!
!
!

everybody knows that by default only internal ospf routes are redistributed into bgp, but here i wanted to redistribute the external ones too with route-map.
but no success. in the bgp table of R1 and R2, there is 10.166.245.0/24 route !!!

i have a doubt: does only the ospf routes that are in the routing table who can be redistributed OR the routes in the OSPF database?

how can i redistribute this static "10.166.245.0 255.255.255.0 172.17.1.4 tag 1000" into OSPF and then automatically to BGP ?



The deal is:
no redistribution of static routes directly to BGP
no "network 10.166.245.0 mask 255.255.255.0" command under bgp.
not change the admin distance of static routes greater thant 110.

Answer:

generally, you would need
router bgp 65000
redistribute ospf 1  match internal external 1 external 2 route-map OSPF-2-BGP
command used to redistribute both internal and external OSPF routes to BGP.

See http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800943c5.shtml#redistributionofospfinternalandexternalroutesintobgp
for details.

But as you describe, in your case the prefix is configured as a static one on your router.
So no matter if redistributed to OSPF or not, it is still treated as static by your router.
If you want to redistribute it to BGP, you need to redistribute static routes (with a route-map permitting only this single prefix, if necessary).

I think there is a  good reason for this IOS behavior - otherwise routing and redistribution loops could Cisco Catalyst 3560 be created easily.

没有评论:

发表评论