Open Shortest Path First Ospf

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 64

Open Shortest Path First

OSPF
8th CEENet Workshop on Network Technology
NATO ANW
OSPF
 Link state or SPF technology
 Developed by OSPF Working Group
of IETF (not proprietary)
 Designed for TCP/IP Internet
environment
 Documented in rfc 1583, rfc 2178

8th CEENet Workshop 2


OSPF
Budapest, 2002
OSPF - Link State Protocol
 Link
 an interface on the router
 Link state
 description of the interface and the
neighboring routers
 IP address, mask, type, routers connected to
 Link state database
 collection of link state advertisement for all
routers and networks

8th CEENet Workshop 3


OSPF
Budapest, 2002
How OSPF Works?
 Each router generates link-state
advertisements for its links
 When no OSPF areas are configured, link-
state advertisements are flooded to all
routers
 It is crucial that all routers have identical link
state database
 Shortest path three is calculated by all
routers and routing tables are derived

8th CEENet Workshop 4


OSPF
Budapest, 2002
Link State Advertisement (LSA)
 Generated periodically or in response to
any change
 Contains:
 source identification
 sequence number
 link state age
 list of neighbors

8th CEENet Workshop 5


OSPF
Budapest, 2002
A Simplified Link State LS
Database Example From To Link Cost num
seq.

a b A B a 1 . 2
A B C A D c 1 2
1 3
B A a 1 2
c 1 d 2 B C b 3 1
f 1 B E e 2 2
e C B b 3 1
D E C E f 1 1
2
D A c 1 2
D E e 2 1
Link State Announcement (LSA)
E B d 2 2
From A to B, Link a, Cost = 1, Ls seq. E C d 2 1
Num. = 2 E D e 2 1
8th CEENet Workshop 6
OSPF
Budapest, 2002
In Case of a Link Failure
a b  A and B send the
A B C information to all
1 3
other nodes about
1 d 2
state of link a and
f 1
e the connectivity is
D E
2 reestablished.

 In the case when network is segmented


the link state database in both parts are
different.

8th CEENet Workshop 7


OSPF
Budapest, 2002
Segmented Network
b  If b breaks, A and
a
A B C D will not receive
1 3
this LSA and their
1 d 2
f 1
database will be
e different than the
D E
2 one of B, C and E.
 When e comes up the D’s database has to
become synchronized. This process is called
bringing up adjacency.
8th CEENet Workshop 8
OSPF
Budapest, 2002
Bringing up Adjacency

 Synchronizing databases via comparison of


sequence numbers
3
 “Interesting records” - the sequence
numbers are different or not present in
database
 Client-server relationship is established first

8th CEENet Workshop 9


OSPF
Budapest, 2002
The Flooding Protocol
 Used to securely deliver LSAs
 Every node sends the LSA on every link except
the one from where it received it
 Very fast and very reliable, but wastes bandwidth
 Messages sent only when there is a change or
every 45 minutes
 Each node compares the newly received LSA
with the entry in the data base. If it is newer the
database is updated

8th CEENet Workshop 10


OSPF
Budapest, 2002
Securing the Map Updates
 Flooding procedure includes hop-by-hop
acknowledgments
 Database description packets are transmitted
in a secure fashion
 Each link state record is protected by a timer
and is removed from the database if a
refreshing packet does not arrive in due time
 All records are protected by checksum
 Messages can be authenticated, e. g. by
passwords
8th CEENet Workshop 11
OSPF
Budapest, 2002
Authenticated Routing
Updates
 Two possibilities are defined
 no authentication (configured by default)
 authentication
 simple password authentication
 message digest authentication

8th CEENet Workshop 12


OSPF
Budapest, 2002
More Routers on One Network
 N routers on the same network (broadcast or
non-broadcast)
 N(N-1) LSA will be needed to transmit
information about the same network
 too much overhead

8th CEENet Workshop 13


OSPF
Budapest, 2002
Designated Router (DR)
 Selected among more routers on the same
network
 selection based on the priority assigned by the
network administrator
 for security reason backup designated router
(BDR) is also selected
 All routers in the network become adjacent
to DR
 exchange routing information with DR via
multicast
 DR updates all the neighbors

8th CEENet Workshop 14


OSPF
Budapest, 2002
The Metrics in OSPF
formula: cost = 108 /bandwidth in bps
56 Kbps serial link 1758
64 Kbps serial link 1562
T1 (1.544 Mbps seral link) 65
E1 (2.048 Mbps serial link) 48
4 Mbps token ring 25
Ethernet 10
16 Mbps token ring 6
FDDI 1
8th CEENet Workshop 15
OSPF
Budapest, 2002
Shortest Path Algorithm
 Places the router at the root of the tree
 In each iteration adds the router that is
