CH10 - Single Area OSPF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

CHAPTER 10

Single Area OSPF

This chapter provides information and commands concerning the following topics:
• Configuring OSPF: Mandatory commands
• Using wildcard masks with OSPF areas
• Configuring OSPF: Optional commands
— Loopback interfaces
— Router ID
— DR/BDR elections
— Modifying cost metrics
— Authentication: Simple
— Authentication: Using MD5 encryption
— Timers
— Propagating a default route
• Verifying OSPF configuration
• Troubleshooting OSPF
• Configuration example: Single area OSPF

Configuring OSPF: Mandatory Commands

router ospf 123


Router(config)#r Starts OSPF process 123. The process
ID is any positive integer value
between 1 and 65,535. The process
ID is not related to the OSPF area.
The process ID merely distinguishes
one process from another within the
device.
network
Router(config-router)#n OSPF advertises interfaces, not
172.16.10.0 0.0.0.255 area 0 networks. Uses the wildcard mask to
determine which interfaces to
advertise. Read this line to say “Any
interface with an address of
172.16.10.x is to be put into area 0.”
92 Using Wildcard Masks with OSPF Areas

NOTE: The process ID number of


one router does not have to match the
process ID of any other router.
Unlike Enhanced Interior Gateway
Routing Protocol (EIGRP), matching
this number across all routers does not
ensure that network adjacencies will
form.
log-
Router(config-router)#l Configures the router to send a syslog
adjacency-changes detail message when there is a change of
state between OSPF neighbors.

TIP: Although the log-adjacency-


changes command is on by default,
only up/down events are reported
unless you use the detail keyword.

Using Wildcard Masks with OSPF Areas

When compared to an IP address, a wildcard mask identifies which addresses get matched
for placement into an area:
• A 0 (zero) in a wildcard mask means to check the corresponding bit in the address for
an exact match.
• A 1 (one) in a wildcard mask means to ignore the corresponding bit in the address—
can be either 1 or 0.
Example 1: 172.16.0.0 0.0.255.255
172.16.0.0 = 10101100.00010000.00000000.00000000
0.0.255.255 = 00000000.00000000.11111111.11111111
result = 10101100.00010000.xxxxxxxx.xxxxxxxx
172.16.x.x (Anything between 172.16.0.0 and 172.16.255.255 will
match the example statement.)

TIP: An octet of all 0s means that the octet has to match exactly to the address.
An octet of all 1s means that the octet can be ignored.
Configuring OSPF: Optional Commands 93

Example 2: 172.16.8.0 0.0.7.255


172.168.8.0 = 10101100.00010000.00001000.00000000
0.0.0.7.255 = 00000000.00000000.00000111.11111111
result = 10101100.00010000.00001xxx.xxxxxxxx
00001xxx = 00001000 to 00001111 = 8–15
xxxxxxxx = 00000000 to 11111111 = 0–255
Anything between 172.16.8.0 and 172.16.15.255 will match the
example statement.

network
Router(config-router)#n Read this line to say “Any interface
172.16.10.1 0.0.0.0 area 0 with an exact address of 172.16.10.1
is to be put into area 0.”
network
Router(config-router)#n Read this line to say “Any interface
172.16.10.0 0.0.255.255 area 0 with an address of 172.16.x.x is to be
put into area 0.”
network 0.0.0.0
Router(config-router)#n Read this line to say “Any interface
255.255.255.255 area 0 with any address is to be put into area
0.”

Configuring OSPF: Optional Commands

The following commands, although not mandatory, enable you to have a more controlled
and efficient deployment of OSPF in your network.

Loopback Interfaces

interface loopback 0
Router(config)#i Creates a virtual interface named
loopback 0, and then moves the
router to interface configuration
mode.
ip address
Router(config-if)#i Assigns the IP address to the
192.168.100.1 255.255.255.255 interface.

NOTE: Loopback interfaces are


always “up and up” and do not go
down unless manually shut down.
This makes loopback interfaces
great for use as OSPF router IDs.
94 Configuring OSPF: Optional Commands

Router ID

router ospf 1
Router(config)#r Starts OSPF process 1.
router-id
Router(config-router)#r Sets the router ID to 10.1.1.1. If
10.1.1.1 this command is used on an OSPF
router process that is already active
(has neighbors), the new router ID
is used at the next reload or at a
manual OSPF process restart.
no router-id
Router(config-router)#n Removes the static router ID from
10.1.1.1 the configuration. If this command
is used on an OSPF router process
that is already active (has
neighbors), the old router ID
behavior is used at the next reload
or at a manual OSPF process
restart.

DR/BDR Elections

interface serial 0/0


Router(config)#i Changes the router to interface
configuration mode.
ip ospf priority 50
Router(config-if)#i Changes the OSPF interface
priority to 50.

NOTE: The assigned priority can


