You are on page 1of 75

Introducing the OSPF Protocol Configuring OSPF

Phung Le Thanh Tung PVHKT-Viettel Telecom

Objectives
Identify the key features of link-state routing Explain how link-state routing information is maintained Discuss the link-state routing algorithm Examine the advantages and disadvantages of link-state routing Compare and contrast link-state routing with distance vector routing Enable OSPF on a router Configure a loopback address to set router priority Change OSPF route preference by modifying the cost metric

Objectives
Configure OSPF authentication Change OSPF timers Describe the steps to create and propagate a default route Use show commands to verify OSPF operation Configure the OSPF routing process Define key OSPF terms Describe the OSPF network types Describe the OSPF Hello protocol Identify the basics steps in the operation of OSPF
3

Table of Content 1 Link-state Routing Protocol 2 OSPF Concepts 3 OSPF Configuration

LINK-STATE ROUTING PROTOCOL

Overview of link-state routing


Protocol Description Characteristics

Distance RIP v1 and RIP Copies routing table to vector v2 neighbors Updates frequently Interrior Slow converge Gateway RIP v1 and RIP v2 use hop Routing count as metric Protocol (IGRP) View network from neighbors perspective Susceptible to routing loops Easy to configure and administrate
6

Overview of link-state routing


Protocol Description Characteristics

Link-stateOpen Shortest Use shortest path Path First Updates are event triggered (OSPF) Fast to converge
Send link-state packets to all network routers

Intermediatesystem to Intermediatesystem (IS-IS)

Has common view of network Not as susceptible to routing loops Harder to configure Requires more memory and processing power than distance vector Consumes less bandwidth than

Link-state routing protocol functions


Link-state routing protocols collect routing information from all other routers in the network. Each router maintains its own complex database of topology information, the own view of the network. Link-state routing protocols functions:
Respond quickly to network changes Send triggered updates only when a network change has occurred Send periodic updates known as link-state refreshes Use a hello mechanism to determine the reachability of neighbors
8

Link-state routing protocol features


Uses the hello information and Link-state advertisements (LSAs) it receives from other routers to build a database about the network
A topological database

Uses the shortest path first (SPF) algorithm (Dijkstra algorithm) to calculate the shortest route to each network
The resulting SPF tree

Stores this route information in its routing table


9

Hello mechanism

Perth1 network

Perth2 network

P1

Hello

Hello

P2

Hello

Hello

P3

Hello

Perth3 network

Hello

P4
Hello Perth4 network

Link-state advertisements (LSAs).


Neighbors P3 and P4 on network 3 Neighbors P2 on network1
Network 1

Neighbors P1 and P4 on network 3 Neighbors P2 on network2


Network 2

P1

Hell o Hell o

Hell o

P2

Hell o

Hell o Hell o

P3

Network 3

Neighbors P1 and P3 on network 3

P4
Hell o Perth4 network

How routing information is maintained


When a failure occurs in the network, each link-state router take flowing action:
Flood LSAs using a special multicast address throughout an area. Copy of the LSA and updates its link-state, or topological database. Then forward the LSA to all neighboring devices Recalculate their routing tables.

Link-state routing algorithms

They are known collectively as shortest path first (SPF) protocols. They maintain a complex database of the network topology. They are based on the Dijkstra algorithm.

Link-state routing algorithms


Net 10 Net 20
Router Destination Next Cost hop

A
Cost=1

20 30 40 40 10 30 40

B C C B A C D

1 1 2 2 1 1 1

A
B

A
Cost=1 Cost=1

A A B B B B

Cost=1

Cost=1

Net 30
1

Net 40

Advantages and disadvantages of link-state routing


Advantages Disadvantages Fast convergence: Significant demands on Changes are reported memory and processing immediately by the source resources affected Requires very strict Robustness against routing loops network design Requires a knowledgeable Routers know the topology network administrator Link-state packets are sequenced and aged The link-state database sizes can minimized with careful network design
1

Initial flooding can impede network performance

SINGLE AREA OSPF CONCEPTS

