Your SlideShare is downloading. ×
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply



Published on

Published in: Technology

1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Open Shortest Path First (OSPF) -Sheela Anand -Kalyani Ravi -Saroja Gadde
  • 2. What is OSPF ? • OSPF is a TCP/IP internet routing protocol classified as a IGP. • Its routers are within one Autonomous System(AS). • Is a Link State Protocol based on SPF technology. • Is a dynamic routing protocol which detects topological changes in the AS over a short period of time.
  • 3. Overview of OSPF • Each router maintains a database describing the AS’s topology called the “Link State Database”. • Each participating router has an identical database. • Each individual piece of this database is a particular routers local state. • The router distributes its local state through the AS by flooding. • All routers run the exact same algorithm in parallel. • From LSD, each router constructs a tree of shortest paths with itself as root (using the Dijkstras algorithm). • This shortest-path tree gives the route to each destination in the AS.
  • 4. WORKING • When a router starts,it first initializes the routing protocol data structures. • It then uses the OSPF’s handshaking Hello Protocol to learn about each other,exchange information and later perform pings with neighbor routers to make certain the link and/or router is up. • Now the peer routers are considered to be merely adjacent (part of synchronization-not complete). • The routers exchange information describing their knowledge of the routing domain.This information is called database description and is placed in LSA messages.
  • 5. WORKING • Using the above LSA messages the receiving router knows if its LSD is consistent with its peer’s databases.If all is consistent the neighbor is now defined as fully adjacent. • A router periodically advertises its state (link state) to detect dead routers in a timely fashion. • From this database each router calculates a shortest path tree with itself the root. • This shortest path tree in turn yields a routing table for the protocol.
  • 6. OSPF is concerned with Link State Database synchronization and much of the OSPF code is devoted to this very task.
  • 7. Routing protocol packets • Hello packet: It is used to discover and maintain neighbor relationships. • Data Description packet and Link State Request packets:They are used in forming adjacencies. • Link State Update and Link State Acknowledgment packets:Used for reliable update mechanisms.
  • 8. Databases • Neighbor Database: Initial table displaying neighbors learned through Hello packets. • Link State Database: Similar in all routers. Formed after each router floods its neighbor database. • Routing table: Each router builds this table by using SPF technology. It gives the shortest path to all the routers in the AS.
  • 9. Flooding Advertisements • Flooding is a part of the OSPF protocol which distributes and synchronizes the Link State Databases of the routers. • Router 3 uses flooding to perform initial advertisement.
  • 10. Flooding Advertisements • When these neighbors receive the LSA, they check for errors(using checksum), check the LSA packet type and make certain the LSA is more recent than the copy in the LSD. • Assuming the received LSA is new, the routers update their databases, and send this LSA out all their interfaces, except the interface from which the LSA was received.
  • 11. Flooding Advertisements • Eventually, all routers in the routing domain receive the LSA. • These routers are required to send back to the originating neighbor an acknowledgment (ACK) of the transmitted LSA.
  • 12. • Hello packets are sent to discover and maintain neighbor relationships. • After Hello protocol each router has information of its links (neighbors) and the costs associated with them in a table called “Neighbor Table”.
  • 13. • After the Data Description Packets are sent and received, each router contains a map of the topology of the autonomous system or area and the costs associated with all the links that make up the topology in the link state database. • This database is same for all the participating routers within an area. • If no areas exist then the LSD is same for all routers within the AS.
  • 14. • Finally each router uses its LSD and Dijkstra’s algorithm to build a shortest path tree with itself as the root. • A routing table is built which consists of information necessary to forward an IP data packet toward its destination. It describes the best path to a particular destination.
  • 15. AREAS • The OSPF divides or partitions the AS into smaller parts called “areas”. • This reduces the amount of routing traffic that is sent through the AS, because the areas are isolated from each other. • This also reduces the amount of information a router must maintain about the full AS.
  • 16. AREAS • Routers within an area are not concerned about the details of the full AS. They obtain this information from a “designated” router. • Routers connected to multiple areas are called “area border routers”. • A stub area is one into which routing information on external routes is not sent. Instead the area border router generates a default route for destinations outside the area. • OSPF requires that all areas be connected together by a backbone area (area 0). • This arrangement might be too restrictive, since inter-area routing has to involve a backbone router. This can be avoided by the use of “Virtual Links” in which routing packets can be sent from one to another, and not have to traverse over the backbone.
  • 17. AREAS • OSPF routers discover external networks through an external gateway protocol(eg, BGP), and then advertise these networks within the AS with external LSA’s. DESIGNATED ROUTER • OSPF requires that one router be assigned a designated router for a network so that the hosts do not have to be concerned with route advertising. • In broadcast networks designated router is used to reduce the number of potential peer relationships.
  • 18. AREAS • A separate copy of OSPF ’s basic routing algorithm runs in each area.Therefore each area has its own Link State Database and a corresponding graph. • With the introduction of areas not all routers in the AS have an identical Link State Database. • A router has a separate LSD for each area it is connected to. • All the routers in an area have ,for that area ,identical area LSD’s. • Intra Area Routing-Source and destination for a packet reside in the same area. • Inter Area Routing-Source and destination for a packet reside in different areas.
  • 19. Inter Area Routing • The OSPF backbone contains all area border routers. • The backbone is responsible for distributing packets between non backbone areas. • The path that the packet travels can be broken up into three contiguous pieces:an intra area path, a backbone path and another intra area path to the destination.
  • 20. Inter Area Routing • Each area border router in an area summarizes for the area its cost to all networks external to the area. • After the SPF tree is calculated for the area ,routes to all inter area destinations are calculated by examining summaries of the area border routers. • Finally the AS takes the star configuration,with the backbone as hub and each of the non-backbone areas as spokes.
  • 21. Neighbor Table Router 1 Router 2 Sender Hello Neighbor 1 Link State Database Neighbor 2 Neighbor 3 Neighbor 4 Neighbor Table Receiver Hello ACK Database Description Sender Link State Database Neighbor 4 Neighbor 3 Neighbor 2 Routing Table Routing Table Receiver Neighbor 1 Activity Diagram
  • 22. Project Demo • To indicate the router is active the server is run. • We are statically initializing the potential neighbors and their costs. String[] names= {"Poirot", "Cadfael","Netlab1"}; String[] m={"4","5","6"}; • There are multiple threads, one for each router for(int i=0;i<names.length; i++) { new ClientThread(names[i],m[i]); } .
  • 23. Hello Protocol • Hello packets are sent to each router to determine their adjacency. out.println("Hello"); • Every router that receives the Hello packet sends an ACK . if (str.equals("Hello")) { System.out.println("Hello packet"); out.println("hello ack"); }
  • 24. Building Neighbor table • When the hello ACK arrives the router inserts it into the neighbor table. st.executeUpdate( "INSERT INTO table2 VALUES(‘Router’,’its neighbor’,cost)”);
  • 25. • The Link State Database is synchronized by flooding Database Description packets from the neighbor table. for(int l=i;l>=1;l--) { out.println("Database"); out.println(arr[l][1]); out.println(arr[l][2]); out.println(arr[l][3]); }
  • 26. • Once the Link State Database is synchronized across the autonomous system, router calculates shortest paths to all destinations using Dijkstra’s algorithm. functions1.dijkstra(source,v,e,vertices,ed); • Using shortest path tree,router builds routing table which is used in making routing decisions. • When an IP data packet is received, the router finds the routing table entry that best matches the packets destination, and then gives the next hop router to forward the packet.