Introduction
OSPF is an open source Routing protocol that handles routing for IP traffic standardized in IETF RFC2328.
OSPF is classified as an Interior Gateway Protocol (IGP). This means that it distributes routing information between routers belonging to a single Autonomous System. The OSPF protocol is based on link-state or SPF technology.
It was designed mainly for the TCP/IP internet environment. Main focus was to produce a protocol that responds quickly to topology changes, with small amounts of control traffic. OSPF is a dynamic routing protocol. It quickly detects topological changes in the AS (such as router interface failures) and calculates new loop-free routes after a period of convergence. This period of convergence is short and involves a minimum of routing traffic.
OSPF routes IP packets based solely on the destination IP address found in the IP packet header. IP packets are routed “as is” — they are not encapsulated in any further protocol headers as they transit the Autonomous System.
OSPF uses Port 89 (IP) for Transport (own transport, not TCP/UDP).
OSPF Attributes (Summary)
OSPF Router IDs
Every Person/machine/protocol needs an ID in this world & so is the OSPF.
OSPF Router ID (aka Router Identifier) is a 32-bit number (like an IP address) that uniquely identifies this router in the Autonomous System (AS is like a whole world for OSPF).
If a router’s OSPF Router ID is changed, the router’s OSPF software should be restarted before the new Router ID takes effect.
Most of Routers (including Cisco) derive the Router ID in one of three ways and with the following precedence order:
- Manually configured Router ID
- Highest Loopback address
- Highest Physical IP address on the router
OSPF Router types
When whole AS is one area then there Internal & External Routers only.
But when the AS is divided into areas then the routers are further divided according to function into the following four overlapping categories:
i. Internal router (IR)
A router that has all its interfaces belonging to the same OSPF area
ii. Area border router (ABR)
A router that connects one or more areas to the main backbone network
iii. Backbone router (BR)
A backbone router has an interface to the backbone area
iv. Autonomous system boundary router (ASBR)
An autonomous system boundary router is a router that is connected by using more than one routing protocol and that exchanges routing information with routers autonomous systems.
DR & BDR in OSPF
Problems (without DR): When multiple OSPF routers are connected to a multi-access medium the networks, there are two problems that arise:
Problem1: High Number of Adjacencies (A large number of adjecancies is required as in fig below)
Problem2: LSA flooding (Traffic increases exponentially because every router needs to flood its information to all other routers in the OSPF domain & for every LSA sent out there must be an acknowledgement sent back. It wastes a lot of BW)
Solution (with DR): To resolve these problems & control the un-necessary flooding of information, DR/BDR solution was proposed. With DR/BDR solution,
- Adjacencies are formed with DR/BDR only.
- All routers send LSA’s to DR only, DR sends out LSA’s to all other Routers.
Designated Router (DR) reduces the network traffic significantly. DR’s reduce network traffic as only they maintain the complete ospf database and then send updates to the other routers on the shared network segment.
Backup Designated Router (BDR) is simply a backup/standby of the DR. If DR fails then BDR takes its position.
DR/BDR Election Process
DR is chosen in below order:
– Highest OSPF priority (default priority is 1), if all are equal then:
– Highest OSPF Router ID, then
– Highest loopback interface, then
– Highest physical interface (should be up/up)
Then Router with the second preference in above list becomes the BDR.
Important Points about DR/BDR:
DR/BDR elections DO NOT occur in point to point networks
In DR/BDR, there is no preemption. Meaning that when a DR goes ofline, the BDR takes his place and when it comes back online it wont be the DR again, for it to be considered for another election process in a network segment, all DR/BDR must go offline so that one router can become the DR again for that segment.
OSPF Metric (Cost)
Every protocol uses some calculations (metrics) to judge a path’s feasibility (when multiple paths exist to for same destination). OSPF uses cost as metric for this purpose.
Logically a packet will face more overhead in crossing a 56Kbps serial link than crossing a 100Mbps Ethernet link. Respectively it will take less time in crossing a higher bandwidth link than a lower bandwidth link. OSPF uses this logic to calculate the cost. Cost is the inverse proportional of bandwidth. Higher bandwidth has a lower cost. Lower bandwidth has a higher cost.
To calculate cost, we have to use some reference Bandwidth to calculate cost. Reference Bandwidth for OSPF is 100 Mbps for cost calculation. The best route will have the lowest cost. Reference bandwidth defaults to 100Mbps (10^8) & can be modified with command.
Formula to calculate OSPF Cost:
Below is the table for reference Bandwidth:
well … the post is really nice & concise.
If you answer that what is the role of topology and routing table in OSPF?
Thanks.
The OSPF process builds and maintains three separate tables:
1. A neighbor table (list of all neighboring routers)
2. A topology table (list of all possible routes to all known networks within an area)
3. A routing table (best route for each known network)
The COST depends on what? Is it only Bandwidth or some other factors as well?
Yes, it is based on the cost formula:
Cost = reference bandwidth / interface bandwidth
Awesome Graphix!!! 🙂
Nice Post!!
Why is OSPF heavier than any Distance Vector Routing Protocol?
Because OSPF is based on dijkstra’s algorithm which needs a lot of overheads.
Routing overhead is the amount of information needed to describe the changes in a dynamic network topology.
Thx
How is DR & bDR are selected & which one is selected first?
If we dive in deep then BDR is elected first.
But the election process for both DR/BDR is same:
– Highest OSPF priority (default priority is 1), if all are equal then:
– Highest OSPF Router ID, then
– Highest loopback interface, then
– Highest physical interface (should be up/up)
Can we have BR & IR roles on the same Router in one ospf area?
Yes, we can have.
The port 89 of OSPF is TCP or UDP Port?
It is neither TCP nor UDP. OSPF uses its own port on plain IP which is Por89.
What are the roles of 224.0.0.5 and 224.0.0.6 in OSPF messages. I have tried many forums but I cannot find any satisfaction level answer?
These are the important roles associated with both types of Multicast Addresses. Hope, I was able to answer you now ….
All OSPF routers(DR/BDR/DROTHER) send Hello on 224.0.0.5
All OSPF routers(DR/BDR/DROTHER) listen on 224.0.0.5
All DROTHER(non-DR/BDR) routers send their LSAs to 224.0.0.6
All DR/BDR listen on 224.0.0.6
All DR/BDR send LSU/LSA on 224.0.0.5
What is recommended/optimal range of no. of OSPF areas on a router?
It depends on the Router platform/SW version & capabilities. Generally, recommended no. of areas per Router for typical ISP design is 1-3 (more than 3 will overload the CPU).
OK I got it, thanks.
one more question, if a router boarders 2 areas but neither area is area 0 is it still an ABR?
No. It is a hard and fast rule that multi-area OSPF must have an area 0.
What happens if DR and BDRs are elected in an area of Ethernet segment and the area has a combination of both p2p and p2mp links?
Always remember, if a router participates in DR/BDR election then it means that the interface type is set to broadcast. This happens for every interface that is set to broadcast. It doesn’t matter what the actual media is.
And also keep in mind, elections do not take place on p2p links if they are configured as such.
In either case, the area ID has no bearing on whether the election takes place or not.
Bravo!
If ABR and ASBR roles are on the same Router then what difference they have?
As I wrote in post, ABR’s (Area Border Router) are at the boundary of areas and they let OSPF know about the different areas, while ASBR’s let OSPF know about the external routes. So, both have their own functions. It doesn’t matter whether they are on same Router or different Routers.
Long time back, I also wrote a post on OSPF considerations: http://www.mplsvpn.info/2009/01/ospf-design-consideration.html
But your post is simply awesome!!!
Still very helpful, following you from almost a year.
Going to have to rethink some of our OSPF concepts.
Thank you for this post.