OSPF is a link-state routing protocol, which in contrast to distance vector routing protocols enable the router to have a map of the whole OSPF domain. This is done by collecting routing information from the rest of the routers in OSPF domain. Routing information is exchanged between routers by using LSAs (Link State Advertisements). LSAs build up the LSDB (Link State Database), which in turn is used by Dijkstra’s algorithm to do SPF (Shortest Path First) calculations. As a result of running Dijkstra’s algorithm the router get best loop-free paths to all network destinations.
OSPF uses a two-level hierarchy, i.e OSPF domain is divided into Areas. It is considered to be a two-level hierarchy because there are two kinds of areas: Backbone Area (Area 0) and Regular Area (other than 0). All regular areas must connect to backbone (physically or in rare case via virtual links) area in order to communicate with other areas. All routers in an area must have identical database for that area, in order to have updated information and best loop-free paths to network destinations. When a router detects for example a link going down, it will inform immediately other routers in the area. After the router synchronize its database with the rest of the routers it runs Dijkstra’s algorithm. Best routes are given to routing table.
Now you might be thinking what is the reason that OSPF must be divided into areas? Well, if it wouldn’t be so, there could be a bad impact on performance of the routers. The bigger network is, the bigger LSDB would be, the bigger chance to have links going down(which leads to more frequent SPF calculations). By dividing OSPF domain into areas will increase router performance because SPF calculations occurs only when a topology change is detected in the area that it participates. Below is a
"show ip ospf database" printout in a simple OSPF network.
R1#show ip ospf database OSPF Router with ID (10.1.1.1) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 10.1.1.1 10.1.1.1 858 0x80000005 0x005DD6 1 10.2.2.2 10.2.2.2 861 0x80000005 0x009360 2 10.3.3.3 10.3.3.3 829 0x80000005 0x00DCD9 4 10.4.4.4 10.4.4.4 863 0x80000004 0x005645 3 Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 192.168.0.3 10.3.3.3 828 0x80000003 0x006420 Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 10.10.10.1 10.1.1.1 858 0x80000003 0x00AC61 10.10.10.128 10.1.1.1 858 0x80000004 0x000DF6 172.16.1.1 10.1.1.1 858 0x80000003 0x00E97A Router Link States (Area 1) Link ID ADV Router Age Seq# Checksum Link count 10.1.1.1 10.1.1.1 858 0x80000005 0x00EAAF 2 172.16.1.1 172.16.1.1 936 0x80000005 0x002C6B 2 Net Link States (Area 1) Link ID ADV Router Age Seq# Checksum 10.10.10.130 172.16.1.1 936 0x80000003 0x005E2E Summary Net Link States (Area 1) Link ID ADV Router Age Seq# Checksum 10.10.20.1 10.1.1.1 860 0x80000003 0x00A257 10.10.30.1 10.1.1.1 860 0x80000003 0x0034BB 10.10.40.1 10.1.1.1 860 0x80000003 0x00485D 172.16.0.0 10.1.1.1 860 0x80000003 0x0065C4 192.168.0.0 10.1.1.1 860 0x80000004 0x00C6F2 R1#
Link state advertisements are sent within special OSPF packets called LSUs (Link State Updates). An LSU can contain one or more LSAs. When a router receives a LSU, it acknowledge that LSU by replying back to sender with a LSAck packet.Each LSA has an aging time and its sequence number (expresed in seconds). In the output below you can see them, the aging time colored in blue in the
Agefield, the sequence number colored in red in
Link ID ADV Router Age Seq# Checksum Link count 10.1.1.1 10.1.1.1 858 0x80000005 0x005DD6 1
When the timer reaches 30 minutes, the originating router resends the LSA with a higher sequence number. If the timer reaches 60 minutes (maxage) and a new LSA with increased sequence number wasn’t received, then the LSA is dropped.
A LSU with a LSA within it is sent to a router when it is requested by that router (by using LSR – Link State Request), or it is flooded to all routers when a toplolgy change is detected.
Link State Advertisements are of various kinds, every kind of them serves its purpose. I will be describing LSA types in other articles, where I’ll be waiting for you!4835 views