OSPF (Open Shortest Path First)

OSPF is a Link State Routing Protocol

Link state algorithm:

  • Detailed information about the topology is shared with in the updates.
  • When a router get this detailed information, then the Djikstra algorithm on that router uses that detailed information to make the map of the whole topology.
  • Once the map of the topology is ready, then the Djikstra computes the best paths to forward data to all networks which are within the topology.
  • Loops are avoided with link state algorithm as the whole view of the topology is there with each router.

Other features of OSPF

  • Maximum allowable hop counts are infinity.
  • OSPF is always classless
  • OSPF uses multicasting (224.0.0.5,224.0.0.6)
  • OSPF has authentication feature support.
    • 0   -Null Authentication
    • 1   -Plaintext Authentication
    • 2   -MD5 Authentication
  • OSPF has AD 110.
  • OSPF calculate distance on the basis of bandwidth.

               Cost = 10^8/Bandwidth    in Bit/sec

  • OSPF shares updates in a reliable manner
  • OSPF has Neighborship feature.
  • OSPF uses Djikstra algorithm to compute best paths for the network.
  • OSPF has area concept.
    • Within area OSPF acts like a link state routing protocol, and detailed information about the topology is shared.
    • Between different areas OSPF acts like a distant vector routing protocol, meaning only network information is shared between areas not link information.
    • These rules are there in the OSPF to improve the efficiency of OSPF.

Terms and terminologies

  1. Link:
    • OSPF sees a link as an interface which is holding a subnet with it.
    • Link information means that not only the link information is shared but also the network information is shared which is associated with the link.
  2. Router ID:
    • Router ID is a 32 bit value.
    • Router ID is used to identify a router within the OSPF domain.
    • So router ID is an identity given to each router within the OSPF domain.
    • Router ID is elected on the following basis.
      1. Configure the router ID manual.
      2. Highest IPV4 address on a non-shut loopback interface, if any.
      3. Highest IPV4 address on a non-shut non loopback interface.
  3. Neighborship:
    • OSPF routers dynamically discovers neighbour’s by multicasting.
    • OSPF hello message to 224.0.0.5 address (to all SPF routers)
    • An OSPF router forms Neighborship with all the other routers within the network which are enabled with OSPF.
    • Two routers cannot share link information until and unless they are neighbour’s.
  4. Adjacency:
    • Even if two routers are OSPF neighbours, it still does not mean that they can share link information with each other.
    • If two routers want to share link information in OSPF, then they not only have to be neighbours but also have to be adjacent.
      • Neighborship    —>    adjacent    —>     sharing of link information.
      • If only neighbour’s    —->     cannot share link information.
    • Within a network not all routers become adjacent with each other.
    • If all routers start sharing link information with each other then there will not be systematic distribution of link information and also there will be duplicacy while sharing link information.
  5. DR(Designated Router):
    • Designated router is elected within each network.
    • Each router within the network forms adjacency with the DR and shares link information with the DR.
    • In turn the DR shares that information with everyone in a systematic manner without duplicacy.
    • DR is elected on the basis of two parameters.
      1. Interface priority     (highest priority is preferred)
        • The moment we enable OSPF on an interface, the OSPF process assigns that interface an 8-bit priority which is by default set to 1.
        • Range:   0 to 255
        • Priority value is used by OSPF only for the DR election process and nothing else.
        • If you set the priority on an interface to be 0, then that interface does not participate in DR election process.
      2. Highest router ID
  6. BDR (Backup Designated Router):
    • Backup DR acts as a backup for the DR.
    • Within a network all the routers form adjacency not only with the DR but also with the BDR.
    • But BDR doesn’t help in distributing the link information systematically, that is DR’s job.
    • BDR sits silent and just wait for the DR to go down, so that it can take its role.
  7. Link State Database:
    • This database holds all the information on a router that is getting shared within the topology.
  8. Neighbour table:
    • Holds information about neighbours.

Neighborship Feature

  • Neighborship is formed using hello messages.
  • The moment we enable OSPF on an interface the router starts transmitting OSPF hello messages via that interface every 10 seconds by default.
  • Dead interval is 40 seconds.
  • OSPF hello messages are Multicasted (224.0.0.5)
  • Contents of hello messages.
    1. Area ID
    2. Router ID
    3. Priority
    4. Subnet mask
    5. Hello interval
    6. Dead interval
    7. DR
    8. BDR
    9. Active neighbours
    10. Options (capabilities)

