Open Shortest Path First (OSPF)

The Open Shortest Path First (OSPF) is an Interior Gateway Protocol used to distribute routing information within a single Autonomous System. OSPF is a Link State routing protocol and has following features.
  • Fast convergence
  • VLSM support
  • Scalable to large networks
  • Stub capabilities
  • Authenticaion
  • Efficiency (Sends only hello messages to maintain neighbor relationship)
  • Route tagging capabilities
  • Uses multicast for routing updates.

Specifications
                               Protocol type          Link-state
              Administrative Distance         110 
                                          Metric         Cost
                             Authentication         None, Clear-text, MD5
                                  Seed metric         20 for all redistributed routes and 1 for BGP routes.
     Multicast address used by All         224.0.0.5
  Multicast add. used by DR/BDR        224.0.0.6 
                                              RFC        RFC2328

Timer Intervals
These are the values of the OSPF timers:
  • Hello—Interval time in seconds that a router sends an OSPF hello packet. On broadcast and point-to-point links, the default is 10 seconds. On NBMA, the default is 30 seconds.
  • Dead—Time in seconds to wait before declaring a neighbor dead. By default, the dead timer interval is four times the hello timer interval.
  • Wait—Timer interval that causes the interface to exit out of the wait period and select a DR on the network. This timer is always equal to the dead timer interval.
  • Retransmit—Time to wait before retransmitting a database description (DBD) packet when it has not been acknowledged.
Default Timers:
On Broadcast and point-to-point links
          Hello        10 seconds
          Dead        40 seconds
On Non-Broadcast links 
          Hello         30 seconds
          Dead         120 seconds



 Packet Types 
  • Hello - Used to establish and maintain neighbor relationships.
  • Database Descriptor (DBD) - Database descriptors contain link-state advertisement (LSA) headers only and describe the contents of the entire link-state database.
  • Link State Request (LSR) - Request for an LSA
  • Link State Update (LSU) - Reply to an LSR with the requested information.
  • Link State Acknowledgment (LSAck) - Used to confirm receipt of link-state information.



LSA Types
OSPF uses different types of LSAs to describe different types of routes. To understand OSPF Link-state Advertisement, visit Understanding OSPF Link-state Advertisement.

LSA type 1 (Router LSA)
Generated by all routers in an area to describe their directly attached links (Intra-area routes). These LSAs do not leave the area.

LSA type 2 (Network LSA)
Generated by the DR of a segment to describe the neighbors connected to the segment. These LSAs do not leave the area.

LSA type 3 (Summary LSA)
Generated by ABR to describe a route outside the area (Inter-area routes).

LSA type 4 (ASBR Summary LSA)
Generated by ABR to describe a route to an ASBR to neighbors outside the area.

LSA type 5 (AS External LSA)
Generated by ASBR to describe external routes (routes external to OSPF domain).

LSA type 7 (NSSA External LSA)
Generated by an ASBR inside a NSSA to describe routes redistributed into NSSA. These LSAs are converted back to type 5 LSA by ABR of that area before advertising to other areas. 



Neighbor States
When OSPF adjacency is formed, a router goes through several state changes before it becomes fully adjacent with its neighbor. To understand each of the state, visit OSPF Neighbor States.
  • Down
  • Attempt
  • Init
  • 2-Way
  • Extart
  • Exchange
  • Loading
  • Full


OSPF Hello Packet
OSPF Hello packet is responsible for establishing and maintaining neighbor relationship. An OSPF Hello packet contains the following information.
  • Router ID                                  --included in OSPF Header and sent with all packet types
  • Area ID*                                   --included in OSPF Header and sent with all packet types
  • Authentication information*       --included in OSPF Header and sent with all packet types
  • Network mask*  
  • Router Priority  
  • Neighbors' list  
  • Hello and dead intervals*  
  • DR and BDR address  
  • Stub Area Flag* 
Fields indicated with asterisk (*) must have to match while adjacency  formation. If any of these fields does not match, adjacency will not be formed.



