06 OSPF Basics
06 OSPF Basics
age 2 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Forewor
d
Static routes are manually configured. If a network topology changes, static
routes have to be manually adjusted, which restricts the large-scale
application of static routes on the live network.
Dynamic routing protocols are widely used on live networks because of their
high flexibility, high reliability, and easy scalability. The Open Shortest Path
First (OSPF) protocol is a widely used dynamic routing protocol.
This course describes basic concepts, working mechanism, and basic
configurations of OSPF.
age 3 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Objective
s
On completion of this course, you will be able to:
Describe the advantages and classification of dynamic routing protocols.
Describe basic OSPF concepts and usage scenarios.
Describe the working mechanism of OSPF.
Implement basic OSPF configurations.
age 4 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Content
s
1. OSPF Overview
2. OSPF Working Mechanism
3. Typical OSPF Configuration
age 5 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Content
Sumber :
s Kukuh Nugroho
Bapak
age 6 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Sumber :
Content
Bapak Kukuh Nugroho
age 7 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Sumber :
Content
Bapak Kukuh Nugroho KONSEP AREA DALAM OSPF
s
AREA 1 AREA 3
AREA
AREA 2
0 AREA 4
AREA UTAMABACKBONE
age 8 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Sumber :
Content Bagaimana dengan begini, kalua sin
Bapak Kukuh Nugroho
s Area ?
AREA 1 AREA 3
AREA
AREA 2
0 AREA 4
?
AREA 5
AREA UTAMABACKBONE
age 9 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Sumber :
Content
Bapak Kukuh Nugroho PROSES ADJACENCY
s
age 10 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Sumber :
Content
Bapak Kukuh Nugroho PROSES ADJACENCY
s
age 11 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Sumber :
Content
Bapak Kukuh Nugroho PROSES ADJACENCY
s
R3
20.20.20.0/24
age 12 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Sumber :
Content
Bapak Kukuh Nugroho
PROSES ADJACENCY R4
s R5
R3
20.20.20.0/24
age 13 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Content
s
age 14 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Content TAHAPAN PERHITUNGAN RUTE TERBAIK
s
age 15 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Why Are Dynamic Routing Protocol
Used?
Static routes are manually configured and maintained, and the command lines are simple and
clear. They apply to small-scale or stable networks. Static routes have the following
disadvantages:
Unable to adapt to large-scale networks: As the number of devices increases, the configuration
workload increases sharply.
Unable to dynamically respond to network changes: If the network topology changes, the network
cannot automatically converge, and static routes must be manually modified.
R R2 R R2
1 1
Link fault
R3 R3
By working mechanisms
and algorithms
Distance Vector Routing Protocols Link-State Routing Protocols
age 17 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Distance-Vector Routing Protocol
A router running a distance-vector routing protocol periodically floods routes. Through route
exchange, each router learns routes from neighboring routers and installs the routes into its
routing table.
Each router on a network is clear only about where the destination is and how far the
destination is, but unclear about the whole network topology. This is the essence of the
Routing Routing Routing
distance-vector algorithm.
table table table
3.3.3.
3
R1 R2 R3
age 18 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Link-State Routing Protocol - LSA
Flooding
Different from a distance-vector routing protocol, a link-state routing protocol
advertises link status information rather than routes in the routing table. Routers
that run a link-state routing protocol establish a neighbor relationship and then
exchange Link State Advertisements (LSAs).
LSA LSA • LSAs, instead of routes, are
R2 1. 5 advertised.
44
Mb •
0 i t/ s An LSA describes a router
1 0 i t/ s interface's status information,
Mb
such as the cost of the
10 s
R1 it / R3 interface and a connected
Mb 0 b
i t/ 0 0M interface name.
s 10
LSA LSA
R4
age 19 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Link-State Routing Protocol - LSDB
Creation
Each router generates LSAs and adds the received LSAs to its own link state
database (LSDB). Routers learn the whole network topology through the LSDB.
R4
LSDB
age 20 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Link-State Routing Protocol - SPF
Calculation
Each router uses the Shortest Path First (SPF) algorithm and LSDB information to calculate
routes. Each router calculates a loop-free tree with itself as the root and the shortest path.
With this tree, a router determines the optimal path to each corner of a network.
LSDB
Each router calculates a loop-
free tree with itself as the root
1. 5 over the shortest path.
LSD R2 44 LSD
bit/s Mb
B
0 0M i t/ s B
1
10 s 2
0M bit /
R1 R3
bit
/ s 0 0M
10 1 3
R4 4
LSDB
age 21 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Link-State Routing Protocol - Routing
Table Generation
Ultimately, the router installs routes for the calculated preferred paths into
its routing table.
Based on SPF calculation results,
Routin each router installs routes into
LSDB
g table the routing table.
LSD R2 1. 5 LSD
it/s
Routin Routin
b Mb 44 Routing
g table
B g table
0 0M i t/ s B
table
1
s
10
0M bit /
R1 R3
bit 0 0M
/ s 10
R4
Routin
LSDB g table
age 22 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Summary of Link-State Routing
Protocols
Neighbor LSDB Link status LSDB
relationship setup information
R1 R2 R1 R2
p
re Ne in ink
at tus
tu
p r
hi bo
fo s
n
se
la igh
rm ta
io
rm ta
ns gh
t
fo s
se ion bo at tus
tio ei
in ink
tu sh r
N
io
L
p ip n
la
R3 1 2 R3 LSDB
re
Path Path computation 3 4 RIB RIB
computation Route
R1 R2 R1 generation R2
1 2
RIB
Path R3 3 RIB: Routing Information R3
computation Base
age 23 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Introduction to OSPF
OSPF is a typical link-state routing protocol and one of the widely used IGPs in the industry.
OSPFv2, as defined in RFC 2328, is designed for IPv4. OSPFv3, as defined in RFC 2740, is designed for
IPv6. Unless otherwise specified, OSPF in this presentation refers to OSPFv2.
OSPF routers exchange link status information, but not routes. Link status information is key information
for OSPF to perform topology and route calculation.
An OSPF router collects link status information on a network and stores the information in the LSDB.
Routers are aware of the intra-area network topology and be able to calculate loop-free paths.
Each OSPF router uses the SPF algorithm to calculate the shortest path to a specific destination. Routers
generate routes based on these paths and install the routes to the routing table.
OSPF supports the variable length subnet mask (VLSM) mechanism and manual route summarization.
The multi-area design enables OSPF to support a larger network.
age 24 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
OSPF Application on a Campus
Network
Internet Firewall
age 25 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Area Router ID Cost Value
R1 Area R2
0
R3
age 26 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Area Router ID Cost Value
R3
Router ID:
3.3.3.3
age 27 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Cost
Area Router-ID
Value
FE interface GE interface
Cost = 1 Cost = 64
Default cost = Default cost = 1
1 R1 R2 R3
• Each OSPF interface has a specific cost • In the routing table of R3, the cost of the OSPF route
because of the particular bandwidth to 1.1.1.0/24 is 75 (10 + 1 + 64).
value.
age 28 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
OSPF Packet Types
There are five types of OSPF protocol packets and implement different
functions in interaction between OSPF routers.
Packet Name Function
Requests a needed LSA from a neighbor. LSRs are sent only after
Link State Request
DD packets have been successfully exchanged.
age 29 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Neighbo LSDB OSPF Routing
r Table Table table
age 30 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Neighbor LSDB OSPF Routing
Table Table Table
▫ An LSDB stores LSAs generated by a router itself and received from neighbors. In this example, the
LSDB of R1 contains three LSAs.
▫ The Type field indicates an LSA type, and the AdvRouter field indicates the router that sends the
LSA.
age 31 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Router 1.1.1.1 1.1.1.1 92 36 80000005
Neighbor LSDB OSPF Routing
Table Table Table
Total Nets: 3
age 32 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Intra Area: 3 Inter Area: 0 ASE: 0 NSSA: 0
Content
s
1. OSPF Overview
2. OSPF Working Mechanism
3. Typical OSPF Configuration
age 33 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Relationships Between OSPF Routers
There are two important concepts about the relationship between OSPF
routers: neighbor relationship and adjacency.
On a simple network, two routers are directly connected. OSPF is enabled on
interconnected interfaces. The routers start to send and listen to Hello
packets. After the two routers discover each other through Hello packets,
they establish a neighbor relationship.
The establishment of a neighbor relationship is just the beginning. A series of
packets, such as DD, LSR, LSU, and LSAck packets, will be exchanged later.
When LSDB synchronization between two routers is complete and the two
routers start to calculate routes independently, the two routers establish an
age 34
adjacency.
Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Process of Establishing an OSPF
Adjacency Relationship
OSPF adjacency relationship establishment involves four steps: establishing a neighbor relationship,
negotiating the master/slave status, exchanging LSDB information, and synchronizing LSDBs.
R1 R2
1
Establish a bidirectional
neighbor relationship.
2
age 35 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Process of Establishing an OSPF
Adjacency - Step 1
Area 1.1.1.1 Area 2.2.2.2
R1 R2
Hello packets
I'm 1.1.1.1. I don't know who's on the
link. Init
R1 (1.1.1.1) is discovered and
Hello packets added to the neighbor list. The
I'm 2.2.2.2. I found my neighbor 1.1.1.1. status of R1 in the neighbor
2- table is Init.
way
R2 (2.2.2.2) is discovered
and added to the neighbor
Hello packets
list. Because R2
I'm 1.1.1.1. I found the neighbor 2.2.2.2.
discovered me, I set the 2-
status of R2 to 2-way in way
the neighbor table. Because R1 found me, I
change the status of
We're neighbors. 1.1.1.1 to 2-way in the
neighbor table.
age 36 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Process of Establishing an OSPF
Adjacency - Steps 2 and 3
Router ID: Router ID:
1.1.1.1 2.2.2.2
R1 R2
LSR
I want to request the complete
information about the yyy LSA.
Full Full
age 38 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Review of the OSPF Neighbor Table
Router ID: Router ID:
1.1.1.1 2.2.2.2
R1 R2
GE1/0/0 GE1/0/0
10.1.1.1/30 10.1.1.2/30
age 40 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
OSPF Network Types (1)
Generally, the network types of OSPF interfaces at both ends of a link must be the same. Otherwise, the
two interfaces cannot establish a neighbor relationship.
An OSPF network type can be manually changed on an interface to adapt to different network scenarios.
For example, you can change the BMA network type to P2P.
/0
E0/ 0
Serial0/0/ Serial0/0/ G
0 0 GE0/0/0
PPP PPP
RTA RTB Ethernet
GE
0 /0 /
0
• P2P indicates that only two network devices can be • BMA is also called broadcast. It refers to an
connected on a link. environment that allows multiple devices to access and
• A typical example is a PPP link. When an interface uses supports broadcast.
PPP encapsulation, the default network type of the • A typical example is an Ethernet network. When an
OSPF interface is P2P. interface uses Ethernet encapsulation, the default
network type of the OSPF interface is BMA.
age 41 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
OSPF Network Types (2)
Non-Broadcast Multiple Access (NBMA) Point-to-Multipoint (P2MP)
Frame
F
Relay
R
age 42 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Background of DR and BDR
Multi-access (MA) networks are classified into BMA and NBMA networks. Ethernet is a typical broadcast
multi-access network.
On an MA network, if each OSPF router establishes OSPF adjacencies with all the other routers, excessive
OSPF adjacencies exist on the network, which increases the load on the devices and the number of OSPF
packets flooded on the network.
Once the network topology changes, LSA flooding on the network may waste bandwidth and device
resources.
Ethernet
Adjacenc
y
age 43 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
DR and BDR
To optimize OSPF neighbor relationships on an MA network, the OSPF protocol specifies three
types of OSPF routers: DR, BDR, and DRother.
Only the DR and BDR can establish adjacencies with other OSPF routers. DRothers do not
establish OSPF adjacencies with one another, and their relationship is in the 2-way state.
The BDR monitors the status of the DR and takes over the role of the DR if the existing DR
fails.
DR BDR
Ethernet
age 44 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
OSPF Domain and Single Area
An OSPF domain is a network that consists of a series of
contiguous OSPF network devices that use the same policy.
An OSPF router floods LSAs in the same area. To ensure that
all routers have the same understanding of the network
topology, LSDBs need to be synchronized within an area.
If there is only one OSPF area, the number of OSPF routers
increases with the network scale. This causes the following
problems:
Area 0
▫ The LSDB becomes larger and larger, and the size of the OSPF
routing table increases. A large number of router resources are
consumed, device performance deteriorates, and data forwarding
is affected.
OSPF introduces the concept of area. An
OSPF domain is divided into multiple
areas to support larger-scale networking.
Area 1
The OSPF multi-area design reduces the
flooding scope of LSAs and effectively
Area 0 controls the impact of topology changes
within an area, optimizing the network.
Routes can be summarized at the area
border to reduce the size of the routing
Area 2 table.
Multi-area improves network scalability
and facilitates large-scale network
age 46 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
construction.
Types of OSPF Routers
OSPF routers are classified into
IR
the following types based on
their locations or functions:
Area 1
Internal router
BR
Area border router (ABR)
Backbone router
ABR/BR
AS boundary router (ASBR)
Another
Area 2 AS
ASBR
age 47 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Typical OSPF Single-Area and Multi-
Area Networking
OSPF Area
0
age 48 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Content
s
1. OSPF Overview
2. OSPF Working Mechanism
3. Typical OSPF Configuration
age 49 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Basic OSPF Configuration Commands
(1)
1. (System view) Create and run an OSPF process.
2. (OSPF view) Create an OSPF area and enter the OSPF area view.
age 50 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Basic OSPF Configuration Commands
(2)
4. (Interface view) Set an OSPF interface cost.
The ospf cost command sets a cost for an OSPF interface. By default, OSPF automatically calculates
the cost of an interface based on the interface bandwidth. The cost value is an integer ranging from 1
to 65535.
5. (OSPF view) Set an OSPF bandwidth reference value.
The bandwidth-reference command sets a bandwidth reference value that is used to calculate
interface costs. The value ranges from 1 to 2147483648, in Mbit/s. The default value is 100 Mbit/s.
The ospf dr-priority command sets a priority for an interface that participates in DR election. A
larger value indicates a higher priority. The value ranges from 0 to 255.
age 51 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
OSPF Configuration Example
Description:
• There are three routers, R1, R2, and R3. R1 and R3 are connected to networks 1.1.1.1/32 and
3.3.3.3/32 (simulated by Loopback 0), respectively. OSPF needs to be used to implement
interworking between the two networks. Detailed topology was as follows:
Area Area
0 1
1.1.1.1/3 3.3.3.3/3
2 GE0/0/0 GE0/0/0 GE0/0/1 GE0/0/1 2
R1 10.1.12.1/30 10.1.12.2/30 R2 10.1.23.1/30 10.1.23.2/30R3
• The configuration process consists of three steps: configuring device interfaces, configuring
OSPF, and verifying the result.
age 52 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
OSPF Configuration Example -
Configuring Interfaces
Verify
Configure Configure
the
interfaces. OSPF.
result.
Area Area
0 1
1.1.1.1/3 3.3.3.3/3
2 GE0/0/0 GE0/0/0 GE0/0/1 GE0/0/1 2
R1 10.1.12.1/30 10.1.12.2/30 R2 10.1.23.1/30 10.1.23.2/30R3
• Set IP addresses for R1's, R2's, and R3's interfaces according to the plan.
• Planned OSPF parameters: The OSPF process ID is 1. Router IDs of R1, R2, and R3 are
1.1.1.1, 2.2.2.2, and 3.3.3.3 respectively.
# Configure OSPF on R1.
• Procedure:
[R1] ospf 1 router-id 1.1.1.1
▫ Create and run an OSPF process. [R1-ospf-1] area 0
[R1-ospf-1-area-0.0.0.0] network 1.1.1.1 An inverse mask
▫ Create an OSPF area and enter the
is specified
0.0.0.0 here.
OSPF area view.
[R1-ospf-1-area-0.0.0.0] network 10.1.12.0
▫ Specify the interface that runs OSPF.. 0.0.0.3
age 54 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
OSPF Configuration Example -
Configuring OSPF (2)
Verify
Configure Configure
the
interfaces. OSPF. result.
• When configuring OSPF multi-area, be sure to advertise the route destined for a
network segment that responds to a specified area.
age 55 Copyright0.0.0.3
© 2020 Huawei Technologies Co., Ltd. All rights reserved.
OSPF Configuration Example -
Verification (1)
Verify
Configure Configure
interfaces. OSPF.
the
result.
Area Area
0 1
1.1.1.1/3 3.3.3.3/3
2 2
R1 R2 R3
age 56 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
OSPF Configuration Example -
Verification (2)
• Check the routing table on R1 and ping 3.3.3.3 from 1.1.1.1.
<R1>display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing tables: Public
Destinations : 10 Routes : 10
Route to Destination/Mask Proto Pre Cost Flags NextHop Interface
3.3.3.3/32 1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
learned
using OSPF 3.3.3.3/32 OSPF 10 2 D 10.1.12.2 GigabitEthernet
0/0/0
10.1.12.0/30 Direct 0 0 D 10.1.12.1 GigabitEthernet
Set the
source IP 0/0/0
address to …
1.1.1.1 and
ping 3.3.3.3. <R1>ping -a 1.1.1.1 3.3.3.3
PING 3.3.3.3: 56 data bytes, press CTRL_C to break
Reply from 3.3.3.3: bytes = 56 Sequence = 1 ttl = 254 time = 50 ms
age 57 Copyright © 2020 Huawei
… Technologies Co., Ltd. All rights reserved.
Quiz
1. (Multiple) In the process of establishing OSPF neighbor relationships and adjacencies, which
of the following states are stable? ( )
A. Exstart
B. Two-way
C. Exchange
D. Full
2. (Multiple) In which of the following situation will the establishment of adjacencies between
routers be triggered? ( )
A. Two routers on a point-to-point link
age 59 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Thank You
www.huawei.com
age 60 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.