0% found this document useful (0 votes)
2 views

01 - OSPF Protocol Basics

The document discusses the evolution and requirements of network routing protocols, particularly focusing on RIP and OSPF. It highlights the limitations of RIP, such as slow convergence and reliance on neighbor information, and contrasts these with OSPF's efficient link-state routing and cost calculation methods. OSPF's ability to synchronize link-state databases and utilize accumulated bandwidth for route selection makes it more effective for large and heterogeneous networks.

Uploaded by

Yuri Henry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

01 - OSPF Protocol Basics

The document discusses the evolution and requirements of network routing protocols, particularly focusing on RIP and OSPF. It highlights the limitations of RIP, such as slow convergence and reliance on neighbor information, and contrasts these with OSPF's efficient link-state routing and cost calculation methods. OSPF's ability to synchronize link-state databases and utilize accumulated bandwidth for route selection makes it more effective for large and heterogeneous networks.

Uploaded by

Yuri Henry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

 Networks are expanding:

 Driven by emerging enterprise services and a trend towards concentration of


services, the internetwork scale has enlarged continuously.

 Higher network reliability is required:

 Various applications require higher network reliability. When a network


failure occurs, the network needs to recover within a shorter period.

 Network heterogeneity requires interconnection between multi-vendor devices:

 During routine O&M, devices are continually upgraded or updated. There


may be large differences in performance between devices. Also, link
bandwidths vary to a certain degree.

 An open routing protocol supported by various vendors is required.

 Can RIP meet these requirements? What problems may RIP encounter?
 Hop-by-hop convergence:

 As shown in the preceding figure, when network N1 changes, RTA sends an


Update message to RTB. After RTB receives the Update message, it performs
route calculation and sends a route change notification to RTC. In this
manner, route convergence is performed hop by hop, slowing down network
convergence.

 Routing-by-rumor mechanism:

 RIP route calculation completely depends on the routing information from


neighbors. For example, RTE calculates routes just depending on the routing
information obtained from RTD without any idea of information about the
network between RTA, RTB, and RTC. Namely, when calculating routes, RIP
lacks the complete knowledge of network topology.

 Employing the hop count as a routing metric:

 RIP uses hop count to measure the distance to a destination. Therefore, when
data packets traverse networks from N1 to N2, the links RTA->RTB->RTD-
>RTE are chosen as the optimal route. Obviously, the Ethernet links RTB-
>RTC->RTD have much higher bandwidths than the serial link RTB->RTD.

 Is there any solution to RIP problems?


 In RIP, the network convergence process involves receiving updates, calculating
routes, and sending updates. This process slows down network convergence
because a router sends route change notifications to neighbors only after it
finishes route calculation. To solve this problem, the network convergence process
can be changed to: receiving updates, sending updates, and calculating routes.
That is, upon receiving route updates from a neighbor, a router sends the updates
to other neighbors and then calculates routes again. By this means, the
convergence time of the network is greatly reduced.

 Because a RIP router obtains routing information just from neighbors, it cannot
identify or eliminate non-optimal or incorrect routing information. The best
solution to this problem is that it collects networkwide information and
independently calculates routes on the basis of the information.

 When using hop count to measure the distance to a destination, the propagation
delay is not taken into account. If the accumulated bandwidth is used as the
criterion for route decision, the risk of selecting a suboptimal route can be
eliminated.

 By what means do link-state routing protocols solve all the problems mentioned
above?
 The term link-state refers to the status of interfaces on an OSPF router, which
includes the following information:

 IP address and mask of the interface

 Bandwidth of the interface

 Neighbor that the interface is connected to

 …

 OSPF transmits link state information to its neighbors instead of transmitting its
complete routing table.

 Each router maintains its link state database (LSDB). Neighbors synchronize their
LSDBs and then use the SPF algorithm to calculate the optimal route. This speeds
up the network convergence speed.

 OSPF uses the accumulated bandwidth of the links as the criterion for route
selection. This method is more accurate than using the accumulated hop count.

 OSPF can solve RIP problems in large networks. The following describes how OSPF
works.
 An enterprise network, often in analogy with a road map, usually consists of a
