OSPF Commands

Open Shortest Path First (OSPF) protocol is an Interior Gateway Protocol operating within a single Autonomous System. It gathers link state information from available routers and constructs a topology map of the network. Based on this topology, OSPF calculates the shortest path tree for each route using Dijkstra's algorithm, and updates the routing table.

OSPF information is encapsulated directly in IP datagrams with protocol number 89. It uses multicast addressing for neighbor discovery and route flooding on a broadcast domain. OSPF handles its own error detection and correction functions, changes in topology are detected usually within seconds.

If multiple routes with the same associated cost to the same destination are detected, an equal cost multipath (ECMP) set is formed. The router then balances traffic across these sets of equal cost paths. A maximum number of 4 routes for each ECMP set are supported by RCP100.

Limitations:

The current implementation has the following limitations:


Table Of Contents

area stub
area default-cost
area range
clear ip ospf
default-information originate
discard-route
ip ospf authentication
ip ospf authentication-key
ip ospf cost
ip ospf dead-interval
ip ospf hello-interval
ip ospf message-digest-key
ip ospf mtu-ignore
ip ospf priority
ip ospf retransmit-interval
network area
router ospf
log-adjacency-changes
redistribute connected
redistribute rip
redistribute static
router-id
show ip ospf
show ip ospf border-routers
show ip ospf database
show ip ospf interface
show ip ospf neighbor
show ip ospf route
timers spf
summary-address
Example: Configuration of Three Networks with OSPF

area stub


Define an area as a stub.

area <area ID> stub [no-summary]
no area <area ID> stub

where:

no-summary - summary link advertisements are not sent into the area.

The no form of the command disables this function.

Example:

rcp(config)#router ospf
rcp(ospf)#area 1 stub no-summary
rcp(ospf)#

area default-cost


Specify the cost for the default route injected into the stub area.

area <area ID> default-cost <cost>
no area <area ID> default-cost

The no form of the command resets the cost to the default value of 1.

Example:

rcp(config)#router ospf
rcp(ospf)#area 1 default-cost 20
rcp(ospf)#

area range


Summarize routes at an area boundary.

area <area ID>range <CIDR range> [not-advertise]
no area <area ID> range <CIDR range>

where:

<CIDR range> - range of addresses to be summarized.
not-advertise - suppress type 3 summary LSA generation.

The no form of the command will remove the summarization.

Example:

rcp(config)#router ospf
rcp(ospf)#area 1 range 1.2.3.0/24 not-advertise
rcp(ospf)#

clear ip ospf


Reset OSPF protocol.

clear ip ospf

Reset OSPF statistics.

clear ip ospf statistics

Start a short path first (SPF) calculation.

clear ip ospf force-spf


default-information originate


Insert the default route into OSPF database. The route will be exchanged with the other routers.

[no] default-information originate

The no form of the command removes the default route from OSPF database.

Example:

rcp(config)#router ospf
rcp(ospf)#default-information originate 
rcp(ospf)#

discard-route


Install or do not install blackhole routes introduced by summarization.

[no] discard-route [internal | external]

By default, blackhole routes introduced by summarization are installed.

Example:

rcp(ospf)#show ip route ospf 
Codes: C - connected, S - static, R - RIP, B - blackhole, O - OSPF
IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2

O E1 1.2.1.0/24[110/23] via 10.1.0.66, br0
O E2 1.3.1.0/24[110/50] via 10.1.0.3, br0
O B  10.0.0.0/23    <<<  Summarization blackhole route installed by default
O IA 10.0.2.0/23[110/9] via 10.1.0.3, br0
O E1 10.0.4.0/24[110/29] via 10.1.0.3, br0
rcp(ospf)#no discard-route
rcp(ospf)#show ip route ospf 
Codes: C - connected, S - static, R - RIP, B - blackhole, O - OSPF
IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2

O E1 1.2.1.0/24[110/23] via 10.1.0.66, br0
O E2 1.3.1.0/24[110/50] via 10.1.0.3, br0
O IA 10.0.2.0/23[110/9] via 10.1.0.3, br0
O E1 10.0.4.0/24[110/29] via 10.1.0.3, br0
rcp(ospf)#

ip ospf authentication


ip ospf authentication

Enable simple password authentication

ip ospf authentication message-digest

Enable MD5 authentication

no ip ospf authentication

The no form of the command disables authentication.

Example:

rcp(config)#interface ethernet eth0
rcp(config-if eth0)#ip ospf authentication message-digest
rcp(config-if eth0)#

