Topic: tech juniper jir prev next
tech juniper jir > 08: Deploying OSPF
Junos supports OSPF versions 2 and 3. OSPF 2 is for IPv4; OSPF 3 is for v4 and v6. In OSPF v2, authentication is available but disabled by default. Route summarisation is available.
External prefix limits can be used to stop too many external prefixes being
acceped into OSPF. This is configured with the prefix-external-limit
statement. Graceful restart is available, for a router to inform its
neighbours before restarting. Its neighbours will continue to forward traffic
to the router whilst it is restarting. A grace period specifies how long it
should forward traffic for. This feature is not enabled by default.
Bidirectional forwarding detection (BFD) detects failures in the network. Hello packets are sent at a regular interval. Router failure is detected when a router does not receive a packet in a specified interval, which is shorter than the OSPF hello timer.
OSPF v2 configuration is under the protocols ospf
hierarchy. OSPF v3
configuration is under the protocols ospf3
hierarchy.
Every router has a single OSPF router id. It is configured under
routing-options router-id
, however, Junos will use an IP address which was
configured at the time the OSPF process started. This is ideally a non-127/128
loopback address. It is strongly recommended that the router id is configured
manually to avoid unpredictable behaviour.
The cost of a link in OSPF, called the ‘metric’, is equal to the reference
bandwidth divided by the bandwidth of the link. The metric can be changed
either by changing the reference bandwidth, which is defined under protocols
ospf reference-bandwidth
, or by specifying the metric directly on the
interface.
By default, the reference bandwith is 100Mbit/s, specified as 100000000. This means that any interface with bandwidth of 100Mbit/s or higher will have an OSPF metric of 1.
No bandwith is associated with the loopback interface.
To add an interface to OSPF;
protocols {
ospf {
area 0.0.0.0 {
interface ge-0/0/0;
}
}
}
Additional configuration can be specified on the interface under protocols
ospf area
;
interface ge-0/0/1 {
metric 100;
hello-interval 4;
dead-interval 10;
}
To accept a specific, directly connected route into OSPF, a routing policy can be written;
policy-options {
policy-statement to-ospf {
term match-direct-route {
from {
protocol direct;
route-filter 172.18.1.0/24 exact;
}
then accept;
}
}
}
The routing policy is applied to export the specified route into OSPF;
ospf {
export to-ospf;
}
Check the states of OSPF adjacencies with;
show ospf neighbor
Output is terse by default. The extensive
option will also display area,
options, DR, BDR, uptime and adjacency uptime.
OSPF neighbours can be cleared with clear ospf neighbor
.
This will cause a momentary disruption. Adjacencies should be reformed immediately.
Find information about individual routes with show route 172.18.1.0/24
. The
result will show that the route was learned from OSPF. It will also show the
next hop IP address and interface.
Show the OSPF interface parameters with show ospf interface extensive
.
Interfaces with OSPF enabled are displayed.
Show routes learned by OSPF with show ospf route
.
Show the OSPF database with show ospf database
. For ABRs, the output is
grouped by OSPF area.
Clear the OSPF database with clear ospf database
. The purge
option forces
the local router to set all LSAs in its database to max-age, causing them to
age out. The LSAs are then re-flooded, because the OSPF specification requires
that any LSAs which have reached max-age must be re-flooded, regardless of
whether the LSA was generated by the local router or not. The LSAs have
max-age set, so the originating router which receives an LSA with max-age set
will be compelled to refresh the LSA and itself re-flood it. Although
disruptive, this technique is effective for removing stale routes.
Display OSPF logging information with show ospf log
. SPF calculation
instances are listed.
Show statistics with show ospf stastics
. The number of packets of each type,
and the number of LSAs, transmitted and received, are displayed.
If no neighbour is detected, first check physical and data link (Layer 2) connectivity. Check basic Layer 3 attributes, such as mismatched IP address and subnet mask. Check that all OSPF variables match; in particular, area number, area type, hello & dead interval, and network type.
If the router is stuck in ExStart state, check the MTU settings.
If the router is stuck in 2-way state, check that the router is not a DR or BDR (it is DRother). It is normal for DRother routers to not progress beyond 2-way state.
Enable traceoptions
in the OSPF configuration;
protocols {
ospf {
traceoptions {
file trace-ospf;
flag error detail;
flag event detail;
}
}
}
The traceoptions
logging output will be stored in /var/log/trace-ospf
. It
can be viewed with show log trace-ospf
or monitor start
commands. The
flag
keyword determines what will be captured in the log.
Error counters, split by type of error, are included in the output of show
ospf statistics
. They can be reset with the clear ospf counters
command.