![]() |
Pre-requisites: Open Shortest Path First (OSPF) Open Shortest Path First (OSPF) is a routing protocol that exchanges routing information within an autonomous system (AS). it is a link-state protocol that provides a more efficient and scalable way of routing traffic compared to distance vector protocols like RIP.it uses a hierarchical network design with areas, where each area has its own link-state database and all routers within an area have identical information about that area. Dijkstra algorithmis used to calculate the shortest path between two points in a network, based on the link-state information available. Key Points of OSPF
Link State Advertisement in OSPFIn OSPF, LSAs (Link State Advertisement) are messages sent by routers to advertise information about their local networks and the state of their links to neighboring routers. Each router in an OSPF network maintains a Link State Database (LSDB) that contains a copy of all the LSAs in the network. The LSDB is used to calculate the shortest path to each destination network in the network.There are several types of LSAs used in OSPF, including:
In nutshell, LSAs are flooded throughout the OSPF domain to ensure that all routers have the same information about the network topology. Routers use the information in LSAs to calculate the shortest path to each destination network in the network. OSPF AreasOSPF divides networks into areas to reduce the amount of routing information that must be exchanged between routers. There are several types of OSPF areas:
Each OSPF area has its own topology database, which contains information about the routers and networks within that area. This allows OSPF to maintain separate routing tables for each area and reduce the amount of routing information that must be exchanged between routers. How OSPF WorksOSPF (Open Shortest Path First) is a link-state routing protocol that works by building a complete topology of the network. OSPF routers exchange information about their directly connected links and build a map of the entire network. This map is then used to calculate the shortest path to a destination, making OSPF an efficient routing protocol.
In summary, OSPF works by building a complete topology map of the network, calculating the shortest path to a destination using the Dijkstra algorithm, and selecting the best path based on the path’s total cost. OSPF routers maintain the network topology by continually monitoring the network and updating their LSAs, and converge quickly when there is a change in the network. Configure the OSPF and Verify Two Routers Connection in Cisco Packet TracerHere we will take an example by using the CISCO packet tracer to configure ospf in the network which contains two routers two switchs and two pcs as shown in below figure 1. now open the cisco packet tracer and select the following devices as shown below:
![]() Figure 1: OSPF Configuration Now we have to assign the ip address as shown below table to each pc and router this is done by the following steps:
Step1: select pc1 then go to Desktop then select ip configration and assign the ip address to pc1 as shown below: ![]() Figure 2: pc1 configuration Step2: select PC2 then go to Desktop then select ip configration and assing the ip address to pc1 as shown below: ![]() figure 3: PC2 configration Step 3:Here we have two methods to assing ip address to router0:
![]() Figure 4: Router 0 configuration Command line: in this method select the router R0 then go to CLI and enter the following commands as shown below to set the ip address of GigabitEthernet0/0 and GigabitEthernet0/1:
Step4: select the router R1 and similarly as shown in step2 assign the ip address as shown in tabble II to GigabitEthernet0/1 and GigabitEthernet0/0 After these steps will done now we have to follow these steps to configure ospf in two routers R0 and R1 : Step 1:Select the router R0 then go to CLI and enter the below commands:
Step 2:Select the router R1 then go to CLI and enter the below commands:
After configuring the ospf now we will verify ospf is working or not to this we will ping from pc1 to pc2. To do this select pc1 and go to command prompt and enter the following command:
as shown in figure 5 the packets are received successfully and now ospf is working successfully. ![]() Figure 5: Ping from pc1 to pc2 Now we will ping from pc2 to pc1 by entering the following command:
as shown in figure 6 the packets are successfully received which means OSPF is working successfully ![]() Figure 5: Ping from pc2 to pc1 What is OSPF Interface Cost?OSPF (Open Shortest Path First) interface cost is a metric used by the OSPF routing protocol to determine the best path to a destination. It represents the cost of sending data across a specific link, and it is calculated based on the bandwidth of the link. The formula for calculating the cost of interface in Cisco router is, as follows.
By default the value of reference bandwidth is 100Mbps. OSPF interface cost plays a crucial role in determining the path selection process in OSPF. When OSPF receives multiple paths to a destination, it chooses the path with the lowest cumulative interface cost. This means that the path with the lowest total cost (sum of interface costs) is selected as the best path to the destination. Network administrators can manipulate the path selection process by adjusting the cost of specific interfaces. For example, increasing the cost of an interface will make OSPF less likely to use that path, and decreasing the cost will make OSPF more likely to use that path. In summary, OSPF interface cost is a critical metric used by OSPF to determine the best path to a destination, and it allows network administrators to optimize network performance by manipulating the path selection process. Example To Calculate Path CostTo calculate the route cost from router R0 to router R1 as shown in figure 7 below: ![]() Figure 7: path cost from R0 to R1 as you seen above figure 7 the cost of route R1 to R2 which consists GigabitEthernet0/1 and GigabitEthernet0/0 whose cost is 10 and 16 respectively. To calculate the cost the above formula is used:
To see the cost of the interface in the cisco packet tracer following commands will be followed:
As shown in figure 8 below the highlighted part is the cost of the route: ![]() figure 8: cost of the route Similarly we can see the cost of the another by following the same procedure. How To Change the Interface Cost?Changing the OSPF cost can control the determination of the optimal route. There are three methods for modifying the OSPF cost.
Directly Configuring OSPF CostsTo configure the OSPF cost directly, by using the following command in interface configuration mode.
as shown in figure 9 highlighted part show the new cost of the interface: ![]() figure 9: Directly Configuring OSPF Costs Modifying Interface BandwidthTo modify the interface bandwidth, use the following command in interface configuration mode.
Altering the numerator in the formula used to calculate costs (reference-bandwidth)To modify the numerator of the cost formula, use the following command in OSPF configuration mode.
The following is the conclusion of the OSPF cost: ![]()
|
Reffered: https://www.geeksforgeeks.org
CCNA |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 11 |