ip ospf authentication-key


Set password for OSPF simple password authentication.

ip ospf authentication-key <password>
no ip ospf authentication-key

The no form of the command removes the password.

Example:

rcp(config)#interface ethernet eth0
rcp(config-if eth0)#ip ospf authentication-key mysecret
rcp(config-if eth0)#

ip ospf cost


Specify the cost of sending a packet on an interface.

ip ospf cost <cost>
no ip ospf cost

The no form of the command sets the cost to the default value of 1.

Example:

rcp(config)#interface ethernet eth0
rcp(config-if eth0)#ip ospf cost 10
rcp(config-if eth0)#

ip ospf dead-interval


Set OSPF dead interval for the interface.

ip ospf dead-interval <seconds>
no ip ospf dead-interval

The no form of the command sets the dead interval to the default value of 40.

Example:

rcp(config)#interface ethernet eth0
rcp(config-if eth0)#ip ospf dead-interval 4
rcp(config-if eth0)#

ip ospf hello-interval


Set OSPF hello interval for the interface.

ip ospf hello-interval <seconds>
no ip ospf hello-interval

The no form of the command sets the hello interval to the default value of 10.

Example:

rcp(config)#interface ethernet eth0
rcp(config-if eth0)#ip ospf hello-interval 1
rcp(config-if eth0)#

ip ospf message-digest-key


Set password for OSPF MD5 authentication.

ip ospf message-digest-key <key ID> md5 <password>
no ip ospf message-digest-key

The no form of the command removes the password.

Example:

rcp(config)#interface ethernet eth0
rcp(config-if eth0)#ip ospf message-digest-key 22 md5 mysecret
rcp(config-if eth0)#

ip ospf mtu-ignore


Disabled MTU mismatch detection.

[no] ip ospf mtu-ignore

The no form of the command enables the detection.

Example:

rcp(config)#interface ethernet eth0
rcp(config-if eth0)#ip ospf mtu-ignore
rcp(config-if eth0)#

ip ospf priority


Set OSPF priority for the interface.

ip ospf priority <priority>
no ip ospf priority

The no form of the command sets the priority to the default value of 1.

Example:

rcp(config)#interface ethernet eth0
rcp(config-if eth0)#ip ospf priority 5
rcp(config-if eth0)#

ip ospf retransmit-interval


Set OSPF retransmit interval for the interface.

ip ospf retransmit-interval <seconds>
no ip ospf retransmit-interval

The no form of the command sets the retransmit interval to the default value of 5.

Example:

rcp(config)#interface ethernet eth0
rcp(config-if eth0)#ip ospf retransmit-interval 10
rcp(config-if eth0)#

network area


Define an area ID and enable OSPF on a network.

[no] network <CIDR address> area <area ID>

The no form of the command removes the network.

Example:

rcp(config)#router ospf 
rcp(ospf)#network 10.1.0.0/16 area 0
rcp(ospf)#

router rip


Enter OSPF configuration mode.

router ospf

Use exit command to return to configuration mode.

Example:

rcp(config)#router ospf 
rcp(ospf)#exit
rcp(config)#

log-adjacency-changes


Send syslog messages when an OSPF neighbor goes up or down.

[no] ospf log-adjacency-changes [detail]

where:

detail - log any neighbor state changes.

The no form of the command disables logging.

Example:

rcp(config)#router ospf
rcp(ospf)#ospf log-adjacency-changes detail
rcp(ospf)#

redistribute connected


Distribute connected routes using OSPF.

[no] redistribute connected [metric <metric>] \
        [metric-type <type>] [tag <tag>]
[no] redistribute connected loopback

where:

metric - metric used for generating the route, default value 10.
type - OSPF external type 1 or type 2 routes, default type 2.
tag - 32-bit tag value, default value 0.
loopback - redistribute loopback interface addresses

The no form of the command removes the connected routes from OSPF database.

Example:

rcp(config)#router ospf
rcp(ospf)#redistribute connected metric 50 metric-type 1
rcp(ospf)#

redistribute rip


Distribute RIP routes using OSPF.

[no] redistribute rip [metric <metric>] [metric-type <type>] [tag <tag>]

where:

metric - metric used for generating the route, default value 10.
type - OSPF external type 1 or type 2 routes, default type 2.
tag - 32-bit tag value, default value 0.

The no form of the command removes the RIP routes from OSPF database.

Example:

