If you want to adjust the the path of an ospf router, beyond the route type (which is it's first and foremost criteria), there are a couple ways you can do it.
Link Cost:
Fist way is adjusting the cost of the link from the perspective of the ospf router. Lower cost is preferred, and if there are a couple links with equal cost, then they will be load balanced automatically.
First thing you may want to do is set your reference bandwidth across all ospf routers. A setting of 10,000 (expressed in Mbps - 10,000 Mbps is 10 Gbps) will be equivalent to 10 Gig, so a 10 Gig interface will have a cost of 1, a 1 Gig interface a cost of 10, 100Mbps a cost of 100, and so on.
auto-cost reference-bandwidth 10000
Consider the topology below...currently the route from R7 to the 4.4.4.4 network has the option of 2 paths - both of equal cost - so they will be load balanced by ospf.
But if we want to only use say the link between R7 and and R1, we can do that by changing the link cost.
Current cost is 10 - and the route table for R7 is shown below- 2 equal cost routes to 4.4.4.4. Note that the loopback interface has a cost of 1, as it's a connected interface.....hence the 3 x 10 links + 1 gives you the 31.
Using the ip ospf cost # command under the respective interface will will change it the cost
R7(config-if)#ip ospf cost 9
Now, we get this - a cost of 9
with a single "better" route (cost of 30 vs 31) to 4.4.4.4
This works fine...BUT...it will effect ALL routes advertised, and destined, across that link. May not be what we need.
Administrative Distance (AD):
You can use the distance command to change the Administrative Distance of a specific route (AD)
First define the route you want to change the AD for in an access-list... in this case, it's 4.4.4.4/32
R7(config)#access-list 1 permit host 4.4.4.4
Next determine the advertising router - the router that the route is learned from, in this case it's R3 - we need to use the routers ospf router id - which is 3.3.3.3 as shown below
R7(config-router)#distance 99 3.3.3.3 0.0.0.0 1
This works, BUT, it does nothing to favor one link over another - you still have equal cost over the 2 links to the route
Due to OSPF's link-state nature, it's more preferable to use policy based routing (PBR), and direct the traffic type you want over a certain link.
PBR:
In the topology below, we will set the next hop to for ICMP traffic originating at R8, to use the link between the R1 and R7.
No comments:
Post a Comment