large number of devices, including routers and switches, of different models and
various kinds of links, which results in great computational complexity.

 The process of OSPF route calculation can be summarized in three steps:

 Routers discover neighbors and establish neighbor relationships.

 Each router generates link state information and floods it to all neighbors,
meanwhile collects link state information from its neighbors until the LSDBs
are synchronized among OSPF neighbors.

 On the basis of its LSDB, each router uses the SPF algorithm to calculate a
Shortest Path Tree (SPT) with itself as the root. By building an SPT, each
router calculates the optimal routes to destination. The routes form a routing
table eventually.

 Let's focus on the three steps mentioned to learn the principles and
implementation of OSPF.
 There are several, dozens of, or even hundreds of devices on an enterprise network.
Each of these devices must be uniquely identified by a router ID.

 A router ID is a 32-bit unsigned integer in the format of an IP address. An OSPF


router uses the following criteria to select the router ID:

 It prefers the manually configured router ID. You are advised to manually
configure a router ID for an OSPF router.

 If there is no router ID manually configured, it selects the largest IP address


on any of its loopback interface as its router ID.

 If no loopback interface is present, it uses the largest IP address on any of its


active physical interfaces as its router ID.

 If a router ID is reconfigured on an OSPF router, the OSPF process must be reset to


apply the new router ID.
 Prior to an exchange of link state information, OSPF routers need to exchange
Hello packets to establish a neighbor relationship.

 In OSPF, interconnected routers exchange Hello packets to discover


neighbors and establish neighbor relationships. This is the preparation for
synchronizing reachability information following up.

 When two OSPF routers sharing a common data link successfully negotiate
certain parameters, the neighbor relationship between them is established.

 After a neighbor relationship is established, routers periodically exchange


Hello packets to maintain the neighbor relationship. If a router does not
receive any Hello packet from its neighbor within a specified period, this
router terminates the OSPF neighbor relationship with this neighbor.
 Description of neighbor states:

 Down: This is the initial state of a neighbor relationship. It indicates that there
has been no information received from the neighbor.

 Init: This state occurs when a router has received a Hello packet from its
neighbor but its router ID is not in the neighbor list contained in the received
Hello packet. This means that bidirectional communication with the neighbor
has not yet been established.

 2-Way: In this state, a router finds that its router ID is in the Hello packet
from a neighbor. Bidirectional communication with the neighbor is then
established.

 The process of establishing an OSPF neighbor relationship is as follows:

 RTA has a router ID 1.1.1.1 and RTB has a router ID 2.2.2.2. When the OSPF
process starts on RTA, RTA sends the first Hello packet, in which the neighbor
list is empty. The neighbor state is Down. When RTB receives the Hello packet
from RTA, the neighbor state is set to Init.

 Likewise, almost at the same time, RTB sends a Hello packet with an empty
list of active neighbor. As what RTB does, RTA sets the neighbor state to Init,
as soon as it receives this Hello packet from RTB.
 RTB sends another Hello packet to RTA, saying that the router ID 1.1.1.1 is on its