Neighborship Conditions

  • Areas must match.
  • Router must be unique.
  • Subnet mask must match.
  • Hello interval and Dead interval must match.
  • Capabilities must match.

Neighbour states in OSPF

  • Down state
    • This is the first OSPF neighbour state. It means that no information (hellos) has been received from this neighbor, but hello packets can still be sent to the neighbor in this state.
  • Init state
    • This state specifies that the router has received a hello packet from its neighbor, but the receiving router’s ID was not included in the hello packet. When a router receives a hello packet from a neighbor, it should list the sender’s router ID in its hello packet as an acknowledgment that it received a valid hello packet.
  • 2-way state
    • This state designates that bi-directional communication has been established between two routers. Bi-directional means that each router has seen the other’s hello packet. This state is attained when the router receiving the hello packet sees its own Router ID within the received hello packet’s neighbor field.
  • Exstart state
    • Once the DR and BDR are elected, the actual process of exchanging link state information can start between the routers and their DR and BDR.
    • In this state, the routers and their DR and BDR establish a master-slave relationship and choose the initial sequence number for adjacency formation. The router with the higher router ID becomes the master and starts the exchange, and as such, is the only router that can increment the sequence number.
  • Exchange state
    • In the exchange state, OSPF routers exchange database descriptor (DBD) packets. Database descriptors contain link-state advertisement (LSA) headers only and describe the contents of the entire link-state database.
  • Loading state
    • In this state, the actual exchange of link state information occurs. Based on the information provided by the DBDs, routers send link-state request packets. The neighbor then provides the requested link-state information in link-state update packets. During the adjacency, if a router receives an outdated or missing LSA, it requests that LSA by sending a link-state request packet. All link-state update packets are acknowledged.
  • Full state
    • In this state, routers are fully adjacent with each other. All the router and network LSAs are exchanged and the routers’ databases are fully synchronized.

Configuration of OSPF

  • On configuration mode:
    • Router(config)#router ospf  <process ID>
  • Process ID is not must match, it is locally significant.
    • Router(config-router)#network <network ID> <wild card mask>
  • Network command is used to enable the OSPF process on that interface.

Area 0 (Backbone Area)

  • Area 0 is special area in OSPF.
  • Only Area 0 routers have the capability to share inter area network information.
  • So a very important rule in OSPF is that all non-zero areas must be directly connected to Area 0 (backbone area).

Types of Routers in OSPF

  • Internal router:
    • A router whose all interfaces belongs to same area.
  • Backbone router:
    • A router whose all interfaces belongs to area 0.
  • ABR (Area border router):
    • A router who’s at least one interface is connected to area 0, and at least one other interface is connected to any other non-zero area.
    • ABR is a router that shares inter area prefix (network) information between two or more areas.
  • ASBR (Autonomous System Boundary Router):
    • A router which is taking one routing domains information into another routing domain, that router is considered to be an ASBR.

LSA (Link State Advertisements)

  • LSA’s are those pieces of information which are used by Djikstra algorithm to make the map of the topology.
  • LSA’s maximum age is 1 hour.
  • LSA’s are refreshed every 30 minutes.
  • LSA’s are stored within the link state database.

LSA’s Types

  • Router LSA (Type 1 LSA)
    1. Each router originate a single router LSA for each area that it is connected to
    2. A router describes all of its links that belongs to a specific area inside the router LSA.
    3. Router LSA’s does not cross the area boundaries.
  • Network LSA (Type 2 LSA)
    1. Network LSA’s are originated by DR’s
    2. Where the DR shares information about its network
      • How many routers are there within the network and which are those.
      • Subnet mask of network.
    3. Network LSA’s are also doesn’t cross the area boundary
    4. Both router LSA and the network LSA are used by routers to make the map of their area.
  • Network summary LSA / summary network LSA (Type 3 LSA)
    1. ABR originate network summary LSA’s
    2. ABR has the responsibility to share inter area network information.
  • ASBR summary LSA / summary ASBR LSA  (Type 4 LSA)
    1. ABR create a type 4 summary ASBR LSA and flood it into area 0.
    2. This LSA will also be flooded in all other areas and is required so all OSPF routers know where to find the ASBR.
  • External LSA (Type 5 LSA)
    1. ASBR originate external LSA’s
    2. Inside these LSA’s the ASBR shares information about the external network which are being brought into OSPF domain because of redistribution.
Design a site like this with WordPress.com
Get started