closest to it (smallest cumulative metric
of the path)
 Finished when all routers are added and
the shortest path tree is generated

8th CEENet Workshop 16


OSPF
Budapest, 2002
Representation of routers R1 R2
and networks in a table N3
R8
R3 R6 R3 R4
8 6
N7 4
From
From R1 R2 R3 R4 N3
From R1 0
R3 R6 R8 R2 0
To R3 To R8 To R3 0
6
R6 8 N7 4 R4 0
N3 1 1 1 1
Broadcast or
Point-to-point network Stub network NBMA network

8th CEENet Workshop 17


OSPF
Budapest, 2002
N1
R1 R4
N12 N13 N14
Example
N3
R5 of an AS
R2
N2
R3 R6
N4
N12
N11 R7
R9 N8 N15
R11
R10
R5 and R7 N9 N6
are border
routers R12 R8
N10 N7

8th CEENet Workshop 18


OSPF
Budapest, 2002
R1 R2 R3 R4 R5 R6 R7 R8 R9R10R11R12 N3 N6 N8 N9

R1
R2
0
0
The Resulting
R3
R4 8
6 0
0
Directed Graph
R5 8 6 6
R6
R7
8 7
6
5
0
Networks and
R8 0 routers are
R9 0
R10 7 0 0 represented by
R11
R12
0 0
0 vertices.
N1 3
N2 3
An edge of cost X
N3 1 1 1 1 connects Vertex A to
Vertex B if the
N4 2
N6 1 1 1
N7
N8
4
3 2
intersection of
N9 1 1 1 Column A and Row B
N10 2
N11 3 is marked with the
N12
N13
8
8
2
cost of the interface.
N14 8
N15 9

8th CEENet Workshop 19


OSPF
Budapest, 2002
R5
Shortest Path Tree
R6
and Routing Table
N12N13 N14 N4 for R6
R3R10
Dest. Next Hop Cost
N6 R7
R4 N3 N1 R3 10
N8 N2 R3 10
R N3 R3 7
R1 R11 R8 N4 R3 8
2 N6 R10 8

N2 N1 N12 N15 N7 R10 12


N9 N8 R10 10
N7 N9 R10 11
N10 R10 13
R9 N11 R10 14
R12
N11 RT5 RT5 6
RT7 RT10 8
N10

8th CEENet Workshop 20


OSPF
Budapest, 2002
Load Balancing by Multiple Path
R2
equal or
proportional cost
multiple paths
path 1

N1
N2
path 2
R1 R3

R4

8th CEENet Workshop 21


OSPF
Budapest, 2002
Hierarchical Structure
 Introduced to put a boundary on the explosion of link-state
updates
 Every area is connected to the backbone area

Backbone
Area #0

Area #1 Area #2 Area #3

8th CEENet Workshop 22


OSPF
Budapest, 2002
Multiple Areas
 Group of IR
contiguous hosts
and networks Area 2 Area 3
 One LS database to other AS IR/BR
per area area 0
 Backbone area ASBR
(contiguous) Area 4
 Virtual links Area 1
 Inter-area routing Virtual
link
8th CEENet Workshop 23
OSPF
Budapest, 2002
OSPF Areas

 The border area is OSPF area 0


 all routers belonging to the same area have
identical database
 SPF calculations are performed separately
for each area
 LSA flooding is bounded by area

8th CEENet Workshop 24


OSPF
Budapest, 2002
Area Link State Database
 Link state database for every area is
different
 Area database is composed of
 router links advertisements
 network links advertisements
 summary links advertisements
 AS external advertisements

8th CEENet Workshop 25


OSPF
Budapest, 2002
Scaling OSPF
 Rule of thumb
 no more than 150 routers /area
 Reality
 no more than 500 routers/area
 Backbone area is an area that glue all the
other areas
 always marked as area 0
 proper use of areas reduces bandwidth
 summarized routes
 instability is limited within the area
8th CEENet Workshop 26
OSPF
Budapest, 2002
Route Redistribution

RIP
Domain

OSPF Domain

 UNIX host
• the router redistributes RIP
running routed
into OSPF and vice versa
8th CEENet Workshop 27
OSPF
Budapest, 2002
OSPF Advanatages
 No limitation on hop count
 Supports classless routing
 Routing updates sent only when there is a
change or very rarely
 Faster convergence
 Better load balancing
 Logical definition of areas
 Authentication and external routes tagging

8th CEENet Workshop 28


