The characteristics of OSPF follow
- Link-state routing protocol.
- Uses IP protocol 89.
- Classless protocol (supports VLSMs and CIDR).
- Metric is cost, based on interface bandwidth by default (10^8 / BW in bps).
- Sends partial route updates only when there are changes.
- Send hello packets every 10 sec with dead timer of 40 sec over P-P & BC networks.
- Send hello packets every 30 sec with dead timer of 120 sec over NBMA networks.
- If the network is stable and there have been no updates within 30 min, a compressed update is sent.
- Routes labeled as intra-area, interarea, external Type 1, or external Type 2.
- Support for authentication.
- Uses Dijkstra algorithm to calculate SPF tree.
- Default administrative distance is 110.
- Uses multicast address 126.96.36.199 (ALLSPFRouters).
- Uses multicast address 188.8.131.52 (ALLDRouters).
- Recommended for large networks.
- For 2 routers to be adjacent :
- 1st. Hello packets must be sent & received.
- 2nd They must have the same hello & dead timers Also & same Net ID with subnet mask.
- 3rd They must be in the same area.
Neighbor State Machine
An OSPF router transitions a neighbor through several states before the neighbor is considered fully adjacent:
- Down The initial state of a neighbor conversation indicates that no Hellos have been heard from the neighbor in the last RouterDeadInterval. Hellos are not sent to down neighbors unless those neighbors are on NBMA networks; in this case, Hellos are sent every PollInterval. If a neighbor transitions to the Down state from some higher state, the link state Retransmission, Database Summary, and Link State Request lists are cleared.
- Attempt This state applies only to neighbors on NBMA networks, where neighbors are manually configured. A DR-eligible router transitions a neighbor to the Attempt state when the interface to the neighbor first becomes Active or when the router is the DR or BDR. A router sends packets to a neighbor in Attempt state at the HelloInterval instead of the PollInterval.
- Init This state indicates that a Hello packet has been seen from the neighbor in the last RouterDeadInterval, but two-way communication has not yet been established. A router includes the Router IDs of all neighbors in this state or higher in the Neighbor field of the Hello packets.
- 2-Way This state indicates that the router has seen its own Router ID in the Neighbor field of the neighbor’s Hello packets, which means that a bidirectional conversation has been established. On multi-access networks, neighbors must be in this state or higher to be eligible to be elected as the DR or BDR. The reception of a Database Description packet from a neighbor in the init state also causes a transition to 2-Way.
- ExStart In this state, the router and its neighbor establish a master/slave relationship and determine the initial DD sequence number in preparation for the exchange of Database Description packets. The neighbor with the highest Router ID becomes the master.
- Exchange The router sends Database Description packets describing its entire link-state database to neighbors that are in the Exchange state. The router may also send Link State Request packets, requesting more recent LSAs, to neighbors in this state.
- Loading The router sends Link State Request packets to neighbors that are in the Loading state, requesting more recent LSAs that have been discovered in the Exchange state but have not yet been received.
- Full Neighbors in this state are fully adjacent, and the adjacencies appear in Router LSAs and Network
- Link A link is a network or router interface assigned to any given network.
- Router ID: The Router ID (RID) is an IP address used to identify the router. Cisco chooses the Router ID by using the highest IP address of all configured loopback interfaces. If no loopback interfaces are configured with addresses, OSPF will choose the highest IP address of all active physical interfaces.
- Hello protocol: The OSPF Hello protocol provides dynamic neighbor discovery and maintains neighbor relationships. Hello packets and Link State Advertisements (LSAs) build and maintain the topological database. Hello packets are addressed to 184.108.40.206.
- Neighbors: Neighbors are two or more routers that have an interface on a common link/network, such as two routers connected on a point-to-point serial link.
- Adjacency: An adjacency is a relationship between two OSPF routers that permits the direct exchange of route updates.
- Neighborship database: The neighborship database is a list of all OSPF routers for which Hello packets have been seen. A variety of details, including the Router ID and state, are maintained on each router in the neighborship database.
- Topology database: The topology database contains information from all of the Link State Advertisement packets that have been received for an area.
- Link State Advertisement: A Link State Advertisement (LSA) is an OSPF data packet containing link-state and routing information that’s shared among OSPF routers.
- Designated router: A designated router (DR) is elected whenever OSPF routers are connected to the same multi-access network.
- Backup designated router: A backup designated router (BDR) is a hot standby for the DR on multi-access links The BDR receives all routing updates from OSPF adjacent routers, but doesn’t flood LSA updates.
- OSPF areas: An OSPF area is a grouping of contiguous networks and routers. All routers in the same area share a common Area ID. Because a router can be a member of more than one area at a time, the Area ID is associated with specific interfaces on the router. This would allow some interfaces to belong to area 1 while the remaining interfaces can belong to area 0. All of the routers within the same area have the same topology table.
- Broadcast (multi-access): networks such as Ethernet allow multiple devices to connect to (or access) the same network, as well as provide a broadcast ability in which a single packet is delivered to all nodes on the network. In OSPF, a DR and a BDR must be elected for each broadcast multi-access network.
- Non-broadcast multi-access: (NBMA) networks are types such as Frame Relay, X.25, and Asynchronous Transfer Mode (ATM). These networks allow for multi-access, but have no broadcast ability like Ethernet. So, NBMA networks require special OSPF configuration to function properly and neighbor relationships must be defined. DR and BDR are elected on broadcast and nonbroadcast multi-access networks.
- Point-to-point: refers to a type of network topology consisting of a direct connection between two routers that provides a single communication path.
- Point-to-multipoint: refers to a type of network topology consisting of a series of connections between a single interface on one router and multiple destination routers.
- SPF Tree Within an area, each router calculates the best/shortest path to every network in that same area. This calculation is based upon the information collected in the topology database and an algorithm called shortest path first (SPF), each router in an area constructing a tree—much like a family tree—where the router is the root, and all other networks are arranged along the branches and leaves. This tree contains only networks that exist in the same area as the router itself does.
OSPF Router Types
- Internal routers: Routers that have all their interfaces in the same area and have identical LSDBs.
- Backbone routers: Routers that sit in the perimeter of the backbone area and have at least one interface connected to area 0. Backbone routers maintain OSPF routing information using the same procedures and algorithms as internal routers.
- ABRs: Routers that have interfaces attached to multiple areas, maintain separate LSDBs for each area to which they connect, and route traffic destined for or arriving from other areas. ABRs are exit points for the area, which means that routing information destined for another area can get there only via the ABR of the local area. ABRs can be configured to summarize the routing information from the LSDBs of their attached areas. ABRs distribute the routing information into the backbone. The backbone routers then forward the information to the other ABRs. In a multiarea network, an area can have one or more ABRs.
- ASBRs: Routers that have at least one interface attached to an external internetwork (another autonomous system [AS]), such as a non-OSPF network. ASBRs can import non- OSPF network information to the OSPF network and vice versa; this process is called route redistribution.
The steps for OSPF convergence are as follows:
- When a router detects a link failure, an LSA is sent to its neighbors. If the router is on a multi-access link, then the update is sent to the DR and BDR, not to all neighbors.
- The path is removed from the originating router’s tables.
- On receipt of the LSA, all routers update the topology table and flood the LSA out its interfaces.
- The Dijkstra algorithm is run to rebuild the routing table.
Convergence is detection time, plus LSA flooding, plus 5 seconds before computing the topology table. This comes to a few seconds. If convergence is deemed to be the topology table being updated, this could take longer.
Router(config)# router ospf <process #> Router(conf-router)# network < Net ID> < W.C > area <#> Router(conf-router)# network < Loopback ip add > < 0.0.0.0 > area <#> (Optinal) Router(conf-router)#passive-interface <interface> Router(conf-router)#distance <N> (Define an administrative distance, default =110) Router(conf-router)#maximum –paths <N> (Up to 6 Links for load sharing, Over equal metric paths default is 4 paths) Router(conf-router)#default-information originate Router(conf-router)# area <#> authentication < message-digest> Router(conf-router) # auto-cost reference-bandwidth <#> (Default is 100, range from 1 to 4,294,967, cost=100/BW bps = 10^8/BW bps) Router(config)# int < Int > Router(config-if)# ip ospf message-digest-key < key-ID> md5 < key> Router(config-if)# bandwidth <# in Kbps> (Optinal) Router(config-if)# ip ospf cost <cost> (Optinal) Router(config-if)# ip ospf priority <#> (Optinal) Router(config-if)# ip ospf hello-interval <#> (Optinal) Router(config-if)# ip ospf dead-interval <#> (Optinal)
#show ip route #show ip route ospf #show ip protocols #show ip ospf database #show ip ospf neighbours #show ip ospf interface #debug ip ospf events #debug ip ospf adj