Você está na página 1de 26

Single-Area OSPF Concepts

Copyright 2003 www.ciscopress.com

Single-Area OSPF Concepts

OSPF would choose the faster route with three T3 links,


and two routers between the source and destination
routers.
RIP would choose the slower route with two 64kbps
links, but only one router between source and
destination.
Copyright 2003 www.ciscopress.com

1
Single-Area OSPF Concepts
Open Shortest Path First (OSPF) is a link-state
routing protocol based on open standards.
“Open”in OSPF means open to the public and
non-proprietary.
OSPF is becoming the preferred IGP protocol
when compared with RIP v1 and v2 because
it is scalable (permitting growth with minimal
design change.)
OSPF can be used and configured as a single
area for small networks, or for large networks
if hierarchical network design principles are
followed.
Copyright 2003 www.ciscopress.com

Single-Area OSPF Concepts

In large OSPF networks, multiple areas connect


to a distribution area, area 0, also called the
backbone.

Defining areas
–  reduces routing overhead,
–  speeds up convergence,
–  confines network instability to an area,
–  improves performance.

Copyright 2003 www.ciscopress.com

2
OSPF Overview

OSPF is becoming the preferred IGP protocol


when compared with RIPv1 and RIPv2
because it is scalable.

Copyright 2003 www.ciscopress.com

Large OSPF Network

Copyright 2003 www.ciscopress.com

3
OSPF Terminology

Copyright 2003 www.ciscopress.com

Designated Routers
To reduce the number of exchanges of
routing information among several
neighbors on the same network,
OSPF routers elect a
Designated Router (DR) and a
Backup Designated Router (BDR)
that serve as focal points for routing
information exchange.

Copyright 2003 www.ciscopress.com

4
Designated Routers
Since all routers in an area have the
same view of the network,

overall consumption of bandwidth can be


reduced,

if only one router in that area floods


updates to all other routers.

Copyright 2003 www.ciscopress.com

Comparing OSPF with Distance Vector Routing Protocols


•  Link-state routers do not broadcast their routing tables periodically as
distance vector protocols do. Therefore, link-state routers use less
bandwidth for routing table maintenance.

•  OSPF selects routes based on cost, which is related to speed


(bandwidth).
The higher the speed, the lower the OSPF cost of the link.

•  OSPF selects the fastest loop-free path from the shortest-path first
tree as the best path in the network.

•  OSPF guarantees loop-free routing.


Distance vector protocols may cause routing loops.

•  RIP is appropriate for small networks, and the best path is based on the
lowest number of hops

Copyright 2003 www.ciscopress.com

5
Comparing OSPF with Distance Vector Routing Protocols
•  OSPF supports VLSMs and therefore is referred to as a classless
protocol.
RIP v1 does not support VLSMs, however, RIP v2 does support VLSMs.
•  RIP considers a network that is more than 15 routers away to be
unreachable because the number of hops is limited to 15. This
limits RIP to small topologies. OSPF has no size limits and is
suitable for intermediate to large networks.
•  RIP selects a path to a network by adding one to the hop count reported
by a neighbor. It compares the hop counts to a destination and selects the
path with the smallest distance or hops. This algorithm is simple and does
not require a powerful router or a lot of memory. RIP does not take into
account the available bandwidth in best path determination.
•  OSPF selects a path using cost, a metric based on bandwidth. All OSPF
routers must obtain complete information about the networks of every
router to calculate the shortest path. This is a complex algorithm.
Therefore, OSPF requires more powerful routers with more memory
than RIP.
Copyright 2003 www.ciscopress.com

Shortest Path Algorithm


In this algorithm, the best path is the lowest cost path.
The algorithm was discovered by Dijkstra, a Dutch computer
scientist, and was explained in 1959.
The algorithm considers a network to be a set of nodes connected
by point-to-point links.
•  Each link has a cost.
•  Each node has a name.
•  Each node has a complete database of all the links ( so
complete information about the physical topology is known).
•  All router link-state databases are identical.

The shortest path algorithm then calculates a loop-free topology


using the node (on which it is running) as the starting point and
examining,in turn, information it has about adjacent nodes.

