In this LAB, I will show you how the equal cost load balancing happens on OSPF.
I have already configured OSPF on all routers while having the reference bandwidth set to default. We should have the costs are following:
[mepr-show rules=”319″ unauth=”message”]
- R1 – R2 – R5 – Destination = 2
- R1 – R3 – R5 – Destination = 2
- R1 – R4 – R5 – Destination = 3124
Not that the cost from R5 to the network 18.104.22.168/24 is 0 because that’s a loopback interface as you can see in the picture below:
That means that I do have 2 equal cost routes to the destination network from R1 (via R2 and via R3). With this, I should be able to see the 2 OSPF routes in the routing table of R1.
Let’s check if our logic is correct.
Indeed, I see in R1’s routing table the 2 routes via R2 and via R3, and it shows clearly that the cost of each router is 2. Now I do have a load balancing from R1 to reach the destination network on R5
Let’s say for a reason, I didn’t want to have load balancing and I want the traffic to go only via R2 and not via R3. How can I do the change so the router via R3 won’t show in the routing table?
Here I can change manually the cost on the interface G/0/0/1 to a higher number then the router via R3 will not be added to the routing table of R1.
Let me show you how this can be done.
Let’s see if the new cost has been changed on the interface G0/0/1.
Indeed, the cost on the interface G0/0/1 is 10 now. That means we shouldn’t see anymore the route via R3 in the routing table of R1 because it has a higher cost than the route via R2. Let’s check that.
Here we go. I only see 1 route to the destination network of R5, and this route is via R2.
Now where is the path via R3 gone? Actually it is in the OSPF database table. Once the main route goes down, then SPF algorithm will run again and magically the route via R3 will be added to the routing table because that is the best router after the main route via R2 is gone. If you want, I can show that to you. I will disable the interface G0/0/0 on R1, then it cannot reach to the destination network via R2 anymore and will see if R1 will add the route via R3 to its routing table.
Let’s disable the interface G0/0/0 on R1 first.
G0/0/0 is down now, that means it doesn’t have OSPF neighborship with R2. In this case, R1 will try to find an alternative router to 22.214.171.124/24 network. In his OSPF database table he has the path via R3 which can take him to 126.96.36.199/24 with a cost of 11. He will run the SPF algorithm and add it to his routing table because that’s the best cost for that destination network for now.
Let’s check if it is in R1 routing table.
Here it is. You see it has been added to the routing table. Now in case the 1st route comes back, what would happen? Let’s bring the interface on G0/0/0 up and see.
The interface is now up. Let’s see the routing table on R1 and see which route will be shown there.
Again, the route via R2 is the one who is on the routing table, and the route via R3 is gone.
Last thing I want to show you in that in case I disable both interface G0/0/0 and G0/0/1 on R1, that means no more peer neighborship between R1/R2 and R1/R3. Do you think that R1 will add the routing via R4 which has a very bad cost?
Now both Gigabit Ethernet interfaces on R1 are done. The only OSPF neighborship that we still have is to R4 via the serial links with a very bad cost. Let’s check if this will be added to the routing table of R1.
Indeed. R1 has added the route via R4 to reach the destination network and look how high is the cost ???? – a link with a high cost to a destination is better than no route at all to that destination.
To finish this LAB and this chapter, let me issue a ping from R1 to the destination network to see if it is reachable via its serial interface.
All is well, and I can ping from R1 to the destination network without any issue.
This is all what I wanted to show you in this chapter, I hope you enjoyed it and see you in the upcoming one.