OSPF is a link-state routing protocol. Link-state protocols use the shortest path first (SPF) algorithm to populate the routing table.
Common OSPF Terms-
Link state Protocol -Information is shared between directly connected routers. This information propagates throughout the network unchanged and is also used to create a shortest path first (SPF) tree.
Area-A group of routers that share the same area ID. All OSPF routers require area assignments.
Autonomous system (AS)-A network under a common network administration.
Cost-The routing metric used by OSPF. Lower costs are always preferred. You can manually configure the cost with the ip ospf cost command. By default, the cost is calculated by using the formula cost = 108 / bandwidth.
Router ID-Each OSPF router requires a unique router ID, which is the highest IP address configured on a Cisco router or the highest numbered loopback address. You can manually assign the router ID.
Adjacency-When two OSPF routers have exchanged information between each other and have the same topology table. An adjacency can have the following different states or exchange states:
1. Init state—When Hello packets have been sent and are awaiting a reply to establish two-way communication.
2. Establish bi-directional (two-way) communication—Accomplished by the discovery of the Hello protocol routers and the election of a DR.
3. Exstart—Two neighbor routers form a master/slave relationship and agree upon a starting sequence to be incremented to ensure LSAs are acknowledged.
4. Exchange state—Database Description (DD) packets continue to flow as the slave router acknowledges the master's packets. OSPF is operational because the routers can send and receive LSAs between each other. DD packets contain information, such as the router ID, area ID, checksum, if authentication is used, link-state type, and the advertising router. LSA packets contain information, such as router ID also but in addition include MTU sizes, DD sequence numbering, and any options.
5. Loading state—Link-state requests are sent to neighbors asking for recent advertisements that have not yet been discovered.
6. Full state—Neighbor routers are fully adjacent because their link-state databases are fully synchronized. Routing tables begin to be populated.
Topology table-Also called the link-state table. This table contains every link in the whole network.
Designated router (DR)-This router is responsible for ensuring adjacencies between all neighbors on a multiaccess network (such as Ethernet). This ensures all routers do not need to maintain full adjacencies with each other.
The DR is selected based on the router priority. In a tie, the router with the highest router ID is selected.
Backup DR-A backup router designed to perform the same functions in case the DR fails.
Link-state advertisement (LSA)-A packet that contains all relevant information regarding a router's links and the state of those links.
Priority-Sets the router's priority so a DR or BDR can be correctly elected.
Router links-Describe the state and cost of the router's interfaces to the area. Router links use LSA type 1.
Summary links-Originated by area border routers (ABRs) and describe networks in the AS. Summary links use LSA types 3 and 4.
Network links-Originated by DRs. Network links use LSA type 2.
External links-Originated by autonomous system boundary routers (ASBRs) and describe external or default routes to the outside (that is, non- OSPF) devices for use with redistribution. External Links use the LSA type 5.
Area Border Router (ABR)-Router located on the border of one or more OSPF areas that connects those areas to the backbone network.
Boundary Router (ASBR)-ABR located between an OSPF autonomous system and a non-OSPF network.
Configuring OSPF in a Single Area
OSPF has some basic rules when it comes to area assignment. OSPF must be configured with areas. The backbone area 0, or 0.0.0.0, must be configured if you use more than one area assignment. You can configure OSPF in one area; you can choose any area, although good OSPF design dictates that you configure area 0.
To enable OSPF on a Cisco router and advertise interfaces, the following tasks are required:
Step 1)Use the command router ospf process ID to start OSPF.
router(config)#router ospf 1
Step 2)Use the network command to enable the interfaces with area assignemtns
router(config-router)#network 10.0.0.0 0.0.0.255 area 0 , when you need to configure ospf on a interface having ip address configure 10.1.1.1 subnetmaks 255.255.255.0 in area 0.
Step 3)(Optional) Assign the router ID.
router(config-router)#router-id 1.1.1.1
Command to configure all router interface in OSPF with a single command-
router ospf 1
network 0.0.0.0 255.255.255.255 area 0
Above command , displays OSPF with a process ID of 1 and places all interfaces configured with an IP address in area 0. The network command network 0.0.0.0 255.255.255.255 area 0 dictates that you do not care (255.255.255.255) what the IP address is, but if an IP address is enabled on any interface, place it in area 0.
Example 3-1 Configuring OSPF in a Single Area with all interfaces-