Copyright 2003 www.ciscopress.com

6
Shortest Path Algorithm

The best path is the lowest-cost path.


Copyright 2003 www.ciscopress.com

OSPF Network Types

Copyright 2003 www.ciscopress.com

7
DR/BDR vs Network Type

Copyright 2003 www.ciscopress.com

Hello Packets
When a router starts an OSPF routing process on an interface, it sends a
hello packet and continues to send hellos at regular intervals.
At Layer 3 of the OSI model, the hello packets are addressed to the
multicast address 224.0.0.5. This address is “all OSPF routers”.
OSPF routers use hello packets to
–  initiate new adjacencies.
–  ensure that neighbor routers are still functioning.
Hellos are sent every 10 seconds by default on broadcast multi-access
and point-to-point networks.
On interfaces that connect to NBMA (non-broadcast multi-access)
networks, such as Frame Relay, the default time is 30 seconds.
On multi-access (broadcast and non-broadcast) networks, the Hello
protocol elects a designated router (DR) and a backup designated
router (BDR).
Although the hello packet is small, it consists of the OSPF packet header.
For the hello packet the type field is set to 1.
The hello packet carries information that all neighbors must agree upon
before an adjacency is formed, and link-state information is exchanged.

Copyright 2003 www.ciscopress.com

8
OSPF Hello Protocol

Copyright 2003 www.ciscopress.com

Steps in the Operation of OSPF

Copyright 2003 www.ciscopress.com

9
Maintaining Routing Information

When an OSPF router notices a change in a


link state, it multicasts an LSU packet that
includes the updated LSA entry to 224.0.0.6,
the “all OSPF DR (and BDR)” address.
Copyright 2003 www.ciscopress.com

Single-Area OSPF Configuration

Copyright 2003 www.ciscopress.com

10
Single-Area OSPF Configuration
An area in the OSPF network, may be assigned any
number from 0 to 65,535.

However a single area is assigned the number 0 and is


known as area 0.

In multi-area OSPF networks, all areas are required to


connect to an area 0, called the backbone area.

OSPF configuration requires that network addresses


are configured with a wildcard mask and not a
subnet mask.
The wildcard mask represents the links or host
addresses that can be present in this segment.
Copyright 2003 www.ciscopress.com

Single-Area OSPF Configuration

To enable OSPF routing,


Router(config)#router ospf process-id

The process ID is a number that is used to identify an


OSPF routing process on the router.
Multiple OSPF processes can be started on
the same router. The number can be any value
between 1 and 65,535.
It is rarely necessary to run more than one
OSPF process on a router.

Copyright 2003 www.ciscopress.com

11
Single-Area OSPF Configuration

IP networks are advertised as follows:

Router(config-router)#network address
wildcard-mask area area-id
The network address can be
–  a whole network,
–  a subnet,
–  the address of the interface.

The wildcard mask represents


the set of host addresses that the segment supports.
As with distance vector, OSPF uses a subnet mask when
configuring IP addresses on interfaces.

Copyright 2003 www.ciscopress.com

Configuring the OSPF Routing Process

Copyright 2003 www.ciscopress.com

12
Configuring OSPF Loopback Address and Router Priority

When the OSPF process starts, the Cisco IOS uses the highest
local active IP address as its OSPF router ID. [If the active interface
goes down, the OSPF process has no router ID and therefore ceases to function
until the interface comes up again.]

To ensure OSPF stability there should be an active interface for the


OSPF process at all times.
A loopback interface, which is a logical interface, can be
configured for this purpose.
When a loopback interface is configured, OSPF uses this
address as the router ID, regardless of the value.
On a router that has more than one loopback interface,
OSPF takes the highest loopback IP address as its router ID.

Copyright 2003 www.ciscopress.com

Configuring OSPF Loopback Address and Router Priority


To create and assign an IP address to a
loopback interface:

Router(config)#interface loopback number

Router(config-if)#ip address ip-address


subnet-mask

Number distinguishes this loopback from others,


in the event more than one is created on this
interface, and sets the priority of this
loopback vs. others on this interface.
Higher number = higher priority.
Copyright 2003 www.ciscopress.com