OSPF overview

Open Shortest Path First (OSPF) is a link-state routing protocol based on open standards. The most recent description is RFC 2328. The Open in OSPF means that it is open to the public and is non-proprietary.

OSPF terminology

OSPF terminology: Links


An interface on Router

Links

Token Ring

OSPF terminology: Link state


The status of a link between two routers. Also a routers interface and its relationship to its neighboring routers.

Neighbors
Links

Token Ring

OSPF terminology: Area


A collection of networks and routers that have the same area identification. Each router within an area has the same linkstate information. A router within an area is an internal router

Area 1
Token Ring

Area 0

OSPF terminology: Area

OSPF terminology: Link Cost


The value assigned to a link. Rather than hops, link-state protocols assign a cost to a link that is based on the speed of the media. Interface Output Cost.
Neighbors
Interfaces

Cost = 10
Token Ring

Cost = 1785

Cost = 6

OSPF terminology: Adjacency database


A listing of all the neighbors to which a router has established bi-directional communication. Not every pair of neighboring routers become adjacent
Neighbors

Token Ring

Adjacency database
2

OSPF terminology: Link-state database


Also known as a topological database A list of link-state entries of all other routers in the internetwork

Token Ring

Adjacency database
2

Topological Database

OSPF terminology: Routing table


The routing table (also known as forwarding database) generated when an algorithm is run on the link-state database. Each routers routing table is unique

Token Ring

Adjacency Topological Routing Database Database Table Lists neighborsLists all routes Lists best routes
2

OSPF terminology: DR and BDR router


Designated router (DR) and backup designated router (BDR): A router that is elected by all other routers on the same LAN to represent all the routers. Each network has a DR and BDR

DR

Token Ring

BDR

Comparing OSPF with distance vector routing protocols


Distance vector OSPF

View network topology from neighbors perspective Adds distance vectors from router to router Frequent, periodic update: Slow convergence

Gets common view of entire network topology Calculates the shortest path to other routers Event-triggered update: Fast to convergence

Passes copies routing Passes link-state tables to neighbor routers routing updates to other routers Use flat topology
2

Allow hierarchical

Shortest path algorithm


1 C 4 2 D 1 E F G B 4 A

The best path is the lowest cost path.


2

Shortest Path First Tree for node B


B (1, B) 1 4 A (4, B) 2 D (4, E) 1 E (3, C)
3

F (5, E)

G (6, A)

OSPF network types

OSPF network types: Fourth type

DR and BDR receive LSAs

Hellos elect DR and BDR to present segment Each router then forms adjacency with DR
3

OSPF Hello Protocol


The rules that govern the exchange of OSPF hello packets are called the Hello protocol. Hello packets use : 224.0.0.5 (all routers). Hello packets are sent at regular intervals (default): Multi access and Point-to-point: 10s NBMA : 30s On multi-access networks the Hello protocol elects a designated router (DR) and a backup designated router (BDR). The hello packet carries information that all neighbors must agree upon before an adjacency is formed, and link-state information is exchanged.
3

OSPF packet header

For the hello packet the type field is set to 1.

OSPF Hello Protocol - Hello header

OSPF Topologies

Broadcast Multiaccess

Point-to-Point

NBMA

X.25
Frame Relay

Steps in the operation of OSPF


5 steps of operation: 1. Establish router adjacencies. 2. Elect a DR and BDR (if necessary). 3. Discover routes. 4. Select the appropriate routes to use. 5. Maintain routing information.

OSPF Operation in a Broadcast Multiaccess Topology

Broadcast Multiaccess

2000, Cisco Systems, Inc.

www.cisco.com

4-39

Step 1: Establish router adjacencies

First step in OSPF operation is to establish router adjacencies RTB sends hello packets, advertising its own router ID highest IP address:10.6.0.1(no loopback)

Step 1: Establish router adjacencies (cont.)


D D E E

Hello

B B

A A
afadjfjorqpoeru 39547439070713

C C

Hello

Router ID Hello/dead intervals Neighbors Area-ID Router priority DR IP address BDR IP address Authentication password Stub area flag

