OSPF Authentication
OSPF Authentication
Introduction
Prerequisites
Requirements
Components Used
Conventions
Background Information
Configure
Network Diagram
Configurations for Plain Text Authentication
Configurations for MD5 Authentication
Verify
Verify Plain Text Authentication
Verify MD5 Authentication
Troubleshoot
Troubleshoot Plain Text Authentication
Troubleshoot MD5 Authentication
Related Information
Introduction
This document shows sample configurations for Open Shortest Path First (OSPF) authentication which allows
the flexibility to authenticate OSPF neighbors. You can enable authentication in OSPF in order to exchange
routing update information in a secure manner. OSPF authentication can either be none (or null), simple, or
MD5. The authentication method "none" means that no authentication is used for OSPF and it is the default
method. With simple authentication, the password goes in clear−text over the network. With MD5
authentication, the password does not pass over the network. MD5 is a message−digest algorithm specified in
RFC 1321. MD5 is considered the most secure OSPF authentication mode. When you configure
authentication, you must configure an entire area with the same type of authentication. Starting with Cisco
IOS® Software Release 12.0(8), authentication is supported on a per−interface basis. This is also mentioned in
RFC 2328 , Appendix D. This feature is added in Cisco bug ID CSCdk33792 ( registered customers only) .
Prerequisites
Requirements
Readers of this document should be familiar with basic concepts of OSPF routing protocol. Refer to the Open
Shortest Path First documentation for information on OSPF routing protocol.
Components Used
The information in this document is based on these software and hardware versions.
The information in this document was created from the devices in a specific lab environment. All of the
devices used in this document started with a cleared (default) configuration. If your network is live, make sure
that you understand the potential impact of any command.
Conventions
Refer to Cisco Technical Tips Conventions for more information on document conventions.
Background Information
These are the three different types of authentication supported by OSPF.
Authentication does not need to be set. However, if it is set, all peer routers on the same segment must have
the same password and authentication method. The examples in this document demonstrate configurations for
both plain text and MD5 authentication.
Configure
This section presents you with the information to configure the features this document describes.
Note: Use the Command Lookup Tool ( registered customers only) to find additional information on the
commands used in this document.
Network Diagram
This document uses this network setup.
• R2−2503
• R1−2503
R2−2503
interface Loopback0
ip address 70.70.70.70 255.255.255.255
!
interface Serial0
ip address 192.16.64.2 255.255.255.0
ip ospf authentication−key kal
clockrate 64000
!
router ospf 10
log−adjacency−changes
network 70.0.0.0 0.255.255.255 area 0
network 192.16.64.0 0.0.0.255 area 0
area 0 authentication
R1−2503
interface Loopback0
ip address 172.16.10.36 255.255.255.240
!
interface Serial0
ip address 192.16.64.1 255.255.255.0
ip ospf authentication−key kal
!
router ospf 10
network 172.16.0.0 0.0.255.255 area 0
network 192.16.64.0 0.0.0.255 area 0
area 0 authentication
Note: The area authentication command in the configuration enables authentication for all the interfaces of
the router in a particular area. You can also use the ip ospf authentication command under the interface to
configure plain text authentication for the interface. This command can be used if a different authentication
method or no authentication method is configured under the area to which the interface belongs. It overrides
the authentication method configured for the area. This is useful if different interfaces that belong to the same
area need to use different authentication methods.
The key ID allows the routers to reference multiple passwords. This makes password migration easier and
more secure. For example, to migrate from one password to another, configure a password under a different
key ID and remove the first key. The sequence number prevents replay attacks, in which OSPF packets are
captured, modified, and retransmitted to a router. As with plain text authentication, MD5 authentication
passwords do not have to be the same throughout an area. However, they do need to be the same between
neighbors.
Note: Cisco recommends that you configure the service password−encryption command on all of the
routers. This causes the router to encrypt the passwords in any display of the configuration file and guards
against the password being learned by observing the text copy of the configuration of the router.
• R2−2503
• R1−2503
R2−2503
interface Loopback0
ip address 70.70.70.70 255.255.255.255
!
interface Serial0
ip address 192.16.64.2 255.255.255.0
ip ospf message−digest−key 1 md5 kal
clockrate 64000
!
router ospf 10
network 192.16.64.0 0.0.0.255 area 0
network 70.0.0.0 0.255.255.255 area 0
area 0 authentication message−digest −−>
R1−2503
interface Loopback0
ip address 172.16.10.36 255.255.255.240
!
interface Serial0
ip address 192.16.64.1 255.255.255.0
ip ospf message−digest−key 1 md5 kal
!
router ospf 10
network 172.16.0.0 0.0.255.255 area 0
network 192.16.64.0 0.0.0.255 area 0
area 0 authentication message−digest
Note: The area authentication message−digest command in this configuration enables authentication for all
of the router interfaces in a particular area. You can also use the ip ospf authentication message−digest
command under the interface to configure MD5 authentication for the specific interface. This command can
be used if a different authentication method or no authentication method is configured under the area to which
the interface belongs. It overrides the authentication method configured for the area. This is useful if different
interfaces that belong to the same area need to use different authentication methods.
Verify
These sections provide information you can use to confirm your configurations work properly.
Certain show commands are supported by the Output Interpreter Tool ( registered customers only) , which allows
you to view an analysis of show command output.
The show ip ospf neighbor command displays the neighbor table that consists of the neighbor details, as this
output shows.
The show ip route command displays the routing table, as this output shows.
The show ip ospf neighbor command displays the neighbor table that consists of the neighbor details, as this
output shows.
The show ip route command displays the routing table, as this output shows.
Troubleshoot
These sections provide information you can use to troubleshoot your configurations. Issue the debug ip ospf
adj command in order to capture the authentication process. This debug command should be issued before
the neighbor relationship is established.
Note: Refer to Important Information on Debug Commands before you use debug commands.
This is the output of the debug ip ospf adj command when there is a mismatch in the type of authentication
configured on the routers. This output shows that Router R1−2503 uses type 1 authentication whereas router
R2−2503 is configured for type 0 authentication. This means that Router R1−2503 is configured for plain text
authentication (Type 1) whereas Router R2−2503 is configured for null authentication (Type 0).
This is the output of the debug ip ospf adj command when there is a mismatch in the authentication key
(password) values. In this case, both routers are configured for plain text authentication (Type 1) but there is a
mismatch in the key (password) values.
00:59:42: OSPF: Send DBD to 70.70.70.70 on Serial0 seq 0x2125 opt 0x42
flag 0x7len 32
00:59:42: OSPF: Send with youngest Key 1
00:59:42: OSPF: Rcv DBD from 70.70.70.70 on Serial0 seq 0x11F3 opt 0x42
flag 0x7 len 32 mtu 1500 state EXSTART
00:59:42: OSPF: First DBD and we are not SLAVE
00:59:42: OSPF: Rcv DBD from 70.70.70.70 on Serial0 seq 0x2125 opt 0x42
flag 0x2 len 72 mtu 1500 state EXSTART
00:59:42: OSPF: NBR Negotiation Done. We are the MASTER
00:59:42: OSPF: Send DBD to 70.70.70.70 on Serial0 seq 0x2126 opt 0x42
flag 0x3 len 72
00:59:42: OSPF: Send with youngest Key 1
00:59:42: OSPF: Send with youngest Key 1
00:59:42: OSPF: Database request to 70.70.70.70
00:59:42: OSPF: sent LS REQ packet to 192.16.64.2, length 12
00:59:42: OSPF: Rcv DBD from 70.70.70.70 on Serial0 seq 0x2126 opt 0x42
flag 0x0 len 32 mtu 1500 state EXCHANGE
00:59:42: OSPF: Send DBD to 70.70.70.70 on Serial0 seq 0x2127 opt 0x42
flag 0x1len 32
00:59:42: OSPF: Send with youngest Key 1
00:59:42: OSPF: Send with youngest Key 1
00:59:42: OSPF: Rcv DBD from 70.70.70.70 on Serial0 seq 0x2127 opt 0x42
flag 0x0 len 32 mtu 1500 state EXCHANGE
00:59:42: OSPF: Exchange Done with 70.70.70.70 on Serial0
00:59:42: OSPF: Synchronized with 70.70.70.70 on Serial0, state FULL
00:59:42: %OSPF−5−ADJCHG: Process 10, Nbr 70.70.70.70 on Serial0 from
LOADING to FULL, Loading Done
00:59:43: OSPF: Build router LSA for area 0, router ID 172.16.10.36,
seq 0x80000010
00:59:43: OSPF: Send with youngest Key 1
00:59:45: OSPF: Send with youngest Key 1
R1−2503#
This is the output of the debug ip ospf adj command when there is a mismatch in the type of authentication
configured on the routers. This output shows that the router R1−2503 uses type 2 (MD5) authentication
whereas Router R2−2503 uses type 1 authentication (plain text authentication).
This is the output of the debug ip ospf adj command when there is a mismatch in the key IDs that are used
for authentication. This output shows that the router R1−2503 uses MD5 authentication with Key ID 1,
whereas the Router R2−2503 uses MD5 authentication with Key ID 2.
This debug ip ospf adj command output for R1−2503 shows when both Key 1 and Key 2 for MD5
authentication are configured as part of migration.
Related Information
• Configuring OSPF Authentication on a Virtual Link
• Why Does the show ip ospf neighbor Command Reveal Neighbors in the Init State?
• OSPF Commands
• OSPF Configuration Examples
• OSPF Technology Support Page
• Technical Support & Documentation − Cisco Systems
All contents are Copyright © 2006−2007 Cisco Systems, Inc. All rights reserved. Important Notices and Privacy Statement.