Understanding OSPF Operation
Understanding OSPF Operation
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-1
• OSPFv3 is an implementation of the OSPF routing protocol
for IPv6.
• OSPFv2 (for IPv4 networks) and OSPFv3 run independently
on a network device.
• OSPFv3 has the same key capabilities as OSPFv2:
- Multiarea network design with Area Border Routers (ABRs) that
segment the network
- Shortest Path First algorithm for optimum path calculation
- Special area types and sophisticated handling of external routes
- Summarization on area borders simplifies network designs (stub
areas)
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-2
The shortest path to the
destination is the lowest
total sum of metrics.
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-3
• Link-state routers recognize more information about the network than
their distance vector counterparts.
- Neighbor table (the adjacency database)
- Topology table (the LSDB)
- Routing table (the forwarding database)
• Each router has a full picture of the topology.
• Link-state routers tend to make more accurate decisions.
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-4
• ABR: Area Border Router
• Internal router
External Routing Domain
• ASBR: Autonomous System Boundary Router
• Backbone router
OSPF Domain
Area 0 ASBR
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-5
• Backbone area—Area 0
• Regular nonbackbone area
• Stubby area or totally stubby area
• Not-so-stubby area (NSSA) or totally NSSA
OSPF Domain
Area 0
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-6
• Link-state routing requires a hierarchical network structure.
• OSPF area characteristics:
- Minimizes routing table entries
- Localizes impact of a topology change (link flapping) within an area
- Detailed LSA flooding stops at area boundary
OSPF Domain
Area 0
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-7
• Routers find the best paths to destinations by applying the Dijkstra SPF
algorithm to the LSDB.
• The best path is calculated based on the lowest total cost and sent to the routing
table.
R1 Link-State Database R1 Shortest Paths
R1 R2 R1 R2
DIJKSTRA SPF
R3 R4 R3 R4
RESULT
R5 R5
R6 R6
LSAs
R9 R9
R7 R8 R7 R8
R1 Forwarding Database
(Routing Table)
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-8
• The Hello protocol is used to define neighbors.
• Adjacency is established.
- Area ID Down
LSDBR1 LSDBR2
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-9
An LSA is more recent if it has Ignore
LSA
the following: LSA
Yes
• A higher sequence number
Is
• A higher checksum number Is entry
in
Yes sequence
number the
• An age equal to the maximum LSDB?
same?
age (poisoning) No No
• A significantly smaller link-state Add to LSDB Is
age (the LSA is significantly Yes sequence
younger) number
Send LSAck higher?
No
Flood LSA
Send LSA with newer
information to source
Run SPF to calculate
new routing table
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-10
Each LSA in the LSDB maintains a sequence number.
• 4-byte number
• Begins with 0x80000001; ends with 0x7FFFFFFF
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-11
• Every OSPF router announces a router LSA for those interfaces that it
owns in that area.
• Router with link ID 10.1.10.1 has been updated three times; the last
update was 115 seconds ago.
RP/0/RSP0/CPU0:PE1#show ospf database
OSPF Router with ID (10.1.1.1) (Process ID 1)
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-12
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-13
Implement OSPF in the Service Provider Network
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-14
CE1#debug ip ospf packet
OSPF packet debugging is on Type Packet Description
*Aug 16 09:18:53.974: OSPF: rcv. v:2 t:1 l:48 rid:10.1.1.1
Discovers
aid:0.0.0.11 chk:8224 aut:0 auk: from GigabitEthernet0/0 neighbors and
1 Hello
builds adjacencies
between them
Checks for
database
2 DBD
synchronization
between routers
Requests specific
3 LSR link-state records
from another router
Link IP OSPF Link
Sends specifically
Header Header Packet Trailer 4 LSU requested link-state
records
Acknowledges the
5 LSAck
Protocol ID Number 89 other packet types
OSPF Packet
Authen-
Version Packet Router Check- Authen-
Type Area ID tication Data
Number Length ID sum tication
Type
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-15
Hello
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-16
R1 R2 R2
172.16.6.0/24
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-17
R1 R2 R2
172.16.6.0/24
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-18
Point-to-point:
▪ A network that joins a single pair of routers
▪ Does not require DR or BDR election
▪ Neighbor is automatically detected
▪ Sends OSPF packets using multicast 224.0.0.5
▪ Default OSPF hello interval is 10 seconds
▪ Default OSPF dead interval is 40 seconds
Broadcast:
▪ DR and BDR selection is required
▪ Other routers form adjacencies with the DR and BDR only
▪ Packets to the DR and BDR use 224.0.0.6
▪ Packets from DR to all other routers use 224.0.0.5
▪ Default OSPF hello interval is 10 seconds
▪ Default OSPF dead interval is 40 seconds
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-19
▪ Hello packets are exchanged via Broadcast
IP multicast.
▪ DR: The router with the highest DROTHER DROTHER DROTHER
OSPF priority
▪ BDR: The router with the second- P=1 P=1 P=0
highest priority value P=3 P=2
▪ OSPF router ID is used as the tie-
breaker.
▪ DR election is nonpre-emptive. DR BDR
router ospf 1
area 11
interface GigabitEthernet0/0 interface GigabitEthernet0/0/0/0
ip ospf priority 2 priority 3
Gi 0/0/0/1
OSPF Area 0
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-21
Nonbroadcast (NBMA)
compliant modes
RFC 2328-
Point-to-multipoint
Hello timer: Automatic
Partial-mesh/star One subnet Generates /32
30 seconds No DR and BDR
Point-to-multipoint nonbroadcast
Hello timer: Manual
Partial-mesh/star One subnet Generates /32
30 seconds No DR and BDR
Cisco modes
Broadcast
Full-mesh Hello timer: Automatic
One subnet Original subnet
partial-mesh 10 seconds DR and BDR
Point-to-point
Partial-mesh/star, Hello timer: Automatic
Different subnets Original subnet
using subinterface 10 seconds No DR and BDR
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-22
• EoMPLS and Metro Ethernet service does not participate in STP, nor
does it learn MAC addresses.
• Customer routers R1 and R2 exchange Ethernet frames via an interface
or VLAN subinterfaces.
• OSPF behaves the same as on Ethernet.
- OSPF network type = multiaccess broadcast network
- DR and BDR are elected
- Routers form full adjacencies with DR and BDR only
Ethernet
interface or
VLAN
subinterface
L2 MPLS VPN backbone OSPF
R1 PE1 PE2 R2
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-23
• Customer routers run OSPF and exchange routing updates with the PE
routers.
- PE routers appear as another router in the customer’s network.
- Service provider routers are hidden from the customer.
- Customer routers are unaware of MPLS VPN.
- Customer and service provider must agree on OSPF parameters.
• Customer routers-to-PE connection can be of any type.
- OSPF behaves per the connection type (point-to-point, broadcast, NBMA)
P2P,
Broadcast,
or NBMA
R1 PE1 PE2 R2
OSPF OSPF
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-24
interface type number router ospf 1
ip ospf priority 0 Define the OSPF area 11
ip ospf network non-broadcast network type interface type number
! network non-broadcast
router ospf 1 Statically define a neighbor 192.168.101.11 priority 0
neighbor 192.168.101.10 neighbor relationship neighbor 192.168.101.21 priority 0
CE1 OSPF
Lo 0 PE1
10.1.10.1 192.168.101.11
CE2 Lo 0
192.168.101.10 10.1.1.1
Lo 0
192.168.101.21
10.2.10.1
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-25
Leased-line Automatic
Single subnet
emulation No DR and BDR
router ospf 1
area 11
interface GigabitEthernet0/0 interface GigabitEthernet0/0/0/0
ip ospf network point-to-point network point-to-point
CE1
OSPF
Lo 0 Gi 0/0 PE1
10.1.10.1 192.168.101.11
Gi 0/0/0/0 Lo 0
192.168.101.10 10.1.1.1
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-26
Automatic
Partial-mesh/star Single subnet
No DR and BDR
router ospf 1
area 11
interface type number interface type number
ip ospf network point-to-multipoint network point-to-multipoint
CE1
OSPF
Lo 0 PE1
10.1.10.1 192.168.101.11
CE2 Lo 0
Lo 0 192.168.101.10
10.1.1.1
10.2.10.1 192.168.101.21
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-27
Manual
Partial-mesh/star Single subnet
No DR and BDR
CE1
OSPF
Lo 0 PE1
10.1.10.1 192.168.101.11
CE2 Lo 0
Lo 0 192.168.101.10 10.1.1.1
10.2.10.1 192.168.101.21
RP/0/RSP0/CPU0:PE1#show ospf neighbor
Neighbors for OSPF 1
Neighbor ID Pri State Dead Time Address Interface
10.1.10.1 0 FULL/ - 00:01:49 192.168.101.11 type number
Neighbor is up for 00:06:18
10.2.10.1 1 FULL/ - 00:01:41 192.168.101.21 type number
Neighbor is up for 00:06:32
Total neighbor count: 2
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-28
LSA Type OSPFv2 OSPFv3
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-29
• One router LSA for every router • One network LSA for each
in an area transit broadcast or NBMA
- Includes a list of directly attached network
links
- Includes a list of attached routers
- Links identified by the IP prefix on the transit link
and link type
- Includes a subnet mask of the link
• LSA identified by the router ID of
the originating router • Advertised by the DR
• Floods within its area only; does • Floods within its area only; does
not cross an ABR not cross an ABR
Link Type Description Link ID
Point-to-point connection to Neighboring OSPF Area 1
1
another router router ID
2
Connection to a transit IP address of DR
network DR Type 1 Router
Connection to a stub IP network or
3 Type 2 Network
network subnet number
Neighboring
4 Virtual link
router ID
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-30
• LSA type 3 used to flood • LSA type 4 used to advertise a
network information to areas metric to the ASBR, which is
outside the originating area used for path selection
• Describes the network number • Contains the router ID of the
and mask of the link ASBR
• Advertised for every subnet and
not summarized, by default
Advertised by the ABR of the Regenerated by all
originating area subsequent ABRs
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-31
• LSA type 5 (external LSA) used to • LSA type 7 (NSSA external LSA)
advertise networks from other used to advertise networks from
autonomous systems other ASs injected into the NSSA
• Flooded throughout the entire AS • Same format as a type 5 external
• Advertising router ID (ASBR) LSA
unchanged throughout the AS • Translated to LSA type 5 on the
• Type 4 LSA is needed to find the NSSA ABR, then propagated as
ASBR LSA type 5 by subsequent ABR
Advertised and owned by the
originating ASBR
ASBR
ABR ABR
ASBR Type 5 Type 5
Type 7 OSPF Area 10 NSSA
Advertised by the ABR of the
originating area
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-32
router ospf 1
area 0
interface GigabitEthernet0/0/0/1
area 1
router ospf 1 interface Loopback0
log-adjacency-changes area 11
network 10.1.10.1 0.0.0.0 area 11 interface GigabitEthernet0/0/0/0
network 192.168.101.11 0.0.0.0 area 11
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-33
CE1 OSPF Area 11 PE1 OSPF Area 1
Gi 0/0 Gi 0/0/0/0
Lo 0 Lo 0
192.168.101.11 192.168.101.10
10.1.10.1 10.1.1.1
Gi 0/0/0/1 192.168.112.10
Gi 0/0/1
OSPF Area 12 192.168.112.20
Gi 0/0 Gi 0/0/0 Lo 0
Lo 0
192.168.102.21 192.168.102.20 10.2.1.1
10.2.10.1
PE2 OSPF Area 0
CE1
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-34
External AS CE1 OSPF Area 11 PE1 OSPF Area 1
Gi 0/0 Gi 0/0/0/0
100.0.0.1/24 Lo 0
10.1.10.1 192.168.101.11 192.168.101.10
10.1.1.1
router ospf 1 Gi 0/0/0/1 192.168.112.10
redistribute connected subnets
Gi 0/0/1
OSPF Area 12 NSSA 192.168.112.20
Gi 0/0 Gi 0/0/0 Lo 0
200.0.0.1/24
10.2.10.1 192.168.102.21 192.168.102.20 10.2.1.1
router ospf 1 OSPF Area 0
CE2 PE2
area 12 nssa
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-35
OSPF interarea (summary LSA):
▪ Networks from outside the area of the router, but within the OSPF autonomous system
▪ Advertised by means of summary LSAs
T1(cost 30) E1 or E2
Gi(cost 1) E2 (cost 30)
R5 R3
Gi(cost 1) R4 Gi(cost 1)
R7 R1
T1(cost 30) Gi(cost 1) R2 Gi(cost 1)
R6
E1 (cost 32)
E1 or E2
E2 (cost 30)
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-37
© 2012 Cisco and/or its affiliates. All rights reserved. SPROUTE v1.01—2-38