be between 0 and 255. A priority
of 0 makes the router ineligible to
become a designated router (DR)
or backup designated router BDR).
The highest priority wins the
election. A priority of 255
guarantees a tie in the election. If
all routers have the same priority,
regardless of the priority number,
they tie. Ties are broken by the
highest router ID.
Configuring OSPF: Optional Commands 95

Modifying Cost Metrics

interface serial 0/0


Router(config)#i Changes the router to interface
configuration mode.
bandwidth 128
Router(config-if)#b If you change the bandwidth, OSPF
recalculates the cost of the link.

Or
ip ospf cost 1564
Router(config-if)#i Changes the cost to a value of 1564.

NOTE: The cost of a link is determined


by dividing the reference bandwidth by
the interface bandwidth.
The bandwidth of the interface is a
number between 1 and 10,000,000. The
unit of measurement is kilobits.
The cost is a number between 1 and
65,535. The cost has no unit of
measurement—it is just a number.

Authentication: Simple

router ospf 1
Router(config)#r Starts OSPF process 1.
area 0
Router(config-router)#a Enables simple authentication; password
authentication will be sent in clear text.
exit
Router(config-router)#e Returns to global configuration mode.
interface
Router(config)#i Moves to interface configuration mode.
fastethernet 0/0

ip ospf
Router(config-if)#i Sets key (password) to fred.
authentication-key fred

NOTE: The password can be any


continuous string of characters that can
be entered from the keyboard, up to
8 bytes in length. To be able to exchange
OSPF information, all neighboring
routers on the same network must have
the same password.
96 Configuring OSPF: Optional Commands

Authentication: Using MD5 Encryption

router ospf 1
Router(config)#r Starts OSPF process 1.
area 0
Router(config-router)#a Enables authentication with MD5
authentication message-digest password encryption.
exit
Router(config-router)#e Returns to global configuration mode.
interface
Router(config)#i Moves to interface configuration mode.
fastethernet 0/0

ip ospf message-
Router(config-if)#i 1 is the key-id. This value must be the
digest-key 1 md5 fred same as that of your neighboring router.
md5 indicates that the MD5 hash
algorithm will be used.
fred is the key (password) and must be
the same as that of your neighboring
router.

NOTE: If the service password-


encryption command is not used when
implementing OSPF MD5
authentication, the MD5 secret is
stored as plain text in NVRAM.

Timers

ip ospf hello-
Router(config-if)#i Changes the Hello Interval timer to
interval timer 20 20 seconds.
ip ospf dead-
Router(config-if)#i Changes the Dead Interval timer to
interval 80 80 seconds.

NOTE: Hello and Dead Interval timers


must match for routers to become
neighbors.

Propagating a Default Route

ip route 0.0.0.0
Router(config)#i Creates a default route.
0.0.0.0 s0/0

router ospf 1
Router(config)#r Starts OSPF process 1.
default-
Router(config-router)#d Sets the default route to be propagated to
information originate all OSPF routers.
Verifying OSPF Configuration 97

default-
Router(config-router)#d The always option propagates a default
information originate always “quad-zero” route even if one is not
configured on this router.

NOTE: The default-information


originate command or the default-
information originate always command
is usually only to be configured on your
“entrance” or “gateway” router, the
router that connects your network to the
outside world—the Autonomous System
Boundary Router (ASBR).

Verifying OSPF Configuration

show ip protocol
Router#s Displays parameters for all protocols
running on the router
show ip route
Router#s Displays a complete IP routing table
show ip ospf
Router#s Displays basic information about OSPF
routing processes
show ip ospf interface
Router#s Displays OSPF info as it relates to all
interfaces
show ip ospf interface
Router#s Displays OSPF information for interface
fastethernet 0/0 fastethernet 0/0
show ip ospf border-routers
Router#s Displays border and boundary router
information
show ip ospf neighbor
Router#s Lists all OSPF neighbors and their states
show ip ospf neighbor detail
Router#s Displays a detailed list of neighbors
show ip ospf database
Router#s Displays contents of the OSPF database
show ip ospf database
Router#s Displays NSSA external link states
nssa-external
98 Configuration Example: Single Area OSPF

Troubleshooting OSPF

clear ip route *
Router#c Clears entire routing table, forcing it to
rebuild
clear ip route a.b.c.d
Router#c Clears specific route to network a.b.c.d
clear ip opsf counters
Router#c Resets OSPF counters
clear ip ospf process
Router#c Resets entire OSPF process, forcing
OSPF to re-create neighbors, database,
and routing table
debug ip ospf events
Router#d Displays all OSPF events
debug ip ospf adjacency
Router#d Displays various OSPF states and DR/
BDR election between adjacent routers
debug ip ospf packets
Router#d Displays OPSF packets

Configuration Example: Single Area OSPF

Figure 10-1 illustrates the network topology for the configuration that follows, which shows
how to configure Single Area OSPF using commands covered in this chapter.