rcp(config)#router ospf
rcp(ospf)#redistribute rip metric 50 metric-type 1
rcp(ospf)#

redistribute static


Distribute static routes using OSPF.

[no] redistribute static [metric <metric>] [metric-type <type>] [tag <tag>]

where:

metric - metric used for generating the route, default value 10.
type - OSPF external type 1 or type 2 routes, default type 2.
tag - 32-bit tag value, default value 0.

The no form of the command removes the static routes from OSPF database.

Example:

rcp(config)#router ospf
rcp(ospf)#redistribute static metric 50 metric-type 1
rcp(ospf)#

router-id


Set OSPF router ID. If the router already has OSPF neighbors active, it is necessary to restart OSPF protocol using clear ip ospf command.

router-id <IP address>

If router ID is not specified, OSPF will use the highest IP address configured on any interface.

Example:

rcp(config)#router ospf
rcp(ospf)#router-id 10.1.1.1
rcp(ospf)#

show ip ospf


Display general OSPF information.

show ip ospf

Example:

rcp#show ip ospf
OSPF router id 192.168.1.22
Conforms to RFC2328, RFC1583 Compatibility flag is disabled
Supports only single TOS(TOS0) routes
This is an Area Border Router
This is an AS Border Router
SPF schedule delay 2 seconds, number of SPF calculations 2
Last SPF calculation Fri Jun 29 09:30:08 2012
Number of external LSA 2
Number of LSA originated 23
Area 2:
   Number of LSA 12
   Network 10.2.0.0/24, 1 neighbors (0 down, 0 2way, 1 full)
Area 1:
   Number of LSA 12
   Network 10.1.0.0/24, 1 neighbors (0 down, 0 2way, 1 full)
Area 0:
   Number of LSA 15
   Network 10.0.0.0/24, 2 neighbors (0 down, 0 2way, 2 full)
rcp#

show ip ospf border-routers


Display network border routers.

show ip ospf border-routers

Example:

rcp#show ip ospf border-routers
i 192.168.10.2 [1], ABR, ASBR, area 0
i 192.168.10.1 [1], ASBR, area 0
rcp#

show ip ospf database


Display OSPF database.

show ip ospf [<area ID>] database \
   router | network | summary | asbr-summary | external | self-originate \
   [detail]

Example:

rcp#show ip ospf database 

			Router Link States (Area 0)

Link ID          ADV Router       Age     Seq#        Checksum    Link count
192.168.1.22     192.168.1.22     564     0x80000028  0xd240      1
10.0.21.10       10.0.21.10       583     0x8000000d  0xceae      2
10.0.22.11       10.0.22.11       583     0x80000007  0x8de4      2
10.0.22.1        10.0.22.1        584     0x80000009  0x7309      2
10.0.21.1        10.0.21.1        590     0x80000009  0x275c      2
10.0.11.1        10.0.11.1        566     0x80000016  0xaffb      2
10.0.12.1        10.0.12.1        565     0x8000000b  0xe3cd      2

			Network Link States (Area 0)

Link ID          ADV Router       Age     Seq#        Checksum    
10.0.3.1         10.0.21.10       583     0x8000000e  0x18a9      
10.0.22.1        10.0.22.1        584     0x8000000a  0x0cb6      
10.0.21.1        10.0.21.1        590     0x8000000a  0xfdc9      
10.0.12.1        10.0.12.1        598     0x8000000a  0xd911      
10.0.0.10        10.0.11.1        566     0x80000017  0x86e6      
10.0.11.1        10.0.11.1        566     0x80000018  0xb927      

			Summary Link States (Area 0)

Link ID          ADV Router       Age     Seq#        Checksum    
10.1.0.0         192.168.1.22     561     0x8000002e  0x6f30      
10.2.0.0         192.168.1.22     561     0x8000002d  0x653a      

			AS External Link States

Link ID          ADV Router       Age     Seq#        Checksum    Type Tag
10.0.41.0        10.0.22.11       584     0x80000006  0x1399      E1   0
10.0.40.0        10.0.21.10       591     0x8000000c  0x9495      E2   0
rcp#

show ip ospf interface


Display OSPF interface information.

show ip ospf interface

Example:

