You are on page 1of 41

By Bill Reed

Single Area OSPF


Explanation & Configuration

By Bill Reed

We Will

Examine the advantages of using a Link State routing protocol like OSPF over using Distance Vector routing protocols like RIPv1 or RIPv2. Identify the way routers running OSPF establish relationships with neighbours, and then communicate with them. Explore the way we configure OSPF in a single area environment.

By Bill Reed

Why should we prefer Link State over Distance Vector?


Scalability. Convergence time. Efficiency and operational advantages.

By Bill Reed

Scalability.

RIPv1 and RIPv2 cannot scale beyond 15 hops and takes no account of the bandwidth of the routes that they choose to use.

OSPF is very scalable, it may be used in a single area for small networks or can be scaled to use multiple areas and support large networks.

By Bill Reed

Convergence time.

RIP networks can take several minutes to converge because the routing table of each router is shared and copied in its entirety with directly connected routers.
OSPF only updates its neighbours with the changes in the network this is called an incremental update, these updates are confined to only one area and this serves to speed up the process of convergence.

By Bill Reed

Efficiency and operational advantages.

OSPF makes far more efficient use of routing updates than Routing Information Protocol does.
Any instability in an OSPF area is confined to that area alone.

By Bill Reed

How OSPF functions.

A router running OSPF holds three databases in its memory.


Topological Database
Routing Table

Adjacencies Database

By Bill Reed

How OSPF functions.

Adjacencies Database

This contains a list of all the routers that this router has established bi-directional communication with!

Topological Database.

Also known as the Link-State Database Same for all routers in the same area! Who is connected to what! A router with multiple interfaces can exist in more than one area at the same time!

Routing Table.

Also known as a forwarding Database This holds the information about the lowest path cost routes to other routers!

By Bill Reed

How OSPF functions.


Seven State Process

Routers running OSPF attempt to form adjacencies to the routers running OSPF who are directly connected to them and having done so transfer information to those routers about its own link states.
They achieve this by going through a seven state process that defines the relationship between the two directly connected routers. Down Init Two way Exstart Exchange Loading Full adjacency

By Bill Reed

How OSPF functions.


OSPF packet types

OSPF routers reduce the number of routing information exchanges by electing a DR (designated router) and a BDR (backup designated router). These routers serve as focal points for the exchange of routing information.

During this seven step process the routers utilise 5 types of packets.

Hello packet - Establishes and maintains adjacency information with neighbours Database description packet Describes content of routers link-state database Link state request Requests specific pieces of linkstate information Link state update Transports LSAs to neighbour routers Link state acknowledgement Acknowledges receipt of neighbour LSAs

By Bill Reed

How OSPF functions.


The seven state process

Down state.
When in the down state the router running OSPF has not yet exchanged any information with any neighbour router. OSPF is waiting to enter the next state in our seven step process the Init state.

By Bill Reed

DOWN STATE

By Bill Reed

How OSPF functions.


The seven state process

Init state.
OSPF routers send out type 1 hello packets at regular intervals (default is 10 seconds).

When an interface on an OSPF router receives a type 1 hello packet it enters the Init state, the router knows there is someone out there and is waiting to take their relationship to the next state.
A router can be in two kinds of relationships with a neighbour router, Two-way and Adjacency. (as we will see many states exist in between these two relationships). A router must receive a type 1 hello packet in order to start the process of establishing a relationship.

By Bill Reed

INIT STATE

Type 1 hello packet R1 Type 1 hello packet

Ah! I know someone's there Lets move on to the Two-way state

By Bill Reed

How OSPF functions.


The seven state process

Two-way state.
Using type 1 hello packets OSPF routers try to establish a two-way state or bi-directional communication with its neighbour routers on the same IP network.

Type 1 hello packets contain a list of the senders known OSPF neighbours.
When a router sees itself in a type 1 hello packet sent from one of its neighbours it declares that a two-way state exists between them. (No routing information is shared while in the two-way state) in order to share routing information we must establish an adjacency

By Bill Reed

TWO-WAY STATE

Type 1 hello packet R1 Type 1 hello packet One of my Neighbours is R1

I recognise myself In this hello packet! Were now in a Two-way state

By Bill Reed

How OSPF functions.


The seven state process

Ex-start state.
Technically when two routers enter the ex-start state they have formed an adjacency, however they are not yet fully adjacent. The Ex-start state is established by the sending of type 2 DDPs (Database Description Packets), but first the routers use hello packets to negotiate who will be master and who will be the slave router. The routers then use DDPs to exchange a summary of their linkstate databases.

By Bill Reed

EX-START STATE

I will start the exchange because my ID is 192.168.2.5

Type 1 hello packet


No I will start the exchange because my ID is 192.168.2.7 (I am the master)

Type 1 hello packet


Here is a summary of my Link state database

