Table of contents

Terminology

OSPF protocol

OSPF (Open Shortest Path First) - a dynamic routing protocol based on an algorithm that constructs a shortest path tree. The OSPF protocol has the following features:

OSPF area

The number of autonomous system routers that use OSPF to exchange routing information can be large. This leads to a high load of the communication channels because of the large number of OSPF service messages. To reduce the amount of transmitted service information, the OSPF protocol divides the autonomous system into areas.

Each area has a 32-bit identifier, which is usually written in two formats:

It is not necessary to use sequential identifiers for areas. For example, the network can include areas with identifiers 0, 2 and 7 (Figure 1a).

An interface belongs to an area, not the device itself. Thus, one router can be connected to multiple areas through its interfaces (Figure 1a).

The area with the identifier 0.0.0.0 has a special role - this area is called the backbone area. The backbone area is a requirement for the OSPF operation. Each area must be directly connected to the backbone area, i.e. a scheme in which some area is connected to another one without having a direct connection to the backbone is prohibited (Figure 1b).

Figure 1a - Permitted network scheme with multiple OSPF areas

Figure 1b - Prohibited network scheme with multiple OSPF areas

Routers types

Depending on the router's place in the network, the following types of devices are distinguished (Figure 2):

Figure 2 - Network scheme with different router types

OSPF's operation

The OSPF's operation follows the below steps. Some steps will require a detailed explanation which is provided in the sections below.

OSPF protocol launching

Two processes are performed when the OSPF service is launching: the selection of a router identifier  and the definition of a list of interfaces that will participate in OSPF.

The router has a 32-bit identifier, which is usually written in the IP address format. Usually, the identifier is not connected with the device's IP address and can be set manually. If the identifier is not set manually, it will be automatically selected as the highest IP address of the device. In case of manual ID selection, it is recommended to set it in the IP address of the loopback0 interface. This will help to identify the devices easier and to speed up the diagnostic of the network problems.

During the automatic router ID selection, the Infinet device generates a special address from the 224. *. *. * multicast subnet, associated with the router's serial number. This helps to avoid the redefinition of the ID when the IP address or the network interface are removed.

The set of interfaces that will take part into the OSPF's protocol operation is determined according to the following rules:

If OSPF has not been started on a network interface, this does not mean that the network associated with this interface will not be advertised to the other routers. Launching OSPF on an interface only impacts the discovery of the neighbors.

Let's take a look at some examples of how to start the OSPF service on router R1 (Figure 3). The table below contains the configuration commands and their correspondence with the router's interfaces; if a match is found, a neighbor discovery process will be performed on the interface.

CommandCorrespondence to eth1Correspondence to eth2Description
network 0.0.0.0/0 area 0yesyes

The 0.0.0.0/0 network includes all IP addresses, so the networks associated with eth1 and eth2 are in this range.

Such a configuration has a hidden behavior: if a new IP address appears in the device's configuration, then OSPF will be launched on the interface associated with it. This is because the 0.0.0.0/0 network includes all the networks.

network 10.10.30.0/24 area 0

network 192.168.6.0/28 area 1

yesyesThe command contain the networks associated with the eth1 and eth2 interfaces, so OSPF will use both interfaces.

network 10.10.30.0/25 area 0

network 192.168.6.0/28 area 1

noyes

Although the IP address of the eth1 interface of R1 belongs to the 10.10.30.0/25 network, OSPF will not be launched on this interface. This is because the network associated with interface eth1 contains addresses in the range 10.10.30.0-255, which is not fully included in the 10.10.30.0/25 (10.10.30.0-127) network range.

OSPF will be launched only on eth2.


Figure 3 - Router with two network interfaces

Passive interfaces

After the router has determined the list of interfaces where OSPF is running, it starts looking for neighbors connected to these interfaces. Besides that, all the networks assigned to these interfaces will be advertised to the other routers. This behavior can be exploited by an attacker: the router will establish neighboring relations with the attacker's device and will transmit all the routing information about the network.

This type of attack can be prevented by using passive interfaces. Any interface participating in OSPF can be configured as passive. In this case, the search for neighbors via such an interface will not be performed, however, the network assigned to this interface will be advertised to the other routers.

External routes

The list of networks that are assigned to the interfaces is defined when OSPF starts. in addition, OSPF can advertise routes to other networks, that were added to the device's routing table. The announcement of such routes is called redistribution. These routes are external to OSPF.

The routing sources for redistribution can be other dynamic routing protocols, static entries or directly attached networks not added to OSPF.

Setting up neighboring relations

The routing information exchange is possible only after the establishment of the neighboring relations between the routers. Two routers having a common link will establish a neighborhood relationship if the following parameters match:

Neighboring relations are established in several steps. Let's look at an example (Figure 4a): the network consists of three routers R1, R2 and R3 connected to the switch. Neighboring relations are established between the routers ( the R2 router is selected as the designated router (DR), R3 as the backup designated router (BDR) ). Router R4 will be added to the network scheme and let's assume that the conditions for establishing neighboring relations are met.