list of active neighbor. Upon receiving this Hello packet, RTA finds its router ID
included in the neighbor list of the packet, and then sets the neighbor state to 2-
way.

 (Similarly, RTA sends RTB the next Hello packet with RTB’s router ID 2.2.2.2 on
the list of active neighbor. RTB sees itself in the neighbor list of the packet, then
sets the neighbor state to 2-way.

 Because the neighbors were unknown before an OSPF router starts its discovery of
neighbors, the destination IP address of a Hello packet is a multicast address
224.0.0.5 instead of a specific unicast address. How does an OSPF router discover
neighbors on a network that does not support multicast?
 If the network does not have the multicast capability, neighbor relationships must
be manually established.

 When the network scale increases or devices are frequently updated, static
configurations need to be modified on related OSPF routers. However, manually
modifying configurations is of heavy workload and error-prone.

 For an OSPF router, the purpose of establishing neighbor relationships is to


synchronize LSDB by exchanging link-state information with other OSPF routers.
The following describes how OSPF routers synchronize their LSDBs.
 Unlike the route exchange process between RIP routers, OSPF routers exchange
link state information to synchronize their link-state databases and then just
forward the original link state information to other neighbors. Eventually, all OSPF
routers will possess the same set of link state information.

 Link state information includes the link type, interface IP address and subnet mask,
neighbors on the link, and link cost.

 A router just needs to know the destination network ID/subnet mask, next hop,
and cost (interface IP address and subnet mask, neighbors on the link, and link
cost). But why is the link type included in the link state information?
 The development of devices, communication media, and protocols are critical parts
of the evolution of networking technologies. Device performance increasingly
improves, and communication links have developed from serial link, ATM, and FR
into Ethernet, xPON, SDH, MSTP, and OTN. A new generation of technology never
comes into being at the snap of a finger. Instead, it is a progressive process.
Different kinds of physical links have their unique characteristics. Accordingly, a
mature routing protocol must fit the characteristics of a physical link where it is
applied.

 The following presents how OSPF defines network types.


 Four network types are defined in OSPF protocol and are used to describe network
topologies partially.

 A point-to-point network connects a pair of routers together and supports


broadcast and multicast.

 An example of a point-to-point network: a network on which two routers are


connected through a Point-to-Point Protocol (PPP) link.
 A broadcast network allows two or more devices to access the same shared link
and supports broadcast and multicast. It is one of the most common OSPF
network types.

 An example of a broadcast network: a network on which routers are connected


through an Ethernet link.

 There are multiple devices on a broadcast network. As to neighbor relationship


establishment and link information synchronization, OSPF provides corresponding
functions to reduce the impact of multiple devices on the network.

 Point-to-point and broadcast networks are the most common OSPF network types.
Besides, there are two more network types which are rarely found.
 Unlike the broadcast network, a non-broadcast multiple access (NBMA) network
does not support broadcast and multicast by default. On an NBMA network, OSPF
emulates operations over a broadcast network. But the neighbor must be manually
specified.

 An example of NBMA network: a network on which routers are connected through


fully-meshed FR links.

 In recent years, NBMA networks are seldom deployed.


 A point-to-multipoint network, which is a special configuration of non-broadcast
multi-access networks, is treated as a group of point-to-point connections. On a
point-to-multipoint network, OSPF neighbors can be discovered through the
Inverse Address Resolution Protocol (Inverse ARP). A point-to-multipoint network
can be considered as a set of multiple point-to-point networks and supports
broadcast and multicast.

 No network is originally a point-to-multipoint network, no matter what kind of


data link layer protocol is being employed. That is to say, a point-to-multipoint
network must be converted from other type of network. A typical practice is
changing partially-meshed FR or ATM networks to point-to-multipoint networks.

 So here comes the question: how is the cost in OSPF link state information
determined?
 The formula for OSPF cost calculation is: Interface cost = Reference
bandwidth/Interface bandwidth, which defines the interface cost as the reference
bandwidth divided by the interface bandwidth. The default reference bandwidth is
100Mbps. If the result is not an integer, it is truncated to a whole number to be the
cost value. If the result is less than 1, the interface has the cost of 1.

 The cost can be changed in two ways:

 Configure the cost under interface configuration mode. Note that the
configured cost is the final value for this interface , but is valid only on this
interface.

 Change the default reference bandwidth for OSPF. This modification takes
effect only on all OSPF-enabled interfaces of the local router. It is suggested
that all routers in the Autonomous System should be configured with the
same reference bandwidth in order to ensure consistency in route selection.
When changing the default reference bandwidth, you should give overall
consideration on bandwidth distribution on the whole network before you
decide a new value.

 OSPF metric is the cumulative cost, which is a total cost of all outbound interfaces
of the routers the packet passing through from the source to the destination. For
example, if a packet routed by OSPF from RTA destined for RTC’s interface
Loopback 1 attached to subnet 192.168.3.3/24, the cost is equal to the cost of G1
plus the cost of G3.
 OSPF take both hop count and bandwidth into account in cost calculation. Hence,
it is a more reliable routing protocol than RIP.

 How do OSPF routers exchange link state information and synchronize their LSDBs?
 RIP operates on UDP port number 520, while OSPF is defined above IP rather than
TCP or UDP, which means OSPF packets are directly encapsulated in IP packets,
with protocol number 89.

 All OSPF packets have the same format of header:

 Version: The value is set to 2 if OSPF version 2 is in use.

 Type: indicates the type of OSPF packet.

 Packet length: indicates the length of entire OSPF packet, in bytes.

 Router ID: indicates the identity of the router that originates this packet.

 Area ID: indicates the OSPF area into which the packet is being advertised.

 Checksum: is used to verify data integrity of the entire OSPF packet, including
the OSPF packet header.

 Auth Type: indicates the authentication mode being used. The value 0
indicates non-authentication. The value 1 indicates simple password. The
value 2 indicates cryptographic (MD5) authentication.

 Authentication: contains the information necessary for authentication. The


content of this field varies according to the AuType field.

 OSPF packet header defines the communication standards and rules between
OSPF routers. Based on these standards, what functions need to be developed for
OSPF packets?
 Type 1 packets are Hello packets, which are used to establish and maintain
neighbor relationships. As discussed earlier, before establishing an OSPF neighbor
relationship, two routers must negotiate some parameters.

 Type 2 packets are Database Description (DD) packets, which are used to describe
the content of local LSDB to neighbors so that the neighbors can determine
whether their LSDBs are complete.

 Type 3 packets are Link State Request (LSR) packets. A router determines whether
its LSDB is complete compared with the information in DD packets from its
neighbors. If its LSDB is incomplete, it creates a list of LSAs that need to be
obtained from the sender of the DD packets and then sends.

 Type 4 packets are Link State Update (LSU) packets, which are used to respond to
the LSR packets received from neighbors. According to the request list in the
received LSR packet, the router packs the required LSAs into LSU packets and
sends them to the neighbor. LSA flooding is performed by LSU packets, and as a
result, the LSDB synchronization among all routers in the area is implemented.

 Type 5 packets are Link State Acknowledgment (LSAck) packets, which are used to
acknowledge received LSAs in order to ensure LSA synchronization reliability.

 DD, LSR, LSU, and LSAck packets contain LSA information in varying degrees:

 A DD packet contains LSA header information, including LS Type, LS ID,


Advertising Router, LS Sequence Number, and LS Checksum.
 An LSR packet contains LS Type, LS ID, and Advertising Router.

 Each LSU packet carries a collection of LSAs.

 An LSAck packet contains LSA header information, including LS Type, LS ID,


Advertising Router, LS Sequence Number, and LS Checksum.

 All these five types of OSPF packets ensure an efficient LSA synchronization
process. So how are these packets utilized to fulfill the task?
 In previous parts of this series, the Hello mechanism used to dynamically discover
neighbors and maintain OSPF neighbor relationships has been explained and need
not be repeated here.

 Compared with the Request and Response messages used for synchronization of
routing information bases (RIBs) in RIP, LSAs are employed to synchronize LSDBs
in OSPF. One possible way for an OSPF router is to send all its LSAs to neighbors;
however, this method is not a perfect one.

 A faster and more efficient method should be like this: summary information
rather than all link-state information is sent to neighbors. On receiving it, the
neighbors examine which LSAs are new or more up-to-date to themselves, and
then request detailed LSAs from the sender. For OSPF protocol, there is necessity
to employ a more efficient and reliable method than RIP’s to synchronize link-
state database between routers.
 State description:

 ExStart: This state occurs when two neighboring routers establish a


master/slave relationship and determine the initial DD sequence number. In
this state, the exchanged DD packets don’t include any LSAs.

 Exchange: This state occurs when a router exchanges DD packets containing


link state summary information with its neighbor.

 Loading: This state occurs when two routers send LSR, LSU, and LSAck
packets to each other. This state occurs when a router finds entries in its Link
State Request list. In this state, the router sends LSR packets to its neighbor,
receives LSU packets from it and answers LSAck packets as acknowledgement.

 Full: This state occurs when the neighboring router’s LSDB is synchronized.
In this state, the neighboring routers are fully adjacent.

 LSDB synchronization process:

 RTA and RTB have router IDs 1.1.1.1 and 2.2.2.2 respectively, and a neighbor
relationship has been established between them. When the neighbor RTB’s
state becomes ExStart, RTA sends its first DD packet to RTB. The DD packet
sequence number is randomly set to X, the I-bit is set to 1, indicating that
this is its first DD packet; the M-bit is set to 1, indicating that subsequent DD
packets need to be sent, and the MS-bit is set to 1, indicating that RTA
asserts itself as the master.
 Similarly, when the neighbor RTA’s state becomes ExStart, RTB sends its first DD
packet, with a DD sequence number of y and three flags I-bit, M-bit and MS-bit set
to 1, 1 and 1 respectively, as the same meaning as RTA’s. Because RTB has a
larger router ID, RTB will become the master. Upon receipt of the DD packet from
RTB, RTA generates a Negotiation-Done event agreeing that RTB is the master,
and transitions neighbor RTB’s state from ExStart to Exchange.

 Then RTA sends a new DD packet containing summary information of its LSDB. In
this packet, the DD packet sequence number is overrode by RTB with Y in step 2,
the I-bit is set to 0, indicating that this packet is not its first DD packet, the M-bit is
set to 0, indicating that this packet is the last DD packet containing LSDB summary
information, and the MS-bit is set to 0, indicating that RTA asserts itself as the
slave. When receiving this DD packet, RTB generates a Negotiation-Done event
and transitions its neighbor RTA’s state from ExStart to Exchange.

 Then RTB sends a new DD packet, which contains LSDB summary information
together with sequence number Y+1 and the M-bit set to 1, indicating that RTB
asserts itself as the master. Suppose all its LSDB summary information is included
in this DD packet, the M-bit is now set to 0, telling RTA, "this is the last DD packet
for you".

 Although there is no need for RTA to sends its LSDB summary information to RTB,
as a slave, it still needs to acknowledge each DD packet from the master. Therefore,
RTA responds to RTB’s DD packet with an empty DD packet containing the
sequence number Y+1. Then RTA generates an Exchange-Done event and
transitions neighbor RTB’s state to Loading. When RTB receives this DD packet, it
transitions its neighbor state to Full. (Assume that RTB has the latest and complete
LSDB and does not need to request updates from RTA.)
 RTA sends an LSR packet to RTB to request more recent LSAs that have been
discovered in the Exchange state but have not yet been received.

 RTB then provides RTA with the requested LSAs in an LSU packet. On
receiving this LSU packet, RTA transitions neighbor RTB’s state from
Loading to Full.

 Then RTA returns an LSAck packet to RTB as an acknowledgement for the


received LSU packet. When RTB receives the LSAck packet, a full adjacency is
established between the two routers.

 The process from establishing neighbor relationship to synchronizing LSDB is


complex. Any incorrect configuration or link failures will lead to an unsuccessful
LSDB synchronization. Understanding the trigger for state transitions is the key to
rapid troubleshooting.
 The series of transitions in the OSPF neighbor state machine is illustrated by the
diagram above. The transition process is described as follows:

 Down: This is the initial state of a neighbor conversation. It indicates that the
router has not received any Hello packet from its neighbor in the last
RouterDeadInterval. On an NBMA network, a router can still send Hello
packets at every PollInterval to its manually configured neighbor which is in
Down state. The PollInterval is often as large as the RouterDeadInterval.

 Attempt: This state only appears on NBMA networks. It indicates that the
router has not received any recent information from its manually configured
neighbor, but that it has been sending Hello packets to the neighbor at every
HelloInterval. If the router does not receive any Hello packet from its
neighbor within a RouterDeadInterval, the neighbor state transitions to Down.

 Init: This state occurs when the router receives a Hello packet from a
neighbor but does not see its own Router ID in neighbor list of this Hello
packet, which means they have not established a two-way communication
with each other. In this state, the router IDs of all its known neighbors must
be included in the neighbor list of the Hello packet sent by the router.
 2-way Received: This event occurs when the router sees its own Router ID in
neighbor list of the Hello packet received from the neighbor, or receives a DD
packet from the neighbor. If the router needs to establish an adjacency with a
neighbor, the neighbor state transitions to ExStart and LSDB synchronization
begins. Otherwise, the neighbor state transitions to 2-Way.

 2-Way: This state occurs when the router establishes a bidirectional


communication, but does not yet form an adjacency, with its neighbor. This is the
final state to which the neighbor transition, if there is so far no need for
establishing adjacency with this neighbor.

 1-Way Received: This event occurs when the router finds that its router ID is not
contained in the neighbor list of the received Hello packet. This is often due to a
restart of the neighboring router.

 ExStart: This state occurs when the router starts to send DD packets to its neighbor.
In this state, the master-slave relationship is established and the initial DD
sequence number is determined. Note that the DD packets do not include any LSA
summary information in this state. This is the first step towards forming an
adjacency.

 Exchange: This state occurs when the router exchanges with its neighbor DD
packets containing LSA summary information to describe its entire LSDB.

 Loading: This state occurs when the router sends LSR packets to its neighbor
requesting the more recent LSAs that have been discovered in the received DD
packets in the Exchange state. Subsequently, the router receives responding LSU
packets from the neighbor.

 Full: This state occurs when its link state request list is empty, which means the
local LSDB is synchronized with its neighbor’s. It indicates that the neighbor is
fully adjacent.
 A Link State Advertisement (LSA) is the carrier of OSPF link state information
between routers. The LSA is the basic structural unit of LSDB. In other words, an
LSDB is composed of an array of LSAs.

 All LSAs have the same format of header, including the following fields:

 LS age: indicates the age of the LSA, in seconds.

 LS type: indicates the LSA format and function. There are five types of
commonly used LSAs.

 Link State ID: identifies the link described by an LSA, for example, router ID.

 Advertising Router: indicates the router ID of the router that originates this
LSA.

 LS sequence number: is used to detect old and duplicate LSAs.

 LS type, Link State ID, and Advertising Router together identify an LSA.

 Aside from locally originated LSAs, there are LSAs obtained from other neighbors
in LSDB. It’s necessary for LSAs to be advertised between neighboring routers
through a passageway.
 OSPF-running MA networks include broadcast and NBMA networks, which are
facing the following problems:

 In a network with N routers, the number of adjacencies can be up to


nx(n−1)/2.

 The same copies of LSAs will be flooded repeatedly among neighbors. For
example, RTA sends its LSAs with the same content to neighbors RTB, RTC
and RTD separately. And what’s more, RTB forwarded these LSAs to
neighbors RTD and RTC, and even RTA where the LSAs are from. This process
is called flooding.

 Evidently, such a process is inefficient and resource-hungry. As an advanced


routing protocol, how does OSPF solve the two problems?
 Designated router (DR) is responsible for establishing and maintaining adjacencies
and flooding LSAs over an MA network.

 The DR establishes adjacencies and exchanges link state information with all the
other routers, while other routes do not directly exchange link state information
with each other. This greatly reduces the number of adjacencies in an MA network,
and as a result, saves resources used to exchange link state information.

 Once the DR becomes invalid, its adjacencies with other routers all become invalid,
and LSDB synchronization fails. A new DR needs to be elected to establish new
adjacencies with non-DR routers for LSDB synchronization. To prevent the single
point of failure, OSPF puts forward the concept of Backup Designated Router
(BDR), which is a backup for DR and elected at the same time as when DR is
elected. When the current DR becomes invalid, the BDR instantly takes over the
role of DR.

 A pseudo node is a virtual device node. The following describes DR and BDR
election.
 The concepts neighbor relationship and adjacency are different from each other.
After two OSPF routers establish a neighbor relationship, they synchronize their
LSDBs and eventually establish an adjacency.

 On point-to-point and point-to-multipoint networks, routers that have established


a neighbor relationship proceed to establish an adjacency.

 On broadcast and NBMA networks, non-DR/BDR routers (DRothers) establish only


neighbor relationships rather than adjacencies with each other; non-DR/BDR
routers (DRothers) establish adjacencies with the DR/BDR; the DR and BDR
establish an adjacency with each other.

 When an adjacency is established, LSDB synchronization is complete. Then OSPF


routers start to use the SPF algorithm to calculate the shortest paths to all known
destinations on the basis of the information in their LSDBs.
 Answer: ABC.

 Answer: point-to-point network, point-to-multipoint network, broadcast network,


NBMA network.

You might also like