rcp#show ip ospf interface 
Interface br2, admin state UP, link state UP
   IP address 10.2.0.1/24, MTU 1500
   Router ID 192.168.1.22, network type BROADCAST, cost 1
   Transmit delay is 0, network state Backup, priority 1
   Hello interval 1, dead interval 4, wait time 4, retransmit interval 5
   Designated router 10.2.0.10, backup designated router 10.2.0.1
   Hello packets received 1830, sent 1830, errors 0
   Database Description packets received 4, sent 3, rxmt 0, errors 0
   LS Request packets received 1, sent 1, rxmt 0, errors 0
   LS Update packets received 29, sent 19, rxmt 0, errors 0
   LS Acknowledgment packets received 19, sent 29, errors 0
   Neighbor count is 1, adjacent neighbor count is 1
Interface br1, admin state UP, link state UP
   IP address 10.1.0.1/24, MTU 1500
   Router ID 192.168.1.22, network type BROADCAST, cost 1
   Transmit delay is 0, network state Backup, priority 1
   Hello interval 1, dead interval 4, wait time 4, retransmit interval 5
   Designated router 10.1.0.10, backup designated router 10.1.0.1
   Hello packets received 1830, sent 1830, errors 0
   Database Description packets received 4, sent 3,rxmt 0,  errors 0
   LS Request packets received 1, sent 1, rxmt 0, errors 0
   LS Update packets received 29, sent 19, rxmt 0, errors 0
   LS Acknowledgment packets received 19, sent 29, errors 0
   Neighbor count is 1, adjacent neighbor count is 1
Interface br0, admin state UP, link state UP
   IP address 10.0.0.1/24, MTU 1500
   Router ID 192.168.1.22, network type BROADCAST, cost 1
   Transmit delay is 0, network state DROther, priority 1
   Hello interval 1, dead interval 4, wait time 4, retransmit interval 5
   Designated router 10.0.0.10, backup designated router 10.0.0.11
   Hello packets received 3660, sent 1830, errors 0
   Database Description packets received 8, sent 6, rxmt 0, errors 0
   LS Request packets received 2, sent 2, rxmt 0, errors 0
   LS Update packets received 50, sent 8, rxmt 0, errors 0
   LS Acknowledgment packets received 62, sent 50, errors 0
   Neighbor count is 2, adjacent neighbor count is 2
rcp#

show ip ospf neighbor


Display OSPF neighbor information.

show ip ospf neighbor

Example:

rcp#show ip ospf neighbor 

		Area 2, network 10.2.0.1/24, network state Backup

Router ID        Priority State           Dead Time Address          Interface 
10.2.0.10        1        Full/DR         3         10.2.0.10        br2       

		Area 1, network 10.1.0.1/24, network state Backup

Router ID        Priority State           Dead Time Address          Interface 
10.1.0.10        1        Full/DR         3         10.1.0.10        br1       

		Area 0, network 10.0.0.1/24, network state DROther

Router ID        Priority State           Dead Time Address          Interface 
10.0.11.1        1        Full/DR         3         10.0.0.10        br0       
10.0.12.1        1        Full/BDR        3         10.0.0.11        br0       

rcp#

show ip ospf route


Display OSPF route information.

show ip ospf route [ecmp]

Example:

rcp#show ip ospf route 
C    10.0.0.0/24 [1] is directly connected, br0, area 0
O    10.0.3.0/24 [4] via 10.0.0.11, area 0
O    10.0.11.0/24 [2] via 10.0.0.10, area 0
O    10.0.12.0/24 [2] via 10.0.0.11, area 0
O    10.0.21.0/24 [3] via 10.0.0.10, area 0
O    10.0.22.0/24 [3] via 10.0.0.11, area 0
O E2 10.0.40.0/24 [20] via 10.0.0.10, area 0
O E1 10.0.41.0/24 [23] via 10.0.0.11, area 0
C    10.1.0.0/24 [1] is directly connected, br1, area 1
C    10.2.0.0/24 [1] is directly connected, br2, area 2
rcp#

timers spf


Specify the delay of shortest path first (SPF) calculation after a topology change is detected.

[no] timers spf <delay>

The no form of the command sets the default value of 5 seconds.

Example:

rcp(config)#router ospf
rcp(ospf)#timers spf 1
rcp(ospf)#

summary-address


Summarize external routes.

summary-address <CIDR range> [not-advertise]
no summary-address <CIDR range>

where:

<CIDR range> - range of addresses to be summarized.
not-advertise - suppress type 3 summary LSA generation.

The no form of the command will remove the summarization.

Example:

rcp(config)#router ospf
rcp(ospf)#summary-address 1.2.3.0/24 not-advertise
rcp(ospf)#