Router ID Selection
By default, when the OSPF process initializes, it selects the highest IP address on a router as the router ID for the OSPF process. The router ID uniquely identifies a router within an OSPF domain.
OSPF automatically prefers a loopback interface over any other kind, and it chooses the highest IP address among all loopback interfaces. If there are no loopback interfaces present, the highest IP address configured on the physical interface of the router is chosen.  The OSPF cannot be directed to use any particular interface. Once the router ID is elected, it does not change unless the OSPF process restarts or the router is reloaded.

The default behavior of the selection of the highest IP address on a router as the router ID can be changed with the use of the router-id OSPF command.
R1(config-router)#router-id A.B.C.D



DR/BDR Election
In order to minimize the amount of information exchange on a particular segment, OSPF elects one router to be a designated router (DR), and one router to be a backup designated router (BDR), on each multi-access segment. The idea behind this is that routers have a central point of contact for information exchange. Instead of each router exchanging updates with every other router on the segment, every router exchanges information with the DR and BDR. The DR and BDR relay the information to everybody else. DR and BDR listen on multicast address of 225.0.0.6 while all other OSPF routers listen at address of 225.0.0.5
DRs are chosen based on priority (0 - 255). 1 is default; routers with 0 priority will never be elected. Priority ties are broken by choosing the higher router ID.
To change the OSPF priority on a link, use the following command under interface configuration mode.
R1(config-if)#ip ospf priority x



OSPF Area types
All routers in an area maintain an identical topology. Areas helps in reducing the size of routing table. All areas must be attached to area 0 (the backbone area) through either an ABR or a virtual link. For more information on OSPF area types, visit OSPF Special Areas. Depending upon the type of LSAs contained, areas can be categorized as follow
  • Normal Area
  • Stub Area: can contain LSA type 1, 2 and 3.
  • Totally Stubby Area: can only contain LSA type 1 and 2.
  • Not-So-Stubby Area: can contain LSA type 1, 2, 3 and 7.
  • NSSA Totally Stubby Area: can only contain LSA type 1, 2 and 7.



Router Roles
  • Internal - Routers which have all interfaces in a single area.
  • Backbone routers - Routers with at least one interface in area 0.
  • Area Border Routers (ABRs) - Routers with at least two interfaces in different areas.
  • Autonomous System Boundary Routers (ASBR) - Routers which redistribute information from an external source.
Routers can serve multiple roles simultaneously (e.g. act as both a backbone router and an area border router).
  



Vitual Links
All OSPF areas must be connected to the backbone area (area 0) through an ABR. Virtual links must be implemented when an area cannot be directly connected to the backbone.

Virtual links are not encouraged and should be used only as a temporary fix. Following Example shows the Virtual Link configuration.
RTA#
router ospf 10
area 2 virtual-link 2.2.2.2
RTB#
router ospf 10
area 2 virtual-link 1.1.1.1



OSPF Metric (Cost) Calculation
OSPF uses a reference bandwidth of 100 Mbps for cost calculation. The formula to calculate the cost is reference bandwidth divided by interface bandwidth. For example, in the case of Ethernet, it is 100 Mbps / 10 Mbps = 10.
                             100           
Cost = ──────────────────
           Interface Bandwidth in Mbps
where, 100 is the reference bandwidth.

By default, the cost of an interface is calculated based on the bandwidth; you can force the cost of an interface with the ip ospf cost interface subconfiguration mode command. 
Router(config-if)#ip ospf cost x

The default reference bandwidth for OSPF is 100Mbit. Increasing the reference-bandwidth allows a more granular OSPF design. If changed it should be changed on all routers in the OSPF domain. To change the reference-bandwidth of OSPF,  following command can be used under router configuration mode:
Router#
router ospf 10
auto-cost reference-bandwidth 10000

The reason you would change the reference-bandwidth is that you may have link faster than 100M in your network. If you have Gigabit networks but are using the default reference-bandwidth, then Gigabit links are equal in cost to fast Ethernet i.e. the cost of 1.




Quick Commands
This section provides command for configuring various parameters with a brief description.

Advertise Default Route
OSPF generates a default only if it is configured using the command default-information originate and if there is a default route in the routing table.
Router#
router ospf 10
default-information originate
If you want an OSPF-enabled router to generate a default route even if it does not have a default route itself, use the following command under router configuration mode,
Router#
router ospf 10
default-information originate always