* Entry must match on neighboring routers


4

Step 2: Electing the DR and BDR (if necessary).


P=3 P=2

DR

BDR

Hello

P=1

P=1

P=0

The router with the highest priority value is the DR. The router with the second highest priority value is the BDR. The default for the interface OSPF priority is

Step 3: Discover routes

On difference network have differ discover process. On multi-access network, the exchange of routing information occurs between the DR or BDR and every other router on the network. Link partners on a point-to-point or point-tomultipoint network also engage in the exchange process.
4

Exchange Process
A
172.16.5.1/24 E0 172.16.5.2/24 E1

Down State

I am router ID 172.16.5.1 and I see no one.


Init State

Router B Router B Neighbors List Neighbors List 172.16.5.1/24, int E1 172.16.5.1/24, int E1 I am router ID 172.16.5.2, and I see 172.16.5.1. Router A Neighbors List 172.16.5.2/24, int E0
Two-way State

Step 3: Discover routes (cont.)


DR E0 172.16.5.3 Exstart State I will start exchange because I have router ID 172.16.5.1.
afadjfjorqpoeru 39547439070713

E0 172.16.5.1
afadjfjorqpoeru 39547439070713

Hello

No, I will start exchange because I have a higher router ID. Exchange State

Hello
afadjfjorqpoeru 39547439070713

Here is a summary of my link-state database.


afadjfjorqpoeru 39547439070713

DBD

DBD
4

Here is a summary of my link-state database.

Step 3: Discover routes (cont.)

DR E0 172.16.5.1
afadjfjorqpoeru 39547439070713

E0 172.16.5.3
afadjfjorqpoeru 39547439070713

LSAck
afadjfjorqpoeru 39547439070713

Thanks for the information! Loading State

LSAck

LSR

I need the complete entry for network 172.16.6.0/24.


afadjfjorqpoeru 39547439070713

Here is the entry for network 172.16.6.0/24.


afadjfjorqpoeru 39547439070713

LSU

LSAck Thanks for the information!


4

Full State

Step 4: Choosing Routes


10.1.1.0/24 A
Token Ring

10.2.2.0/24 B
F D D I

10.3.3.0/24 C

Cost=6 Cost=1 Cost=10


10.4.4.0/24 Topology Table Net Cost Out Interface 10.2.2.0 6 To0 10.3.3.0 7 To0 10.3.3.0 10 E0
4

This is the best route to 10.3.3.0.

Step 5: Maintaining Routing Information


Link-State Change
DR

1 LSU

Router A tells all OSPF DRs on 224.0.0.6


4

Step 5: Maintaining Routing Information


Link-State Change
LSU

2
DR

1 LSU

Router A tells all OSPF DRs on 224.0.0.6 DR tells all others on 224.0.0.5
4

Step 5: Maintaining Routing Information


Link-State Change
LSU

2
DR

1 LSU

3
LSU

Router A tells all OSPF DRs on 224.0.0.6 DR tells all others on 224.0.0.5
5

Step 5: Maintaining Routing Information


Link-State Change
LSU

2
DR

4 I need to update my routing table. 1 LSU

3
LSU

Router A tells all OSPF DRs on 224.0.0.6 DR tells all others on 224.0.0.5
5

Step 5: Maintaining Routing Information (cont.)


LSU LSA Is entry in link-state database? No Add to database Send LSAck to DR Flood LSA Run SPF to calculate new routing table End
5

Step 5: Maintaining Routing Information (cont.)


LSU LSA Is entry in link-state database? No Add to database Send LSAck to DR Flood LSA Run SPF to calculate new routing table End
5

Yes

Is seq. # the same?

Ignore LSA Yes

Step 5: Maintaining Routing Information (cont.)


LSU LSA Is entry in link-state database? No Add to database Send LSAck to DR Flood LSA Run SPF to calculate new routing table End
5

Yes

Is seq. # the same? No Is seq. # higher? No Send LSU with newer information to source End

Ignore LSA Yes