Figure 10-9 Network Topology for Single Area OSPF Configuration


Network Network
172.16.20.0/30 172.16.40.0/30

s0/0 s0/0
172.16.20.1 s0/1 172.16.40.1 s0/1
172.16.20.2 172.16.40.2
DCE DCE
Austin Houston Galveston
fa0/0 fa0/0 fa0/0
172.16.10.1 172.16.30.1 172.16.50.1

172.16.10.10 172.16.30.30 172.16.50.50

Network Network Network


172.16.10.0/24 172.16.30.0/24 172.16.50.0/24
Configuration Example: Single Area OSPF 99

Austin Router

enable
Router>e Moves to privileged mode.
configure terminal
Router#c Moves to global configuration mode.
hostname Austin
Router(config)#h Sets the host name.
interface
Austin(config)#i Moves to interface configuration mode.
fastethernet 0/0

ip address
Austin(config-if)#i Assigns an IP address and netmask.
172.16.10.1 255.255.255.0

no shutdown
Austin(config-if)#n Enables the interface.
interface serial
Austin(config-if)#i Moves to interface configuration mode.
0/0

ip address
Austin(config-if)#i Assigns an IP address and netmask.
172.16.20.1 255.255.255.252

clock rate 56000


Austin(config-if)#c DCE cable plugged in this side.
no shutdown
Austin(config-if)#n Enables the interface.
exit
Austin(config-if)#e Returns to global configuration mode.
router ospf 1
Austin(config)#r Starts OSPF process 1.
network
Austin(config-router)#n Any interface with an address of
172.16.10.0 0.0.0.255 area 0 172.16.10.x is to be put into area 0.
network
Austin(config-router)#n Any interface with an address of
172.16.20.0 0.0.0.255 area 0 172.16.20.x is to be put into area 0.
<ctrl> z
Austin(config-router)#< Returns to privileged mode.
copy running-config
Austin#c Saves the configuration to NVRAM.
startup-config
100 Configuration Example: Single Area OSPF

Houston Router

enable
Router>e Moves to privileged mode.
configure terminal
Router#c Moves to global configuration mode.
hostname Houston
Router(config)#h Sets the host name.
interface
Houston(config)#i Moves to interface configuration mode.
fastethernet 0/0

ip address
Houston(config-if)#i Assigns an IP address and netmask.
172.16.30.1 255.255.255.0

no shutdown
Houston(config-if)#n Enables the interface.
interface
Houston(config-if)#i Moves to interface configuration mode.
serial0/0

ip address
Houston(config-if)#i Assigns an IP address and netmask.
172.16.40.1 255.255.255.252

clock rate 56000


Houston(config-if)#c DCE cable plugged in this side.
no shutdown
Houston(config-if)#n Enables the interface.
interface serial 0/1
Houston(config)#i Moves to interface configuration mode.
ip address
Houston(config-if)#i Assigns an IP address and netmask.
172.16.20.2 255.255.255.252

no shutdown
Houston(config-if)#n Enables the interface.
exit
Houston(config-if)#e Returns to global configuration mode.
router ospf 1
Houston(config)#r Starts OSPF process 1.
network
Houston(config-router)#n Any interface with an address of
172.16.0.0 0.0.255.255 area 0 172.16.x.x is to be put into area 0.
One statement will now advertise all
three interfaces.
<ctrl> z
Houston(config-router)#< Returns to privileged mode.
copy running-config startup-
Houston#c Saves the configuration to NVRAM.
config
Configuration Example: Single Area OSPF 101

Galveston Router

enable
Router>e Moves to privileged mode.
configure terminal
Router#c Moves to global configuration mode.
hostname Galveston
Router(config)#h Sets the host name.
interface
Galveston(config)#i Moves to interface configuration mode.
fastethernet 0/0

ip address
Galveston(config-if)#i Assigns an IP address and netmask.
172.16.50.1 255.255.255.0

no shutdown
Galveston(config-if)#n Enables the interface.
interface
Galveston(config-if)#i Moves to interface configuration mode.
serial 0/1

ip address
Galveston(config-if)#i Assigns an IP address and netmask.
172.16.40.2 255.255.255.252

no shutdown
Galveston(config-if)#n Enables the interface.
exit
Galveston(config-if)#e Returns to global configuration mode.
router ospf 1
Galveston(config)#r Starts OSPF process 1.
network
Galveston(config-router)#n Any interface with an exact address of
172.16.40.2 0.0.0.0 area 0 172.16.40.2 is to be put into area 0. This
is the most precise way to place an
exact address into the OSPF routing
process.
network
Galveston(config-router)#n Any interface with an exact address of
172.16.50.1 0.0.0.0 area 0 172.16.50.2 is to be put into area 0.
<ctrl> z
Galveston(config-router)#< Returns to privileged mode.
copy running-config
Galveston#c Saves the configuration to NVRAM.
startup-config
This page intentionally left blank

You might also like