CH10 - Single Area OSPF
CH10 - Single Area OSPF
CH10 - 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
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
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.”
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.
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
Or
ip ospf cost 1564
Router(config-if)#i Changes the cost to a value of 1564.
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
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.
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.
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.
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
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.
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
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
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
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