Step 5: Maintaining Routing Information (cont.)


LSU LSA Is entry in link-state database? No Add to database Send LSAck to DR Flood LSA Run SPF to calculate new routing table End
5

Yes

Is seq. # the same? No Is seq. # higher? No Send LSU with newer information to source End

Ignore LSA Yes

Yes

Go to A

OSPF Operation in a Point-to-Point

Point-to-Point Neighborship Router dynamically detects its neighboring router using the Hello protocol No election: Adjacency is automatic as soon as the two routers can communicate OSPF packets are always sent as multicast 224.0.0.5
5

OSPF Operation in an NBMA

X.25
Frame Relay ATM

NBMA Topology Single interface interconnects multiple sites NBMA topologies support multiple routers but without broadcasting capabilities
5

SINGLE AREA OSPF Configuration

Basic OSPF Configuration


Broadcast Network A
10.64.0.2 10.64.0.1 E0 E0

Point-to-Point Network B
S0 10.2.1.2 10. 2.1.1 S1

<Output Omitted> <Output Omitted> interface Ethernet0 interface Ethernet0 ip address 10.64.0.2 255.255.255.0 ip address 10.64.0.1 255.255.255.0 ! ! interface Serial0 <Output Omitted> ip address 10.2.1.2 255.255.255.0 router ospf 1 <Output Omitted> network 10.0.0.0 0.255.255.255 area 0router ospf 50 network 10.2.1.2 0.0.0.0 area 0 network 10.64.0.2 0.0.0.0 area 0

Can Assign Network or Interface Address.


5

Configuring OSPF loopback address


Router ID: Number by which the router is known to OSPF Default: The highest IP address on an active interface at the moment of OSPF process startup Can be overridden by a loopback interface: Highest IP address of any active loopback interface
! Create the loopback 0 interface Router(configf)#Interface loopback 0 Router(configf-if)#ip address 192.168.31.33 255.255.255.255 ! Remove loopback 0 interface Router(configf)#no Interface loopback 0
6

Configuring OSPF router priority


The router with the highest priority value is the DR. The default for the interface OSPF priority is 1. In case of a tie, the routers router ID is used.
! Setting OSPF Priority Router(configf)#Interface Fastethernet 0/0 Router(configf-if)#ip ospf priority 50

The priorities can be set to any value from 0 to 255 The command show ip ospf interface will display the interface priority value as well as other key information.

Modifying OSPF cost metric


Medium 56 kbps serial link T1 (1.544 Mbps serial link) E1 (2.048 Mbps serial link) Ethernet Fast Ethernet/FDDI Cost 1785 64 48 10 1

Cost is calculated using the formula 108/bandwidth, where bandwidth is expressed in bps. Bandwidth dividend is user configurable: Interface subcommand: bandwidth 64
6

Interface subcommand: ip ospf cost <1-

Configuring OSPF authentication


! Create a key that is used to generate the authentication data ! in the OSPF packet header. Router(config-if)#ip ospf authentication-key password

! After the password is configured, authentication must be enabled:

Router(config-router)#area area-number authentication

The authentication key, known as a password, is a shared secret between the routers. The password can be up to eight characters. The password is sent as plain text.

Configuring OSPF authentication: with MD5

Specifies the type of message-digest hashing algorithm to use and key value

outer(config-if)#ip ospf message-digest-key key-id md5 encryption-type

The value of encryption-type field is 0 means none and 7 means proprietary. The key-id is an identifier (1 to 255) The key is an alphanumeric password up to sixteen characters. Neighbor routers must use the same key identifier with the same key value.
! After that, authentication must be enabled: Router(config-router)#area area-id authentication message-digest
6

Configuring OSPF timers


! To configure the hello and dead intervals on an interface Router(config-if)#ip ospf hello-interval seconds Router(config-if)#ip ospf dead-interval seconds

OSPF networks, the default Hello interval is 10 seconds Dead interval is 40 seconds. On nonbroadcast networks, the default Hello interval is 30 seconds Dead interval is 120 seconds. These timers must be configured to match those of any neighboring router.
6