13
Configuring OSPF Loopback Address and Router Priority

This loopback interface should be


configured with an address
using a 32-bit subnet mask of
255.255.255.255.

A 32-bit (all 1s) subnet mask is called a


host mask because the subnet mask
specifies a network of one host.

Copyright 2003 www.ciscopress.com

Configuring OSPF Loopback


Address and Router Priority

Copyright 2003 www.ciscopress.com

14
Configuring OSPF Loopback Address and Router Priority

In multi-access networks, OSPF elects a designated router (DR)


to be the focal point of all link-state updates and link-state
advertisements.
Because the DR role is critical, a backup designated router
(BDR) is elected to take over if the DR fails.
If the network type of an interface is broadcast (e.g., Ethernet),
the default OSPF priority is 1. When OSPF priorities are the
same, the OSPF election for DR is decided on the router ID.
The highest router ID is selected.
The priorities can be set to any value from 0 to 255.
A value of 0 prevents that router from being elected.
A router with the highest OSPF priority will be selected as the
DR. A router with the second highest priority will be the BDR.
Note: After the election process, the DR and BDR retain their roles
even if routers are added to the network with higher OSPF
priority values.
Copyright 2003 www.ciscopress.com

Configuring OSPF Loopback Address and Router Priority


To modify the OSPF priority use the
ip ospf priority command
on an interface that is participating in OSPF.

Router(config-if)#ip ospf priority number

Number can be between 0 and 255.

The command
show ip ospf interface
will display the interface priority value as well as other key
information.

Router#show ip ospf interface type number

See next slide for examples.


Copyright 2003 www.ciscopress.com

15
Configuring Router Priority

The priorities can be set to any value from 0 to 255. A value of 0


prevents that router from being elected. A router with the highest
OSPF priority will win the election for DR.
Copyright 2003 www.ciscopress.com

Modifying OSPF Cost Metric


OSPF uses cost as the metric for determining the best route.
Cost is calculated using the formula 108/bandwidth,
or 100,000,000 bps ( 100 Mbps ) / bandwidth,
where “bandwidth” is expressed in bps, and
represents the bandwidth of the link to which the cost will be assigned.
The Cisco IOS automatically determines cost based on the bandwidth
assigned to the interface. It is essential for proper OSPF operation
that the correct interface bandwidth is set.

To assign bandwidth to an interface:

Router(config)#interface serial 0/0

Router(config-if)#bandwidth 64

Copyright 2003 www.ciscopress.com

16
Modifying OSPF Cost Metric
The default bandwidth for Cisco serial interfaces is
1.544 Mbps, or 1544 kbps.
You can change the cost.
For example, the default cost assigns the lowest cost
value, 1, to a 100 Mbps link (100 Mbps / 100 Mbps).
For 100-Mbps and Gigabit Ethernet links, the default
cost values could cause routing to a less than
desirable path.
The cost value can be between 1 and 65,535.
Use the following interface configuration command to
set the link cost:

Router(config-if)#ip ospf cost number

Copyright 2003 www.ciscopress.com

Modifying OSPF Cost Metric

Copyright 2003 www.ciscopress.com

17
Modifying OSPF Cost Metric

auto-cost reference-bandwidth bandwidth

Copyright 2003 www.ciscopress.com

Configuring OSPF Authentication

By default, a router trusts that


–  information is coming from the correct router.
–  information has not been tampered with.
Routers in a specific area can be configured to
authenticate each other.
Each OSPF interface can be assigned an authentication
key for use by routers sending it information.
The authentication key, known as a password, is a
shared between the routers.
–  This key is used to generate the authentication
data in the OSPF packet header.
–  The password can be up to eight characters.

Copyright 2003 www.ciscopress.com

18
Configuring OSPF Authentication
To configure OSPF authentication:
Router(config-if)#ip ospf
authentication-key password

After the password is configured, authentication


must be enabled:

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

Copyright 2003 www.ciscopress.com

Plain Text vs. Encrypted Authentication


With simple authentication, the password is sent as plain text.
The password could be easily decoded if a packet sniffer
captures an OSPF packet.
It is recommended that authentication information be encrypted.
To encrypt authentication information:
Router(config-if)#ip ospf message-digest-key
key-id md5 encryption-type key

