OSPF Deep Dive
OSPF Deep Dive
OSPF Deep Dive
This is a self-study, lab based tutorial using Juniper Networks routers. Although this was
developed on some old J2300 routers, any Junos based router should work for purposes of this
tutorial. If Junos based routers are unavailable, the Junosphere virtual environment can definately
be used. This assumes that the reader has some working knowledge of Junos operation and
configuration.
Topics
1. Overview
2. Precursors
3. History
4. Operation
5. LSDB
6. Configuration on Junos
8. Cost
9. Packets
10. Adjacencies
11. Authentication
14. Router ID
15. LSAs
29. L3VPNs
31. BFD
35. References
Labs
1. Build the Backbone
2. OSPF Metrics
3. OSPF Authentication
6. Router LSAs
7. Network LSAs
9. External LSAs
12. NSSAs
Configurations
1. Baselines
2. Final
Topologies
1. General Setup
2. Backbone
3. Multiple Area
OSPF Overview
OSPF is an interior gateway protocol that routes Internet Protocol (IP) packets solely
within a single routing domain (autonomous system). (From Wikipedia) Each router
gathers link state information and builds a complete network topology for the entire
routing domain.
o RIP had slow convergence, prone to loops, noisy, updates can consume a lot of
bandwidth
Search started for a new routing protocol for IP and the Internet
o Huge arguments and differences of opinion caused formation of two groups, one
that though a link-state protocol was the future and the other that wanted to tune
distance vector protocols
Distance Vector
Operation
Simple to implement
Computationally less intensive
Link State
Operation
Critical that every node has the same view of the network
topology
Link State Routing was pioneered by BBN for use on the ARPANET
o Decision was made it would be easier to develop a new protocol rather than adapt
or modify an existing one
o Link-state camp splits off into the Open Shortest Path First Interior Gateway
Protocol Working Group (OSPFIGP), and then later becomes the OSPF Working
Group
OSPF History
Development started in 1987, first complete specification published in 1991 (OSPFv2)in
RFC 2328
Fast Convergence
Hierarchical Routing
OSPF Operation
Runs directly on top of IP using protocol 89 for IPv4
Makes use of two well known link-local scoped multicast 224.0.0.0/24 to limit to OSPF
messages only interested parties
Takes advantage of IP's ability to run over almost any link-layer protocols
o Once OSPF routers see hellos from another router, they will compare
configuration parameters, and if they agree will form an adjacency and become
neighbors
OSPF routers advertise information about themselves and their connectivity in Link State
Advertisements (LSAs) to their OSPF neighbors
OSPF routers will send any LSAs they receive to all of their neighbors (except the one
that they received the advertisement from) -- flooding
All LSAs sent much be acknowledged by all routers the LSA was sent to
Link State Advertisements are aged out over time to prevent stale
information from building up
Each router uses it's own LSDB to calculate paths to every other node
using Dijkstra's Shortest Path Algorithm
Can subdivide the entire OSPF routing domain into smaller regions known
as areas
Makes use of a two level hierarchy creating a simple hub and spoke
topology
Top level of the hierarchy is known as the backbone area (0.0.0.0)
o Contains tuples of the node's router id, neighbors router id, and a cost to that
neighbor
o Router runs Dijkstra's Shortest Path First Algorithm on the LSDB every the
LSDB changes
The more nodes, more links, more LSA types, and more network changes
the more SPF runs will have to be made
SPF algorithm
For any given node, the find the shortest path to every other node
Tree Database - Matrix of all of the shortest paths to every node in the
network
Can see a summary of the LSDB with the operational command show ospf database
summary
The LSDB can be viewed with the operational commandshow ospf database
o Shows an overview of all of the LSAs in the LSDB for each area
Using the detail flag shows information about the contents of each LSA
Using the extensive flag shows all of the information contained in each LSA
As the LSDB can grow very large, can use several flags to the show ospf database
command to narrow down the results:
o area (area id) to view LSAs only in the LSDB for the specified area
o asbrsummary|external|network|netsummary|nssa|opaque-area|router|
opaque-area to view just certain LSA types
Operational mode command show ospf interface shows the status of each interface
that is configured to participate in the OSPF process
o Can use the detail and extensive flags to see more information
o Displays each interface that will contribute to the LSDB in some form, and which
LSDB (area) they will populate
The contents of the LSDB can be discarded with the operational mode command clear
ospf database
Can use the purge flag to discard all LSAs, and age out all of the system generated LSAS
o Sets the maximum age on all the system's generated LSAs and refloods them
Can use the same flags that are supported in show ospf database to selectively discard
and purge certain LSAs rather than do them all enmass
Operational mode command show ospf route displays the OSPF routing table
o A separate memory structure that contains all of the best OSPF routes
These may not be the best routes to a certain destination, but is only the
OSPF routes
o Can use the detail and extensive flags to provide more detail
admin@J2300-1>
Can view the OSPF routes that have been installed in the routing table with show route
protocol ospf
o Can use the terse,brief, detail and extensive flags to vary the level
of information displayed on the output
o Can use the multitude of other flags in the show route command to scope the
output
admin@J2300-1>
o Must define at least one area with edit protocols ospf area
Junos will translate any Area IDs into dotted quad notation
o Define what interfaces belong to which area by adding the interface under the
appropriate area level of the hierarchy withset protocols ospf area
interface
Router will only advertise the subnet that matches the configured
IP address
user@Router> edit
Entering configuration mode
[edit]
user@Router# edit protocols ospf
Can get an overview of OSPF with the operational mode command show
ospf overview
Can view general OSPF stats with operational mode command show ospf
statistics
o Can modify the delay in the time between the detection of a topology change and
when the SPF algorithm actually runs with delay (milliseconds)
Default is 200 ms
Default is 5000 ms
o Can configure the hold down, or wait, before running another SPF calculation
after the SPF algorithm has run in succession the configured maximum number of
times
Default is 3
A log of the SPF runs can be seen with the operational mode command
show ospf log
Gives a log of what caused a SPF run, and how long it took
o General stats as related to SPF runs can be seen with the operational mode
command show ospf io-statistics
o Detailed information on individual SPF runs can be logged and viewed using
Junos traceoptions for OSPF
OSPF Cost
Cost is a measure of how desirable (or undesirable) it is for a link
Cost is a vector
OSPF spec specifies a method for automatically calculating metrics based on interface
bandwidth
Can use k, m, and g suffixes in Junos instead of typing out vast amounts of
zeros
o Set on a per interface basis under set protocols ospf area interface
metric (cost)
Overload
o Unlike IS-IS, there is no way for a router to actually tell everyone else not to
consider it as part of the transit topology
OSPF fakes it, by setting the metric on all transit links in the Router LSA
to the maximum metric (65535)
[edit]
admin@J2300-1# set protocols ospf overload timeout 60
[edit]
admin@J2300-1#
Easiest way is to use the detail flag with the operational mode command
show ospf interface
admin@J2300-1>
Can see the link costs of any router per configured area
o Note that show route and show ospf route commands show the overall cost to
a destination -- not link costs
Exercise:OSPF Metrics
OSPF Packets
This section examines the OSPF packet structure. It's boring, but necessary.
OSPF runs directly on the network layer (Layer 3) with it's own IP protocol number 89
o Most OSPF packets only travel a single hop so the TTL is normally set to 1
Most implementations, including Junos, will use the IP precedence (DSCP) bits to allow
for prioritization of OSPF messages over other traffic
o Junos sets all OSPF packets to IP Precedence 110 (Internetwork control, or CS6
for DSCP) by default
In order for to neighboring routers to form a relationship several of the fields in the hello
packet have to match
o Network mask
o HelloInterval
o RouterDeadInterval
Based on the contents of the options field, a router may reject forming an adjacency
Options Field
+--------------------------------------+
| DN | O | DC | EA | N/P | MC | E | MT |
+--------------------------------------+
The Options Field Bits are defined as follows:
DN-bit
Used to prevent looping in L3 MPLS VPNs
O-bit
Set if the router supports Opaque LSAs
DC-bit
Set if the router supports demand circuits
EA-bit
Set the router supports External-Attributes-LSAs
N/P-bit
Set if the router supports Type-7 LSAs for NSSA support
MC-bit
Describes whether IP multicast datagrams are forwarded
E-bit
Describes the way AS-external-LSAs are flooded
MT-bit
Describes a router's multi-topology capability
Used when an adjacency is being initialized between two neighboring routers. They
describe the contents of the link-state database.
If the Interface MTU does not match during the database exchange, the exchange will not
continue
Specific LSAs are requested and identified using the LS type, Link Sate
ID and the Advertising Router's Router Id to uniquely identify the LSA
o Explicit acknowlegements occur by recieving a LSA Ack Packet back from the
neighbor
o LSAs can be implicitly acknowledged if the LSA is seen from the neighbor in
another LSA Update packet
Explicit acknowledgement that a router received a neighbors LSAs that were flooded
Adjacency Formation
This section examines the how OSPF neighbors form adjacencies.
Neighbors discover each other by periodically sending Hello packets out all of it's
interfaces
o Hello protocol ensures that each router can send and receive packets from each
other -- bidirectional communication
o Ensures that neighboring routers agree in intervals for Hellos and declaring each
other unreachable
The Router Priority field is used for electing the DR and BDR
The Router Priority field is used for electing the DR and BDR
Once two OSPF speakers have seen each other on a network they will attempt to
synchronize their link state databases
o The "quickest" router to respond sends and empty DD packet with the first DD
packet and sets the initial sequence number
The receiving router examines the Router ID in the empty DD packet and
compares it to it's own
OSPF Moves Through Several States before two neighbors become fully adjacent
DOWN
Router has not seen hellos from the neighbor since the last Dead interval.
ATTEMPT
Only on NBMA networks where neighbors have been manually configured. Indicates that
the router is attempting to get a response from a neighbor.
INIT
Router has seen a hello packet from a neighbor but has not yet seen it's own Router ID in
the neighbor list
2-WAY
Router has seen a hello packet from a neighbor (or DR/BDR for broadcast networks) that
has it's own Router ID in the neighbor field of the hello. On broadcast networks, routers
will remain in this state for adjacencies other than with the DR and BDR. A router knows
it has bidirectional communication with a neighbor at this point.
EXSTART
Router is initializing initial sequence numbers for database exchange an maintenance. For
broadcast networks without a DR or BDR, the election takes place at this state.
EXCHANGE
Router's exchange Database Descriptors (DBDs) that list each router's LSAs. Rotuers
figure out which LSAs they are missing, or have an outdated copy.
LOADING
Routers are actively exchanging LSAs that were identified during the EXCHANGE
phase.
FULL
Routers are fully adjacent
Designated Routers
Huge number of link state updates and acknowlegements sent over the
network as every router keeps in sync with every other router on the
subnet
All routers on the network only need to form adjacencies with the two
DRs on the network
8 bit field with 0 being the lowest priority, and 255 being
the highst
DR election is non-deterministic
No automatic DR premption
DR has more state to keep, so should be one of the more stable and
powerful routers on the network
Authentication Types
o Null Authentication
Default on Junos
o Simple Authentication
Junos will obscure the password in the config file, but it will still
be transmitted as plain text over the network
admin@J2300-1> edit
Entering configuration mode
[edit]
admin@J2300-1# edit protocols ospf area 0 interface fe-0/0/1.12
o Cyrptographic authentication
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0 | Key ID | Auth Data Len |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cryptographic sequence number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Key ID
Used to identify the algorithm and the key used
Auth Data Len
Length of the message digest in bytes that has been appended to the OSPF packet
Cryptographic Sequence Number
An incrementing sequence number used to protect against replay attacks
o More than one key can be active at a time to smooth key expiration
Configure with set protocols ospf area interface authentication md5 key
o By default in Junos, keys have an infinite lifetime and are always transmitted
o Can add a time to start using a key at a certain time by using the start-time
option for a particular key
Example: Configuring OSPF for MD5 authentication with a key that is always valid,
and a key to start using at the start of 2012
o Packets that do not pass the authentication check through mismatch type
authentication type will generate the error:
o Packets where the key-id does not match will generate two errors:
o Packets where the key does not match will also generate two errors:
admin@J2300-2> edit
Entering configuration mode
[edit]
admin@J2300-2# edit protocols ospf traceoptions
Can use IPSEC to both authenticate and encrypt the entire OSPF packet
Can use IPSEC together with simple or MD5 authentication
Exercise:OSPF Authentication
Tuning Interfaces
This section examines changing parameters on interfaces running OSPF to change their
behavior.
All interface "tuning" is done on a per area basis in Junos under the set protocols
ospf area interface level of the heirarchy
Can change the hello interval with set protocols ospf area interface hello-
interval
o Must be the same for all devices on the network for adjacency formation
o Default is 120 seconds for nonbroadcast networks until an active neighbor comes
up
Change this interval with set protocols ospf area interface poll-
interval
Can change the dead interval with set protocols ospf area interface dead-
interval
o Must be the same for all devices on the network for adjacency formation
o Does not make sense to have dead interval less than the hello interval
o Default is 128
o Junos starts a timer once a LSA is sent -- if not acknowledged by the time the
timer expires the router will resend the LSA
o Can set the timer with set protocols ospf area interface retransmit-
interval
Default is 5 seconds
o Aging link-state updates protects against the router receiving an update packet
back that is younger than the original copy
o On very slow links ( low bandwidth, satellite shots) 1 second may not be long
enough
o Can configure the aging of the packet as it is transmitted with set protocols
ospf area interface retransmit-interval
o By default Junos chooses the interface type based upon the type of physical
interface
o Can override the default selection with set protocols ospf area interface
interface-type (nbma|p2mp|p2p)
o For NBMA networks specify neigbors explicitly by IP address with the set
protocols ospf area interface neighbor statement
Unnumbered Interfaces
Simply configure the interface to support the inet address family but
don't assign any IP address
Junos will borrow the default address for the system, normally on
lo0, for anything that needs an IP for identification over the
unnumbered interface
Can use Ethernet interfaces that have been manually set to point-
to-point for OSPF adjacencies
o Specify the circuit is a demand circuit with set protocols ospf area
interface demand-circuit
Flood Reduction
o Normally LSAs that are generated by a router age out over time and are reflooded
every 30 minutes
o Can stop this behavior by forcing the router to set the DoNot Age bit in all LSAs
that are self generated with set protocols ospf area interface flood-
reduction
Troubleshooting Adjacencies
This section examines the how to troubleshoot OSPF adjacencies.
o Can use the detail and extensiveflags to vary the amount of information
admin@J2300-1>
Can view number of adjacencies on each interface with operational command show ospf
interface
o Can use the detail and extensive flags to vary the amount of information
admin@J2300-1>
Clearing an adjacency can be accomplished with the operational mode command clear
ospf neighbor
o Be careful with clear ospf neighbor without any arguments as it will clear all
the OSPF adjacencies on the router
admin@J2300-1>
Hellos are essentially ignored if any of the following conditions do not match:
o Authentication Type
o Authentication keys
o Area ID
o Hello Interval
o Dead Interval
o No common IP subnets
o No Duplicate router ID
o An adjacency does not even begin to form under any of these conditions
o Can catch these problems with Junos by enabling OSPF traceoptions and looking
at error conditions
Configured under protocols ospf traceoptions
file show
admin@J2300-1> edit
Entering configuration mode
[edit]
admin@J2300-1# edit protocols ospf traceoptions
admin@J2300-1>
*** ospf.log ***
Aug 30 08:45:48.098450 OSPF packet ignored: configuration mismatch
from 10.1.111.101 on intf fxp1.1001 area 0.0.0.1
Aug 30 08:45:49.052569 OSPF packet ignored: configuration mismatch
from 10.1.111.101 on intf fxp1.1001 area 0.0.0.1
Aug 30 08:45:50.002191 OSPF packet ignored: configuration mismatch
from 10.1.111.101 on intf fxp1.1001 area 0.0.0.1
Aug 30 08:45:50.950214 OSPF packet ignored: configuration mismatch
from 10.1.111.101 on intf fxp1.1001 area 0.0.0.1
Aug 30 08:45:51.886726 OSPF packet ignored: configuration mismatch
from 10.1.111.101 on intf fxp1.1001 area 0.0.0.1
monitor stop
admin@J2300-1>
admin@J2300-1>
If an adjacency gets stuck in the ExStart phase, there is most likely a MTU mismatch
o Database Exchange checks the MTU size to see what size packet the neighbors
can send between themselves
Fix by setting the Layer 2 MTU on the interface with set interface mtu
Or, fix by setting the Layer 3 MTU for the IPv4 address family with set interface
unit family inet mtu
Can view the interface MTUs with the show interface operational mode command
admin@srx100-1> edit
Entering configuration mode
[edit]
admin@srx100-1# top
warning: already at top of configuration; use 'exit' to exit
[edit]
admin@srx100-1# edit protocols ospf traceoptions
Keep in mind, on a broadcast network, routers will only form a Full neighbor relationship
with the DR and BDR
Router ID
A 32-bit number that uniquely identifies a router -- Normally written in dotted quad
notation - Used as a tie breaker in several routing protocol and routing decisions -- OSPF
uses it for a tie breaker in DR/BDR elections - Can't have any duplicates -- OSPF uses it
as part of the LSA identifier - Changing the router-id in OSPF causes the router to:
Junos automatically uses the IP address of the first interface that comes up as the router-
id
2. Junos will use the IP defined or identified as the primary address of the interface
Set for the entir router with set router-id under the routing-options
level of the Junos hierarchy
user@Router> edit
Entering configuration mode
[edit]
user@Router# set routing-options router-id 1.2.3.4
[edit]
user@Router# show routing-options
router-id 1.2.3.4;
[edit]
Exercise:DR Battle
Contain all the real data used to build and maintain a topology
LSA Aging
16 bit integer
o Incremented by the Transit Delay time of the interface every time the LSA is
flooded
Default of 1 second
o Once a LSA is 3600 seconds old (1 hour) the LSA is deleted from the LSDB
Routers can prematurely age LSAs they originate to flush them from the
OSPF domain
Done for LSAs that carry external routing information where the
destination is no longer reachable
Can configure flood reduction to keep LSAs from aging out -- good for
stable networks
o Can view LSA refresh times with operational mode command show ospf
overview
Each OSPF router originates a router LSA for each area it belongs to
o Describes the state and cost of all of the routers links into the area
Link State ID of the common LSA header is set to the Router ID of the originating router.
Unamed Bitfield
Directly following the common LSA header is an unamed bitfield which is used to
describe some of the capabilities of a router
B bit
Signifies that the router is an Area Border Router (ABR)
Set whenever a router belongs to two or more areas
Bit position 1, 0x1
E bit
Signifies that the router is an Autonomous System Boundary Router (ASBR)
E signifies External
Set whenever a router will inject external routing information into OSPF (redistribution)
Bit position 2, 0x2
V bit
When set signifies the router is an endpoint of a virtual link
Bit position 3, 0x4
W bit
Signifies the router is a wild-card multicast receiver
Bit position 4, 0x8
Nt bit
Signifies that the router will translate Type7 LSAs into Type5 LSAs (redistribution)
Bit position 5, 0x10
# links
total number of links described in the LSA
Link ID
Identifies the object that this router link connects to
Value depends on the link Type
When two routers connect to the same link the Link ID provides a key for finding the
neighbors LSA
Type
The type of link connecting to the router
Four types of connections are defined
o Point-to-point
o Transit
o Stub
o Virtual link
Link Data
The information about the link such as addressing, neigbhors, etc.
Contents varies depending on the Link Type
# TOS
Number of different Type of Service metrics for TOS routing
Not implemented in Junos
Metric
A value from 1 to 65535
Higher value indicates a more costly route
TOS
Type of Service type
Not implemented in Junos
TOS Metric
Type of Service metric
Not implemented in Junos
Link Types
Each router on the link will also advertise a Type 3 link (stub network)
containing the IP network value and subnet mask in the Link Data
2 - Transit
A network that may contain more than two endpoints, Ethernet, Frame Relay, FDDI
May or may not have broadcast capability
Will have a DR and BDR election
If the router on a transit network has a full adjacency with a DR (or if it is the DR) the
Link ID is set to the DR routers interface IP address
The link data contains the routers own IP address on the transit network
3 - Stub
A stub network that can be treated as if it terminates on the router originating the LSA
Link ID is set to the IP network number
Link Data is set to the IP subnet mask
4 - Virtual Link
Used to tunnel routing information across areas
Link ID is set to the Router ID of a virtual neighbor
Link Data is set to the IP interface address of the interface associted with the virtual link
Can use the detail and extensive flags to tailor output level of detail
Example: Viewing all of the information for the router LSA for the 10.0.0.6 router
admin@J2300-1>
o Can use this to determine if a router is an ABR, ASBR, NSSA ABR, has a virtual
link (or any combination)
Exercise:Router LSAs
Type 2 LSA - The Network LSA
Flooding scope:Area
o DR only originates a network LSA if it has at least one full adjacency with
another router
o Costs for each router are advertised in each routers Router LSA as a cost to a
transit link
o Link State ID of the common LSA header is set to the interface IP address of the
DR on the network segment.
o The Advertising Router in the common LSA header is set to the Router ID of the
DR
Network Mask
Subnet mask for the network
Attached Router
Router IDs of all routers on the attached network that are fully adjacent to the DR
Includes the DR itself
Can use the detail and extensive flags to tailor output level of detail
Example: Viewing all of the information for the network LSAs in area 0.0.0.0
admin@J2300-1>
o Each attached router sends all of the information to describe the link in the Router
LSAs
Exercise:Network LSAs
A Type 3 Network Summary LSAs are originated by Area Border Routers (ABR)
o Link State ID of the common LSA header is set to the interface IP network
number of the subnet being described.
o The Advertising Router in the common LSA header is set to the Router ID of the
ABR advertising the Summary LSA
Network Mask
Subnet mask for the network
A Default Route can be represented in OSPF by a Type 3 Network Summary LSA where
both the Link ID and the Subnet mask are all zeros
Can use the detail and extensive flags to tailor output level of detail
admin@J2300-1>
Example: Viewing network summary LSAs for the 10.102.0.0 network in the backbone
area
admin@J2300-1>
ABRs advertise both intra-area and inter-area routes into all other areas
Routes where the cost will exceed the maximum metric allowed
o By default every IP subnet listed in every Router LSA or Network LSA will be
translated into a separate Network Summary LSA
The metric associated with the LSA will inherit the highest metric of the
contributing routes that are being summarized
Type 3 LSAs will not be generated by the ABR for any networks
that match
o Be wary that when routes are summarized, some reachability information is being
lost, so routing inefficiencies can be introduced
o Junos will create an OSPF route with a next hop of discard, and the maximum
metric for OSPF on the ABR for any area ranges that are being summarized
admin@J2300-1> edit
Entering configuration mode
[edit]
admin@J2300-1# edit protocols ospf area 1
admin@J2300-1>
o By default, and by OSPF spec, ABRs flood network summaries to all areas based
upon Router LSAs and Network LSAs and floods all Network Summary LSAs
across area boundaries
Can control how Network Summary LSAs are distributed and generated
Can configure an import policy to specify which routes from an area are
used to generate Network Summary LSAs into other areas with network-
summary-import configured under the area
ASBR is a router that has is redistributing routes from one routing protocol into OSPF
o Link State ID of the common LSA header is set to the Router ID of the ASBR.
o The Advertising Router in the common LSA header is set to the Router ID of the
ABR advertising the ASBR Summary LSA
Network Mask
Set to all zeros
Metric
Cost to reach the ASBR
Can use the detail and extensive flags to tailor output level of detail
admin@J2300-1>
[edit]
o Routes being redistributed from other protocols ( RIP, static, Connected, BGP, IS-
IS, other OSPF instances, etc)
o Link State ID of the common LSA header is set to IP address of the network being
advertisedthe .
o The Advertising Router in the common LSA header is set to the Router ID of the
ASBR
Network Mask
Set to subnet mask of the advertising network
E bit
Specifies the type of external metric
o Type 1
Indicates that the metric indicated in the metric field is the same units as
the metrics used in the LSDB
The total cost of the route should be equal to the metric contained in the
metric field, plus the cost to reach the ASBR from the router calculating
the total cost of the path.
o Type 2
E bit is set
Indicates that the metric is not compatible with the LSDB link costs and
should be used as the sole metric for the external route.
Metric
Cost of the route
Interpretation depends on how the E bit is set
Forwarding address
Data traffic for the advertised destination will be forwarded to the address set here
If the address is set to 0.0.0.0, traffic is forwarded to the originator of the LSA (ASBR)
External Route Tag
A 32 bit field used for administrative purposes.
o Administrative tag that has meaning only within the administrative domain
Can use the detail and extensive flags to tailor output level of detail
Can specify the type with thhe type (1|2) to specifiy the route
should be a Type 1 or Type 2 external route
Can also add and subtract from the value already present in the tag field
with the add or subtract
Example: Policy to export RFC-1918 static routes as Type 2 Externals and tag them with
a value of 100, and to export all other static routes as Type 1 externals with a metric of
50000 and a tag of 333
admin@J2300-1# show
policy-statement EXPORT-STATIC {
term RFC-1918 {
from {
protocol static;
route-filter 10.0.0.0/8 orlonger;
route-filter 192.168.0.0/16 orlonger;
route-filter 172.16.0.0/12 orlonger;
}
then {
tag 100;
external {
type 2;
}
}
}
term OTHER-STATICS {
from protocol static;
then {
metric 50000;
tag 333;
external {
type 1;
}
accept;
}
}
}
[edit policy-options]
admin@J2300-1#
Example: Policy to export RIP routes with a tag according to the metric of the RIP route
admin@J2300-1# show
policy-statement EXPORT-RIP {
term RIP-Metric-1 {
from {
protocol rip;
metric 1;
}
then {
metric 1000;
tag 1;
accept;
}
}
term RIP-Metric-2 {
from {
protocol rip;
metric 2;
}
then {
metric 1000;
tag 2;
accept;
}
}
term RIP-Metric-3 {
from {
protocol rip;
metric 3;
}
then {
metric 1000;
tag 3;
accept;
}
}
term RIP-Too-Many-Hops {
from protocol rip;
then {
metric 1000;
tag 16;
accept;
}
}
}
Example: Applying the two policies above as export policies for OSPF
[edit]
admin@J2300-1# edit protocols ospf
Junos can apply import policies to external routes received via External LSAs to block routes
from entering a local routers routing table
Import policies do not block or modify the LSA - only the route as it enters the routing
table
Routers still flood External LSAs to the routing domain regardless of the import policy
Can limit the number of external prefixes an ASBR will generate with set protocols ospf
prefix-export-limit where the number ranges from 0 to 4294967295
Used to protect a router from flooding the network with External LSAs in case of a
disaster
Exercise:External LSAs
Junos is compatible with the path selection alogritim in RFC 1583 by default
Can enable this functionality with the knob set protocols ospf no-
rfc-1583
A router has several potential next hops towards a destination that all have the same cost
Junos selects one potential path based on a hashing algorithm to install in the forwarding
table
To enable load balancing (based upon flows), must apply a export policy to the
forwarding table
Example: Route with more than one next-hop, and it's forwarding entry
admin@J2300-1>
Example: Enabling flow based load balancing in Junos with an export policy
admin@J2300-1> edit
Entering configuration mode
The configuration has been changed but not committed
[edit]
admin@J2300-1# edit policy-options policy-statement LOAD-BALANCE
[edit]
admin@J2300-1# set routing-options forwarding-table export LOAD-BALANCE
[edit]
admin@J2300-1# commit and-quit
commit complete
Exiting configuration mode
Example: ECMP route with micro-flow based load balancing applied. Note two potential next
hops appear in the forwarding table
o Can modify this by setting globally for OSPF set protocols ospf preference
where the preference is from 0 to 4294967295
Can modify this globally for OSPF with set protocols ospf external-preference
where the preference is from 0 to 4294967295
Multi-area Adjacencies
Since intra-area paths are always considered better than inter-area paths, this can introduce some
routing inefficiences.
Example: For the network below, the best path from R1 to R5 is over the slow T1 links through
Area 1.1.1.1 even though some nice fast Gigabit links exist
To eliminate some routing inefficiencies, it is permissible to have a link in more than one
area
ABRs can establish multiple adjacencies belonging to different areas over the same
logical interface
A stub route (Type 3) is only attached to the Router LSA for the area where the interface
is primary
Configure an interface to participate in multiple areas with set protocols ospf area
interface secondary
Passive Interfaces
Possible to advertise an interface in OSPF as part of the Router LSA without actively
running OSPF on the interface by marking the interface with the passive flag
Interface and any IP networks are announced as part of the Router LSA
Stub Areas
Stub area definition
Exit point taken from the area is not dependent on any external destinations
Not important that routers in the area have explicit information on how to reach
destinations outside the AS
As Type 5 LSAs are no longer supported in the area, there is no need for Type 4 LSAs
either, ASBR Summary LSAs
External LSAs are not flooded into the area (by the ABRs)
No ASBR Summary LSAs are advertised into the area as they are not needed
External LSAs are not flooded out of the area either by the ABRs
Internal routers in a stub area do not support Type 5 LSAs
o E bit in the options field of the OSPF header is cleared to inidcate the router does
not support External LSAs
o In order to form an adjacency, the E bit setting must match on all interfaces
attempting to form an adjacency
A default route can be flooded into a stub area from the ABRs instead (if needed) as a Type 3
LSA, Network Summary LSA
To define an area as a stub area, add the stub keyword underneath the area definition with
set protocols area stub
To flood a default route into a stub area include the default-metric after the stub
keyword where the metric is from 1 to 16777215
An interface configured for inclusion in a stub area will be visible with show ospf
interface with the detail flag set
admin@J2300-1>
An area configured as a stub will be displayed in the Router LSA as well
Can be troubleshot by enabling traceroptions and looking for errors reporting "stubness"
mismatches
In some cases it may not even be necessary to flood all of the Type 3 LSAs into a stub area
As this functionality is dependent solely on the behavior of the ABRs it only needs to be
configured there
Simply add the no-summaries flag to the stub directive: set protocols ospf area stub
no-summaries
Cannot inject any external routing information into a stub area -- no redistribution into
OSPF
Exercise:Stub Areas
Not So Stubby Area is a stub area with the ability to support external routes
Prime motivation: Remote areas separated from the backbone by low-speed links
Minimize LSDB
Type 3 Network Summary LSAs are flooded into the area by the ABRs
o Can disable this behavior as with a Totally Stubby Area (Stub Area with No
Summaries)
o May need the ABRs to flood a default LSA into the area to make up for a lack of
routing information
As No Type 5 External LSAs are allowed in a NSSA, need to make up a new LSA - Type 7
NSSA LSA
The Fields are defined and populated as follows: Most everything is the same as a Type 5
External LSA
Link State ID of the common LSA header is set to IP address of the network being
advertisedthe .
The Advertising Router in the common LSA header is set to the Router ID of the ASBR
Options Field
Sets the P bit as described above
Forwarding address
Traffic for the advertised destination will be forwarded to
o If the P bit is set, the address is set an address on the NSSA router injecting the
External route
Prefers to use an internal loopback address, but will use an active physical
address in the NSSA if no loopback is available
o If set to 0.0.0.0, traffic is forwarded to the NSSA router injecting the External
route
Can use the detail and extensive flags to tailor output level of detail
NSSA ABRs can translate a Type 7 LSA from an NSSA to a Type 5 LSA and flood it to the
rest of the OSPF domain as a Type 7 LSA
Type 7 LSAs that have the P bit set are propogated to the rest of the domain
Each NSSA ABR generates a Type 4 ASBR Summary LSA for each NSSA ASBR that
needs one
o Supports multiple translator ABRs
All NSSA Border Routers set the E bit in the Router LSA
All NSSA ABRs that translate Type 7 LSAs into Type 5 LSAs set the E bit in the Router
LSA
A NSSA ABR that is translating all Type 7 LSAs into Type 5 LSAs will set the Nt bit
Not-so-Totally-Stubby Areas
Instruct the NSSA ABRs not to flood Type 3 LSAs into the area
Ironically, RFC calls for a Type 3 default route to be flooded in place of all other Type 3
LSAs
To define an area as a NSSA, add the nssa keyword underneath the area definition with set
protocols area nssa>
To disable flooding Type-3 LSAs into the NSSA by the ABR, include the no-summaries
keyword
To flood a default route into a NSSA from an ABR, include the default-lsa default-
metric after the nssa keyword where the metric is from 1 to 16777215
Can block translations in the matched range with the restrict flag
On an NSSA ABR with muliple NSSAs attached, if an ABR is originating any external routes
it will send a separate NSSA LSA into each NSSA it serves by default
Can override this behavior with the no-nssa-abr flag at the protocols ospf level
Troubleshooting NSSAs
An interface configured for inclusion in a NSSA will be visible with show ospf interface
with the detail flag set
admin@J2300-1> show ospf interface fe-0/0/1.1001 detail
Interface State Area DR ID BDR ID
Nbrs
fe-0/0/1.1001 DRother 0.0.0.1 10.1.0.1 0.0.0.0
1
Type: LAN, Address: 10.1.111.1, Mask: 255.255.255.0, MTU: 1496, Cost: 2500
DR addr: 10.1.111.101, Priority: 0
Adj count: 1
Hello: 1, Dead: 11, ReXmit: 3, Stub NSSA
Auth type: None
Protection type: None
Topology default (ID 0) -> Cost: 2500
admin@J2300-1>
An adjacency will not form if routers on both ends do not agree that the link is a NSSA area
Can be troubleshot by enabling traceroptions and looking for errors reporting "stubness"
mismatches or "nssaness" mismatches
o Stubness mismatches occur between interfaces configured for non-stub areas and
ones configured NSSAs
o Nssaness mismatches occur between interfaces configured for NSSA areas and
ones configured for stub areas
Sep 1 13:54:46.684118 OSPF packet ignored: area stubness mismatch from
10.1.111.101 on intf fe-0/0/1.1001 area 0.0.0.1
If a default route is being injected into an area, it will show up as a Type 3 Network
Summary LSA or a Type 7 NSSA LSA with a Link ID of 0.0.0.0
Example: Viewing a default route injected into a stub area by an ABR as a Type 7 LSA
admin@J2300-1>
LSAs that are translated will show up having a NSSA LSA in the originating area, and a Type
5 LSA in all other areas (except for stub areas)
admin@J2300-1>
Junos NSSA ABRs will create a Type 4 ASBR Summary LSA for every NSSA ASBR that it
performs a NSSA to External Translation for
Example: ASBR Summary LSA created because of a NSSA to External LSA Translation
admin@J2300-1> show ospf database asbrsummary lsa-id 10.1.0.3 detail
If an NSSA ABR creates is the originator of a "unique" External LSA (one that is
summarized or created on the ABR) the forwarding address will be set to 0.0.0.0
Example: NSSA LSA and matching External LSA created by an NSSA ABR
admin@J2300-1>
Exercise: NSSA Areas
Opaque LSAs
Original OSPF developers thought it would be best to hard code all of the types, options, etc
for the OSPF protocol
Viewed as more efficient CPU and bandwidth-wise, and a way to keep implementations
honest
With a few extentions, OSPF started to quickly run out of space for new options and new
types
Opaque LSAs were envisioned to be a generalized type of advertisement
The OSPF state machine does not necessarily need to know about the contents of the
opaque fields
Lots of RFCs on the individual extensions - the TLV definitions contained in the LSAs
Three Types of Opaque LSAs defined -- each with a defined flooding scope
o LSA is not to be flooded past the local subnet on which the interface is attached
o LSA is not to be flooded beyond the area the LSA was orginated in
Cannot violate any of the area restrictions for stub or NSSA networks
Adjacency Formation
Potential neighbors that support Opaque LSAs will set the O bit in the Options field in
Hello packets
Indicates that the neighbor can support and can forward Opaque LSAs
Mismatched O bit settings between neighbors don't mean that an adjacency will not form
Options Field
+--------------------------------------+
| DN | O | DC | EA | N/P | MC | E | MT |
+--------------------------------------+
Opaque LSAs vary in size, but are aligned to 32 bit boundaries
Can use the detail and extensive flags to tailor output level of detail
Troubleshooting
Can trace opaque LSA operations like any other LSA in the context of OSPF
Need to troubleshoot within the context of the application that is using opaque LSAs to
convey information
Junos does not support any applications that use Type 11 - Domain Scope Opaque LSAs
Many routers have a forwarding plane that operates separately from the control plane
M, T and MX series routers from Juniper have total separation of the control plane and
forwarding plane
o Programs the forwarding table into the forwarding plane from the calculated best
routes
o Note: Some of the hardware of the forwarding plane can offload boring repetive
things like generating and receiving Hello packets
Forwarding plane runs on the Packet Forwarding Engines (PFEs) on the FPCs, DPCs, etc
(depending on hardware architecture)
o Forwarding plane will keep forwarding packets even if the control plane goes
away
No changes in the forwarding state can be made
The control plane will need to reestablish all of it's dynamic adjacencies (OSPF, IS-IS,
BGP, PIM, RIP, etc.)
Can cause a network wide noticeable event while the network routes around, and then
establishes a restarting router back in the network topology - a big ripple
A lot of this is unnecessary when the forwarding plane of the restarting router can
continue to forward packets without the control plane being fully operational
Graceful Restart is a concept that allows a lot of these ripples to be avoided if the following
conditions are met:
For Graceful Restart to take place routers must agree between them that they help each other
out in case of a catastrophe
3. Restart Candidate
A router that is about to restart, and has informed it's neighbors, or one that is undergoing
a restart event
During a restart event:
Neighbors around the restarting router wait a period of time, the restart duration, before
declaring the neighbor down and informing other neighbors of any topology changes
o In the event of a planned restart, the restarting router, informs it's neighbors that it
is about to restart
o In the event of an unplanned restart, the restarting router sends a Grace LSA once
it's control plane has recovered
Neighbors hide the failure of the restarting router from the rest of the network
When the restarting routers control plane starts to come back up after a restart, it's
neighbors that assist it (helper routers) dump as much topology information as possible to
help the router rebuild it's state
If all goes well, other than the restarting routers neighbors, no other router in the network
was aware of the failure
If anything doesn't go well or the restart timer expires the graceful restart is aborted
Opaque Type 3
Opaque ID 0
Grace LSA requests that the router's neighbors aid it's restart
Request to advertise the restarting router as fully adjacent during a grace perioid
o Neighbors use the age of the Grace LSA to keep track of how long the restarting
router made the request
o Reason
o IP address of the interface of restarting router (if on a link that has a DR election
take place)
TLV Format
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Value... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The following TLVs have been defined for the Grace LSA
Disabled by default
o Once enabled, support for all protocols that are supported is enabled
Can disable and tweak each protocol independently for Graceful Restart
Can set the restart duration expected with set routing-options graceful-restart
restart-duration
Good to know an approximate value of how long it takes a router to undergo a restart
OSPF specific items for graceful restart are in protocols ospf graceful-restart
Can set the amount of time before the restarting router notifies helper OSPF routers that it
has completed graceful restart with notify-duration where seconds is 1 to 3600
Can disable the constraint about no other network topology changes by setting the no-
strict-lsa-checking flag
Troubleshooting
Can tell if the router supports graceful restart for the OSPF process with opertional command
show ospf overveiw
admin@J2300-1>
Can track graceful restart OSPF events with the graceful-restart flag under the
traceoptions for the protocol
Exercise: Graceful Restart
Applications:Traffic Engineering
Traffic Engineering is basically controlling and regulating the path that packets take through the
network. This can be done a number of ways, by tweaking link costs, and policy routing for
example. OSPF can help construct a special database that can be used for calculating the paths of
MPLS Label Switched Paths (LSPs) on which to map network onto. When these LSPs are
initiated, they can consult the database built by OSPF (or IS-IS) to help them determine the paths
through the network based on bandwidth, priority, usage, cost, link type and class. To help
construct the Traffic Engineering Database (TED), a special LSA was added to OSPF.
Updated by RFC 4203 to add support for GMPLS, and RFC 5786 on how a router should
advertise it's own addresses for TE extensions
Uses Type 10 Opaque LSAs with a type of 1
Intended to be used for traffic engineering, monitoring extended link attributes, constraint
based routing
TE data and topology is independent of the regular routed topology and data
Upon receipt of new TE LSAs, a router should update it's Traffic Engineering Database
o Can be throttled back only to flood when certain thresholds are met
Can also work on multi-access links, but reservations are a bit hard to concretely make
TLV Header
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Value... |
. .
. .
. .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mandatory subTLV
2. Link ID (4 octets)
Mandatory subTLV
Length is also 4*n octets, where n is the number of addresses on the link
Maximum bandwidth that can be used on the link in the direction from the
system originating the LSA towards it's neighbor
Enable generation of Traffic Engineering LSAs by setting set protocols ospf traffic-
engineering
Can set shortcuts directive to instruct OSPF to use MPLS LSPs as next hops
o Copies OSPF routes that can use configured LSPs into the inet.3 table
o Can configure OSPF to advertise the LSPs metric, rather than the link (or sum of
link) metrics into summary LSAs with the set protocols ospf traffic-
engineering shortcuts lsp-metric-into-summary directive
Can ignore LSP metrics when doing shortcuts with the ignore-lsp-metrics flag
Can set an independent metric on a link for TE with set protocols ospf area
interface te-metric where the metric is from 1 to 4294967295
Can view all Type 10 Opaque Area-Scope LSAs with operational command show ospf
database opaque-area
Can use the detail, extensive and summary flags to vary the amount of information
shown
o TLV Type, and subTLV data is visible with detail and extensive flags
Example: Viewing a TE LSA with a Router Address TLV Note: the TLV Type, Length and value
is shown in the LSA guts
admin@J2300-1>
admin@J2300-1>
Junos will only create a TE LSA with a Link Attributes TLV if an interface is configured to
process RSVP and MPLS
Junos will create a TE LSA with a Router Address TLV as long as it is configured to run TE
extensions to OSPF
A TE LSA with a Link TLV will pull it's values from the following places for each subTLV:
5. Traffic Engineering Metric - Defaults to the OSPF cost, or the configured TE metric if
one exists
Can view the protocols that are populating the TED with show ted protocol
Can use the detail and extensive flags to vary the amount of information shown
Can specify the System ID (From the Router Address TLV) to view TED on just node
with show ted database
admin@J2300-1>
Can view all of the link information with operational command show ted link
admin@J2300-1>
Editorial Note: Since an LSA with area flooding scope is used to build the TED, you wind up
with a separate TED for each area. Due to the nature of OSPF, it isn't guaranteed that a router,
especially a non-backbone router, will have complete information of the entire domain topology.
This is certain if any kind of stub areas, summarizing addresses at ABRs. Thus, a router trying to
precompute the path for a LSP won't necessarily have all of the needed information if the LSP
terminates outside it's own area. So if you're planning on doing any TE, do your best to keep
your OSPF design to a single area. To do TE in multiple areas you need to arrange for meeting
points of LSPs in each area, and stitch them together. There are a lot of expired RFCs and things
in the works. So stay tuned for a good working implementation, but don't hold your breath.
LDP distributes labels based on the best path determined by the IGP
o Situation can arise where the IGP is operational on a link, but LDP is not
o Causes OSPF to advertise the maximum metric over a link until LDP is
operational across the link
Configure as an option to the interface desired to syncrhonize with the LDP process with
set protocols ospf interface ldp-synchronization
o Can also configure a timer to advertise the maximum link metric with set
protocols ospf interface ldp-synchronization hold-time where the
time is from 1 to 65536 seconds
Advertising LSPs with OSPF
o Can set a metric for the LSP for OSPF like it is any other interface
o Works for IP traffic and helps with MPLS traffic using LDP signaled paths for
forwarding during link or node outages
Allows a pre-computed backup path to be installed in the Packet Forwarding Engine for
OSPF routes
o Traffic can be shunted down the backup path by the local router until routing
converges globally
o Care must be taken that the backup path does not wind up looping traffic back to
the router that is making the repair
Junos runs the SPF calculation from the perspective of each neighbor that
is one hop away to ensure a loop free path
Link Protection
o Used when only a single link may be come unavailable but the neighboring node
would still be reachable on another interface
Node-Link Protection
Can use RSVP signaled LSPs as a backup path used in the link-node schemes by setting
the backup flag in the LSPs configuration
When calculating an alternative path, Junos by default will use any available interface as
a potential backup path for a protected interface
o Can exclude an interface from being used by setting the set protocols ospf area
interface no-eligible-backup for the interface to be avoided
Need to configure load balancing allow the PFE to install all the potential next hops for
all of the destinations that will wind up being protected with either link or node-link
protection
Virtual Links
OSPF has a two level hierarchy
All areas must connect to the backbone area to transit traffic to another
area
o OSPF loop protection mechanism will not allow ABRs connected to the backbone
to install routes from Network Summary LSAs that did not come from the
backbone
LSAs are still flooded per the flooding scope of their LSA type, but they
may be ignored by the SPF
To overcome this feature/limitation two ABRs can install a virtual link through a non-
backbone area
o Can be used to join two disparate backbone areas together in the event of an
outage or to support a network merger
Virtual link is treated as an unnumbered point-to-point circuit that is part of the backbone
area
o A "virtual adjacency" will establish between the routers on the ends of the virtual
link
OSPF packets that belong to the backbone area flow across the virtual link
Type 5 Exernal LSAs are not flooded across virtual links as their
domain wide flooding scope would cause duplicates
Example: Area 4.4.4.4 is severed from the backbone area, but R41 has a connection to
R33 in area 3.3.3.3
A virtual link is put up from R41 (ABR) to R03 (ABR) to connnect area 4.4.4.4 virtually to
the backbone using area 3.3.3.3 as the Transit area.
o Need to specify the Router ID of the other side of the virtual link with neighbor-
id
[edit]
admin@J2300-1# edit protocols ospf area 0
Note that the neighbor is a Router ID which is not necessarily an interface IP address
o Need to be able to see the Router ID in a Type 1 LSA for the virtual link to come
up
Once configured, a virtual link will show up as an interface for OSPF to use, thus the
show ospf interface command will return results
o In Junos virtual links will be displayed with the interface name vl- of remote
side>
Inspecting the virtual link interface in detail will give more information on what the
virtual link parameters are
admin@J2300-1>
Virtual link will show a state of Down if parameters are not correct
Need to have a Router LSA present in the Transit area with an LSA ID of the target of the
other side of the virutal link
A router with an operational virtual link will have it displayed in its Router LSA that is
sent into the backbone area
Editorial Note: Most network books seem to paint a really awesome picture of a network that
has an area severed from the backbone, and a heroic network engineer steps in and saves the
day with a zero-cost virutal link! However, much like their ugly cousin the GRE tunnel, try to
avoid using these wherever possible. They are like putting a band-aid on a gunshot wound. Sure
it stops the immediate bleeding, but there are bigger problems a lot deeper that the virtual link
band aide is just covering up. A network that needs a virtual link actually needs a real
architectural overhaul. If you're using these, there are probably a lot better ways to "fix" your
problem.
OSPF attributes from LSAs are encoded into BGP extended attributes so the OSPF
advertisement can be recreated at remote VPN sites
o OSPF cost
o Area
o Route type
o Router ID
o Route tags
Diagram: OSPF used as the routing protocol between the CE and PE in a MPLS L3VPN
There are a few extensions and features in OSPF that enhance it's use as a routing protocol in
L3VPNs
Down Bit
L3VPNs usually require mutual redistribution between BGP, for the service providers
signalling between PE devices, and OSPF for dynamic routing between the PE devices
and the CE devices
o Can result in looping -- thus the definition of the Dn bit in the OSPF options field
o Down bit is set in the options field of a recreated OSPF LSA to indicate the route
has been sent down by a PE device
A PE device should not import (redistribute) any LSA with the down bit
set to remote sites
Sham Links
o Not normally a problem when all customer sites are only connected through the
providers network
If a direct link exists between customer sites, these two sites will always see the direct
link as a better path due to OSPF route preference
o Intra-area routes (learned from Type 1 and Type 2 LSAs) are preferred over Inter-
Area routes (Type 3 Network Summary LSAs)
o Sham links are much like virtual links that are setup between PE devices
Diagram: Backdoor Problem with L3VPNs running OSPF between Customer Sites
The Type 1 and 2 LSAs in area 0.0.0.0 at site 1 are advertised into BGP by PE1. The
OSPF values are encoded into extended BGP communities and advertised to PE2 via
BGP. The LSAs are reconstructed as Type 3 LSAs at the other side by PE2 and flooded
into the OSPF area at site 2. However, due to the fact that Type 1 and 2 LSAs can flow
over the T1 link between Site 1 and Site 2, these will always be preferred.
The Type 1 and 2 LSAs can now flow over the sham link. Thus, preference on whether or
not to send traffic between the sites over the T1 as opposed to the L3VPN becomes a
matter of the cost of the links.
There are some other aspects of OSPF in a L3VPN that come into play on the BGP side
of the router when the PE devices are advertising the BGP encoded LSAs back and forth
to each other in the MPLS network
o The origin BGP extended community is used to identify where a route originated
Used to prevent an OSPF route from being advertised back into the site
from which it originated
o The domain-id BGP extended community identifies the OSPF area from where a
route originated
Editorial Note: As much fun it is to set up OSPF as the routing protocol between the CE and PE
in a MPLS L3VPN, it is really quite nasty and should not be attempted by mortal network
engineers (really , it is fun). This involves some of the most advanced level routing concepts
you'll ever run into between BGP and OSPF. This is also plagued by some strangeish behavior -
the Type 1 & 2 LSA converstion to a Type 3 LSA which can be really daunting and misleading. It
also suffers from some messy hacks -- the sham link, which sleeps in the bed next to the virtual
link and GRE tunnel. It's really good to understand how all this works for one simple reason --
talking people out of using it! There are far better protocols for route distribution between the
CE and PE - RIP, BGP and even static routes. As scared as some people are about using BGP, it
is for the most part straight forward and predictable -- use it instead of OSPF.
Unused LSAs
Several LSAs are presently unused in Junos, but exist in standards documents
o Was defined for use with MOSPF (Multicast Extensions for OSPF)
o Nobody ever really implemented MOSPF and was never really used
A Type 8 LSA would match a Type 5 LSA and carry the BGP attributes for
the prefix in the Type 5 LSA
o Opaque LSA with flooding domain wide aside from stub areas of all types
o Can be set up for faster intervals that most dynamic routing protocols allow
MPLS LSPs
Tunnels
o Network layer
o Link layer
o Tunnels
BFD Operation
Implements a three way handshake for BFD session establishment and teardown
Transmit interval
Receive interval
Operating mode
o Asynchronous mode
o Demand mode
Control packets are only send when systems want to verify connectivity
o Passive system may not send BFD control packets until it has recieved one
BFD session neighbors negotiate if they want to use echo mode, demand
mode, and the rate at which packets will be sent
Once a session is down, it can not come back up until both parties
acknowledged to each other that the previous session was down
Specify the interval that BFD packets are sent, and the minimum
the system will accept recieving them with the minimum-interval
directive where the time is from 1 to 255000 milliseconds
Adaptive timers are used by default, but can be disabled with the
no-adaptation flag
o The default time for declaring a BFD session dead is 3x the transmission interval
Can change the multiplier from 1 to 255 with the multiplier command
o For OSPF, BFD sessions can be configured to start only for OSPF neighbors that
are in the Full state by adding the full-neighbors-only flag
admin@J2300-1> edit
Entering configuration mode
[edit]
admin@J2300-1# edit protocols ospf area 0 interface fxp1.13
o Can specify address, discriminator and prefix to narrow down results that
are returned
2 sessions, 2 clients
Cumulative transmit rate 1.7 pps, cumulative receive rate 0.7 pps
Init
Session is in the process of being setup, three way handshake is underway
Down
Session is down
Up
Session is up
AdminDown
Session has been administratively disabled, or not configured
Can restart a BFD session with the operational mode clear bfd session
o Will clear all BFD sessions unless a specific session is identified with a
combination of address
and discriminator
Can reset adaptive packet intervals for an active session with clear bfd adaptation
o Will reset adaptation on all BFD sessions unless a specific session is identified
with a combination of address
and discriminator
Debugging and tracing on the actual BFD protocol can be done by setting traceoptions
under edit protocols bfd
Flooding scopes have been more generalized (like with the Opaque LSAs)
Discovery, autoconfiguration
LSA changes
Routers can now use multiple Router LSAs instead of just one
Link State ID lost it's addressing symantics and now just serves to
identify an LSA
Stub and NSSA areas were redefined to allow the new LSA Types
o Peculiar Similarities
Router IDs, Area IDs, LSA Link State IDs remain 32 bits in size (like an
IPv4 address)
Editorial Note: I wish we could divorce ourself of IPv4 addresses in routing protocols
designed for IPv6
OSPF Configuration Overview
OSPF Configuration Options for OSPFv2 for Junos 10.0
protocols {
ospf {
disable;
export [ policy-names ];
external-preference preference;
graceful-restart {
disable;
helper-disable;
notify-duration seconds;
restart-duration seconds;
}
import [ policy-names ];
no-nssa-abr;
no-rfc-1583;
overload {
timeout seconds;
}
preference preference;
prefix-export-limit;
rib-group group-name;
reference-bandwidth reference-bandwidth;
sham-link {
local address;
}
spf-options {
delay milliseconds;
rapid-runs number;
holddown milliseconds;
}
traffic-engineering {
advertise-unnumbered-interfaces;
multicast-rpf-routes;
no-topology;
shortcuts {
ignore-lsp-metrics;
lsp-metric-into-summary;
}
}
traceoptions {
file filename ;
flag flag ;
}
area area-id {
area-range network/mask-length ;
interface interface-name {
disable;
authentication {
md5 key-id {
key [ key-values ];
start-time time;
}
simple-password key;
}
bfd-liveness-detection {
authentication {
algorithm algorithm-name;
key-chain key-chain-name;
loose-check;
}
detection-time {
threshold milliseconds;
}
full-neighbors-only;
minimum-interval milliseconds;
minimum-receive-interval milliseconds;
multiplier number;
no-adaptation;
transmit-interval {
threshold milliseconds;
minimum-interval milliseconds;
}
version (1 | automatic);
}
dead-interval seconds;
demand-circuit;
flood-reduction;
hello-interval seconds;
interface-type type;
ipsec-sa name;
ldp-synchronization {
disable;
hold-time seconds;
}
metric metric;
neighbor address ;
passive {
traffic-engineering {
remote-node-id address;
}
}
poll-interval seconds;
priority number;
retransmit-interval seconds;
secondary;
te-metric metric;
topology (ipv4-multicast | name) {
metric metric;
}
transit-delay seconds;
}
label-switched-path name metric metric;
network-summary-export [ policy-names ];
network-summary-import [policy-names ];
nssa {
area-range network/mask-length ;
default-lsa {
default-metric metric;
metric-type type;
type-7;
}
(summaries | no-summaries);
}
peer-interface interface-name {
disable;
dead-interval seconds;
demand-circuit;
flood-reduction;
hello-interval seconds;
retransmit-interval seconds;
transit-delay seconds;
}
sham-link-remote address {
demand-circuit;
flood-reduction;
ipsec-sa name;
metric metric;
}
}
stub ;
virtual-link neighbor-id router-id transit-area area-id {
disable;
authentication {
md5 key-id {
key [ key-values ];
}
simple-password key;
}
dead-interval seconds;
demand-circuit;
flood-reduction;
hello-interval seconds;
ipsec-sa name;
retransmit-interval seconds;
topology (ipv4-multicast | name) disable;
transit-delay seconds;
}
}
}
Final Comments
Whew!
After all of this is said and done, I actually really prefer IS-IS as my IGP.
If I ever find some time, I may expand this section a bit in the following ways:
References
RFC 1583 OSPF Version 2
RFC 5786 Advertising a Router's Local Addresses in OSPF Traffic Engineering (TE) Extensions
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Version 0 | C | Plenty |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Router ID - www.blackhole-networks.com |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Area ID - OSPF Deep Dive |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Checksum OK | Construction |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+- -+
| PAGE STILL |
+- UNDER -+
| CONSTRUCTION |
+- -+
| ROUGH AROUND THE EDGES |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
OSPF Deep Dive by Blackhole Networks is licensed under a Creative Commons Attribution-
NonCommercial-ShareAlike 3.0 Unported License.
Concerning comments and/or errors, please contact OSPF
Networking Notes
2. Aggregate Routes
3. Generated Routes
Static Routing
Next-Hop Options
reject
Qualified-Next-hop
LSP
The oppposite functions are available and can be configured by prepending the keywords with
no (like no-install)
active Remove routes from the routing table if next-hop is not available.
o Allows static route to be exported from routing table and redistributed into
another routing protocol.
no-retain
o If the routing protocol process shuts down, static routes are removed from the
forwarding table.
Aggregate Routes
Promote Route Summarization
Once aggregate routes become active in inet.0 table, aggregate routes will remain until
you manually remove them from the configuration.
Contributing Routes
Key to making an aggregate route active in the routing table is the presence of one or
more contributing routes.
Next-Hop Options
Reject (Default)
o Configured NULL value. Route with reject next-hop are dropped and an ICMP
message with destination host unreachable returned ti the source of the IP packet.
Generated Routes
Generated routes are almost like aggregate routes and in fact the routing table views them as one
protocol, protocol aggregate.
The difference between the aggregate and generated routes is that the next-hop attribute,
where
The next-hop IP address need not be configured for the generated route. The next-hop
will be selected automatically by Junos software.
One of the contributing route will be selected as the next-hop for the generated route.
This route is called Primary contributing route.
When you have multiple contributing routes, the primary contributing route is selected
based on the route having numerically smallest prefix
The automatic selection mechanism can be changed using Routing policy by allowing the
specific contributing route.
Martian Routes
RFC 1918 Private IP address space of 10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12 are not included
in the above list. This is due to Junos treats martian routes specially.
Junos Implementation
Martian route is not allowed to be placed into a routing table. The local router can never forward
packets to those destinations.
inet.0
Only Active routes (*) are copied into the forwarding table.
o Protocol Preference
o Next Hop When multiple nexthop exists, the routing table selects a single next-
hop to be placed in the forwarding table. This selected next-hop is marked as >.
inet.1
inet.2
inet.3
inet.4
inet6.0
mpls.0
bgp.l3vpn.0
Route Preference
The reason for using the preference system is that each protocol have separate method for
determining the best path to destination. (Eg: RIP-Hop Count, OSPF-Cost). These parameters are
not comparable hence Route-Preference.
1. Direct 0
2. Local 0
3. Static 5
4. RSVP 7
5. LDP 9
6. OSPF Internal 10
9. RIP 100
Load Balancing
Junos Defaults
Show Commands
Gallery
EBGP
2. Peer Group
4. Peer-AS
5. Type External.
IBGP
2. Peer Group
3. neighbor <Loopback>
4. Type Internal
Show commands
Gallery
Each peer advertise their entire routing knowledge to each other. (By default only
ACTIVE BGP routes learned from EBGP are advertised into IBGP)
After the initial exchange, Updates occur only on as-needed basis. Updates are only sent
when new information is learned or existing information is withdrawn.
TTL of EBGP = 1
Open Message consists of Version, Local AS, Hold Time, BGP ID, Optional Params
lenght and Optional Params
Update message consist of advertised routes and withdrawn routes. The fields of Update
message are Unfeasible routes length, WithDrawn Routes, Total Path Attributes Length,
Path Attributes and NLRI.
If the length value in Total Path attributes is 0, it means that No Routes are being
advertised with this message.
Each attribute in the Path Attribute filed is encoded as TLV (Type, Length and Value).
KeepAlive Message are exchanged at 1/3rd the negotiated hold-time value for the
session.
If the local router dont receive keepalive or update message within the hold-time period,
Notification message of Hold Time Expired is generated and session is torn down.
BGP router establishes memory locations in which to store routing knowledge. These are
collectively known as Routing Information Base(RIB).
1. Adjaceny-RIB-In
2. Local-RIB
3. Adjacency-RIB-Out
Adjacency-RIB-In
This table is created on the local router for each established BGP peer.
All routes received from the peer are placed in the appropriate memory table.
Adjacency-RIB-In table will be examined for the routes received(Update Message) from
the peer only after the local router implements any applied import routing policies.
The purpose of examining this table is to identify the best path advertisement to each
unique destination.
Local-RIB
Adjacency -RIB-Out
This table is created on the local router for each established BGP peer for Outbound route
advertisements.
Only routes currently located in the Local-RIB are eligible to be placed in this outbound
database.
By default, All Loca-RIB routes are placed in each Adjacency -RIB-Out table. Using
export policies, the behavior can be changed.
Path Attributes
Path Attributes are encoded in the Update Message using TLV triple. The type portion is a 2 octet
field.
o Only optional transitive attributes use this bit. 0 means BGP router along the
path recognized this attribute. 1 means at least one of the BGP router didnt
recognize this attribute.
Gallery
JUNOS
Network Mask : Unnumbered Pt-toPt interfaces and Virtual links set this value to 0.0.0.0
Options(1):
DR and BDR 0.0.0.0 is used when they are not elected. (Interface address will be
displayed by default)
DataBaseDescription Packet(Type 2)
DD Sequence number(4)
Number of LSAs(4)
LSA Types
Type 1-Router LSA ( Advertise networks connected, Links,metric of interfaces and OSPF
capabilities) => V(Virtual Link 0x4),E(ASBR
router0x2),B(ABR0x1), Both ABR and ASBR (0x3), None(0x0)
bits => Link-ID and Link data Fields for
different interface types
***Link- ID: Router ID of the adjacent peer(Pt-Pt & Virtual link),interface address of
DR(Trasit links), network# of the subnet(Stub).
=>Link Data : IP address of the local routers interface(Pt-Pt, V-link, Transit), Subnet
mask (Stub)
Type 2- Network LSA (DR generates network LSA represent broadcast segment to the
rest of the network. =>Network Mast and Attached
Router
Type 3 Network Summary(Advertise local routing info(router and network lsa) in both
directions across the boundary. =>Network Mask,
Metric(SPF cost + Cost carried in LSA).
Type 4 ASBR Summary (Required to reach the ASBR in a remote OSPF area, ABR
generates ASBR summary LSA for Type 5 LSA to reach ASBR).=>Network Mask ,
Metric , Router-id of the ASBR.
NSSA
When multiple ABRs are present in the NSSA, only the ABR with the highest-router ID
performs the 5-to-7 LSA translation.
ABR that translates the type 7 into type 5 changes the Advertising router id field to itself
thus by looking like an ASBR to the internal routers.(Router LSA Ebit will be changed to
0x3). NSSA LSA opt 0x8 setting the P Bit.
Opaque LSA
Cli Commands
show ospf database router area <id> extensive ( Display Router LSA)
Link
Hello Interval
Broadcast
Hello 10; Dead interval 40
NBMA
Metric
This formula will not work for gigabit and higher, as anything higher than fast-ethernet will be
having metric of 1.
OSPF wait timer : The wait time for electing the first DR on the segment is WaitTimer
(40 sec Router dead interval)
Auto-cost Reference-bandwidth
Seed Metric
By default Redistribute into RIP and EIGRP will have metric of Infinity; into OSPF will
have 20, into BGP will keeps the what ever the other protocol have.
Subnets Keyword : By default, when you redistribute into OSPF, it will summarize. Subnet
command will redistribute the individual subnets.
DR/BDR Election
Default E2 (metric-type 2)
Note: Router-id should be configured manually before forming the neighbor relationship,
otherwise it picks up the router-id automatically. Changing the router-id needs clearing the
OSPF process or reload of router to take affect.
OSPF -NBMA
Broadcast In frame-relay configuration, Broadcast keyword will not allow the broadcast but
it does pseudo broadcast means directed broadcast
Loopback by default will be advertised as /32, in order to advertise as a normal network which
ever it is configured for,
OSPF path selection Criteria (Regardless of Metric and AD) (IOS & JUNOS)
Intra-Area (O)
Inter-Area (O IA)
External Type 1 (E1)
External Type 2 (E2)
NSSA Type 1 (N1)
NSSA Type 2 (N2)
Junos Each LSA in the link-state database originated by the local router is noted with an
asterisk (*).
OSPF
September 6, 2012 rao1301Leave a comment
EIGRP topology table doesnt have the roadmap of the network whereas OSPF does.
Finds the best path to the destination and generates the routing table.
AREA
Why? when SPF alogrithm run too often, updates become too numerous because the
network has grown too large. So by splitting into multiple areas we make the topology
database smaller for routers within that area. So that SPF algorithm can be run less often,
the reason being summarization can be done at the borders(ABR and ASBR).
Area 0 Backbone Area /** All areas must connect to area 0**/
All routers within an area will have same database and roadmap.
ABR Area Border Router Router connecting two area in which one interface connects
to backbone area and another interface connects to non-backbone area within an
autonomous system.
ASBR Router connects two networks that part of different autonomous system.
Neighbor Relationship
R1 - R2
Once the OSPF process is started, router will determine its own Router-ID.(Router-id will
be the highest active IP address, Preference Loopback interface > Interface address.
Adds interfaces to the link state database (dictated by the network command)
Bold are mandatory parameters that should be matched between the neighbors to form a
successful neighborship.
Send Reply Hello After the verification is successful, enters into 2WAy state. R1 and
R2 both look at each others hello packets and checks if am I listed as neighbor in your
hello packet ?(If yes, Reset the DEAD timer; If No, Add as a new neighbor). Continue in
case only if the neighbor is new.
MASTER SLAVE relationship Exstart (Exchange start) State, exchanges the link
state database between the neighbors. Master-slave determination determines who sends
the information first.
DBDs are acknowledged and reviewed Loading state (loading into the memory).
If any information is missing in the DBDs that were exchanged, Master/Slave requests
the information , sends LSR.
The information will be exchanged until the LSDB is synchronized between the
neighbors. At this point, neighbors have same database and enters into FULL state.
SPF algorithm will be run on the top of the LSDB and forms the routing table which will have
only the best paths to the destination vs LSDB contains all the possible paths to the destination.
OSPF Cost
OSPF DR/BDR uses multicast address 224.0.0.5 to send and receive/Listens on 224.0.0.6
Inside the hello packet (two fields Router Priority and router-id (neighbor))
In a shared network, Non-DR/BDR routers will stay in 2Way state as there is no need
for these routers to synchronize the LSDB. Thats the basic idea behind electing
DR/BDR.
Scenario
Area 0 is the main office in USA and Area 1 in UK of company A. Company A want to merge
with company B. In this scenario, temporarily we need to merge Company A and B so lets say
Company B is in Area 2. In order to provide connectivity to area 0 (main office) we need to
create a virtual links. This solution is used during the transition period.
=>Virtual-link is like a tunnel interface. Virtual-link is a tunnel that looks like it is directly
connected to the device in area 0. We can accomplish the same by configuring the tunnel
interface.
LSA Type 3 : Summary LSA (Provide summary info about Type 1 and Type 2 LSAs for
other areas).
Type 4 LSAs (Summary ) are always generated by an ABR when an ASBR is present in
an area it touches. OSPF routers in a different area than the ASBRs area will look at the
Type 5 and Type 4 LSAs to calculate the path and metric to reach the external route.
OSPF routers in the same area as the ASBR can look at just the Type 5 LSA to calculate
the path. However, the Type 5 LSA by itself does not have enough information for OSPF
routers outside the area*, hence the need for the Type 4 LSA.* The Type 5 LSA remains
unmodified as it passes from area to area. One of the key pieces of information that
remains unmodified is the Advertising Router. Routers outside of the ASBRs area do
not have the Type 1 LSA describing the ASBR (because its a different area). The Type 4
LSA has information about the ASBR that matches the Advertising Router information
in the Type 5 LSA. Furthermore, the Type 4 LSAs Advertising Router field changes to
that of the ABR as it passes into a new area. All of this information helps the OSPF
router in other areas calculate the metric and next hop to reach the external routes
AREAS
Stub Area Blocks Type 5 LSAs from entering.(Default route will be generated by ABR
as type-3 LSA and will be installed in the stub router and next-hop as ABR)
Totally stubby (Cisco Proprietary) : Blocks Type 3, 4, 5 LSA from entering(Default route
will be generated by ABR as Type3 LSA and will be installed in the totally stub router).
Not-So-Stubby-Area Passes external routes through Type 7 LSA, these convert back to
Type 5 once they reach the Backbone by ABR.
Redistribution
Why do we redistribute?
Redistribution issues
Dont do two way FULL redistribution. (Use Static or default for one way and one way
do FULL table).
Looping issues with Two way full redistribution. (Filtering is one solution).
Resolutions
Passive Interfaces
Distribute-list/ Prefix-list
Seed Metric
By default Redistribute into RIP and EIGRP will have metric of Infinity; into OSPF will
have 20, into BGP will keeps the what ever the other protocol have.
Subnets Keyword : By default, when you redistribute into OSPF, it will summarize.
Subnet command will redistribute the individual subnets.
Advance Redistribution
Route Tag : Tagging routes will give flexibility to use it for later purposes like filtering.
Under the route-map, When you match tag like match tag 10 20 30 (This is an OR
operation) where as match 10, match 20, match 30 (This is an AND operation).( Specific
to Cisco IOS)
ATTEMPT This state is only valid for manually configured neighbors in an NBMA
environment. In Attempt state, the router sends unicast hello packets every poll interval to the
neighbor, from which hellos have not been received within the dead interval
Broadcast keyword in the frame-relay map doesnt allow broadcast, it creates pseudo
broadcasting (its a directed broadcast).
No DR/BDR elected
Partial Mesh (No full connectivity, spokes cannot ping each other)
Works like Point to Multipoint except for neighbors do not form automatically, need
static configuration
Aside
Create a free website or blog at WordPress.com. | The Minnow Theme.
Follow