OSPF
OSPF
- find the shortest path to the node you have found the SPT to the prefix
recommended resources
books
ospf anatomy of an internet routing protocol
routing tcp/ip vol 1
standards
rfc 2328 ospfv2
rfc 5340 ospfv3
documentation
tech guides
config guide/command ref
open standards based
OSPFv3 routes both IPv4 and IPv6 there is MAF support
rfc 2328
classless link state protocol
uses dijkstra spf algorithm
maintains active adjacencies
some limits to design and traffic engineering
supports vlsm
supports both topology and nlri summarization
Guarantees loop free topology
all routers agree on overall topology
SPF for calculation
standards based
run between 2 vendors
large scalability
hierarchy through areas
topology summarization
Fast Convergence
actively tracks neighbors
event driven incremental updates
Efficient updating
IP protocol 89
uses reliable multicast and unicast updates
non ospf devices do not need to process updates
Bandwidth based cost metric
more flexible than static hop count
Control Plane security
supports multiple forms of authentication
clear text, md5, sha and ipsec
extensible
future application support through opaque lsa
MPLS traffic engineering
Step 1
Uses hello packet to discover neighbors on interface enabled to
run OSPF
transport via IP protocol 89
sent as mcast to 224.0.0.5 or .6 or unicast
hello packet contain attributes that neighbors must agree on to
form adjacency
You can form a neighbor relationship but not form an
adjacency
if you form an adjacency you also form a neighbor
relationship
once adjacency is negotiated, LSDB exchanged
Negotiating ospf adjacencies
adjacency occurs when connected neighbors agree on
unique/common attributes
not all ospf neighbors actually form adjacency
most ospf configuration problems happen at this stage
Unique OSPF adjacency attributes
Router ID
Node ID in the LS graph
Chosen based on
Manual config
highest active loopback IP
highest active interface IP
Interface IP address
for OSPFv2, the interfaces primary IP address
For OSPFv3, the interfaces link local address
Common OSPF adjacency attributes
Interface Area ID
Hello/dead interval
interface network address
interface MTU
network type
authentication
stub flags
Other optional capabilities
OSPF hello packet
routers send periodic hellos out ospf enabled links every
hello interval
hello packet contains
local router ID | area ID | interface Subnet Mask |
interface priority | hello/dead interval | authenticaton type/password |
DR/BDR addresses | Options | RIDs of other neighbors
on the link
Adjacency state machine
Down
no hellos have been received from neighbor
Attempt - unicast
unicast hello packet has been sent to neighbor, but
no hello has been received back
Init - multicast
I have received a hello packet from a neighbor, but
they have not acknowledge a hello from me
2 way -
I have received a hello packet from a neighbor and
they have ack'd a hello from me
Indicated by my router id in neighbors hello packet
A list of routers on seen on my segment: a list of
RIDs the neighbor sees
Issues at this point indicate a layer 2 issue
Exchange start
first step of actual adjacency
Master&slave relationship is formed, where master has
higher router id
master chooses the starting sequence number for the
DBD packets that are used for actual LSA exchange
Exhange
local link state database is sent through DBD packets
DBD sequence number is used for reliable
ack/retransmission
Stub flags and other options happen here
Loading
link state request packets are sent to ask for more
information about a particular LSA
Full
Neighbors are fully adjacent and databases are
synchronized
Step 2
Once data bases are synchronized, path selection begins
Each routers LSA includes a cost attribute for each described
link
best path to that is lowest end to end cost
Multiple equal cost paths are allowed ECMP
Cisco Implementation uses BW based cost, but RFC says you can use
whatever you would like
Default Cisco Cost = 100Mbps / link bandwidth
Reference bandwidth can be modified to accomodate higher
speed links
Step 3
Niehgbor and topology maintenance
Once adjacencies established and spt built, OSPF state
machine tracks neighbor and topology changes
hello packets used to track neighbor changes
LSA fields used to track topology changes
Tracking neighbor changes
Hello packets continue to be sent on each OSPF enabled link
every hello interval
10 or 30 seconds by default depending on interface
type
If hello packet is not received from a neighbor within dead
interval, the neighbor is declared down
defaults to 4 times hello interval
can be as low as 1 second for faster convergence
Tracing topology changes
when a new LSA is received it is checked against the
database for changes such as
sequence number
used to track new vs old LSAs
age
used to keep information new and withdraw old
information
periodic flooding occurs after 30 minutes
paranoid update
LSAs that reach Maxage - 60 minutes are
withdrawn
Checksum
used to avoid transmission and memory
corruption
LSA flooding
when change is detected new LSA is generated and flooded
out all links
OSPF does not use SH
self originiated LSA s are simply dropped
Not all LSA changes require SPF to recalculate
link up/down event - re run SPF vs sequence number
change - do not re-run SPF
Forming adjacencies
neighbors must agree on attributes to form adjacency
not all ospf neighbors actually form adjacency
most ospf configuration problems happen at this stage
unique attributes include
local router id
local interface ip address
common attributes
interface area id
hello interval and dead interval
how often we talk to each other
how long we wait before declaring the remote neighbor down
interface network address
must be on same subnet
unless ppp unumbered link
interface mtu
network type
how updates are sent across the link
must be a compatible value
authentication
null- default, clear text, MD5/SHA, in IPv6 SPI
stub flags
other optional capabilities
opaque, extensible
non stop forwarding, graceful restart
forming adjacencies
cost value= slower bandwidth higher value, higher bandwidth lower value
if there are too many retransmissions, the will drop the adjacency
maximum metric makes the router look bad to ospf
resulting in ospf routing around that router, allowing it to be taken
out of service
the database
the link state database must be the same on all routers in order for
the SPF algorithm to work
original implementation, TOS routing was available
Cisco implementation doesn't support that
ip ospf point to point disables DR/BDR election
Media dependencies
ospf behavior changes based on media
ethernet vs. frame relay vs. PPP
different media uses different network types to control
how updates are sent
who forms adjacency
how next hop is calculated
broadcast
ip ospf network broadcast
default on multiaccess broadcast medias
ethernet token ring and fddi
sends hellos and updates as multicast
224.0.0.5 all spf routers
224.0.0.6 all dr routers
performs designated router and backup designated router election
Troubleshooting Adjacencies
Where can problems arise
transport problems
attribute negotiation problems
Useful tshooting commands
show ip ospf neighbor
show ip ospf database
debug ip ospf adj
debug ip packet
Normal OSPF Adjacency state machine
down - all network types except non broadcast
attempt - only non broadcast
Init
transport issue
hello is sent but neighbor hasn't responded
2-way
stop here for DROthers
If you don't get to this state, there is an issue with transport
Mcast could be blocked
OSPF could be blocked
exstart
the DBD packets begin
exchange
loading
full
Duplicate router id
2 routers with the same router id
Flood war
When the correct router sends an update out to the router with
incorrect router id, the incorrect router believes it has old info
and ages it out
The advertising router ID is the node and the LSA ID is the link
Attribute issues
Broadcast/NBMA will use DR/BDR
P2P/P2MP/P2MP NB do not use a DR/BDR
BCAST/NBMA use 10/40 timers
P2P/P2MP/P2MP NB use 30/120 timers
MTU issues
Enabling OSPF
enable the global process
router ospf process id
process id locally significant
exception is MPLS L3VPN
must be an up/up interface running IP
used for the router id
enable the interface process
process level
network x.x.x.x x.x.x.x area x
interface level
ip ospf process id area x
Network statement
Useful for enabling OSPF on multiple intefaces at the same time
Wildcard mask does not relate to subnet mask
used for enabling OSPF on several interfaces at the
same time
Most specific match determines the area
Implies statements can overlap, most specific statement
determines area
all zero's/32 area 0 mean all interfaces in area 0
network 0.0.0.0 255.255.255.255 area 0
all interfaces starting with 1.x.x.x /8 in area 1
network 1.0.0.0 0.255.255.255 area 1
all interfaces starting with 1.2.x.x /16 in area 2
network 1.2.0.0 0.0.255.255 area 2
all interfaces starting with 1.2.3.x /24 in area 3
network 1.2.3.0 0.0.0.255 area 3
interface with 1.2.3.4 /32 in area 4
network 1.2.3.4 0.0.0.0 area 4
That's the benefit of the network statement, more
specific statement determines area
Interface statement
enables ospf on the primary and secondary IP addresses
secondary advertisement can be disabled
suppress the secondary prefixes, use the ip ospf [process-
id] area [area-id] secondaries none command
OSPF stay enabled even if IP address changes
Verification
verify OSPF is enabled
show ip ospf
show ip ospf interfaces
verify OSPF adjacencies
show ip ospf neighbor
debug ip ospf adj
verify ospf database
show ip ospf database
The OSPF Database
R8#sh ip ospf database
OSPF Router with ID (150.1.8.8) (Process ID 1)
Router Link States (Area 0)
Type 1 LSA - The router LSA
Link ID ADV Router Age Seq# Checksum
Link count
150.1.8.8 150.1.8.8 281 0x80000002 0x00CE99 4
150.1.10.10 150.1.10.10 287 0x80000003 0x000639 3
R8
my node id is 150.1.8.8
my dr is 150.1.10.10
Virtual Links
Discontiguous area problems
SPF not run to reach an ABRs advertised inter area routes
use the intra area SPT to the ABR
add the ABRs cost to my SPT cost
What if the ABR isn't reachable via an SPT
certain states cause ABRs to be unreachable
These state are called discontiguous areas or discontiguous area 0
Repairing discontiguous areas
Broken designs are fixed by adding new area 0 links and adjacencies
links could be either physical or virtual
GRE could be used
OSPF VL are a form of virtual area 0 adjacencies
OSPF Virtual links
how OSPF virtual links work
used to form multihop unicast area adjacency
follows the already built SPT between ABRs to heal the database
The cost is the cost through the SPT to the ABR to the target
destination
DNA, do not age bit is set, if the age of the LSA goes past 1800
seconds or 30 minutes a reflood won't occur
Path selection change
The OSPF State machine prefers
Intra area over Inter area routes
For external routes
Intra area external over an Inter area external
Transit capability
Normal operation has traffic go through the area 0 connection
VL is an adjacency that might be farther away to the ABR using
the SPT
Transit capability gives you the ability to use shorter paths to
the ABR if available rather than following the area 0 path
VL Caveats
endpoints must be reachable via a normal area
not stub area
transit area must not have filtering appled
LSA 3 filters, distribute lists
Inherits cost from SPT cost between endpoints
cost must be below 65535
Runs as a demand circuit
errors in config could be hidden until flooding occurs
VLs must be configured on ABRs, ABR is a router that borders 2 areas
ABRs are routers that have at least 1 link in area 0 and other
links in other non backbone areas
The RIDs are used to form the adjacency
Config
R1:
router ospf 1
area 1 virtual-link 150.1.6.6
R6:
router ospf 1
area 1 virtual-link 150.1.1.1
Verification
If your primary path to reach an inter area route is through an
ABR, which it should be, goes down for some reason, you need to be able
to route around the failure if there is another path that can be
used.
One way to accomplish this goal is use a Virtual link to bridge
the gap over another area that may not be area 0, a non backbone area
can be used to form a virtual link to a router may be connected
to the now unreachable area and with the use of a VL, you could bridge
area 0 over the non backbone area to connect to the router that
may be connected to the unreachable area.
One key point is that the a VL needs an ABR, a router with at
least one link active in area 0, to connect itself to area 0 and bridge the
gap between area 0 and the non backbone area to the router that
may have connectivity to the unreachable area.
The VL is a unicast adjacency that utilizes the ABR to connect
area 0 with the other router in the non backbone area.
The first important point to note about the virtual-link is that
the neighbor value specified in the virtual-link syntax is the router-id
of the neighbor in the transit area.
This means that if for some reason the router-id changes (for
example, if a new higher Loopback interface is added) or the router-id
command is changed, the virtual-link will fail.
Additionally, the neighbors forming adjacency over the virtual-
link do not have to be directly connected; they simply need to know how
to recurse toward each other's LSA 1 advertisements.
This means that the traffic flow via the virtual-link should
naturally follow the Intra-Area SPF calculation between the routers’
LSA 1 advertisements.
The VL also runs as a demand circuit, meaning it doesn't send
hellos across the link.
The VL also suppresses periodic LSA refresh, the paranoid updates
that occur every 30 minutes by default. The only time an update is sent
is when there a change in the network topology that
requires and LSA update.
These are indicated by the demand circuit keyword and the
DoNotAge LSA allowed.
The cost value associated with the VL is the cost the VL endpoint
uses to reach the ABR. This is calculated via LSA 1 recursion.
If the VL is running over an network type broadcast, then a type
2 LSA lookup will be done to find out what the VL endpoint is connected to
and what the associated cost is to the neighbor.
Now that there is an ABR connecting to the previously unreachable
area, issue the show ip ospf border routers command and the new VL
endpoint should appear in the output.
If the previous ABR that failed is still active, you may see it
advertising type 3 LSAs but the age will increment and a type 1 LSA
recursion should fail.
If the previous ABR comes back up it will advertise Type 3 LSAs
back into area 0, the VL will still be preferred as it is advertising type 1
LSAs and it's an extension of area 0, there fore the VL intra
area connection will be preferred over the inter area connection to the ABR
even if the cost to the ABR is 1, intra area is preferred over
inter area in the OSPF stat machine process.
Per RFC 1793, Extending OSPF to Support Demand Circuits, “OSPF Hellos
and the refresh of OSPF routing information are suppressed on
demand circuits, allowing the underlying data-link connections to be
closed when not carrying application traffic.”
This feature allows low-speed and pay-per-use links, such as analog
dial and ISDN, to run OSPF without the need for periodic hellos and
LSA flooding. Periodic hellos are only suppressed for point-to-point
and point-to-multipoint OSPF network types.
This feature is enabled with the interface-level command ip ospf
demand-circuit and is negotiated as part of the neighbor adjacency
establishment, thus only one OSPF router on the segmment requires to
have the feature enabled.
If routers on the segment do not support it, it will just ignore the
option inthe HELLO packet, but OSPF neighbors will still be established
The lack of periodic hello exchange will be visible also in the show ip
ospf neighbor output, where the Dead Time field for the adjacency is null
Per RFC 2328, OSPF Version 2, “an LSA's LS age is never incremented
past the value MaxAge." When the Link State Age reaches MaxAge,
"the router must attempt to flush the LSA... by reflooding the MaxAge
LSA just as if it was a newly originated LSA".
In Cisco’s IOS implementation of OSPF, the MaxAge value is 3600
seconds, or 60 minutes.
To ensure the an LSA is not aged out, which means it will be flushed
from the OSPF database, each LSA is reflooded after 30 minutes,
regardless of whether the topology is stable or not. This periodic
flooding behavior is commonly referred to as the “paranoid update.”
The ip ospf flood-reduction feature stops unnecessary LSA flooding by
setting the DoNotAge (DNA) bit in the LSA,
removing the requirement for the periodic refresh. This needs to be
enabled on links with OSPF neighbors attached, as on the other links,
as there are no neighbors, no LSAs are sent anyways
Path selection
once databases are synchronized, path selection begins
each router lsas include a cost attribute for each described link
best path to that link is lowest end to end cost
cisco implementation uses bandwidth based cost, but per rfc it is arbitrary
default cisco cost = 100Mbps / link bandwidth
reference bandwidth can be modified to accomodate higher speed links
Per RFC, ospf path selection state machine
intra area routes
inter area routes
external type 1
external type 2
nssa type 1
nssa type 2
cannot be modified with metric or distance
ospf uses bandwidth based cost
cost = reference-bw / interface bw
cost can be modified with
interface bandwidth
interface ip ospf cost
used for traffic engineering on a per hop basis
it effects outgoing traffic
process auto cost
is reference bandwidth
needs to be configured on all routers
process neighbor x.x.x.x cost - point to multipoint neighbors
Modifying the cost effects other things like QoS
Auto cost reference bandwidth does not need to match for neighbors to form
adjacency, but if there are differences throughout the topology
it is possible for loops to occur by varying cost.
router ospf 1
auto-cost reference-bandwidth 30000
This means that a 100Mbps Fast Ethernet interface will have a cost of
1, and furthermore all interfaces with higher bandwidth values
are also 1.
The result of this is that OSPF routers in the topology cannot make an
accurate path calculation when comparing an OC-48 POS interface
to a Gigabit Ethernet interface, because both interfaces revert
to a cost of 1.
To resolve this, the reference bandwidth value is typically modified to
allow these higher-bandwidth interfaces to have separate,
more granular cost values
R5:
interface GigabitEthernet1.45
ip ospf cost 1001
SPF calculations are only performed for Intra-Area routing, whereas the
Area Border Routers’ (ABRs)
advertised information is trusted for Inter-Area and External
calculations.
The idea is to modify the traffic flow so that packets coming from a
particular source are routed to a specific destination a certain way.
It is important to understand how OSPF will route traffic by it's
default SPF algorithm and default calculation, then we can modify to see the
results.
Starting from the source, note the direction that traffic will be
forwarded. If the route is intra area, by looking at the "from" part of the
show ip route x.x.x.x will determine how the route will be
forwarded.
Intra area forwarding, all routers are in the same area, therefore have
identical copies of the LSDB.
By entering a show ip ospf database router x.x.x.x for intra area LSAs
will indicate where you need to forward it to, the advertising router
field in the LSDB output is the key indicator as to who
originated it.
If the Routing bit is set, then you know that SPF was able to solve the
SPT to the originating router
Routing Bit Set on this LSA in topology Base with MTID 0
The nice thing about a singe area, the LSDBs are the same, anywhere
there are 2 or more interfaces to choose a path on is a TE point.
Inter area forwarding, the common point of attachment, the area border
router, is the router that would advertise the Type 3 LSA into the area
The important point to remember with this is the advertising
router will be the ABR.
If you look in the LSDB for the Type 3 LSA, the summary network, and
the routing bit is set, you can successfully solve the SPT to the ABR.
If you look on the ABR, the LSA that it was advertising, the Type
1 LSA, the router LSA, if the routing bit is set on the ABR for the area
that originated the route, you can solve the SPT to the router
that originated the route.
The metric value indicated in the ospf database output is the metric to
reach the ABR advertising the route.
The ABR is where you would make your path selection changes. Depending
on which was you choose to have the traffic go would determine which interface
gets the change done to it.
R4:
interface GigabitEthernet1.45
bandwidth 10000
Bandwidth is the one and only calculation metric OSPF uses, it directly
relates a cost to a bandwidth value. If you modify the bandwidth for
a given interface, this will affect the cost used to reach
destinations on that given interface. Sometimes not using it at all after the
change
Before modifying anything, determine how OSPF will forward traffic to a
given destination without modifying anything.
Once you know how OSPF will forward traffic, you can then determine on
what router(s) the change needs to occur on and what interface(s) you need to
make the change on.
The reason we may need to modify 2 or more routers is because you may
be learning information multiple points in the network. If you are trying to reach
an inter area destination, you will choose, by default an intra
area route first as intra area is preferred over inter area regardless of
the cost or metric.
The idea is to find out how you route after you make your first
change, is it the way you need to route traffic?
If not, from the place you made the change, see how the routing
decision is made and based on traffic forwarding need, make the determination
where you need to make the next change. Once you have
determined and made the change, verify this is correct.
R6:
router ospf 1
area 1 virtual-link 150.1.1.1
no capability transit
Capability transit
OSPF area capability transit is enabled by default, allowing the OSPF
Area Border Router to install better-cost
routes to the backbone area through the transit area instead of the
virtual links. If you want to retain a traffic
pattern through the virtual-link path, you can disable capability
transit by entering the no capability transit
command. If paths through the transit area are discovered, they are
most likely to be more optimal paths, or
at least equal to, the virtual-link path.
Basically, if a router connected via a VL to an ABR that connects to
area 0 to reach a particular destination, If that same router
connected via a VL has a better cost path over a non backbone
connection, this is not the desired way to forward.
The desired path is to use the area 0 path, through the backbone area
to reach the destination.
Technically, the router connected via the VL is connected via a virtual
connection over a non backbone area to reach an ABR that is
connected to the back bone area that maybe a higher cost path.
Normal OSPF selection is to use the O, intra area path. But since the
design is broken, the router connected via the VL can choose the
path to the ABR that is not the VL.
The no capability transit command forces the path selection process to
use the VL to route towards area 0 to reach the destination.
R3:
router ospf 1
area 5 virtual-link 150.1.2.2
default path for the traffic, which will follows OSPF design rules,
thus for inter-area traffic we cannot transit a non-backbone area
Basically what happens is the reverse path back to the backbone area
using a VL
If traffic is coming from a discontiguous area and needs to reach a
destination it would by default need to route to an ABR that connects to
the backbone area, this may not be the optimal way to route the
traffic.
By using a VL you are connecting the backbone area over a non backbone
area in order to reach a discontiguous area, by using the VL this gives
you the ability to use the correct forwarding design, the backbone to
reach the destination.
Convergence timers
convergence based on hello and dead timer
supports sub second timers
different timer for different network types
sho ip ospf interface
changing hello time automatically adjusts the dead timers
ip ospf hello interval
ip ospf dead interval
bidirectional forwarding detection
acts as a keepalive that will detect a neighbor down by monitoring the
layer 2
Benefits
The limit-retransmissions command provides for backward compatibility
for previous or other releases of
Cisco IOS or other routers that do not have this feature.
the Update (OSPF message type 4) payload is one or more LSAs, preceded
by a field specifying how many LSAs are contained in the packet. Any one of the
following events causes a router to send an LSA to one or more
neighbors:
The first three events are a part of routine maintenance of the link
state database
The fourth event is the normal routing protocol procedure of
communicating network information.
The last event, sending an LSA in response to a Link State Request
message, is part of the database synchronization process
The manner in which the Update is sent depends on the type of network
link over which it is transmitted:
Acknowledgment of LSAs
Whenever an Update message is sent, the LSAs it contains must be
acknowledged by the receiving neighbors to ensure reliable flooding.
So when a router floods an LSA on a link, it adds the LSA to a
retransmit list and sets a retransmit timer. Every time the retransmit timer
expires, the router retransmits the LSA. When the LSA is
acknowledged, it is removed from the retransmit list. The retransmit timer is
configurable to between 1 and 65,535 seconds, with a typical
default of 5 seconds. This is a long enough interval that on normal networks
an LSA should almost always be acknowledged and removed from the
retransmit list before the retransmit timer expires. A good OSPF
implementation might also include a mechanism for "windowing" the
retransmission rate so as not to overwhelm a slow neighbor, and a
mechanism for handling a case where a neighbor never acknowledges
an LSA, such as removing the LSA from the retransmit list and logging a
flooding error message.
There are two things to know about the way OSPF acknowledges the
receipt of an LSA:
The acknowledgment can be explicit or implicit.
The acknowledgment can be delayed or direct.
The Link State ID field of the LSA header is a 32-bit field that
carries some IP address by which the LSA is identified.
The derivation of this IP address varies from one LSA type to
another
When multiple LSAs are received with identical Type, Link State
ID, and Advertising Router values, the Age, Sequence Number, and
Checksum fields of the LSAs are compared to determine which of
the LSAs is the most recentand hence, the one that should be accepted.
The steps for comparing these three fields is as follows:
OSPF Metrics
RFC 2328 and its predecessors do not specify or suggest a default
interface cost for OSPF, other than that it must be greater than 0.
That leaves the potential for implementations to vary widely in
their default value. Fortunately, many vendors have copied Cisco
Systems' method for determining default costs, thereby creating a
reasonable consistency across vendors.
You can set the interface manually rather than use the automatic
costing algorithm. If your network is large, it is usually wise
to develop a well thought-out costing plan that realistically
reflects your ideas about traffic behavior, and use this plan to
administratively assign interface costs. Manually assigned costs
might be based, for example, on line-of-sight or wire/fiber
distance between sites.
Type 1 External (E1) metrics take into account both the cost
assigned by the ASBR and the cost to the ASBR.
Type 2 External (E2) metrics remain just the cost assigned by the
ASBR, and do not change as the prefix is advertised through the
OSPF domain.
E1 and E2 metrics can both exist in an OSPF domain, and can even
be assigned to the same prefix by different ASBRs. Therefore,
there are two rules for managing conflicts:
Stub areas
Scaling ospf is a function of two variables
how complex is the topology graph?
how many routers are in the area
large flooding domain means lots of spf runs
how much reachability information is there
how many routers are being advertised
large routing tables means it takes longer to flood
scalability through reducing the two above
NSSA logic
stub areas block external routes, but what if I need to
redistribute into the stub area
filter like a stub area, but make an exception for local
redistribution
NSSA result
redist router generates NSSA external, type 7
abr changes NSSA external into external in area 0
abr removes lsas 4 and 5
abr does not automatically originate default route
Totally NSSA
totally stubby areas block inter area and external routes, but
what if you need to redist into the totally stub area
combine totally stubby and nssa behaviors
result
redist router generates nssa external, type 7
abr changes nssa external into external into area 0
abr removes lsa 3/4 and 5
abr originates a default route
Stubby Area
When an OSPF router redistributes a route into the domain, it
originates a Type-5 External LSA representing the route and its attributes.
Inside this LSA, the originating router sets the advertising router
field to its local router-id and, generally, the forward address field to
0.0.0.0.
When an OSPF router in the same area as the originator looks up the
Type-5 LSA, it looks at the forward address. If the forward address is set
to 0.0.0.0, it means that the traffic should be sent toward the
advertising router to reach the destination. To find out how to reach the
advertising router, the advertising router’s Type-1 Router LSA is
consulted, and intra-area SPF is performed. This is similar to inter-area
routing logic, because the router doing the lookup does not compute SPF
to the final destination, only the intermediary advertising router.
For external routing between areas, the logic is modified slightly.
When an Area Border Router receives a Type-5 External LSA from a device
in its own area and passes it into a different area, a Type-4 ASBR
Summary LSA is generated. The Type-4 LSA tells devices in the new area
how to forward toward the ASBR, which in turn tells them how to forward
toward the external route.
Note that only the ABR(s) connecting the stub area to area 0 need the
no-summary argument on the stub command, because they are the only devices
that are allowed to originate Type-3 LSAs. Although it won’t break the
OSPF design to add the command to other routers inside the totally stubby
area, it is technically incorrect to configure the option this way. As
long as all devices in the area agree on the stub flag in the first place,
it is the ABR’s duty to determine whether the area is totally stubby or
not.
Routes that are redistributed directly into the NSSA are generated as Type-7
NSSA External LSAs.
Like Type-5 External LSAs, two subtypes of Type-7 NSSA External LSAs exist,
type 1 (N1) and type 2 (N2).
N1, similar to E1, considers the metric that the ASBR reports into the OSPF
domain along with the metric needed to reach the ABSR.
N2, similar to E2, separates the metric into the flat value that the ASBR
reports into
the OSPF domain, which is installed in the routing table, and the value
needed to reach the ASBR,
known as the forwarding metric.
When the Type-7 NSSA External LSA is received by the ABR and is moved into
area 0, the information contained in the
Type-7 LSA is translated to a normal Type-5 External LSA.
If multiple ABRs exist, only one of them performs the translation through an
election process, which is
discussed in depth in a later task.
In this fashion, OSPF devices outside of the NSSA do not know that the NSSA
exists, which is analogous
to how a Confederation works in BGP.
Pitfall
The other key difference between stub and NSSA areas is how default
routing works.
The stub area removes external LSAs and replaces them with a default
route.
The totally stubby area extends this by replacing external LSAs and
inter-area LSAs with a default route.
However, with the NSSA, a default route is not automatically originated
by the ABR.
This means that devices within the NSSA will have reachability
to their own area and to other areas, but not to destinations outside
of the OSPF domain
If you skip from type 3 lsa to type 5 lsa this means this is an intra area
external route
you have solved the SPT to the ASBR which can be an ABR at the same
time
If the ASBR is in our area and the SPT is correct, the routing bit is set,
then we will use the cost the ASBR is advertising
to the external route
you would do this by looking at the ospf database external and the
route being advertised
If the ASBR is not in our area then we would have to recurse to a lsa 4
lookup which would recurse to an lsa 3 which would
recurse to the lsa 1
LSA 1 would follow the SPT to the LSA 3, ABR then the from the LSA 3 would
follow the SPT to the LSA 4 which would lead
to the external route
The forward address is an actual route not a node identifier. This is the key
distinction when going from:
lsa 5 to 4 as opposed to lsa 5 to 3
lsa 4 is I have the short path to the node in the graph
lsa 3 is I have the actual route to the destination
NSSA does not by default advertise a default route, use the default-
information orginiate to do this,
The OSPF ABR Type 3 LSA Filtering feature gives the administrator
improved control of route distribution
between OSPF areas.
Only type 3 LSAs that originate from an ABR are filtered.
Configuring OSPF ABR Type 3 LSA Filtering
SUMMARY STEPS
1. Router(config)# router ospf process-id
2. Router(config-router)# area area-id filter-list prefix
prefix-list-name in
3. Router(config-router)# exit
4. Router(config)# ip prefix-list list-name [seq seq-value]
deny | permit network/len [ge ge-value] [le le-value]
Authentication
supports adjacency authentication to protect control plane
prevent against routing injection attacks
OSPF packet header included authentication information
hello, lsu, lsr
Authentication does not mean encryption
v2 payload is clear text
v3 supports ipsec encryption
1 hop IPsec tunnel with ESP or AH
ospf supports 3 types of authentication
0=null - no authentication
1=clear text - simple password
2=md5/sha
key of zero means no key is used
Enabled by
OSPF process level
Link level
link level overrides process level
key is always applied at the link level
key numbers must match on both ends
lowest active key used
can be enabled
if enabled under the process all links in the process are authenticated
if enabled under the interface only that link gets it
on all links in the area
on a per link basis
virtual links are area 0 interfaces
implies same inheritance rules of authentication just like other area 0
interfaces
key goes at the interface
type can be configured globally or at the interface
VL runs as a DC
always clear the VL after authentication
Null Authentication
By default this is the authentication, no authentication. Type 0 in the
debug output.
SHA Authentication
Type 2 OSPF authentication was extended to offer support for HMAC-SHA
based authentication, and this is defined in RFC 5709.
Cisco implemented support for all variants of HMAC-SHA although per the
RFC, only HMAC-SHA-256 is mandatory.
HMAC-SHA-1 uses the first version of SHA, while all the other methods
use SHA-2, the second version of the function:
HMAC-SHA-1 (160 bits digest)
HMAC-SHA-256 (256 bits digest)
HMAC-SHA-384 (384 bits digest)
HMAC-SHA-512 (512 bits digest)
So far, IOS does not allow you to enable SHA authentication at the area
level, only at the interface level.
To configure SHA authentication, you first need to define the key ID
and key string by using a key-chain, jut like for RIP or EIGRP,
and afterwards apply the key-chain at the interface using command ip
ospf authentication key-chain <NAME>.
By using a key-chain, which allows defining several keys with specific
lifetimes, the whole process of key rotation becomes simpled and
more efficient, just like in EIGRP, as OSPF will always send OSPF
packets authenticated with the first valid key from the key-chain, but
received OSPF packets will be matched against all valid configured
keys.
With the current IOS code, SHA authentication is not supported for
virtual-links. In case of a mismatch between key ID, key string or
authentication type, the debug messages are identical with the case
when using MD5 authentication. With the addition of SHA to Type 2
authentication, this is now called a "Cryptographic Authentication" for
both MD5 and SHA, which is also visible from the outputs
Pitfall
A failure in authentication can occur for two reasons: a mismatch in
authentication type or a mismatch involving the authentication key.
An authentication type mismatch occurs when one neighbor is configured
with clear text while the other is running MD5, or one is running MD5
and the other is running null, etc. A key mismatch is simply when the
routers are using different passwords.
OSPF Summarization
summarize the topology graph
achieved through ospf areas
hides the details of how the graph looks in other areas
find the SPT to the node that owns the route
only run spf for intra area destinations
Summarize the NLRI
achieved through stub areas and per prefix summaries
Summarize type 5 lsa to a default route
replace multiple longer matches with a shorter match
NLRI summarization
all devices in the same area must have same LSDB
summarization can't be performed at arbitrary points in the
topology
ospf summarization can only occur:
between internal areas - ABRs
between external domains - ASBRs
EIGRP & BGP win over OSPF & IS-IS here
EIGRP/BGP hierarchy is arbitrary
OSPF and ISIS is strict leaf - spine - leaf
Internal vs External Summaries
internal summaries
summarizes Type 1 into Type 3 lsas
take a group of individual routes and summarize into a type
3 LSA
performed on ABRs
the area range command is used here
External summarizations
summarizes type 5 into type 5 lsas
summarizes type 7 into type 7 lsas
performed on ASBRs
Summary Discard Route
When summarizing, the OSPF process automatically creates a local
discard rotue
a route to Null0
Goal of it is to drop traffic if the longest match is the summary
if you are summarizing it, you should always have a more specific
route to it
you shouldn't be routing to a destination you don't have a
longer match for
End result is that summary router cannot fallback to default
Can be disabled with the no discard route
Where OSPF can summarize
Internal summaries
only at the ABR who knows the LSA 1
you can summarize lsa 1 to lsa 3 but not lsa 3 to lsa 3
if you take a group of Type 1 LSAs and summarize them into
an area on an ABR, you can't summarize them again as they are
being advertised as a Type 3 LSA
External summaries
only at the ASBR who is the originator
ASBR performing Type 5 or Type 7 redistribution
ASBR/ABR performing Type 5 to Type 7 translation
Who ever did the summarization to reach the external
network, the forwarding address will be set to that routers RID
When the LSA is flooded from the ASBR to the ABRs, it will
flood type 5 external LSAs everywhere except a Stub area
Internal summaries
between areas
area X range x.x.x.x mask x.x.x.x
X is the source area
External summaries
only at the ASBR who is the originator
ASBR performing Type 5 or Type 7 redistribution
ASBR/ABR performing Type 5 to Type 7 translation
during redistribution
summary address x.x.x.x x.x.x.x
automatically generates discard route
disabled with no discard route [internal | external]
if a route in the summary fails, any traffic destined for that route is
dropped instead of being
forwarded to a shorter match route
if a packet comes in and the destination is the summary itself you
should drop that packet
Other summary applications
can be used for traffic engineering via longest match routing
prefer longer match over shorter match
internal summarization
summarizes type 3 lsas
network summary lsas, area range command on abr
summarizing as routes come into area 0 or as they go out to
another non transit area
external summarization
summarizes type 7 lsa
summary address command, done on asbr
ospf database
type 5 as external
advertising router is the router doing the redistribution
adv router: x.x.x.x
network mask: /whatever
metric type 2 is an E2, external type 2, no
incrementing the cost through the network
metric is: 20 is the default for redistribution
forward address:0.0.0.0 means use the router doing
the redistribution
the forward metric is the total cost in an intra area to get to
the redistributing router
if there are 2 equal cost paths, two routes with 20 as the
metric, the lowest forward metric would be used
LSA types
intra area routes O
lsa 1 and 2
lsa 1 is the router lsa, router ID
lsa 2 is the network lsa, generated by the DR
inter area routes O IA
lsa 3 and 4
lsa 3 is the summary lsa, area border router, abr
lsa 4 is the summary lsa for ospf to non ospf networks
external routes E1 and E2
lsa 5
lsa 5 is the redistribution lsa, when routes are sent into
ospf from other protocols
nssa external routes N1 and N2
lsa 7
lsa 7 is the redistribution lsa, when routes are sent into
ospf from other protocols
this "n" is only seen with the nssa command applied
to an ABR and ASBR
Essential LSAs
The five essential LSAs are:
Router LSAs
Network LSAs
Network Summary LSAs
ASBR Summary LSAs
AS-External LSAs
Router LSAs
The purpose of the LSA is to advertise the originating router,
the router's attached links, the cost of those links, and its
adjacent neighbors. The Router LSA has an area flooding scope: It
is flooded throughout the area in which it is originated,
but never to other areas.
Type Link ID
1 Neighboring router's RID
2 IP address of DR
3 Network IP address
4 Neighboring router's RID
Metric is the cost from the ABR to the destination. Notice that
unlike the 16-bit intra-area metric, this one is 24 bits to
accommodate presumably longer paths to the destination.
ToS and ToS Metric are, as with the Router LSA, for backward
compatibility with earlier OSPFv2 incarnations.
ToS is not used in modern OSPFv2, and so the ToS type is always
0, and the ToS Metric is all 0s.
The LSA type of the ASBR Summary LSA is 4, and the Link State ID
is the ASBR's RID. An ABR must originate a separate
ASBR Summary LSA for each ASBR it wants to advertise into an
area.
Metric is the cost of the path from the ABR to the ASBR.
AS-External LSAs
An ASBR originates a single AS-External LSA for each external
prefix it wants to advertise to the OSPF domain.
Unlike the previous four LSAs examined, this LSA has autonomous
system (domain) flooding scope.
That is, it is flooded to all nonstub areas in the OSPF domain.
AS-External LSAs are also used to advertise a default
route (0.0.0.0/0) out of the OSPF domain.
Metric is the cost to the prefix from the ASBR, and is assigned
by the ASBR based on an arbitrary
configuration or on the value (as specified by a configured
routing policy) of the metric of the protocol
from which the prefix was learned. Like the metric in the Network
Summary LSAs, this metric is 24 bits.
Internal Summarization
Because devices in an OSPF area require the same copy of the database
to compute correct SPF, filtering or summarization of routes in the
database can only occur between areas or domains, not within an area.
The below configuration illustrates how an Intra-Area Summary Network
LSA (LSA 3) can be summarized as it is originated by an ABR.
If a router is receiving an LSA for a route that it must use an ABR to
reach and there are multiple Type 3 LSAs that the ABR is originating,
this implies that all the LSAs that the ABR is originating that the
router looking to send traffic to is the type 3 LSA that the sending router
must recurse to, to reach the inter area route, this also means that
the ABR is the place where summarization must occur.
If you were to look in the OSPF LSDB for the summary route and the
advertising router it would point you to the ABR.
By replacing a longer match, in this case several longer matches with a
single shorter match, the routers in other areas will only have to
install a single LSA to reach all the inter area routes, using the Type
3 LSA to recurse to the ABR to solve the SPT to the Type 1 router LSA.
External Summarization
External OSPF summarization is configured at the redistribution point
between routing domains with the summary-address command. These summaries
inherit their attributes from the subnets that make them up. For
example, a summary comprised of External Type-1 routes will result in an
External Type-1 summary. This means that on the orginiating router in
this configuration, the metric-type 1 command is set at the time of redistribution
instead
of on the summary itself. External Type-2 OSPF routes, which are the
default, do not install the end-to-end metric in the routing table.
Instead, only the metric that was reported via the ASBR is installed.
The actual routing path is determined by the addition of the reported
metric and the metric toward the ASBR, which is called the forward
metric
From a recursion standpoint, you are learning a type 5 lsa in from the
ASBR, this means you need to know how to recurse to the router originating the Type
5 LSA.
Once you reach the router generating the type 5 lsa, you'll need to
solve the SPT to the router generating the type 4 ASBR network summary. Get to that
box, then
figure out the oringinating router for the Type 1 LSA.
Update packets are used to send complete LSAs from one neighbor
to another, and how Acknowledgment packets carry LSA headers to
explicitly acknowledge the receipt of LSAs for reliable flooding.
Seven of the bits are currently used as flags; the eighth bit,
marked with an asterisk (*) is unused
The originating router only sets bits representing capabilities
it supports. Any bit representing an option that the router does not
support is considered unknown by the router, and the router sets
that bit to 0 in all Options fields it originates.
An address prefix occurs in almost all newly defined LSAs. The prefix
is represented by three fields:
PrefixLength, PrefixOptions, and Address Prefix. In OSPFv3, addresses
for these LSAs are expressed as
prefix, prefix length instead of address, mask. The default route is
expressed as a prefix with length 0. Type
3 and Type 9 LSAs carry all prefix (subnet) information that, in
OSPFv2, is included in device LSAs and
network LSAs. The Options field in certain LSAs (device LSAs, network
LSAs, interarea-device LSAs, and
link LSAs) has been expanded to 24 bits to provide support for OSPFv3.
In OSPFv3, the sole function of the link-state ID in interarea-prefix
LSAs, interarea-device LSAs, and
autonomous-system external LSAs is to identify individual pieces of the
link-state database. All addresses or
device IDs that are expressed by the link-state ID in OSPF version 2
are carried in the body of the LSA in
OSPFv3.
The link-state ID in network LSAs and link LSAs is always the interface
ID of the originating device on the
link being described. For this reason, network LSAs and link LSAs are
now the only LSAs whose size cannot
be limited. A network LSA must list all devices connected to the link,
and a link LSA must list all of the
address prefixes of a device on the link.
NBMA in OSPFv3
On NBMA networks, the designated router (DR) or backup DR (BDR)
performs the LSA flooding. On
point-to-point networks, flooding simply goes out an interface directly
to a neighbor.
Devices that share a common segment (Layer 2 link between two
interfaces) become neighbors on that segment.
OSPFv3 uses the Hello protocol, periodically sending hello packets out
each interface. Devices become
neighbors when they see themselves listed in the neighbor’s hello
packet. After two devices become neighbors,
they may proceed to exchange and synchronize their databases, which
creates an adjacency. Not all neighboring
devices have an adjacency.
To use the IPsec AH, you must enable the ipv6 ospf authentication
command. To use the IPsec ESP header,
you must enable the ipv6 ospf encryption command. The ESP header may be
applied alone or in combination
with the AH, and when ESP is used, both encryption and authentication
are provided. Security services can
be provided between a pair of communicating hosts, between a pair of
communicating security gateways, or
between a security gateway and a host.
To use the IPsec AH, you must enable the ipv6 ospf authentication
command. To use the IPsec ESP header,
you must enable the ipv6 ospf encryption command. The ESP header may be
applied alone or in combination
with the AH, and when ESP is used, both encryption and authentication
are provided. Security services can
be provided between a pair of communicating hosts, between a pair of
communicating security gateways, or
between a security gateway and a host.
Each interface has a secure socket state, which can be one of the
following:
• NULL: Do not create a secure socket for the interface if
authentication is configured for the area.
• DOWN: IPsec has been configured for the interface (or the area that
contains the interface), but OSPFv3
either has not requested IPsec to create a secure socket for this
interface, or there is an error condition.
• GOING UP: OSPFv3 has requested a secure socket from IPsec and is
waiting for a
CRYPTO_SS_SOCKET_UP message from IPsec.
• UP: OSPFv3 has received a CRYPTO_SS_SOCKET_UP message from IPsec.
• CLOSING: The secure socket for the interface has been closed. A new
socket may be opened for the
interface, in which case the current secure socket makes the transition
to the DOWN state. Otherwise,
the interface will become UNCONFIGURED.
• UNCONFIGURED: Authentication is not configured on the interface.
OSPFv3 will not send or accept packets while in the DOWN state.
Defining Encryption on an Interface
SUMMARY STEPS
1.enable
2.configure terminal
3.interface type number
4.Do one of the following:
•ospfv3 encryption {ipsec spi spi esp encryption-algorithm key-
encryption-type key
authentication-algorithm key-encryption-type key | null}
•ipv6 ospf encryption {ipsec spi spi esp {encryption-algorithm [[key-
encryption-type] key] | null}
authentication-algorithm [key-encryption-type] key | null}