Figure 4a - The R4 router was added to the network scheme

Figure 4b - R4 sends Hello messages

Figure 4c - R1, R2, R3 send Hello messages

Figure 4d - 2-Way relationships were established

Figure 4e - Full relations were established by R4 with the DR and the BDR

Role distribution

In each broadcast segment where OSPF is running, DR and BDR elections are performed. The elections are carried out according to the following rules:

The group address 224.0.0.6 is associated with the DR and the BDR devices, which is used for LSDB synchronization. The devices having DR and BDR roles establish a Full relationship with each router in the broadcast segment and require higher device performance demands compared to the DROthers. Since the device's hardware performance can become a bottleneck, it should be taken into account during network planning. Interface prioritization should be set to ensure a predictable selection of the highest performing devices as DR and BDR.

The main function of the DR is the routing information exchange in the broadcast segment. The main function of the BDR is to monitor the DR's state and, if it fails, to change the role to DR. Since each DROther establishes a Full relationship with both the DR and the BDR, the LSDB on the BDR is synchronous with the DR, so the BDR can start performing the DR's functions without timing database synchronization delays. If the BDR becomes DR, then the BDR is selected among the DROthers according to the algorithm described above.

LSDB synchronization

The routing information in OSPF is categorized in different types of LSAs. The LSDB is a set of LSAs. The LSA is not an OSPF service message, therefore, the DBD, LSR, LSU and LSAck messages are used to transmit it according to steps 6-8 used in the neighboring relations establishment algorithm.

 OSPF version 2 which is supported by the WANFleX OS defines 7 LSA types as described in the table below. To explain the purpose of different LSA types, the network scheme in Figure 5a will be used: the network consists of 6 routers and three OSPF areas are defined. This scheme describes the LSA types generated by the devices regardless of the neighboring relations establishment stages.

TypeNameDescriptionExample
1

Router LSA

This type of LSA is distributed by all the routers within the same area.

The LSA contains the following routing information:

  • a description of all the routes to the networks included in this area;
  • the costs of the routes;
  • a list of routers inside the routing area, specifying the established neighboring relations.

This type of LSA is distributed by all the routers in the network (Figure 5b).

This LSA type has the following features:

  • R3 will include only the 10.10.234.0/29 network information in the LSA type 1 broadcasted in area 0, and the 192.168.36.0/24 network information in LSA broadcasted in area 36. This behavior is explained by the fact that LSA type 1 is designed to exchange information within an area;
  • Router R5 does not generate an LSA type 1 with information about the external network 172.16.0.0/16;
  • The type 1 LSA generated by R4 will be received by R2 and forwarded to R1 with an increased metric value. Thus, LSA type 1 is propagated over the entire area with metric increments, the rest of the parameters remaining unchanged.
2

Network LSA

This type of LSA is distributed by the DR within the same area.

The LSA contains the following routing information:

  • the broadcast's segment network address;
  • the broadcast's segment network mask;
  • a list of routers with the established neighboring relations.

This type of LSA is generated only by routers having a DR role - R1, R2, R3 and R4 (Figure 5c).

Similar to LSA type 1, LSA type 2 is distributed across the entire area with metric value increments.

3

Summary Network LSA

This type of LSA is distributed by the ABR and contains a summary of the routes in one area, that it is intended to be sent through the interfaces included in different area. LSA types 1 and 2 allow the router to build a topology of the area and calculate the data transmission paths. Type 3 LSAs are not sources of topology data, they only contain routing information about the neighboring areas. Thus, at the area borders, OSPF behaves as a distance vector protocol.

The ABR generates one LSA type 3 for each network. The number of LSA type 3 messaged can be reduced by using route summarization.

This type of LSA is generated by ABR routers - R3 and R4 (Figure 5d).

The R3 router generates the following LSA type 3 messages:

  • route to the 192.168.36.0/24 network of area 36 that will be sent to area 0 through the eth0 interface.
  • route to the 10.10.234.0/29 network of area 0 that will be sent to area 36 through the eth1 interface.
  • route to the 10.10.21.0/30 network of area 0 that will be sent to area 36 through the eth1 interface. This network information is taken from LSA types 1 and 2 received from R1;
  • route to the 192.168.45.0/24 network of area 45 that will be sent to area 36 through the eth1 interface. The route to this network is taken from the LSA type 3 received from router R4. When advertising this network, router R3 sets itself as the route source in the LSA. Source substitution is necessary, since the routers in area 36 are unaware of the R4's location.

Router R4 generates LSA type 3 in the same way as R3.

4

ASBR Summary LSA

LSA of this type an ABR generates in addition to LSA type 5.

LSA of this type contain information about the ASBR location for the neighboring to ASBR area.

See example for LSA type 5.
5

External LSA

LSA of this type are generated by ASBR for external routes, including default routes. Such messages are distributed throughout the AS unchanged.

Similar to ABR, ASBR can summarize external routes, i.e. replace several routes with one. This reduce the routing table and the service information amount during the further routes distribution.

