Home > OSPF Tutorial

OSPF Tutorial

December 3rd, 2010 Go to comments

In this article we will learn about the OSPF Routing Protocol

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 can’t 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 router’s Router LSA.

There are five types of OSPF Link-State Packets (LSPs).

OSPF_example.jpg

+ 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 router’s link-state 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 it’s 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

Let’s see an example of OSPF

Suppose OSPF has just been enabled on R1 & R2. Both R1 and R2 are very eager to discover if they have any neighbors nearby but before sending Hello messages they must first choose an OSPF router identifier (router-id) to tell their neighbors who they are. The Router ID (RID) is an IP address used to identify the router and is chosen using the following sequence:

+ The highest IP address assigned to a loopback (logical) interface.

+ If a loopback interface is not defined, the highest IP address of all active router’s physical interfaces will be chosen.

+ The router ID can be manually assigned

In this example, suppose R1 has 2 loopback interfaces & 2 physical interfaces:

+ Loopback 0: 10.0.0.1

+ Loopback 1: 12.0.0.1

+ Fa0/0: 192.168.1.1

+ Fa0/1: 200.200.200.1

As said above, the loopback interfaces are preferred to physical interfaces (because they are never down) so the highest IP address of the loopback interfaces is chosen as the router-id -> Loopback 1 IP address is chosen as the router-id.

OSPF_choose_router_id.jpg

Suppose R1 doesn’t have any loopback interfaces but it has 2 physical interfaces:

+ Fa0/0: 210.0.0.1 but it is shut down

+ Fa0/1: 192.168.1.2 (is active)

Although Fa0/0 has higher IP address but it is shutdown so R1 will choose Fa0/1 as its router-id.

OSPF_choose_router_id_2.jpg

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 packet.

