redistribute BGP routes in OSPF
Consider two routers A & B. Both of them run eBGP for connecting to ISP and also run OSPF inside the cloud. Both A&B also run iBGP and are connected in an internal iBGP mesh.
How suppose prefix P1 is received at both A & B (eBGP). They run the bgp process as:
router bgp 747
neighbor xxxx route-map ISP-ROUTES-IN
route-map ISP-ROUTES-IN permit 100
match ip address prefix-list ACCEPT-ROUTES-F开发者_开发百科ROM-ISP ip prefix-list ACCEPT-ROUTES-FROM-ISP seq 10 permit xx.xx.xx.xx/29
In both A&B, inside the OSPF process there is a redistribute statement like:
router ospf 1234
redistribute bgp 747 metric-type 1 subnets tag 747
Because of the ospf process 1234, both routers A & B redistribute P1 inside their network as Type5 E1.
However, I would like to make A as the exit point for prefix P1 and B as the backup exit router.
How do I set the metric for redistribution?
Because you're saying metric-type 1
in your redistribute
statement, the OSPF metric for the redistributed routes will be the same as the OSPF metric to the router doing the redistribution. In this case, if you're 'closer' to A, you'd exit via A. If you're 'closer' to B, you'd exit via B.
If you set metric-type 2
, then the OSPF cost to router A and B would not be considered and both routes would appear equivalent everywhere. To force it to prefer A, you can set a different metric on A and B:
On A
router ospf 1234
redistribute bgp 747 metric-type 2 subnets tag 747 metric 10
On B
router ospf 1234
redistribute bgp 747 metric-type 2 subnets tag 747 metric 20
精彩评论