OSPF
OSPF
OSPF
Open-Shortest-Path-First (OSPF) is the most widely used interior gateway protocol routing
protocol on the world because it is a public (non-proprietary) routing protocol while its biggest
rival, EIGRP, is a Cisco proprietary protocol so other vendors cant use it (edit: EIGRP has
become a public routing protocol since 2013). OSPF is a complex link-state routing protocol.
Link-state routing protocols generate routing updates only when a change occurs in the network
topology. When a link changes state, the device that detected the change creates a link-state
advertisement (LSA) concerning that link and sends to all neighboring devices using a special
multicast address. Each routing device takes a copy of the LSA, updates its link-state database
(LSDB), and forwards the LSA to all neighboring devices.
Note:
+ OSPF routers use LSA (Link State Advertisement)to describe its link state. LSDB stores all
LSAs.
+ A router uses Router LSA to describe its interface IP addresses.
+ After OSPF is started on a router, it creates LSDB that contains one entry: this routers Router
LSA.
There are five types of OSPF Link-State Packets (LSPs).
+ Hello: are used to establish and maintain adjacency with other OSPF routers. They are also
used to elect the Designated Router (DR) and Backup Designated Router (BDR) on multiaccess
networks (like Ethernet or Frame Relay).
+ Database Description (DBD or DD): contains an abbreviated list of the sending routers linkstate database and is used by receiving routers to check against the local link-state database
+ Link-State Request (LSR): used by receiving routers to request more information about any
entry in the DBD
+ Link-State Update (LSU): used to reply to LSRs as well as to announce new information.
LSUs contain seven different types of Link-State Advertisements (LSAs)
+ Link-State Acknowledgement (LSAck): sent to confirm receipt of an LSU message
Key points
+ Is a public (non-proprietary) routing protocol.
+ Is the only link-state routing protocol you learn in CCNA
+ This works by using the Dijkstra algorithm
+ Information about its neighbors (local connectivity) is sent to the entire network using
multicasting
+ Routing information is shared through Link-state updates (LSAs)
+ HELLO messages are used to maintain adjacent neighbors. By default, OSPF routers send
Hello packets every 10 seconds on multiaccess and point-to-point segments and every 30
seconds on non-broadcast multiaccess (NBMA) segments (like Frame Relay, X.25, ATM).
+ Is a classless routing protocol because it does not assume the default subnet masks are used. It
sends the subnet mask in the routing update.
+ Supports VLSM and route summarization
+ Uses COST as a metric which CISCO defines as the inverse of the bandwidth
+ Uses AREAs to subdivide large networks, providing a hierarchical structure and limit the
multicast LSAs within routers of the same area Area 0 is called backbone area and all other
areas connect directly to it. All OSPF networks must have a backbone area
+ Only support IP but its not bad as we are all using IP, right? :)
Area Border Routers (ABR) are any routers that have one interface in one area and another
interface in another area
Suppose R1 doesnt have any loopback interfaces but it has 2 physical interfaces:
Now both the routers have the router-id so they will send Hello packets on all OSPF-enabled
interfaces to determine if there are any neighbors on those links. The information in the OSPF
Hello includes the OSPF Router ID of the router sending the Hello
For example, R1 wants to find out if it has any neighbor running OSPF it sends a Hello message
to the multicast address 224.0.0.5. This is the multicast address for all OSPF routers and all
routers running OSPF will proceed this message.
If an OSPF router receives an OSPF Hello packet that satisfied all its requirement then it will
establish adjacency with the router that sent the Hello packet. In this example, if R1 meet R2s
requirements, meaning it has the same Hello interval, Dead interval and AREA number, R2
will add R1 to its neighbor table.
+ Hello interval: indicates how often it sends Hello packets. By default, OSPF routers send
Hello packets every 10 seconds on multiaccess and point-to-point segments and every 30
seconds on non-broadcast multiaccess (NBMA) segments (like Frame Relay, X.25, ATM)
+ Dead interval: number of seconds this router should wait between receiving hello packets
from a neighbor before declaring the adjacency to that neighbor down
+ AREA number: the area it belongs to
Now R1 and R2 are neighbors but they dont exchange LSAs immediately. Instead, they sends
Database Description (DD or DBD) packets which contain an abbreviated list of the sending
routers link-state database.
The neighbors also determine who will be the master and who will be the slave. The router
which higher router-id will become master and initiates the database exchange. The receiver
acknowledges a received DD packet by sending an identical DD packet back to the sender. Each
DD packet has a sequence number and only the master can increment sequence numbers.
Note: OSPF works distributely. After routers have synchronized their LSDB, they use the same
data (LSDB) to calculate shortest paths, and updates their routing tables independently.
Ack update : LSAs are received
In order to assure reliable transmission, when a router receives an Update, it sends an Ack to the
Update sender. If the sender does not receivie Ack within a specific peried, it times out and
retransmits Update.
Note: OSPF uses Update-Ack to implemnet relaible transmission. It does not use TCP.
H1 ping H2: succeeded.
Each OSPF router creates a Router LSA to describe its interfaces IP addresses and floods its
Router LSA to its neighbors. After a few rounds of flooding, all OSPF routers have the same set
of Router LSAs in their LSDBs. Now routers can use the same LSDB to calculate routes and
update routing tables.
From LSDB, a router learns the entire topology: the number of routers being connected. Router
interfaces and their IP addresses, interface link costs (OSPF metric). With such detail
information, routers are able to calculate routing paths to reach all destinations found in LSDB.
For example, in the OSPF basic simulation (see External links), R1s LSDB contains two Router
LSAs: A Router LSA from R1. R1 has two links. Their IP addresses are
192.168.1.0/24,192.168.3.0/30. A Router LSA from R2. R2 has two links. Their IP addresses
are 192.168.2.0/24,192.168.3.0/30. From these LSA, R1 can calculate the routing path to reach
remote destination 192.11.68.2.2 and adds an entry (192.168.2.0/24, S1/0) to its routing table.