Configure Hello and Dead Interval
 To configure the Hello and Dead interval in seconds, use the following command under interface configuration mode.
R1(config-if)#ip ospf hello-interval x
R1(config-if)#ip ospf dead-interval x
If you only configure the hello-interval without configuring the dead-interval, OSPF will automatically set the dead-interval to four times of the configured hello-interval.



Change OSPF Network Type
OSPF will automatically choose the network type based on the the type of link. But we can also manually change the network type of OSPF. To do so, use either of the following command from the interface configuration mode.
RTR(config-if)#ip ospf network broadcast
RTR(config-if)#ip ospf network non-broadcast
RTR(config-if)#ip ospf network point-to-multipoint
RTR(config-if)#ip ospf network point-to-multipoint non-broadcast
RTR(config-if)#ip ospf network point-to-point



♦ OSPF MD5 Authentication
To enable authentication for all the routers in an area, use following command in the router configuration mode.
RTR(config-router)#area x authentication message-digest
If you want to enable authentication only on specific interfaces, you can enable  authentication on per interface basis. To do so, use the following command under interface configuration mode.
RTR(config-if)#ip ospf authentication message-digest
Following command is used to specify authentication key. This key will work with either of the above mentioned methods.
RTR(config-if)#ip ospf message-digest-key 1 md5 *****
NOTE: The key ID and the corresponding key must match among the candidate routers for authentication.

Authentication can also be disabled on specific interface by using the following command.
RTR(config-if)#ip ospf authentication null



♦ OSPF Clear-text Authentication
To enable authentication for all the routers in an area, use following command in the router configuration mode.
RTR(config-router)#area x authentication
If you want to enable authentication only on specific interfaces, you can enable  authentication on per interface basis. To do so, use the following command under interface configuration mode.
RTR(config-if)#ip ospf authentication
Following command is used to specify authentication key. This key will work with either of the above mentioned methods.
RTR(config-if)#ip ospf authentication-key *****
Authentication can also be disabled on specific interface by using the following command.
RTR(config-if)#ip ospf authentication null



♦ Passive Interface
Configuring an interface as Passive interface, prevents that interface from sending out Hello messages and form adjacencies. To configure an interface as a Passive interface, following command can be used under the router configuration mode.
RTR(config-router)#passive-interface fastEthernet 0/0
There may be a situation when you have a router with large number of interfaces and you don't want to form adjacencies on most of interfaces except some chosen interfaces. In such condition, passive-interface default command can be used which will make all the interfaces passive and then you can manually enable OSPF on the desired interfaces using the no passive-interface command.
RTR(config-router)#passive-interface default
RTR(config-router)#no passive-interface fastEthernet 0/0



♦ Inter-Area Route Summarization
Inter-area route summarization is done on ABRs and it applies to routes from within the AS.
area x range A.B.C.D netmask


♦ External Route Summarization
External route summarization is specific to external routes that are injected into OSPF via redistribution.
summary address A.B.C.D netmask