OSPF
Budapest, 2002
The Link State  LS age
Header  time since the LS record
was first advertised
0 31
 options ET
LS age options LS type  E - external links
Link State ID  T - TOS (type 0 doesn’t
support any TOS
Advertising Router
 LS type (router link, network
LS sequence number link, summary link (IP network,
summary link, to a border router,
LS checksum length external link)

8th CEENet Workshop 29


OSPF
Budapest, 2002
The Router Links
0 31  summarizes all links
..0….EB ..0.. number of links that start from the
Link ID router
Link data
Type #TOS TOS 0 metric  bits 6 and 7 of the
TOS =x 0 TOS x metric first word indicate
---
the type of the
router
TOS =z 0 TOS z metric

8th CEENet Workshop 30


OSPF
Budapest, 2002
The Network Links
0 31
Network mask
Attached router
---
Attached router

 advertised by designated routers

8th CEENet Workshop 31


OSPF
Budapest, 2002
The Summary Links
network mask
TOS 0 TOS 0 metric
TOS =x 0 TOS x metric

---

TOS =z 0 TOS z metric

 advertised by area-border routers


 the network mask is followed by a set of
metrics
8th CEENet Workshop 32
OSPF
Budapest, 2002
The External Links
 advertised by border
network mask routers
E, TOS 0 TOS 0 metric
 required by EGPs
external route tag 0
E,TOS =x 0 TOS x metric  E indicates that TOS
external route tag x
is not comparable
--- with that of internal
--- ---
routes
E,TOS =z 0 TOS z metric
external route tag z

8th CEENet Workshop 33


OSPF
Budapest, 2002
Protocols within OSPF

 Common header
 Hello protocol
 Exchange protocol
 Flooding protocol

8th CEENet Workshop 34


OSPF
Budapest, 2002
The Common Header
0 31

version (1) type (1) packet length (2)


Router ID (4)
Area ID (4)
Checksum (2) autype (2)
Authentication (4)

8th CEENet Workshop 35


OSPF
Budapest, 2002
The Hello Protocol
0 31
OSPF packet header, type = 1 (hello)
Network mask
Hello interval Options Priority
Dead interval
Designated router
Backup designated router
Neighbour
----
Neighbour

8th CEENet Workshop 36


OSPF
Budapest, 2002
The Exchange Protocol
0 31  Uses database description
OSPF packet header, type = 2 (dd) packets
0 0 options 0I M MS  Asymmetric protocol
DD sequence number (master-slave)
Link state type  Master sends database
description packets
Link State ID
 Slave sends the
Advertising router acknowledgments
Link State sequence number
LS checksum LS age
----
8th CEENet Workshop 37
OSPF
Budapest, 2002
The Exchange Protocol 2

0 31
OSPF packet header, type = 3 (rq)  Request records
Link state type
 send in case when
Link State ID sequence number of
the LS is smaller
Advertising router
 the other router will
---- answer with a LS
update

8th CEENet Workshop 38


OSPF
Budapest, 2002
The Flooding Protocol
0 31
 When a link changes
OSPF packet header, type = 4 (upd) state
Number of advertisements  a router responsible
Link State advertisements for that link issues a
---- new version of the link
0 31 state
OSPF packet header, type = 5 (ack)
 the update is
retransmitted in regular
Link State advertisements interval until an
headers acknowledgment is
---- received
8th CEENet Workshop 39
OSPF
Budapest, 2002
Conclusions
 More complex than RIP
 the documentation is five times thicker
 the management needs more information
 the implementation needs more code
 Why design such complex procedure?
 routing is important
 requires less “signalization” messages
 compute better routes
8th CEENet Workshop 40
OSPF
Budapest, 2002
Conclusions
 OSPF is not a perfect protocol
 IETF keeps making it better
 “O” in OSPF stands for Open

 OSPF is not the only link state protocol


 IS-IS protocol is part of OSI routing framework for
CLNP
 similar in design to OSPF
 uses different terminology
8th CEENet Workshop 41
OSPF
Budapest, 2002
IP Routing Configuration

8th CEENet Workshop 42


OSPF
Budapest, 2002
IP Routing Configuration Tasks
• Global configuration
Network 172.16.0.0
Select routing protocol(s)

IGRP,
Specify network(s) RIP,
OSPF
Network 160.89.0.0

Network 172.30.0.0

8th CEENet Workshop 43


OSPF
Budapest, 2002
IP Routing Configuration Tasks

Network 172.16.0.0
• Global configuration
OSPF
Select routing protocol(s)
IGRP,
Specify network(s) RIP,
OSPF Network 160.89.0
• Interface configuration
OSPF
Verify address/subnet
mask Network 172.30.0.0

8th CEENet Workshop 44


OSPF
Budapest, 2002
Dynamic Routing Configuration
Router (config) #

router protocol [ keyword ]

 Defines an IP routing protocol

Router (config-router) #

network network-number
• The network subcommand is a
mandatory configuration command
for each IP routing process
8th CEENet Workshop 45
OSPF
Budapest, 2002
OSPF Basic Configuration
Commands
Router (config) #

router ospf process-id

 Enables an OSPF routing process


Router (config-router) #

network address wildcard-mask area area-id

• Selects participating interfaces

8th CEENet Workshop 46


OSPF
Budapest, 2002
OSPF Basic Configuration
Example
172.16.5.3
E2
172.16.1.1 Token
Ring
192.168.10.5 T0
E1
E0 172.16.3.2
Area 1
Area 0

router ospf 63
network 172.16.5.3 0.0.0.0. area 1
network 172.16.0.0 0.0.255.255 area 0
network 192.168.10.5 0.0.0.0 area 1
8th CEENet Workshop 47
OSPF
Budapest, 2002
OSPF Route Summarization
Area 0 Backbone

Summarization

ABRs

Area 1

x
 Minimizes routing table entries
 Localizes impact of a topology change
8th CEENet Workshop 48
OSPF
Budapest, 2002
Route Summarization (cont.)
Area 1 ABR Area 0

A B C

Summarization
Routing Table for B
O 131.108.4.0 255.255.252.0
O 131.108.8.0 255.255.252.0
O 131.108.12.0 255.255.252.0
Routing Table for C
O 131.108.16.0 255.255.252.0
O 131.108.20.0 255.255.252.0 IA 131.108.16.0 255.255.240.0
O 131.108.24.0 255.255.252.0
O 131.108.28.0 255.255.252.0

 Inter-area (IA) summary link carries mask


 One entry can represent several subnets
8th CEENet Workshop 49
OSPF
Budapest, 2002
Route Summarization Issue
Existing Subnet
Mask = 252 1111 11 00 Valid
Address = 12 0000 11 00 3rd Subnet
131.108.12.0 255.255.252.0
Summary Route
Mask = 240 1111 0000 Invalid Subnet
255.255.240.0 Address = 12 0000 1100 Zero
131.108.12.0

 Some addresses may need reallocating

8th CEENet Workshop 50


OSPF
Budapest, 2002
Route Summarization
Commands
Router (config-router) #

area area-id range address mask

 Consolidates IA routes on an ABR


Router (config-router) #

summary-address address mask

• Consolidates external routes on an ASBR

8th CEENet Workshop 51


OSPF
Budapest, 2002
Route Summarization Example
Area 0
Interface Addresses
Interface Addresses 172.16.96.0 - 172.16.127.0 (255.255.255.0 mask)
(255.255.255.0 mask) 255.255.255.0
172.16.96.1 172.16.127.1
R2
172.16.32.1 172.16.64.1
R1 R2
172.16.32.0 - 172.16.63.0 172.16.64.0 - 172.16.95.0
255.255.255.0 255.255.255.0
Area 1 Area 2

R1# R2#
router ospf 100 router ospf 100
network 172.16.32.0 0.0.31.255 area 1 network 172.16.64.0 0.0.31.255 area 2
network 172.16.96.0 0.0.31.255 area 0 network 172.16.96.0 0.0.31.255 area 0
area 0 range 172.16.96.0 255.255.224.0 area 0 range 172.16.96.0 255.255.224.0
area 1 range 172.16.32.0 255.255.224.0 area 2 range 172.16.64.0 255.255.224.0
8th CEENet Workshop 52
OSPF
Budapest, 2002
OSPF Route Redistribution

OSPF

RIP
IGRP BGP
Enhanced IGRP EGP
IS-IS

 Allows routing-information exchange between


OSPF and other routing protocols

8th CEENet Workshop 53


OSPF
Budapest, 2002
OSPF Redistribution Command

Router (config-router) #

redistribute protocol [ process-id ] [ metric value ]


[ metric-type value ] [ subnets ]

 Redistributes routes from OSPF into other routing


protocols (and vice versa)

8th CEENet Workshop 54


OSPF
Budapest, 2002
OSPF Redistribution Example 1

Redistribution between RIP and OSPF

RIP OSPF Area 0

172.16.9.1 S0 172.16.62.1

R1 S1
172.16.8.1 172.16.63.1

8th CEENet Workshop 55


OSPF
Budapest, 2002
OSPF Redistribution Example 1

router ospf 109


network 172.16.62.0 0.0.0.255 area 0
network 172.16.63.0 0.0.0.255 area 0
redistribute rip subnets metric-type 1 metric 20

router rip
network 172.16.0.0
passive-interface serial 0
passive-interface serial 1
default-metric 10
redistribute ospf 109 match internal external 1 external 2

8th CEENet Workshop 56


OSPF
Budapest, 2002
Redistribution Example 2
Avoiding Loops
RIP
RIP

172.16.9.1
OSPF Area 0
R1
R3
172.16.8.1

R2
R2
"Back door" creates
RIP potential loop

8th CEENet Workshop 57


OSPF
Budapest, 2002
Redistribution Example 2 cont

router ospf 109


network 172.16.62.0 0.0.0.255 area 0
network 172.16.63.0 0.0.0.255 area 0
redistribute rip subnets metric-type 1 metric 20
distribute-list 11 out rip

access-list 11 permit 172.16.8.0 0.0.7.255

8th CEENet Workshop 58


OSPF
Budapest, 2002
VERIFYING OSPF OPERATION

8th CEENet Workshop 59


OSPF
Budapest, 2002
show ip ospf interface Command
Router# show ip ospf interface e0
Ethernet0 is up, line protocol is up
Internet Address 203.250.14.1 255.255.255.0, Area 0.0.0.0
Process ID 10, Router ID 203.250.13.41, Network Type BROADCAST,
Cost: 10
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 203.250.15.1, Interface address 203.250.14.2
Backup Designated router (ID) 203.250.13.41, Interface address
203.250.14.1
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 0:00:02
Neighbor Count is 3, Adjacent neighbor count is 3
Adjacent with neighbor 203.250.15.1 (Designated Router)
Loopback0 is up, line protocol is up
Internet Address 203.250.13.41 255.255.255.255, Area 1
Process ID 10, Router ID 203.250.13.41, Network Type LOOPBACK, Cost: 1
Loopback interface is treated as a stub Host

 Verifies interfaces are in correct areas

8th CEENet Workshop 60


OSPF
Budapest, 2002
show ip ospf Command
Router # show ip ospf
Routing Process "ospf 1" with ID 2.2.2.2
Supports only single TOS (TOS0) routes
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Number of areas in this router is 1
Area 23
Number of interfaces in this area is 3
Area has no authentication
SPF algorithm executed 19 times
Area ranges are
Link State Update Interval is 0:30:00 and due in 0:04:55
Link State Age Interval is 0:20:00 and due in 0:04:55

 Displays general information about the


OSPF routing process
8th CEENet Workshop 61
OSPF
Budapest, 2002
show ip ospf database Command
Router# show ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 1)

Router Link States (Area 23)


Link ID ADV Age Seq# Checksum Link
Router count
3.3.3.3 3.3.3.3 78 0x80000032 0x80B6 5
4.4.4.4 4.4.4.4 1691 0x8000002B 0xE11C 1
2.2.2.2 2.2.2.2 1693 0x80000030 0xE35E 5
1.1.1.1 1.1.1.1 1696 0x80000026 0x80A1 1

Net Link States (Area 23)

Link ID ADV Router Age Seq# Checksum


150.100.4.2 4.4.4.4 1691 0x80000030 0x2FCE
150.100.1.2 2.2.2.2 1693 0x80000024 0xFB29

8th CEENet Workshop 62


OSPF
Budapest, 2002
show ip protocol Command
Router> show ip protocol
Routing Protocol is “ospf 300”
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: ospf 300
Routing for Networks:
183.8.0.0/0.0.255.255
144.253.100.0/0.0.0.255
Routing Information Sources:
Gateway Distance Last Update
144.253.100.0 110 6d21
183.8.128.12 110 0:17:32
192.3.63.192 110 0:17:33
192.3.63.194 110 0:17:33
183.8.128.0 110 6d21
153.50.192.0 110 0:17:33
153.50.193.1 110 0:17:33
183.8.64.130 110 6d19
183.8.64.128 110 0:17:33
133.3.4.0 110 0:17:33
131.108.100.3 110 0:17:33
Distance: (default is 110)
- - More - -

8th CEENet Workshop 63


OSPF
Budapest, 2002
Other OSPF show Commands
Router #

show ip ospf virtual-links


 Displays parameters about OSPF virtual links
Router #

show ip ospf neighbor detail

• Displays neighbor information per interface


Router #

show ip ospf border-routers

• Displays routes to the ABR and ASBR


8th CEENet Workshop 64
OSPF
Budapest, 2002

You might also like