R1
Here is a summary of my Link state database

Type 2 DDP

Type 2 DDP Type 5 LSAck


Thanks for the summary
Thanks for the summary

Type 5 LSAck

By Bill Reed

How OSPF functions.


The seven state process

Exchange state.
In the exchange state the receiving router examines the DDP and compares it with its own link-state database. If there is information in the DDP that does not exist in the routers original link state database then it requests a complete update from the sending neighbour. The exchanging of database information takes place in the loading state.

By Bill Reed

How OSPF functions.


The seven state process

Loading state.
Having examined the contents of its neighbours database and found new information, the receiving router send a type 3 LSR to its sending neighbour. The neighbour that receives the type 3 LSR (link state request) will respond with a type 4 LSU (link state update) these LSUs contain the actual LSAs (link state advertisements). LSAs are at the heart of the OSPF process and once a router receives an LSA it responds with a type 5 LSAck (link state acknowledgment).

By Bill Reed

EXCHANGE / LOADING STATE

Here is a summary of my Link state database

Type 2 DDP
I've found someone listed I didnt know about Send me an update!

Type 3 Link state request


OK heres the information!

Type 4 Link state update R1 Type 5 LSAck


Thanks for the information

Ill add this information to my own database

By Bill Reed

How OSPF functions.


The seven state process

Full adjacency. Now the loading state is completed the routers are fully adjacent. Each OSPF router keeps a list of adjacent neighbours in its adjacency database as we saw earlier. So far we have seen how routers establish adjacencies now we have to examine the rest of the processes that go together to make up OSPF. The 1. 2. 3. 4. 5. functionality of OSPF can be summarised as: Establish router adjacencies Elect a DR and a BDR Discover routes Select the appropriate routes to use Maintain routing information

By Bill Reed

Single Area OSPF


DR and BDR Election

By Bill Reed

How OSPF functions.


DR and BDR Election

For every multi-access IP network one router will be elected as the DR (designated router).
The designated router is charged with two tasks:

1. 2.

to become adjacent to every other router in its area. to act as a spokesperson for the network.

The DR is responsible for sending LSAs to other IP networks and updating routers in its own area.
Because the DR is adjacent to every router in its area it can act as a focal point for collecting routing information from link state advertisements sent by the routers in its area.

By Bill Reed

How OSPF functions.


DR and BDR Election

Because the DR could represent a single point of failure we have to elect a BDR (backup designated router). The BDR must also become adjacent to every router in its area. And serves as a second focal point for LSAs However the BDR is not responsible for sending LSAs to other IP networks or updating routers in its area unless the DR fails.

The BDR maintains a timer on the DRs update activity to make sure that the DR is still active. If the BDRs timer expires before update traffic is detected then the BDR takes over the role of the DR, and a new BDR is elected.
On a point to point network no DR / BDR election takes place.

By Bill Reed

How OSPF functions.


DR and BDR Election

Multi-access networks support more than two routers and so we must elect a DR and a BDR. The criteria for the election process is as follows:

1. 2.

Priority setting Router ID

The priority of a router can be set by the administrator.

By default the priority is set to 1 The range available to the administrator is between 0 and 255 If priority is set to 0 then that router can never be elected a DR In the event of a priority tie then the router ID decides the election Router ID is the highest IP address on the box unless a loopback address is configured.

By Bill Reed

How OSPF functions.


Discovering Routes

We covered the process of discovering routes earlier when we looked at the Ex-start, Exchange and Loading states. We used: Type 1 hello packets Type 2 Database Description Packets Type 3 Link State Requests Type 4 Link State Updates Type 5 Link State Acknowledgements

By Bill Reed

How OSPF functions.


Selecting Appropriate Routes

Once we have established adjacencies and have a complete link state database we need to create a routing table in order to forward traffic across our network.
OSPF uses cost as its metric value to determine the best route to a destination. Cost is based upon the bandwidth of the media and in general the cost decreases as the bandwidth of a link increases. A 10 mbps Ethernet link will have a lower cost than a 1.544 mbps T1 link.

By Bill Reed

How OSPF functions.


Selecting Appropriate Routes

When OSPF calculates the best route to a destination it uses the Shortest Path First algorithm or (DIJKSTRA algorithm).
Basically put, the SPF algorithm adds up the costs of all the links between a local router (known as the root) and its destination network, it is the product of this calculation that is used to determine the best path which it then places in its routing table. If there are multiple paths to a destination network then the route with the lowest cost will be the preferred route.

N.B. routers can hold up to 4 equal-cost routes to a destination network, this facilitates load balancing.

If a link rapidly goes up and down (Flapping), then this can cause a router to overtax its CPU by continually trying to run the SPF algorithm on the new data. OSPF deals with this by the implementation of hold timer. This timer governs how long the router will wait before running the SPF algorithm again.