Comments (190) Comments
Comment pages
  1. koji
    March 20th, 2012

    could you please send me the latest dumps of questions to kojivecnick@gmail.com
    thank you 9tut

  2. JoseAlvarez
    March 20th, 2012

    I have a question about router-id. 1 for area? Or in all ospf network 1 router-id? Sorry for my english but i am from venezuela!

  3. 9tut
    March 21st, 2012

    @JoseAlvarez: Each router has a unique router-id.

  4. akash
    March 22nd, 2012

    i didnt like it

  5. JoseAlvarez
    March 22nd, 2012

    @9tut thanks…

  6. H1L1
    March 26th, 2012

    I am about to take the CCNA could I get the latest test dump? Please hellen.lleet@gmail.com

  7. Manica
    April 1st, 2012

    Guys, where can I download the latest version of cisco packet tracer?

  8. Daniel Smith
    April 3rd, 2012

    Cisco Networking Academy have an up to date copy I downloaded yesterday, have to be a registered student though? otherwise try http://www.downloads.com

  9. kashyap
    April 20th, 2012

    great…

  10. Sri Ganesh
    May 25th, 2012

    Very good article for the beginners!!

  11. Anish
    May 31st, 2012

    Is thr any OSPF lab sim?

  12. Javed
    June 3rd, 2012

    These are very useful to revise things………………

  13. Javed
    June 3rd, 2012

    Anybody knows any site related to learn MPLS and BGP Tutorials…………….?

  14. Rawie
    June 6th, 2012

    Need latest dump. Doing exam next week rawiemsm@telfort.nl

    Thnx in advnc

  15. ddane
    June 6th, 2012

    When it’s about OSPF DR/BDR election process, maybe we can tell it like this:

    1. DR router is the router with highest OSPF Interface Priority.

    example:
    R1(config)#interface fastEthernet0/0
    R1(config-if)#ip ospf priority 255
    R1(config-if)#end
    ———————————————
    2. BDR router is the router with second highest OSPF Interface Priority.

    example:
    R3(config)#interface fastEthernet0/0
    R3(config-if)#ip ospf priority 100
    R3(config-if)#end
    ———————————————

    3. If OSPF Interface Priorities are equal, than the highest OSPF Router ID is used to break the tie.

    ——————————-
    Determining the Router ID

    The OSPF router ID is used to uniquely identify each router in the OSPF routing domain. A router ID is simply an IP address. Cisco routers derive the router ID based on three criteria and with the following precedence:

    1. Use the IP address configured with the OSPF router-id command.

    2. If the router-id is not configured, the router chooses highest IP address of any of its loopback interfaces.

    3. If no loopback interfaces are configured, the router chooses highest active IP address of any of its physical interfaces.

  16. sarwar
    June 25th, 2012

    very nice

  17. Anonymous
    June 26th, 2012

    Dear friends
    I am new in 9tut.
    I am preparing for CCNA vendor exam.
    I need the latest dumps questions.
    My email id is chiranjibi.adhikari@hotmail.com.
    Please help me

  18. CCNAbeginer
    June 27th, 2012

    Hi 9tut
    do u have any example below command and from the command what can we learn from display command ( what information we can get from below command )
    i find out that CCNA exam need us know what we can learn from below command and
    and u have done well for this link :http://www.9tut.com/cisco-router-boot-sequence-tutorial

    Show access-lists – all access lists on the router

    · Show cdp – cdp timer and holdtime frequency

    · Show cdp entry * – same as next

    · Show cdp neighbors detail – details of neighbor with ip add and ios version

    · Show cdp neighbors – id, local interface, holdtime, capability, platform portid

    · Show cdp interface – int’s running cdp and their encapsulation

    · Show cdp traffic – cdp packets sent and received

    · Show controllers serial 0 – DTE or DCE status

    · Show dialer – number of times dialer string has been reached, other stats

    · Show flash – files in flash

    · Show frame-relay lmi – lmi stats

    · Show frame-relay map – static and dynamic maps for PVC’s

    · Show frame-relay pvc – pvc’s and dlci’s

    · Show history – commands entered

    · Show hosts – contents of host table

    · Show int f0/26 – stats of f0/26

    · Show interface Ethernet 0 – show stats of Ethernet 0

    · Show ip – ip config of switch

    · Show ip access-lists – ip access-lists on switch

    · Show ip interface – ip config of interface

    · Show ip protocols – routing protocols and timers

    · Show ip route – Displays IP routing table

    · Show ipx access-lists – same, only ipx

    · Show ipx interfaces – RIP and SAP info being sent and received, IPX addresses

    · Show ipx route – ipx routes in the table

    · Show ipx servers – SAP table

    · Show ipx traffic – RIP and SAP info

    · Show isdn active – number with active status

    · Show isdn status – shows if SPIDs are valid, if connected

    · Show mac-address-table – contents of the dynamic table

    · Show protocols – routed protocols and net_addresses of interfaces

    · Show running-config – dram config file

    · Show sessions – connections via telnet to remote device

    · Show startup-config – nvram config file

    · Show terminal – shows history size

    · Show trunk a/b – trunk stat of port 26/27

    · Show version – ios info, uptime, address of switch

    · Show vlan – all configured vlan’s

    · Show vlan-membership – vlan assignments

    · Show vtp – vtp configs

  19. 9tut
    June 28th, 2012

    @CCNAbeginer: No, we don’t. It is difficult to explain these commands without putting it into a situation. But by practicing questions on this site you can grasp most of them.

  20. Anonymous
    July 4th, 2012

    @9tut
    Am very grateful….I am preparing for CCNA, expected to take an exam next month! every time i go thorugh the tutorials and questions in here…i get hit by this strong force of confidence that i am ready to take the exam by tommorow morning! I knw I am going to pass the exam and you (9tut) are going to be one of the very big force behind my success….you gonna be my hero!

  21. ropam
    July 4th, 2012

    @9tut
    Am very grateful….I am preparing for CCNA, expected to take an exam next month! every time i go thorugh the tutorials and questions in here…i get hit by this strong force of confidence that i am ready to take the exam by tommorow morning! I knw I am going to pass the exam and you (9tut) are going to be one of the very big force behind my success….you gonna be my hero!

  22. WarFreak
    July 13th, 2012

    Thanks. Very useful site.! What is your name 9tut :) heh cheers

  23. vishwajit
    July 13th, 2012

    9tut is a great website…

  24. CCNA-Student44
    July 17th, 2012

    Hi 9tut,
    just wanted to clarify one thing about OSPF..I know its very dumb or silly doubt but … in above tutorial there is a statement regarding OSPF – “The entire routing table is transmitted once every 30 minutes” and when I was checking OSPF questions

    [CCNA – OSPF Questions 2] – Q2 it says “Unlike Distance vector routing protocol (which utilizes frequent periodic updates), link-state routing protocol utilizes event-triggered updates (only sends update when a change occurs) -> D is correct but E is not correct.”

    So, OSPF does both periodic updates as well as event-triggered updates. Please clarify!

    Thanks,
    CCNA-Student44

  25. 9tut
    July 18th, 2012

    @CCNA-Student44: The main advantage of link-state protocol over distance vector protocol is it utilizes event-triggered updates. This is also the main point of Q2 when asking “representative characteristics of a link-state”.

  26. rakesh
    August 14th, 2012

    explanation of Question 2 under section “OSPF Questions 2″ and the Key point “The entire routing table is transmitted once every 30 minutes” contradicts..

  27. 9tut
    August 14th, 2012

    @rakesh: Maybe this tutorial causes some confusion about the link-state routing protocol so I decide to remove the “The entire routing table is transmitted once every 30 minutes” because it is not the key point of OSPF. But you should know even the link-state protocol sends entire routing table every 30 minutes.

  28. balvinder
    August 22nd, 2012

    can anybody tell me how many router we can connect in single ospf area

    and

    how may area we can connect in area 0

  29. TG
    August 22nd, 2012

    Just like Usian Bolt warms up his pistons before his 100m drag… ;-D I am revising it for ICND2, appearing on 27th of August

  30. traffikator
    August 22nd, 2012

    + 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
    This is INCORRECT!!! I am surprised how many people get this so wrong! You do not need an area 0 if you have only one area. Even if you have only two areas, OSPF functions great without the need for an area 0/backbone. It only becomes necessary when you have three or more areas. Please correct this mis-information. If you need a full explanation, well you can get it…

  31. traffikator
    August 22nd, 2012

    By the RFC, the OSPF database must be refreshed in 60 minutes, the default implementation of some vendor’s is 30 minutes, Juniper use 50 minutes. The LSA’s have a timer when installed and gets flushed just before that expiry time. So since every LSA did not get into the LS db at the same time, they will get flushed at different times. So the timing is key. If all LSA’s were installed at the same time, then they would all be flushed within that 30/50 minute period.

  32. Ankit
    August 25th, 2012

    Is there any difference between a Master Router and a designated Router ?? Or they both are one and the same thing ? If there is any difference care to explain !!! Thanks !!

  33. Ravi
    August 27th, 2012

    to form a neighbor in ospf network hello and dead time should match along with area name password process id and network type

  34. sainyi
    August 29th, 2012

    i can’t understand OSF area very well.
    how can i study easy to understand

  35. saheed adebare
    September 13th, 2012

    pls,ao can we router ID and loop interface

  36. Shaukat hayat
    September 15th, 2012

    Hi everyone
    i need latest ccna dumps.. any body have the latest dumps plz send me on email engr.hayat@gmail.com. plz help me
    Thnks

  37. Racho Panadero
    September 30th, 2012

    I was wondering a am about to take the exam first week of october. is it enough mastering the dumps for the exam? I am just curious as well are the multiple choice answers jumbled too the same way the randomly pick the questions from the dumps thank you very much for your response to my question.

  38. David Doss
    October 3rd, 2012

    please send me the latest dumbs to my email … my id is david.doss12@gmail.com .. PLS

  39. Abdul
    October 9th, 2012

    Hi

    Could you please send me the latest dumps for the CCNA. Many thanks
    azidouri@hotmail.com

  40. Shanaka
    October 24th, 2012

    could you please send me some ospf and eigrp lab practicals to shanakawinfox@gmail.com

    thnk u 9tut

    best regards

    shanaka silva

  41. Anonymous
    November 4th, 2012

    perfect document

  42. He-Man
    November 14th, 2012

    May I please get the latest and greatest dumps for CCNA. please email them to risk94@yahoo.com

    many thanks

  43. suresh
    November 17th, 2012

    y u cold not explain wildcard mask.ospf can’t understand the host bit or network bit…

  44. Riquelme
    November 20th, 2012

    so sorry there is something happened plz send the latest dumps again altango78@hotmail.com

  45. tinasoft
    November 25th, 2012

    i need deatel infomation more and more OSPF,you can send tudq@solicomvn.com
    thank so much

  46. Zeebra2012
    November 29th, 2012

    Hell guys,
    Am going to sit for CCNA next week: could someone sendme the latest dump to zeebra2012@hotmail.ca

  47. Ashwini
    December 6th, 2012

    you could download from examcollection.com

  48. Ameh Desstiny
    December 10th, 2012

    pls good frds, am preparing for my ccna exams, pls help me with the latest dumps
    my email” liuken247@yahoo.com

  49. Elenita
    December 10th, 2012

    *****Router D will be elected DR, and rouetr C will become the BDR. Router D will be elected DR, and rouetr B will remain the BDR. Router C will become the DR, and rouetr B will become the BDR. Router B will remain the BDR, and OSPF will function on the segment via the use of only the BDR.If the rouetrs are restarted D will have the highest priority and C owns the highest Loopback IP.

  50. Brendyta
    December 11th, 2012

    Question 41 the corect anresws are:***Router B will remain the DR, and router C will remain the BDR.Router D will be elected DR, and router B will remain the BDR.Router C will become the DR, and router B will become the BDR.Router B will remain the BDR, and OSPF will function on the segment via the use of only the BDR.

Comment pages
Add a Comment