OSPF, propagating a default route

!Configure a gateway of last resort

Router(config)#ip route 0.0.0.0 0.0.0.0 [interface | next-hop address] ! To propagate this route to all the routers in a normal OSPF area Router(config-router)#default-information originate
6

Common OSPF configuration issues


Failure to establish a neighbor relationship is caused by any of the following reasons: Hellos are not sent from both neighbors. Hello and dead interval timers are not the same. Interfaces are on different network types. Authentication passwords or keys are different. In OSPF routing it is also important to ensure the following: All interfaces have the correct addresses and subnet mask. network area statements have the correct wildcard masks. network area statements put interfaces into the correct area.
6

Verifying OSPF Operation


Router#

show ip protocols

Verifies that OSPF is configured


Router#

show ip route

Displays all the routes learned by the router


Router#

show ip ospf interface

Displays area ID and adjacency information


6

Verifying OSPF Operation (cont.)


Router#

show ip ospf

Displays OSPF timers and statistics


Router#

Displays information about DR, BDR and neighbors


Router#

show ip ospf neighbor detail

show ip ospf database

Displays the link-state database


6

Verifying OSPF Operation (cont.)


Router#

clear ip route *

Allows you to clear the IP routing table


Router#

debug ip ospf option

Displays router interaction during the hello, exchange, and flooding processes
7

show ip ospf interface

R2#sh ip ospf int e0 Ethernet0 is up, line protocol is up Internet Address 192.168.0.12/24, Area 0 Process ID 1, Router ID 192.168.0.12, Network Type BROADCAST, Cost: 10 Transmit Delay is 1 sec, State DROTHER, Priority 1 Designated Router (ID) 192.168.0.11, Interface address 192.168.0.11 Backup Designated router (ID) 192.168.0.13, Interface address 192.168.0.13 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:04 Neighbor Count is 3, Adjacent neighbor count is 2 Adjacent with neighbor 192.168.0.13 (Backup Designated Router) Adjacent with neighbor 192.168.0.11 (Designated Router) Suppress hello for 0 neighbor(s)

show ip ospf neighbor

Neighbor ID 192.168.0.13 192.168.0.14 192.168.0.11 192.168.0.12

Pri 1 1 1 1

State Dead Time Address 2WAY/DROTHER 00:00:31 192.168.0.13 FULL/BDR 00:00:38 192.168.0.14 2WAY/DROTHER 00:00:36 192.168.0.11 FULL/DR 00:00:38 192.168.0.12

Interface Ethernet0 Ethernet0 Ethernet0 Ethernet0

OSPF over Ethernet - Multiaccess Network

Neighbor ID 192.168.0.11

Pri 1

State FULL/

Dead Time 00:00:39

Address 10.1.1.2

Interface Serial1

OSPF over HDLC - Point-to-Point Network

show ip ospf database

R2#show ip ospf database OSPF Router with ID (192.168.0.12) (Process ID 1) Router Link States (Area 0) Link ID 192.168.0.10 192.168.0.11 192.168.0.12 192.168.0.13 192.168.0.14 ADV Router 192.168.0.10 192.168.0.11 192.168.0.12 192.168.0.13 192.168.0.14 Age 817 817 816 816 817 Seq# 0x80000003 0x80000003 0x80000003 0x80000003 0x80000003 Checksum 0xFF56 0xFD55 0xFB54 0xF953 0xD990 Link count 1 1 1 1 1

Net Link States (Area 0) Link ID 192.168.0.14 ADV Router 192.168.0.14 Age 812 Seq# 0x80000002 Checksum 0x4AC8

Summary
Link-state routing protocols collect routing information from all other router in the network or within a defined area of the network. Link-state routing protocols perform the following functions: Respond quickly to network changes Send triggered update only when a network change has occurred Send periodic updates know as link-state refreshes Use a hello mechanism to determine the reachability of neighbors OSPF is link-state routing protocol based on open standards. OSPF routing uses the concept of area. Each router contains a complete database of link-states in specific area
7

Q&A

You might also like