By Bill Reed

How OSPF functions.


Maintaining Routing Information

Routing information in the routers routing table must be kept up to date and accurate. When a router notices a change to its link states it sends this change to its DR using the multicast address of 224.0.0.6 The DR will acknowledge receipt of the information with a LSAck then update all the other routers in its area by sending the information using the multicast address 224.0.0.5
Once a router receives a LSU it updates its link state database and then runs the SPF algorithm using the new information to recalculate its preferred routes.

If a route already exists then the router will use the old route while it runs the SPF algorithm on the new data. OSPF information is updated whether a change has occurred or not, every 30 minutes by default.

By Bill Reed

Single Area OSPF


Configuration

By Bill Reed

How OSPF functions.


Configuration

Step 1

Configure OSPF on the router and assign it a process number.

R1(config) # router ospf 1 R1(config-router) # network network address / wildcard mask / area

Network

Identifies the directly connected network addresses.

Wildcard mask

Allows the administrator precise control over which interfaces can participate in the OSPF routing process. And is necessary because OSPF supports VLSM. Places the OSPF process into a discrete network area for administrative purposes. Area 0 designates the backbone area (there must always be a backbone area configured)

Area

By Bill Reed

How OSPF functions.


Configuration

Step 2

Verifying your configuration

R1 # show protocols

This command will display some important information about the OSPF process running on your router.

Update, invalid and hold down timers

All set to 0, OSPF is event driven, updates are not sent at predetermined intervals. Routing information sources:

Routers that have supplied updates are listed under the heading

By Bill Reed

How OSPF functions.


Configuration

We continue looking at commands used to verify our configuration or gather valuable information about our OSPF process.

R1 # show ip ospf 1

This command provides statistics about the OSPF process and can be very useful when trying to confirm a suspicion that an interface is flapping by
looking at the number of times that the SPF algorithm has been executed.

By Bill Reed

How OSPF functions.


Configuration

We will now explore the command for, and the reasoning behind setting a loopback address on our router.

R1(config) # interface loopback 0 R1(config-if) # ip address 192.168.1.1 255.255.255.0

We set a loopback address to make our network more stable.

If the interface that constitutes our router ID on our DR or BDR goes down this can trigger a re-election of our DR or BDR. A loopback interface is immune to link failure and therefore ensures stability.

A loopback address will always be used as the router ID if one is configured on the router. In order for the loopback address to take effect it must be configured prior to the starting of the election process.

By Bill Reed

How OSPF functions.


Configuration

We have discussed earlier how an OSPF routers priority can effect the DR and BDR election process. We can modify the priority setting on a router with the following commands:

R1 (config) # interface ethernet 0 R1(config-if) # ip ospf priority 0

The priority must be set before the election takes place to have any effect on the outcome. We can examine the results of an election by using the command:

R1 (config) # show ip ospf interface ethernet 0

By Bill Reed

How OSPF functions.


Configuration

We have seen how the cost of a link can determine if it is used as a preferred route or not We can modify the cost of a link with the following commands:

R1 (config) # interface ethernet 0 R1(config-if) # ip ospf cost 1000

The above commands can be used to override the default values for a link and can be a range between 1 and 65,535. By changing the value of the cost metric we can influence the desirability of a link and therefore its use as a preferred route.

By Bill Reed

How OSPF functions.


Authentication

OSPF authentication ensures that information coming from a router is in fact from that router and not from another source.

R1(config) # interface serial 0/1 R1(config-if) # ip ospf message-digest-key 1 md5 barnfield R1(config-if) # exit R1(config) # router ospf 55 R1(config-router) # area 0 authentication message-digest R1(config-router) # end

The configuration above enables MD5 authentication and defines the encryption key (a password on an interface). Now we must set up authentication on all the other routers in the area.

By Bill Reed

How OSPF functions.


Authentication

We enter essentially the same commands into all the other OSPF routers in our area as follows:

R?(config) # interface serial 0/0 R?(config-if) # ip ospf message-digest-key 1 md5 barnfield R?(config-if) # exit R?(config) # router ospf 12 R?(config-router) # area 0 authentication message-digest R?(config-router) # end

We can verify our authentication by entering the command: R?(config) # show ip ospf interface serial 0/0

By Bill Reed

OSPF

Is a link state routing protocol Makes more efficient use of bandwidth the RIP Is more scalable than distance vector routing protocols Uses a seven stage process to establish adjacencies Makes use of five types of hello packets Elects a DR and BDR to talk to other networks Runs the SPF or DIJKSTRA algorithm on its link state database to determine preferred routes Updates routing information every 30 minutes (default ) unless a change occurs OSPF uses multicast addresses to communicate between DR, BDR and other routers in an OSPF area

By Bill Reed

OSPF

Practical Exercise

You might also like