The MD5 keyword specifies the type of message-digest hashing


algorithm to use.
The encryption type field refers to the type of encryption,
where 0 means none and 7 means proprietary.
The key-id is an identifier and takes the value in the range of 1
through 255.
The key is an alphanumeric password up to sixteen characters.
Neighbor routers must use the same key identifier with the same
key value.
Copyright 2003 www.ciscopress.com

19
Plain Text vs. Encrypted Authentication
To enable encrypted authentication::
Router(config-router)#area area-id authentication
message-digest
MD5 authentication creates a message digest,
scrambled data, based on the password and the packet contents.
The receiving router uses the shared password and the packet to re-
calculate the digest.
•  If the digests match, the router believes that the source and contents of
the packet have not been tampered with.
•  The authentication type identifies which authentication, if any, is being
used.
•  In the case of message-digest authentication, the authentication data
field contains the key-id and the length of the message digest that is
appended to the packet. [The message digest is like a watermark that
cannot be counterfeited.]

Copyright 2003 www.ciscopress.com

Configuring OSPF Authentication

Copyright 2003 www.ciscopress.com

20
Configuring OSPF Timers
OSPF routers must have the same hello intervals and
the same dead intervals to exchange information.

By default, the dead interval is four times the value of


the hello interval. This ratio can be changed.

On broadcast OSPF networks, the default hello interval


is 10 seconds and the default dead interval is 40
seconds. On nonbroadcast networks, the default
hello interval is 30 seconds and the default dead
interval is 120 seconds. [These default values result
in efficient OSPF operation and seldom need to be
modified.]

Copyright 2003 www.ciscopress.com

Configuring OSPF Timers


Before changing these default values,
the network administrator should
consider:

– Whether there is justification that OSPF


network performance will be improved.
– That these timers must be configured to
match those of any neighboring router
(because all neighboring routers must
have the same timer interval values).
Copyright 2003 www.ciscopress.com

21
Configuring OSPF Timers
To configure the hello and dead intervals on an
interface, use the following commands:

Router(config-if)#ip ospf hello-interval


seconds
Router(config-if)#ip ospf dead-interval
seconds

Note: Changes made on one router do not


automatically apply to other routers.

Copyright 2003 www.ciscopress.com

Configuring OSPF Timers

Copyright 2003 www.ciscopress.com

22
Propagating a Default Route in OSPF
To configure a default route:

Router(config)#ip route 0.0.0.0 0.0.0.0


[interface | next-hop address]

The following configuration statement will propagate this route to


all the routers in a normal OSPF area:

Router(config-router)#default-information originate

Copyright 2003 www.ciscopress.com

OSPF, Propagating a
Default Route

Copyright 2003 www.ciscopress.com

23
Propagating a Default Route in OSPF

An OSPF router must establish a neighbor or


adjacency relationship with another OSPF router to
exchange routing information.
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
(timer mismatch).
•  Interfaces are on different network types.
•  Authentication passwords or keys are different
(inconsistent authentication configuration).

Copyright 2003 www.ciscopress.com

Common OSPF
Configuration Issues

Copyright 2003 www.ciscopress.com

24
Verifying OSPF Configuration
•  show ip protocol
Displays parameters about timers, filters, metrics and networks.

•  show ip route
Displays contents of the routing table: routes known to router
and how they were learned.

•  show ip ospf interface


Verifies that interfaces have been configured in the intended
area. Shows timer intervals (hello & dead), and the neighbor
adjacencies.

Copyright 2003 www.ciscopress.com

Verifying OSPF Configuration


•  shop ip ospf
Displays the number of times that the shortest
path first (SPF) algorithm has been executed.
•  show ip ospf neighbor detail
Displays list of neighbors, their priorities, and
their state (e.g., init, exstart,or full).
•  show ip ospf database
Displays the contents of the topological
database, maintained by the router, including the
router ID and the OSPF process ID.

Copyright 2003 www.ciscopress.com

25
Cisco IOS Debug and Clear Commands

Copyright 2003 www.ciscopress.com

26

Você também pode gostar