OSPF Routing Protocol
Copyright © Wuhan FiberHome Technical Services Co ., Ltd. All rights reserved.
Contents 1. IP Routing Basis
2. Brief introduction to OSPF
3. OSPF configuration and checking
BROADEN YOUR FUTURE
What Is Routing?
Routing: specifies the path along which a packet is forwarded. -------addressing the issue about how
a packet is sent to its destination
Routing is the process of forwarding a packet. -------Per-hop behavior (PHB): A router does not
know the complete forwarding path, but only knows how to forward a packet to the nearest next
hop along the path to the destination.
Routing table: stores routing information. -------Routing information such as destination addresses,
protocols and cost of route learning, next-hop addresses, and outgoing interfaces is stored in a
routing table.
BROADEN YOUR FUTURE
Routing Table and FIB Table
Forwarding packets Selecting the optimal route
IP/MASK Next-hop Interface Protocol Preference Metric/Cost
[Link]/24 [Link] XGE0/10/1 OSPF 110 100
[Link]/24 [Link] XGE0/7/1 ISIS 25 150
[Link]/24 [Link] GE0/6/1 ISIS 25 1500
[Link]/30 [Link].2 XGE0/10/1 Static 10 10
BROADEN YOUR FUTURE
IP Forwarding Hop-by-hop
IP/MASK NEXTHOP
IP/MASK NEXTHOP
[Link]/16 Direct
[Link]/16 R2
…..
….. R2 ([Link])
IP/MASK NEXTHOP
[Link]/16 R1 R1
…..
[Link]
R5
([Link])
R3
R4
Router does not know the complete forwarding path, only knows the best next hop to reach the
destination. Therefore, the router forwards hop by hop.
longest matching mechanism is used when querying the routing table. Pay attention to the
difference between "longest matching" and "accurate matching"
BROADEN YOUR FUTURE
Router Routing- Longest-prefix Match
Carry out operation matched with route entry, according to destination address of message. The matched action
is to carry out "and" for destination address of message and subnet mask of route entry; the results of "and" for
destination IP10.111.1.88 and subnet mask of various entries are shown as follows:
[Link] & [Link] = [Link]
[Link] & [Link] = [Link]
[Link] & [Link] = [Link]
If the result of "and" has the same network address as route
entry, it should be considered as successful route
matching .Subnet mask with the longest bits in all matching IP network port Mask Interface number Remarks
entry is the optimal matching entry, and message shall be ·
[Link] [Link] 3 ...
forwarded accordingly (transmitting from the corresponding [Link] [Link] 2 ...
interface of the entry) [Link] [Link] 2 ...
If matching entry is not found, it will be forwarded according
to default route [Link]/0.
If default route is not available, the message should be
discarded.
Intf 1 Intf 2
DA:xx-xx-xx-xx-xx-xx DA:xx-xx-xx-xx-xx-xx
SA:xx-xx-xx-xx-xx-xx Intf SA:xx-xx-xx-xx-xx-xx
...... 3 ......
SIP:[Link] SIP:[Link]
DIP:[Link] DIP:[Link]
...... ......
BROADEN YOUR FUTURE
IP Forwarding Table
([Link]/16) IP Forwarding Table
Destination Next-hop Interface
[Link]/16 [Link] GE0/1/1
[Link]/30 [Link]/16 [Link] GE0/1/2
GE0/1/1 [Link]/16 [Link] GE0/1/3
[Link]/30
GE0/1/3
[Link]/30
GE0/1/2 [Link]/30
[Link]/30
[Link]/30
([Link]/16) ([Link]/16)
BROADEN YOUR FUTURE
Routing Protocols
Routing protocols are classified by route type, which may be direct routes, static routes,
and dynamic routes.
Disadvantages of direct routes and static routes:
A direct routing protocol can only discover routes on the network segment where
the specified interface is located.
Static routes are maintained manually and applicable only to networks with a
simple topology.
Characteristics of dynamic routing protocols:
Protocol packets are exchanged in real time and routers can perceive network
topology change.
Routing algorithms update routing information automatically and route
convergence is fast.
Dynamic routes do not need to be maintained manually and are applicable to
networks with a complex topology.
BROADEN YOUR FUTURE
Contents 1. IP Routing Basis
2. Brief introduction to OSPF
3. OSPF configuration and checking
BROADEN YOUR FUTURE
Classification of Dynamic Routing Protocols
Classification by algorithm
Distance vector protocols, such as the Routing Information Protocol (RIP) and
Border Gateway Protocol (BGP)
Link state protocols, s u c h a s t h e Open Shortest Path First (OSPF) and
Intermediate System to Intermediate System (IS-IS)
Classification by application scope
Interior Gateway Protocols (IGPs), such as RIP, OSPF, and IS-IS, which are used to
calculate routing information in an autonomous system (AS).
Exterior Gateway Protocols (EGPs), such as the BGP, which is used to transmit
routing information between ASs.
BROADEN YOUR FUTURE
Classification of Dynamic Routing Protocols
AS 1 AS 2
BGP
OSPF IS-IS
An AS is a collection of routers that use the same routing policy and are
managed by a single network operator.
BROADEN YOUR FUTURE
OSPF Overview
OSPF is abbreviation of Open Shortest Path First, it's typical routing protocol.
OSPF is open, so it can be used by all manufacturers.
OSPF is IGP (Interior Gateway Protocol), it’s usually used intra AS (Autonomous System).
OSPF is link state routing protocol, it uses SPF (Shortest path first ) algorithm.
BROADEN YOUR FUTURE
OSPF Features
OSPF supports large-scale networks with several hundred routers.
OSPF supports VLSM (variable-length subnet masking) and CIDR (Classless Inter-Domain Routing)
because its packets carry mask information.
OSPF supports area division, the routing information transmitted between areas is further
abstracted to reduce the occupied network bandwidth.
OSPF supports multiple equal-cost routes to the same destination address.
BROADEN YOUR FUTURE
OSPF Terminologies
Link State
LSA
LSDB
Router
ID
BROADEN YOUR FUTURE
OSPF Route Calculation
The route calculation process of OSPF is described briefly as follows:
Each router generates an LSA based on its surrounding network topology and sends the LSA to
other routers on the network through Update packets.
Each router receives LSAs from other routers. The LSAs received by a router from all other routers
are stored in an LSDB. An LSA describes the surrounding network topology of a router and an
LSDB describes the network topology of the entire AS.
Each OSPF router converts its LSDB into a weighted directed graph, which reflects the entire
network topology. The weighted directed graphs obtained by all routers are the same.
Based on its weighted directed graph, each router uses the SPF algorithm to calculate an SPF tree
with itself as the root node. The SPF tree provides the routes to various nodes in the AS.
BROADEN YOUR FUTURE
OSPF Route Calculation
1 1
A B
RTA RTB 2 5
2 5
C
RTC
3 3
RTD D
(3) Weighted directed graph obtained
(1) Network topology (2) LSDB of each router from the LSDB
1 B 1 B 1 B 1 B
A A A A
2 C 2 C 2 C 2 C
3 3 3 3
D D D D
(4) Each router calculates an SPF tree when it works as the root node.
BROADEN YOUR FUTURE
OSPF header
OSPF packets are carried over the IP layer. The protocol number is 89.
Data link header IP header OSPF header OSPF PDU FCS
BROADEN YOUR FUTURE
Five types of OSPF packets
A B
Hello
Ensure Reachability
Hello
DD
DD
Database Synchronization
DD
DD
LSR
Update synchronization LSU
LSACK
BROADEN YOUR FUTURE
Hello packet
Hello packet: is sent periodically to establish and maintain an OSPF neighbor relationship.
BROADEN YOUR FUTURE
DD packet
DD (Database Description) packet: also called DBD packet, describes the local LSDB digest and is
used for LSDB synchronization between two routers.
BROADEN YOUR FUTURE
LSR packet
LSR (Link State Request) packet: is used by a router to request the required LSA from the peer
router. An LSR packet is sent only after two routers exchange DD packets.
BROADEN YOUR FUTURE
LSU packet
LSU (Link State Update) packet: is used by a router to send the required LSA to the peer router or to
flood its updated LSA.
BROADEN YOUR FUTURE
LSACK packet
LSACK (Link State Acknowledgment ) packet: is used by a router to acknowledge the reception of
an LSA.
BROADEN YOUR FUTURE
Area Division
Area [Link]
Area [Link]
Area [Link]
Area [Link]
Area [Link]
BROADEN YOUR FUTURE
Router Classification
Area [Link] ISIS ASBR
Area [Link]
Backbone router
IAR
Area [Link]
Area [Link]
Area [Link]
ABR
BROADEN YOUR FUTURE
OPSF Network Classification
Networks in OSPF are classified on the link layer media as follows: Broadcast network , NBMA
network, P2P network and P2MP network.
HUB
PTP
BROADCAST
FR/X.25 FR/X.25
NBMA PTMP
BROADEN YOUR FUTURE
LSA Classification
For a router, LSA describes the interface status and adjacency status of the router.
LSA Type Description
Type 1 Router-LSA : Generated by Each router, describes the link state and cost of the
router and advertised in the area the router belongs to.
Type 2 Network-LSA : Generated by DR, describes the link state of the network segment
and advertised in the area DR belongs to.
Type 3 Network-summary-LSA : Generated by ABR, describes the route of a network
segment in the area and advertised to other related areas.
Type 4 ASBR-summary-LSA : Generated by ABR, describes the route to ASBR and
advertised to other related areas.
Type 5 AS-external-LSA : Generated by ASBR, describes the routes to the outside of the AS
and advertised to all other areas except STUB/NSSA area).
BROADEN YOUR FUTURE
Type 1 LSA
Generated by Each router, describes the link state and cost of the router and advertised in the area
the router belongs to.
AREA 1
Type 1
IAR IAR
BROADEN YOUR FUTURE
Type 2 LSA
Generated by DR, describes the link state of the network segment and advertised in the area DR
belongs to.
AREA 1
Type 2
IAR
DR
IAR IAR
IAR
BROADEN YOUR FUTURE
Type 3 LSA
Generated by ABR, describes the route of a network segment in the area and advertised to other
related areas.
AREA 1 AREA 0 AREA 2
Type 1 Type 3 Type 3
IAR IAR
ABR ABR
BROADEN YOUR FUTURE
Type 4 LSA
Generated by ABR, describes the route to ASBR and advertised to other related areas.
ISIS
AREA 1 AREA 0 AREA 2
Type 1 Type 4 Type 4
ASBR ABR IAR
ABR
BROADEN YOUR FUTURE
Type 5 LSA
Generated by ASBR, describes the routes to the outside of the AS and advertised to all other areas
except STUB/NSSA area.
ISIS
AREA 1 AREA 0 AREA 2
Type 5 Type 5 Type 5
ASBR IAR
ABR ABR
BROADEN YOUR FUTURE
STUB and NSSA
STUB area and NSSA are non-backbone areas:
STUB area denies AS's external routes but permits inter-area routes.
Totally STUB area denies AS’s external routes and inter-area routes.
NSSA area permits AS’s external routes from the ASBR of local area and it also permits inter-
area routes, but denies AS’s external routes from the ASBR of other areas.
Totally NSSA area permits AS’s external routes from the ASBR of local area but denies AS’s
external routes from the ASBR of other areas and it also denies inter-area routes.
BROADEN YOUR FUTURE
Contents 1. IP Routing Basis
2. Brief introduction to OSPF
3. OSPF configuration and checking
BROADEN YOUR FUTURE
Check OSPF configuration
interface mgmt
ip vrf forwarding CTVPN193
ip address [Link]/24
ip ospf network broadcast
ip vrf CTVPN193
ip ospf priority 0
!
!
router ospf 65533 vrf CTVPN193
interface gigabitethernet 0/14/0/4
router-id [Link]
pdcn enable
network [Link]/24 area [Link]
!
interface gigabitethernet 0/14/0/4.4093
interface gigabitethernet 0/14/0/4.4093
area [Link]
vlan-type dot1q 4093
!
ip vrf forwarding CTVPN193
ip unnumbered mgmt
ip ospf cost 30
!
BROADEN YOUR FUTURE
Check OSPF routes and status
BROADEN YOUR FUTURE
Check OSPF interface
BROADEN YOUR FUTURE
Check Logical Interface
BROADEN YOUR FUTURE
Check Physical Interface
BROADEN YOUR FUTURE
THANKS!