LSA type 5 is generated by R5 as the only ASBR in the network scheme (Figure 5e).

The type 5 LSA generated by R5 contains information about the 172.16.0.0/16 network and is distributed through the entire autonomous system unchanged. Thus, each router in the scheme has information that the 172.16.0.0/16 network is an external and is available via the R5 router.

The hidden problem is that R1, R2, R3, and R6 do not know the R5 location. LSA type 1 where the the R5 ID specified is only propagated within area 45.

To solve this problem, border routers R4 and R3 generate LSA type 4 in addition to the transmitted LSA type 5. In LSA type 4, routers advertise that all traffic directed to R5 can be sent to ABR.

6

Group Membership LSA

LSAs of this type are used in Multicast networks and contain a list of groups whose consumers are in the network segment. LSA of this type will not be described in this article.

-
7

Type 7 LSA

LSA of this type are similar to LSA type 5 and are used in NSSA areas. The use of LSA type 7 is necessary for compatibility between Stub areas and NSSA. LSA type 7 is converted to LSA type 5 by ABR during export from NSSA area.An example of LSA type 7 generation is presented in the NSSA areas description.





Figure 5a - Network scheme for LSA types analyzing

Figure 5b - LSA type 1 distribution

Figure 5c - LSA type 2 distribution

Figure 5d - LSA type 3 distribution

Figure 5e - LSA type 4 and 5 distribution

Building the shortest paths tree

After LSDB synchronization, each router performs a shortest paths tree calculation using Dijkstra's algorithm.

In networks with channel redundancy, LSDB contains announcements about the same network received from different sources. Such routes are transmitted to the RIB in the following order:

Areas types

The way to reduce the OSPF service traffic volume is to use different types of areas. The protocol provides for the following types of areas:

Let's look the main features of different areas types at the example via the following scheme (Figure 6): routers R1, R2, R3 and R4 are connected in sequence with each other, forming three OSPF areas. Routers R3 and R4 have external links. In each example, we will change the type of area 4 and analyze the LSA types associated with that area. In these examples, the details of LSA not connected with area 4 and LSA of types 1 and 2 will be omitted because they are distributed within areas of any type.

Figure 6 - Network scheme for area types description

Normal

Normal areas do not change the LSA propagation and processing logic described above (Figure 7a). This area type is used by default. The backbone area is a special case of the Normal area.

Figure 7a - LSA distribution in the Normal area

Stub

The Stub area is characterized by the following features (Figure 7b):

Stub areas are used in LAN segments that have no connection to external links, but routers in this area must receive routing information from neighboring areas in full. The Stub areas using allows to obtain a small performance increasment by reducing the LSA number and to protect the network from attacks that involve connecting the router to the external network segment.

Figure 7b - LSA distribution in the Stub area

Totally Stub

The Totally Stub area behaves similarly to the Stub area with one exception: LSA of types 3 and 5 from neighboring areas are replaced with one LSA type 3 with a default route (Figure 7c).

Totally Stub areas applications are similar to Stub, but the area routers will not have all the routing information about neighboring areas. This will give significant performance increase as Totally Stub area routers will use a single default route to transmit data to neighboring areas.

Figure 7c - LSA distribution in the Totally Stub area

NSSA

The NSSA has the characteristics of the Stub area with one exception: the NSSA can have an external link (Figure 7d). Since LSA type 5 which are used to distribute routing information about external links, are prohibited in Stub areas, NSSA use LSA type 7 for this purpose. This LSA type has the same structure as LSA type 5, but is permitted for distribution in NSSA areas. At the area border the ABR converts LSA type 7 to LSA type 5, setting itself as the source. Since ABR performing the LSA conversion become the source, there is no need to create an additional type 4 LSA.

Usually, the NSSA area using is a result of the network development: connecting an external communication channel to the Stub area requires changing its type to NSSA.

Figure 7d - LSA distribution in the NSSA

Totally NSSA

Totally NSSA behave similarly to NSSA with the exception: only one type 3 LSA with a default route is exported to the Totally NSSA (Figure 7e).

Totally NSSA areas is a result of the network development: connecting an external link to a Totally Stub area requires changing the area type to Totally NSSA.

Figure 7e - LSA distribution in the Totally NSSA

Virtual link

One of the OSPF principles is possibility to connect two non-backbone areas only through the backbone area. Despite that, as a result of the historical development, the structure of some networks does not match to this principle. Bringing such networks up to OSPF requirements can be costly, so OSPF has been extended with the virtual link concept.

The virtual link has the following features (Figure 8):

Figure 8 - Network scheme with a virtual link

OSPF protocol features

OSPF protocol features can be represented in following way:

The examples of OSPF configuration are on the document child page: OSPF protocol configuration.

Additional materials

Webinars

  1. Typical scenario of routing setting using Infinet Wireless devices. Part II

Other

  1. Ifconfig command (interfaces configuration)
  2. ARDA (Aqua Router Daemon)
  3. OSPF command
  4. arip command
  5. rip command
  6. RFC 2328