7. Bandwidth vs Clock Rate and Speed
In the next lecture you’ll learn about how the OSPF cost metric works and how it’s based on interface bandwidth by default. But before we get there, I want to explain how the bandwidth command works and what it does and how it relates to the speed and the clock rate commands because this is a common source of confusion. Okay, so starting with the speed command first the rate that ethernet interfaces physically transmit at is set by the speed command gigabit ethernet interfaces transmit at 1000 megabits per second by default. A thousand megabits per second is one gigabit per second and fast ethernet interfaces transmit at 100 megabits per second by default.
For example, if you use the speed ten command on a fast ethernet interface and it supports it, it will physically transmit at ten megabits per second instead. So if you do that, you need to make sure that you manually set the speed on both sides of the link or you’re going to have problems. But when you do that it changes the actual physical speed of the interface from 100 megabits per second to ten megabits per second. So any for interfaces it’s speed command that you can use to change the default physical speed of the interface. Next command we have is the clock rate command and this works on serial interfaces. Serial interfaces used to be used very commonly on Wan links, not so much nowadays, but you do still find them the rate that serial interfaces physically transmit that is set by the clock great command. Serial interfaces transmit at 1.
54 megabits per second by default. That is the speed of a T one interface that used to be commonly used in the United States Cisco and a US company. So that’s why that is the default. If you use the clock rate 64,000 command on a serial interface it will physically transmit at 64 Kbps. So a serial interface transmits at 1. 5 megabits per second by default. You can change that by using the clock rate command to set a transmit rate in kilobits per second and again this will change the physical speed of the interface and again it has to match on both sides of the link. Okay, so that was the speed and the clock great commands which do change the physical transmission rate of interfaces. Next up we have got the bandwidth command which does not. So interfaces also have a default bandwidth, for example, 100 megabits per second on fast definite interfaces, 1. 54 megabits per second on a studio interface and you see that defaults to what the speed and the clock rate defaulted to as well. And the bandwidth does usually match physical transmission rate of the interface it will do by default and normally as the administrator we want to leave it at that as well. We want it to have it set to that. The bandwidth setting on an interface does not affect the physical transmission rate that is set by the speed or the clock rate. So if you set a bandwidth of 50 megabits per second on a fast Ethernet interface, it will still transmit at 100 megabits per second.
Okay, so if the bandwidth setting does not affect the actual physical speed of an interface, what does it do then? Well, it affects software policy on the router, such as which path will be selected by our routing protocols, EIGRP or OSP, or how much bandwidth will be guaranteed to a traffic type by QoS. For example, if you’ve configured a QoS policy which is going to guarantee your video traffic, a third of the bandwidth on an interface, the way that you tell it or how much bandwidth is actually there is with the bandwidth command.
So you can influence software policy by setting the bandwidth on an interface. Now like I said, you normally want the bandwidth to actually match the physical interface. On an Ethernet interface, it’s going to do that by default anyway. On a serial interface it’s going to default to 1. 5 megabits per second always. So if it’s actually a 64K or 128K interface, then you’re definitely going to want to set the bandwidth command on that interface to make sure that the bandwidth which affects the software policy is also matching the actual physical bandwidth on the interface. Now you don’t have to have the matching. Sometimes you want to override what would happen by default. So you don’t do this very commonly. But it is possible to set the bandwidth to be different than the actual bandwidth on the physical interface if you want to influence software policy. Okay, so that is how the speed, the clock rate and the bandwidth commands work. See you in the next lecture where we’ll get into the OSPF cost metric.
8. OSPF Cost Metric
This lecture you’ll learn about the OSPF metric, which is the cost. As OSPF is a link state routing protocol, the router will learn about all the destinations in its area, the links to get there, and their cost. The router will select routes based on the lowest cost to get to the destination and that’s the route that will make it into the routing table. So having a look at an example of an OSPF metric calculation, r two over on the left has got two possible paths it could take to get to the 10 100:24 network behind R one. It could either go over the single link directly to R one, or it could go via R three. If it goes over directly the link to R one, the cost there would be 50 the cost to R one plus ten the cost of the link itself.
So that cost would be 60. To go along the bottom path via R three, the cost would be ten plus ten plus ten, so the cost there would be 30. So the bottom path has got a lower cost. Even though it’s a longer hop count, it’s a lower cost because it’s better quality. Links are going to have higher bandwidth, so it’s going to prefer to take the lower path. Next thing to talk about is the reference bandwidth. The cost for OSPF is automatically derived from the interface bandwidth, so a higher bandwidth interface will be automatically preferred.
The way that the cost is calculated is it’s the reference bandwidth divided by the actual interface bandwidth and the default reference bandwidth is 100 megabits per second. So what this means is if you’ve got a fast ethernet link that would default to a cost of one because fast Ethernet, the default bandwidth on there is 100. For 100 megabits per second, we divide 100 by 100. That gives us a cost of one on a CDO interface like a T one. In our example here, the bandwidth there is 1. 54 megabits per second. So that will default to a cost of 64 because 100 divided by 1. 54 is 64. So you can see that the higher bandwidth interface is going to be automatically preferred.
But there’s a problem here because OSPF will treat all interfaces of 100 megabits per second or faster as equal, the best possible cost is one we don’t have like a 0. 1 cost. So fast Ethernet, gigabit Ethernet and ten gigabit Ethernet, et cetera. 40 gigabit Ethernet, 100 gigabit Ethernet, they will all default to a cost of one. And this can cause undesirable routing in modern networks with modern high speed ethernet interfaces. You see the example in the diagram here. The link directly between R One and R two on the top path is fast Ethernet. So with the default reference bandwidth of 100 it gets a cost of one.
But on the bottom path going via R three they’re gigabit ethernet interfaces. So they’re faster, they’ve got higher bandwidth, but because we’ve got the default reference bandwidth of 100, they get a cost of one each as well. So the top half will have a default cost of two, which is the cost from r two to r one, plus the cost of the link itself. And then along the bottom path it’s going to have a cost of three. So the bottom path is not going to be preferred. The router is going to use the top path, which is fast ethernet, even though it’s slower than the bottom path, which is gigabit ethernet. So really we would prefer the traffic to go along the bottom path.
So the way that we can force this is by changing the reference bandwidth. The reason that the default reference bandwidth is 100, by the way, is that OSPF has been around for a long time. And when OSPF first came out, we were back on ethernet networks like old style classical ethernet of ten megabits per second. And at the time network engineers thought, well, maybe sometime in the future we’ll have 100 megabits per second. Well that’s way off, we’ll never get faster than that. Obviously, times have moved on and we do have much faster ethernet interfaces than fast ethernet, 100 megabits per second.
Now we’ve got gigabit ethernet, we’ve got ten gigabit ethernet, and we’ve even got 40 gigabit and 100 gigabit ethernet now, but using the old default reference bandwidth, they’ll all be treated the same equal cost by OSPF. So we want to set the reference bandwidth to a higher value. The way you do that is a global config router OSPF, and then under there the command is all cost reference bandwidth and what you want to set the reference bandwidth to. So if you set it to 1000, for example, that would mean that gigabit ethernet interfaces at a cost of one fast ethernet would get a cost of ten.
But you want to think a bit further ahead in the future if on your current production network your fastest interfaces right now are gigabit ethernet, don’t set a reference bandwidth of 1000 because maybe in a year or two’s time you’re going to have ten gigabit, 40 gigabit ethernet and 100 gigabit ethernet. So set it to a high value that you’re not going to have to change it again in future when you set the reference bandwidth, you need to do it the same on all routers. So they’re all using a consistent metric. So the example here, I’ve said autocross reference band with 100,000, which is 100 gigabit ethernet. So now for our example, the fast ethernet interface along the top half will get a cost of 1000, the gigabit ethernet interfaces along the bottom path get a cost of 100.
So it will now prefer the bottom path because we changed the reference bandwidth. So in real world networks, typically all you’ll have to do is just change reference bandwidth and then OSPF is going to automatically select the highest bandwidth paths, which is what you would normally prefer. However, you might want to manipulate this. For example, say you’ve got a high latency satellite link, which is higher bandwidth, but you want to prefer a lower bandwidth interface. You can do that by manipulating the OSPF metric.
Another reason would be just if you want to spread the load of your traffic across different paths on your network. So OSPF takes the bandwidth of an interface into account when calculating the metric, so paths along higher bandwidth links will be preferred. The most desirable path will typically be automatically selected. Like I just said, if you want to use a different path, you can manipulate that by manually changing the bandwidth or the OSPF cost. On interfaces it’s recommended to use cost because the bandwidth setting can affect many features other than OSPF, such as QoS. With OSPF we manipulate the cost rather than the bandwidth, but both would have the same effect. So if we are going to manipulate the bandwidth, you see in the example here on R one, I’ve said Show Interface Serial 10 and I can see there that the bandwidth is one five, four, 4 Kbps, which is the default bandwidth on a serial interface.
If I wanted to change this in global config, I can go to Interface Serial 10 and then say bandwidth seven six, eight. Again, at the physical level the link is still going to run at the clock grade. So if the clock grade is 1544, it’s still going to run at 1544. Setting the bandwidth does not change the actual physical speed of the interface, it just changes how iOS will look at that interface for software policy. So this is how we could manipulate the overall cost for that link by changing the bandwidth. But the better way of doing it is by directly changing the cost because that won’t affect other software policy like QoS. So to do that we can say Interface Fast Ethernet Ipospf cost 50 will change the cost on that link.
And to verify what the cost on the link is, we can do a Show Iposp interface. If you’ve got a lot of interfaces on the router and you just say Show Ipospf Interface and hit Enter, you’re going to get quite long output. So you can also specify the individual interface. Here you’ll just get information about that one interface. We can also do a Show IP OSPF Interface brief to get it in a short output so you’re the cost on all of our interfaces. Okay, so that’s all the information about the OSPF metric. Next lecture we’ll take a look at actually configuring it in the last.
9. OSPF Cost Metric Lab Demo
In this lecture, I’m going to show you how to manipulate the OSPF metric, which is the cost in the lab. We’ve got our usual lab setup of routers r One to R Five, all their interfaces and the networks beginning with Ten. And if we have a look at the configuration of the show IP out on R One, you can see that I’ve already got OSPF configured on all of my routers back at the lab topology. The Ten 1224 network is available behind R four. So R One could get there either along the top path via R Two and R Three, or along the bottom path via R five. So let’s have a look and see which path it is taking. So from our short IP route, I can see the route was learned via OSPF.
For the Ten one two four network, it’s going via 100 three two, which is along the bottom path via R Five, which is what we’d expect because it’s a shorter path and administrative distance is 110, the default for OSPF and the metric, the cost currently is free. So if you look back at the topology diagram again, the reason it’s got a cost of three is that all the interfaces are fast Ethernet, so they all have a cost of one. So we’ve got the link itself, we’ve got a cost of one. Then the link from R Four to R Five is also a cost of one. Then from r five to r one is also one. So we add up one, one and one together, that gives us our cost of three. So we’re using the default reference bandwidth of 100 there, where the best possible interface is a fast Ethernet interface. If we had Gigabit Ethernet or Ten Gigabit Ethernet, et cetera, that would still have a cost of one.
It would not be treated any better than the slower fast Ethernet interface. So we want to set a higher reference bandwidth so that those newer, faster Ethernet interfaces like Gigabit and Ten Gigabit Ethernet will be preferred over the slower Fast Ethernet. So to do that, it’s going to be the same configuring all the routers. You want to configure this on all the routers in your network or you can get unexpected results. You need them to all have the same consistent reference bandwidth. So I’m going to open up a text editor for this and the commands I want to use are Router OSPF One and then the command is auto cost reference bandwidth and I’ll set it to a high enough value that I’m futureproofing myself as well. So I’ll set this to 100,000 and then I’m going to copy and paste this into all of my routers.
I need a config t. So there is R One and you see, it gives me the warning, make sure you do this on all of your routers. And I’ll also paste it in to R Two. And why did that not take the command, let me try pasting it in again. Okay, that’s got corrupted somehow so let me go copy it again. So CTRL C to copy it from my text document again and then back on the router paste it in, that took it.
Okay this time that also shows you as well that even when you are copying and pasting on a Cisco router, have a look at the output and check it’s taken the commands correctly. Do also on R three, on R four and R five. Okay, so that should be good now so you saw when we did the old show IP route for the ten one two network, the cost was three. This should be updated now. So if I now do a do show IP route you see for Vitan one two network, it’s got a cost of 3000 now because 100,000 divided by 100 is 1000 and we had the three links so that gives us a total cost of 3000. Okay, so that’s the effect of a reference bandwidth. If we had another path which had gigabit ethernet interfaces now rather than each of those having a cost of 1000, they would have a cost of 100 so it would be preferred.
Okay, next thing to do is let’s change the path here so the traffic for ten one two is currently going via ten three two which is on R five along the bottom path with a cost of 3000. So have a look at our network topology again. And what I want to do is change the traffic. So rather than going along the bottom path, I’m going to move it to the top path. I could either give the top path a lower cost or I can manipulating it by giving the bottom path a higher cost than what it is now. So there’s only two links along the bottom so it’s going to be quicker to change it along the bottom path. So each link now currently has a cost of 1000.
Let’s set these two links here from R one to R five and from R five to R four to have a cost of 2000 instead so that will give the bottom path a total cost of 5000. The 2000 here, the 2000 from R five to R four and the 1000 on the link itself. So 5000 on the bottom path along the top path will be one two three 4000. So the top path will be preferred and I want to do this on all the interfaces along the bottom path so that I’ve got the consistent cost on each link on both sides of the link. So I’ll go on to R one first and that was on interface fast 30 is facing R five and I’ll say IP cost OSPF 2000 it’s because I’ve missed out the OSPF Ipospf, sorry, cost 2000 is the correct command so that was on R one, then on R five it’s on Interfaces Fast 20, Ipospf cost 2000.
And I’ll hit the upado a couple of times and changes to Fast 30 and Ipospf cost 2000. And finally, on R four, it’s interface fast 20, which is facing R five and Ipospf cost 2000. So that bottom path should now be a higher cost than the top path. If I go back onto R One and I do a show IP route. Now, you see, previously it was going via ten three two. Now to get to ten one two, the next top is 100 two. That’s R two along the top path. Okay, so that’s how we change the reference bandwidth and also how we can manipulate the paths our traffic is going to take through the OSPF costs.