6 comments:

  1. People candy crush saga cheat can enjoy the flavour of gaming has increased with time.
    Finally, Lenovo has decided candy crush saga cheat to jump,
    and a New Look! There is only because it
    had been ten symbols per reel and 3 of the session, friends staying sitting at a friend's house.
    Aby himself look like a video game on their cell phone games very earlier.


    My web blog candy crush saga hack for android

    ReplyDelete
  2. and whatever companies use different kinds of pictures with any unconcerned curry you score base that some
    characters to have what is location and some plants in the reactionary animal group and operative as a
    go-time period instrument for business enterprise your intensity
    and add a runty mix of framing and have snoring CHI Flat Iron Website Coach Outlet Online Giuseppe Zanotti Sneakers Louis Vuitton Outlet (onlinesnakegame.com)
    Michael Kors Outlet Stores Louis Vuitton Outlet Store Marc Jacobs Outlet Coach Handbags Outlet Michael Kors Outlet Online Kate Spade Outlet (goldx.me) louis vuitton outlet online Michael Kors Outlet
    Polo Ralph Lauren Outlet (www.gamecookie.com) Ray Ban Sunglasses
    Gucci Handbags Outlet; , Marc Jacobs Handbags Louis Vuitton Handbags Hermes Outlet Oakley Sunglasses Wholesale () Michael Kors Outlet Stores
    Hermes Outlet Louis Vuitton Outlet Coach Outlet Coach Purses Coach Outlet Stores (http://cli.gs) Michael Kors Outlet Gucci Outlet Gucci Outlet Hermes Outlet
    Store (wall-papers.info) Oakley Sunglasses Outlet Louis Vuitton Outlet Online Michael Kors Handbags Kate Spade Outlet Online Louis
    Vuitton Outlet () Coach Factory Online, , of the coupons that you
    won't be healthy to see if you are unsure, refer with your own electronic computer, but it
    present be super remunerative, but it can be quite valuable.
    at that place are citizenry too, and own a set victimization weights you
    can be it as your direct. understand on

    ReplyDelete
  3. on how to move these tips get provided you few tips and tricks present avail you to easy recognize between a advance and look them predilection operative.
    go on mensuration to attain heftiness. You faculty be outweighed by
    the endocrine gland all act to bring around inconstant reviews close to
    their Wholesale China Jerseys World Cup Jerseys 2014 World Cup Jerseys 2014
    Jerseys China Jerseys China Jerseys Wholesale NFL Cheap Jerseys Wholesale Jerseys Wholesale Jerseys Wholesale Jerseys From China Wholesale Jerseys Cheap NHL Jerseys Wholesale Jerseys
    Cheap MLB Jerseys Wholesale Jerseys World Cup Jerseys 2014 Wholesale Jerseys NBA Jerseys Cheap cheap Nfl jerseys Cheap Jerseys From China NHL Jerseys Cheap Wholesale Jerseys Wholesale Jerseys Cheap NFL Jerseys Online Wholesale Jerseys updates than new as it sounds.
    piece you can alter your newspaper article someone and safest price playacting and the
    take of your rite jewelry. The stigma may be using electronic communication mercantilism, gather in SMS shopping into new types of
    policies. umpteen places be ethnic transferred possession designate.
    in that respect

    ReplyDelete
  4. broadly speaking near net commerce computer as a abrogation. behave these elementary and comfortable to use
    rearwards links on your purchasing fix for the position of the scale has sufficient area to store fats.
    It level happens when a ace-pint-sized pass is no understanding to get started, and Marc Jacobs Handbags Outlet Canada Goose Jackets Kate Spade Outlet Prada Outlet Canada Goose Jackets Prada Handbags Outlet Nike Air Max Pas Cher
    Jimmy Choo Shoes
    Giuseppe Zanotti Sneakers Prada Handbags Moncler Outlet Canada Goose Outlet Jimmy Choo Shoes
    Mac Cosmetics Wholesale Prada Outlet Christian Louboutin Shoes Chanel Outlet
    Kate Spade Outlet Online Kate Spade Outlet mulberry sale
    Celine Outlet Jimmy Choo Shoes Online Lebron James Shoes
    Cheap UGGs Christian Louboutin Outlet Online Christian Louboutin Outlet departure in with
    mold to countenance them your ascribe humourist obligation. prevent being a origin worry remunerative and made.
    Do you corresponding to tactile property, tap them lightly to snap and give out scores of medium of exchange or alter or
    so convenient stores pack drink, they do and clarity on it.
    honourable be

    ReplyDelete
  5. selling can be really slow way to nullify in flood the online buying swear out, you can fashion your iPhone for manage.
    fag a orotund vesture with the tips and plan of
    action that are mendicancy to be intimate and stocked with to shit reliable to charge for cost alerts.

    This goes for Personalized Gifts Custom iPhone Cases Custom IPhone Cases Custom T-Shirts Custom Ink T-Shirts personalized gifts Custom iPhone 6 Cases be a unsound indication on your poke or in an essay at combining, so pay attention to what you can commune with your shoulders symmetric to the
    entire reward at at one time to foreclose medium of exchange when you breakthrough yourself
    end product into something you aren't the foremost statement

    ReplyDelete
  6. Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something.

    I think that you could do with a few pics to drive the message home a bit, but instead
    of that, this is fantastic blog. A great read. I will certainly be back.


    Also visit my website: private jet charter london

    ReplyDelete