Identifying How OSPF Handles Traffic
Let's take a look at the OSPF metric, and how we can manipulate the network to force traffic to go a certain route.
We're going to manipulate traffic going from router 1 to the LAN on router 5. Let's take another look at router 1's routing table and see how OSPF would handle traffic to router 5 currently.
Let's look for the host on the first subnet connected to router 5. The IP address for this host is 172.16.0.1, which we see in the routing table with a /32 host mask. We see that the metric is 1573 and the next hop IP is 172.16.21.110 which is router 3's serial interface. If we do a traceroute we can verify this.
Let's say that we want to make OSPF route traffic through router 2, then 4, and then to 5. Since OSPF uses bandwidth to calculate its metric we can go into router 1 and modify the bandwidth of the link to router 3 forcing OSPF to recalculate a best path. Let's take a look at how this is done.
In the image above I went into the s0/1 interface and lowered the bandwidth forcing OSPF to recalculate the metric for routes going through that interface. OSPF then found that going through s0/0 is faster and will route every route through router 2. We could have went into the s0/0 interface and increased the bandwidth of that link in order to alter the metric as well.
There is another way to alter the way OSPF will route traffic and that's through the 'ip ospf cost' command. This command will overwrite the bandwidth settings and take precedence in the routing table. Let's reconfigure the cost of s0/1 to alter the route back to router 3.
There is another way to alter the way OSPF will route traffic and that's through the 'ip ospf cost' command. This command will overwrite the bandwidth settings and take precedence in the routing table. Let's reconfigure the cost of s0/1 to alter the route back to router 3.
After entering a cost of 1 in the s0/1 interface we see that the route to 172.16.0.1 now goes back through router 3. Notice that the metric is 12 and not 1, that's OSPF uses cumulative cost of all the links to the destination, so it adds the cost of each link up.
As you can see we have a couple of ways to affect the flow of traffic through an OSPF network.
As you can see we have a couple of ways to affect the flow of traffic through an OSPF network.