The commands presented in this section include
both OSPF-specific commands and routing protocol–independent
commands that are not limited to OSPF. You can use these commands
to perform the tasks listed in Table 11.
Table 11: Additional
Configuration Tasks
Filter and apply policy to routes.
Set the maximum paths.
Set a baseline for statistics.
Enable automatic cost calculation.
Clear statistics for access lists, counters, redistributed routes,
or processes.
Enable logs for OSPF neighbor changes.
Set the redistribution routes.
Set SPF hold time.
Set the distance for OSPF routes.
Set a default metric.
Administratively disable OSPF.
access-list
route-map
Use the access-list command
to create a standard or extended access list.
Use the route-map command to
create a route map.
For detailed information about configuring access lists
and route maps, see JUNOSe IP Services Configuration Guide.
Configure an access list with filters on routes 20.20.20.0/24
and 20.20.21.0/24.
host1(config)#access-list boston permit 20.20.0.0
0.0.255.255
Configure a route map that matches the previous access
list and applies a metric type 1 (OSPF).
host1(config)#route-map boston
host1(config-route-map)#match ip address boston
host1(config-route-map)#set metric-type type-1
Configure redistribution of the static routes into OSPF
with route map boston.
host1(config)#router ospf 2
host1(config-router)#redistribute static route-map
boston
Use the show ip ospf database command to verify the effect of the redistribution (that the two
static routes matching the route map are redistributed as external
type 1).
host1#show ip ospf database
OSPF Database
Router Link States (Area 0.0.0.0)
Link ID ADV Router Age Seq# Checksum
192.168.1.250 192.168.1.250 3 0x80000006 0x39a1
192.168.254.7 192.168.254.7 220 0x80000169 0xd2b5
Network Link States (Area 0.0.0.0)
Link ID ADV Router Age Seq# Checksum
192.168.1.214 192.168.254.7 220 0x80000001 0xe0f2
AS External Link States
Link ID ADV Router Age Seq# Checksum
20.20.20.0 192.168.1.250 3 0x80000001 0x6045
20.20.21.0 192.168.1.250 3 0x80000001 0x554f
Use the no version of the access-list command to remove the access list or the
specified entry in the access list.
Use the no version of the route-map command to remove an entry.
Use to calculate the OSPFv2 or OSPFv3 interface cost according
to bandwidth.
Sets the OSPF metric for an interface according to the
bandwidth specified.
Affects OSPF metrics for existing OSPFv2 interfaces and
OSPFv2 interfaces created after the execution of this command.
Affects OSPF metrics for only OSPFv3 interfaces created
after the execution of this command.
This command’s value overrides the cost resulting
from the command.
If you want this command to apply to OSPF interfaces already
configured, you need to bounce the existing interfaces: Use the no
network and then the network command for the selected OSPF interfaces.
Use to set a baseline for OSPF statistics and counters.
The following example first displays the output of the show ip ospf command, which is shown before you run
the baseline ip ospf command; then it displays
the execution of the baseline ip ospf command;
and finally, it displays the show ip ospf command run after you execute the baseline ip ospf command.
The output of the show ip ospf command run before the baseline ip ospf command reflects the up-to-date packet counters.
The output of the show ip ospfdelta command run after you run the baseline ip ospf command reflects the baseline set
for OSPF statistics and counters.
Example
host1#show ip ospf
Routing Process OSPF 1 with Router ID 5.106.7.1
OSPF Statistics:
Rcvd: 217935 total, 0 checksum errors
8987 hello, 8367 database desc, 188 link state req
159898 link state updates, 40484 link state acks
Sent: 265026 total, 0 pkts dropped
8927 hello, 8341 database desc, 53 link state req
158571 link state updates, 89134 link state acks
Supports only single TOS(TOS0) routes
SPF schedule delay 0 secs, Hold time between two SPFs 3 secs
Maximum path splits 1
Area BACKBONE(0.0.0.0)
Area is a transit area
SPF algorithm executed 425 times
ABR count 0
ASBR count 1
LSA Count 12
Number of interfaces in this area is 24
Area ranges are:
Number of active areas in this router is 1
1 normal, 0 stub, 0 NSSA.
host1#baseline ip ospf
host1#show ip ospf delta
Routing Process OSPF 1 with Router ID 5.106.7.1
OSPF Statistics:
Rcvd: 0 total, 0 checksum errors
0 hello, 0 database desc, 0 link state req
0 link state updates, 0 link state acks
Sent: 0 total, 0 pkts dropped
0 hello, 0 database desc, 0 link state req
0 link state updates, 0 link state acks
Supports only single TOS(TOS0) routes
SPF schedule delay 0 secs, Hold time between two SPFs 3 secs
Maximum path splits 1
Area BACKBONE(0.0.0.0)
Area is a transit area
SPF algorithm executed 425 times
ABR count 0
ASBR count 1
LSA Count 12
Number of interfaces in this area is 24
Area ranges are:
Number of active areas in this router is 1
1 normal, 0 stub, 0 NSSA.
Use to delete all entries from the OSPF link-state database
and to reset all adjacencies.
Example
host1#clear ip ospf database
There is no no version.
clear ip ospf neighbor
Use to clear an IP OSPF neighbor by specifying the IP
address.
Note:
When OSPF is configured and running over an NBMA network, do not issue
the clear ip ospf neighbor command simultaneously
on both ends of the OSPF link. Doing so brings the OSPF link down
completely. In this event, you must do one of the following on both
sides of the link to bring the link back up:
Reconfigure the OSPF neighbors on the NBMA interface with
the neighbor command.
Issue the clear ip ospf database command to clear and reset the OSPF adjacencies.
Issue the shutdown command
followed by the no shutdown command on
the interface.
Use to generate a default route into an OSPF routing domain.
When you use this command to redistribute routes into
an OSPF routing domain, the router automatically becomes an AS boundary
router.
An AS boundary router, however, does not, by default,
generate a default route into the OSPF routing domain. The software
must have a default route before it generates one, except when you
have specified the always keyword.
You can specify a metric for the route or specify that
the route be OSPF external type 1 or 2.
Use to disable the transmission of routing updates on
the interface, meaning that OSPFv2 or OSPFv3 routing information is
neither sent by nor received through the interface.
The specified interface appears as a stub network in the
OSPF domain.
By default, OSPF is enabled on a configured OSPF interface.
Use to apply a policy to modify distance, metric, metric
type, route type, or tag values of OSPF routes about to be added to
the IP routing table.
The new route map is applied to all routes currently in
and those subsequently placed in the forwarding table. Previously
redistributed routes are redistributed with the changes caused by
the route map.
To remove from the forwarding table any old routes that
are now disallowed by the specified route map, you must refresh the
IP routing table with the clear ip routes * command.
Example
host1(config)#route-map dist1 permit 5
host1(config-route-map)#match community boston42
host1(config-route-map)#set distance 33
host1(config-route-map)#exit
host1(config)#router ospf 100
host1(config-router)#table-map dist1
host1(config-router)#exit
host1(config)#exit
host1#clear ip routes *
Use the no version to halt
application of the route map.
Although the router does not support a default-metric command, the redistribute command provides two ways to set a default metric for redistributed
routes.
You can simply configure a metric with the redistribute command to apply to all routes redistributed
from the specified source protocol:
host1(config)#router ospf 5
host1(config-router)#redistribute bgp metric
5
Alternatively, you can create one or more route
maps that set the metric and apply them selectively to redistributed
routes: