📜 ⬆️ ⬇️

OSPF LSA in pictures

The theme of the dynamic routing protocol OSPF more than once rose on the habr . However, the question of what LSA is and what they are like, it seems to me, is not transparent enough. And I would like to talk about it without reference to a specific manufacturer and console commands.

Let me briefly remind you that when using OSPF, routers exchange information about network topology. Then, based on this information, the routing table is calculated using the Dijkstra algorithm . So LSA 1 and there are pieces of the information from which the router adds the network diagram. Traditionally, when describing them, you can see the message format tables, but I propose to consider the LSA as puzzle pieces, from which the router collects the full graph of the network 2 .

So:
')
LSA type 1 - “pieces with routers”

Each router provides its own unique “router-id”, and a detailed list of interfaces.
for each interface is indicated:
IP address (if there is 3 )
interface type
The “router-id” with which the adjacency state is set on this interface.
image
If the adjacency (adjacencies) is not set on the interface, then the network mask for the IP address is recorded in the “router-id” field and this side of the piece can be considered “flat” (there are no longer routers).

If the link type is point-to-point or virtual connection, then now you need to find another piece, with the known “router-id” in the middle and combine the corresponding connections.
image
If the interface type is Broadcast or NBMA (multi-access network), then there may be many different routers at the other end, and here we will need

LSA type 2 - “pieces with nets”

In networks with multiple access (and normal ethernet is just such, routers choose from their number a “manager” (DR), with which they establish an adjacency relationship 4. So each such “manager” sends messages that can be drawn :
image
in the middle is the IP address of the DR on this network with a mask, and a full list of connected routers. Fill in the blanks:
image
That's all, now repeating the steps from Figures 2 and 4, the router collects from the pieces the complete network topology and can run the SPF algorithm. After completing the calculations, he knows the best paths to all routers and networks.
We have already folded the puzzle with the Area topology. But since An IP network is not always limited to one Area and the OSPF protocol, the LSAs are not over yet.

LSA type 3 - “routes to another area" 5

This component will be drawn as a green box attached to the router, with information about the network from another Area and the cost of the connection. The router to which we connect them is called ABR. Interfaces to which we catch the “frame” are not specified, because they belong to another area.

LSA type 5 - “routes of other routing domains”

similarly to the previous one, you can think of it as an orange box attached to the router, with information about which networks it can send packets regardless of the OSPF protocol. The router that sends such LSA is called ASBR.
image
LSA type 4 - long tail.

What to do if the router to which you want to attach the network from the previous point is in another Area? Especially for this, devices located on the border of 2x Area transmit not only “LSA type 3” but also “LSA type 4” in which they anonymize, about all known routes to ASBR from other Area, and their cost. Let's draw this ASBR in green. A particularly interesting case considered in this article can be depicted as an orange square attached to green.

It turns out that in the last figure:
blue routers with interfaces is LSA type 1
prefix cloud - LSA type 2
green squares - LSA type 3
orange squares are LSA type 5
green router - LSA type 4
green and orange connecting lines carry information about the cost of the corresponding connection.
yyyy and zzzz routers - ABR (they include green lines)
kkkk and wwww - ASBR routers (they include orange lines)

LSA type 6 - in fact, nowhere and not used by anyone, and the main vendors are not implemented. Therefore, skipping.

LSA type 7 is actually a complete analogue of LSA type 5 for NSSA Area types. When crossing the boundary of the Area, they turn into them.

The rest of the LSA with IP routes in general is not connected, so I will not consider them.

Small result:

The SFP process that calculates the cost of the routes with the Dijkstra algorithm starts only with changes in LSA 1 or 2 (always with any changes).
The cost to routes announced in other LSAs is obtained by simply adding the cost to the ABR / ASBR and the green and / or orange “link” metrics.
The router can be ABR and ASBR at the same time.

When the “puzzle” does not add up?


Quite often, there is a situation when, of all the pieces that exist, a holistic picture cannot be folded. This is due to the fact that in Link State protocols there is no way to instantly drop the “disappeared” LSA.
Consider the last drawing.
For example, on the yyyy router, the interface dropped towards bbbd (gray cloud). Then yyyy generates a new type 1 LSA (with the same ID, but with a higher sequence number), where there is no longer a disconnected interface. zzzz installs a new LSA in LSDB, recalculates the routing table ... But still keeps in memory all LSAs received from gggg, mmmm and kkkk, the connection with which has already been lost. those. extra pieces left. Similarly, if suddenly the router-router “router-id” changes, all others for a while store 2 copies of the LSA: with the old and with the new ID.
Each router has a “router-id” and it must be unique. What happens if there are duplicates - depends on the vendor and settings, but one thing is for sure - there will be problems. As the simplest example: 2 routers broadcast mutually exclusive LSAs; the rest will install LSA with a large sequence number, and networks connected to another device will be lost and inaccessible. This can be compared to the loss of a puzzle piece.
Similarly, there should not be a DR with the same IP address.

I dare to hope that the community will find this style of presentation interesting.

  1. ↑ - Link State Advertisement. LSA are elements of the adjacency list for the network graph; this list itself is called LSDB (Link State Database)
  2. ↑ - in fact, only those areas to which
  3. - if the interface is “Unnambered” or “Virtual Link” then its number is transmitted.
  4. ↑ - it looks as though all routers of the segment are directly connected to DR, and the cost of DR links is zero.
  5. ↑ -Area = Area is a piece of our OSPF routing domain, in each such piece the topology is calculated independently.

Source: https://habr.com/ru/post/201794/


All Articles