OSPF traffic manipulation with bandwidth

Task: Make sure traffic to uses the path via R2 by changing the bandwidth


To manipulate traffic flows by configuring bandwidth, we use the exact same logic as when we did it by configuring ospf cost. When we configured “ip ospf cost” on an interface, ospf would use the cost configured on the interface for calculations of that particular link and wouldn’t care about bandwidth or what kind of interface it was before it got configured.

The only difference when using bandwidth is just another step where we need to know how the metric is calculated from the bandwidth.

To calculate the cost there is a quite simple formula, worth remembering:

For those of you who cant read my handwriting:

OSPF Metric = ref. bw/bw
Default Reference bandwidth = 100mbps

Reference bandwidth, whats that?

Reference bw is just what it sounds like, look closer to the formula and its really self explaining. Its just a reference value for how fast a link is in relation to the reference bandwidth. As you all understand now, ospf was founded way before we were spreading 10-gig links around us. A 1Gig-link were considered superfast and without changing the reference bandwidth, all links faster than 100mbps will be calculated to 1 or less, and <1 is rounded up to 1.

In the given topology above, all links are 1Gig. Rounded to OSPF cost 1. That could be annoying.. ?

Verify and change current OSPF reference bandwidth

To check current ref. bw used by OSPF, look at “show ip ospf” output, there might be a lot of handy information there.

Pro tip: “sh ip os | i Ref”

To change it, its just to configure a new one under the ospf process:

The syntax wants us the give a number of mbits per second, lets raise it a notch?

And then we verify, again with show ip ospf and piping out what we need. We dont want to waste time on reading stuff we don’t care about at the moment.

We dont have to configure the same reference bandwidth for the whole domain, neighborships will come be established anyway and ospf will route traffic – yet were not stupid. Discontigous reference bandwidth would cause routers to classify links differently and that might cause really annoying behaviours and report metrics that is not really true for the next router. Don’t go there, use the same reference bw on all routers.

Manipulate Cost with Bandwidth command

Now with some background, would it be very hard to figure out how to manipulate the path with bandwidth? no.
Just as when we configured the metric statically with ospf cost command, we want to figure out which cost we want for a specific link. Then we calculate backwards from the formula and use the bandwidth command instead.

Lets go back to the first topology, we want the path via R2 to be preferred. All we have to do is to make the cost via R3 higher, or the cost via R2 lower. Depending on what restrictions the task gives you, you might have to do it differently.

We can either make the cost via R3 higher by adding a bandwidth that is low enough for the calculation to bring you a metric higher than one.
OSPF Metric = Ref. bw / bw
OSPF Metric = 100mbits / 10mbits = 10 – (We need to use bandwidth 10mbits or lower in order to differentiate the path from the other)

Or we can make the path via R2 more preferred by lowering the cost, but to do that we need to configure a higher reference bandwidth first. Then apply the same logic.

Leave a Reply

Your email address will not be published. Required fields are marked *