注:机翻,未校对。
正本:RFC 2328 OSPF Version 2 中相关解释
April 1998
12.1.6. LS sequence number
12.1.6. 序列号
The sequence number field is a signed 32-bit integer. It is used to detect old and duplicate LSAs. The space of sequence numbers is linearly ordered. The larger the sequence number (when compared as signed 32-bit integers) the more recent the LSA. To describe to sequence number space more precisely, let N refer in the discussion below to the constant 2**31.
序列号字段是有符号 32 位整数。它用于检测旧的和重复的 LSA。序列号的空间是线性有序的。序列号越大(与有符号 32 位整数相比),LSA 越近。为了更精确地描述序列号空间,让 N 在下面的讨论中参考常数 2 31 2^{31} 231。
The sequence number -N (0x80000000) is reserved (and unused). This leaves -N + 1 (0x80000001) as the smallest (and therefore oldest) sequence number; this sequence number is referred to as the constant InitialSequenceNumber. A router uses InitialSequenceNumber the first time it originates any LSA. Afterwards, the LSA’s sequence number is incremented each time the router originates a new instance of the LSA. When an attempt is made to increment the sequence number past the maximum value of N - 1 (0x7fffffff; also referred to as MaxSequenceNumber), the current instance of the LSA must first be flushed from the routing domain. This is done by prematurely aging the LSA (see Section 14.1) and reflooding it. As soon as this flood has been acknowledged by all adjacent neighbors, a new instance can be originated with sequence number of InitialSequenceNumber.
序列号 - N(0x8000000)为保留(未使用)。这使得 − N + 1 - N + 1 −N+1(0x8000001)成为最小的(因此也是最早的)序列号;此序列号称为常量 InitialSequenceNumber。路由器在第一次发起任何 LSA 时使用 InitialSequenceNumber。之后,每次路由器启动 LSA 的新实例时,LSA 的序列号都会增加。当试图将序列号增加到超过最大值 N − 1 N -1 N−1(0x7fffffff;也称为 MaxSequenceNumber)时,必须首先从路由域刷新 LSA 的当前实例。这是通过提前老化 LSA(见第 14.1 节)并对其进行再泛洪来实现的。一旦所有相邻邻居都确认了该泛洪,就可以使用 InitialSequenceNumber 的序列号创建一个新实例。
The router may be forced to promote the sequence number of one of its LSAs when a more recent instance of the LSA is unexpectedly received during the flooding process. This should be a rare event. This may indicate that an out-of-date LSA, originated by the router itself before its last restart/reload, still exists in the Autonomous System. For more information see Section 13.4.
路由器可能会被迫提升其某个 LSA 的序列号,当在泛洪过程中意外接收到 LSA 的较新实例时。这应该是一个罕见的事件。这可能表明,在路由器最后一次重启 / 重新加载之前,由该路由器自己发起的过时 LSA 仍然存在于自治系统中。有关更多信息,请参见第 13.4 节。
InitialSequenceNumber The value used for LS Sequence Number when originating the first instance of any LSA. Its value is the signed 32-bit integer 0x80000001.
InitialSequenceNumber 在初始化任何 LSA 的第一个实例时用于 LS 序列号的值。其值为有符号 32 位整数 0x8000001。
13.4. Receiving self-originated LSAs
13.4. 接收自创 LSA
It is a common occurrence for a router to receive self-originated LSAs via the flooding procedure. A self-originated LSA is detected when either 1) the LSA’s Advertising Router is equal to the router’s own Router ID or 2) the LSA is a network-LSA and its Link State ID is equal to one of the router’s own IP interface addresses.
路由器通常通过泛洪过程接收自创 LSA。当 1)LSA 的广告路由器等于路由器自己的路由器 ID 或 2)LSA 是网络 LSA 且其链路状态 ID 等于路由器自己的 IP 接口地址之一时,检测到自创 LSA。
However, if the received self-originated LSA is newer than the last instance that the router actually originated, the router must take special action. The reception of such an LSA indicates that there are LSAs in the routing domain that were originated by the router before the last time it was restarted. In most cases, the router must then advance the LSA’s LS sequence number one past the received LS sequence number, and originate a new instance of the LSA.
但是,如果收到的自发端 LSA 比路由器实际发端的最后一个实例要新,路由器必须采取特殊措施。接收到这样的 LSA 表示路由域中存在在路由器上次重新启动之前由路由器发起的 LSA。在大多数情况下,路由器必须将 LSA 的 LS 序列号提前 1,超过接收到的 LS 序列号,并发起 LSA 的新实例。
It may be the case the router no longer wishes to originate the received LSA. Possible examples include: 1) the LSA is a summary-LSA or AS-external-LSA and the router no longer has an (advertisable) route to the destination, 2) the LSA is a network-LSA but the router is no longer Designated Router for the network or 3) the LSA is a network-LSA whose Link State ID is one of the router’s own IP interface addresses but whose Advertising Router is not equal to the router’s own Router ID (this latter case should be rare, and it indicates that the router’s Router ID has changed since originating the LSA). In all these cases, instead of updating the LSA, the LSA should be flushed from the routing domain by incrementing the received LSA’s LS age to MaxAge and reflooding (see Section 14.1).
路由器可能不再希望发起接收到的 LSA。可能的示例包括:1)LSA 是摘要 LSA 或作为外部 LSA,并且路由器不再具有到目的地的(可通告的)路由,2)LSA 是网络 LSA,但路由器不再是网络的指定路由器;或 3)LSA 是网络 LSA,其链路状态 ID 是路由器自己的 IP 接口地址之一,但其广告路由器不等于路由器自己的路由器 ID(后一种情况应该是罕见的,它表明路由器的路由器 ID 在发起 LSA 后发生了变化)。在所有这些情况下,不更新 LSA,而应该通过将接收到的 LSA 的 LS age 增加到 MaxAge 并重新加载来从路由域刷新 LSA(见第 14.1 节)。
14.1. Premature aging of LSAs
14.1. LSA 的过早老化
An LSA can be flushed from the routing domain by setting its LS age to MaxAge, while leaving its LS sequence number alone, and then reflooding the LSA. This procedure follows the same course as flushing an LSA whose LS age has naturally reached the value MaxAge (see Section 14). In particular, the MaxAge LSA is removed from the router’s link state database as soon as a) it is no longer contained on any neighbor Link state retransmission lists and b) none of the router’s neighbors are in states Exchange or Loading. We call the setting of an LSA’s LS age to MaxAge “premature aging”.
通过将 LSA 的 LS age 设置为 MaxAge,而不使用其 LS 序列号,然后重新加载 LSA,可以从路由域刷新 LSA。该程序遵循与刷新 LS age 自然达到最大值的 LSA 相同的过程(见第 14 节)。特别是,只要 a)MaxAge LSA 不再包含在任何邻居链路状态重传列表中,并且 b)路由器的邻居没有处于交换或加载状态,MaxAge LSA 就会从路由器的链路状态数据库中删除。我们将 LSA 的 LS age 设置为 MaxAge 称为 “过早老化”。
Premature aging is used when it is time for a self-originated LSA’s sequence number field to wrap. At this point, the current LSA instance (having LS sequence number MaxSequenceNumber) must be prematurely aged and flushed from the routing domain before a new instance with sequence number equal to InitialSequenceNumber can be originated. See Section 12.1.6 for more information.
当自创 LSA 的序列号字段需要换行时,使用过早老化。此时,当前 LSA 实例(具有 LS 序列号 MaxSequenceNumber)必须提前老化并从路由域刷新,然后才能生成序列号等于 InitialSequenceNumber 的新实例。详见第 12.1.6 节。
Premature aging can also be used when, for example, one of the router’s previously advertised external routes is no longer reachable. In this circumstance, the router can flush its AS-external-LSA from the routing domain via premature aging. This procedure is preferable to the alternative, which is to originate a new LSA for the destination specifying a metric of LSInfinity. Premature aging is also be used when unexpectedly receiving self-originated LSAs during the flooding procedure (see Section 13.4).
例如,当路由器先前公布的外部路由之一不再可到达时,也可使用过早老化。在这种情况下,路由器可以通过提前老化将其作为外部 LSA 从路由域刷新。此过程比另一种方法更可取,即为指定 LSInfinity 度量的目的地创建新的 LSA。在泛洪过程中意外接收自产 LSA 时,也可使用过早老化(见第 13.4 节)。
A router may only prematurely age its own self-originated LSAs. The router may not prematurely age LSAs that have been originated by other routers. An LSA is considered self-originated when either 1) the LSA’s Advertising Router is equal to the router’s own Router ID or 2) the LSA is a network-LSA and its Link State ID is equal to one of the router’s own IP interface addresses.
路由器可能只会过早地老化自己的源于自身的 LSA。路由器不得过早老化由其他路由器发起的 LSA。当 1)LSA 的广告路由器等于路由器自己的路由器 ID 或 2)LSA 是网络 LSA 且其链路状态 ID 等于路由器自己的 IP 接口地址之一时,LSA 被认为是自始的。
via:
-
RFC 2328: OSPF Version 2
https://www.rfc-editor.org/rfc/rfc2328
清源:CCIE v5 中 key topic
注意:
在 OSPF 中,LSA 序列号形成一个线性有序的符号 32 位整数空间,其范围从
−
2
31
+
1
-2^{31} + 1
−231+1 到
2
31
−
1
2^{31} - 1
231−1,即从
−
2
,
147
,
483
,
647
-2,147,483,647
−2,147,483,647 到
2
,
147
,
483
,
647
2,147,483,647
2,147,483,647。
值 2 31 2^{31} 231 保留用于检测 LSA 序列号是否回绕,并不作为有效的序列号。
由于在大多数计算机系统中,负整数以二进制补码形式存储,因此打印出负数的二进制补码值的十六进制形式会得到如下值: 0 x 80000001 0x80000001 0x80000001 (对应于 − 2 31 + 1 -2^{31} + 1 −231+1 )到 0 x F F F F F F F F 0xFFFFFFFF 0xFFFFFFFF (对应于 − 1 -1 −1)。
因此,当以十六进制打印时,LSA 序列号的范围如下:
- 开始于 0 x 80000001 0x80000001 0x80000001(即 − 2 31 + 1 -2^{31} + 1 −231+1)
- 增加至 0 x F F F F F F F F 0xFFFFFFFF 0xFFFFFFFF(即 − 1 -1 −1),
- 然后是 0 x 00000000 0x00000000 0x00000000(即 0 0 0),
- 接着是 0 x 00000001 0x00000001 0x00000001(即 1 1 1),
- 最后为 0 x 7 F F F F F F F 0x7FFFFFFF 0x7FFFFFFF(即 2 31 − 1 2^{31} - 1 231−1)。
如果某个 LSA 的序列号增加到 0 x 80000000 0x80000000 0x80000000,则需要将该 LSA 从 LSDB 中刷新,然后重新生成,使其序列号再次从 0 x 80000001 0x80000001 0x80000001 开始。序列号 0 x 80000000 0x80000000 0x80000000 从未出现在网络中。
讨论一:OSPF Sequence Number Question!
Iluvnetwork
11-22-2017 02:02 AM - edited
03-08-2019 12:50 PM
When does the sequence number of LSA change?
LSA 的序列号何时更改?
How does the router first make sequence number for the advertising LSA?
路由器如何为先通告的 LSA 生成序列号?
P.S. LSA sequence number has nothing to do with the sequence number during the LSDB Synchronization. Right?
P.S. LSA 序列号与 LSDB 同步期间的序列号无关。是吗?
damasiel
03-27-2020 08:31 AM
Hello,
Every route in the OSPF database has a sequence number. A initial sequence number is assigned when the OSPF process is started on the router and interfaces or networks are entered into the OSPF process. This process is done by either the network statement under the OSPF process or at the interface subcommand
OSPF 数据库中的每条路由都有一个序列号。 在路由器上启动 OSPF 进程并将接口或网络输入到 OSPF 进程中时,将分配初始序列号。 此过程由 OSPF 进程下的 network 语句或 interface 子命令完成
Initially, every route in an OSPF database is assigned the beginning sequence in Hex of 0x80000001
最初,OSPF 数据库中的每条路由都被分配了十六进制的开始序列 0x80000001
This sequence number will increase when:
在以下情况下,此序列号将增加:
There is an update to the specific network entry in the database, such as the best path has changed.
数据库中的特定网络条目有更新,例如最佳路径已更改。
I would say, in a stable environment the sequence number changes when the OSPF timers for each route reach a certain age. By default the age is 30 mins. The OSPF database also keeps track of this age value within the database. When the route gets “old” enough, its time for OSPF to increase the sequence number and then flood the update out to all the routers within in the area.
我想说的是,在稳定的环境中,当每条路由的 OSPF 计时器达到一定年龄时,序列号会发生变化。 默认情况下,年龄为 30 分钟。 OSPF 数据库还会在数据库中跟踪此年龄值。 当路由变得足够 “旧” 时,OSPF 就需要增加序列号,然后将更新大量传输到区域内的所有路由器。
So once the entry of 192.168.1.128 /25 reaches a LS age of something like 1800 seconds the local router determines it’s time to increase the sequence number by 1, 0x80000002 and flood this new LSA out to everyone as an OSPF packet type of LSA Update. Other routers see the 0x80000002 and replaces their entry for that route with the “newer” one.
因此,一旦条目 192.168.1.128 /25 达到大约 1800 秒的 LS 年龄,本地路由器就会确定是时候将序列号增加 1、0x80000002 并将此新 LSA 作为 LSA 更新的 OSPF 数据包类型提供给所有人。 其他路由器会看到 0x80000002,并用 “较新” 的路由替换其该路由的条目。
The sequence number is a signed value. Meaning it does have a positive /negative value. Sounds crazy but yes I had to do more digging on this. Think of the sequence number of 0x80000001 as a negative value, it can keep increasing getting greater in value, until it reaches 0x8FFFFFFF (which would be -1) we add one to this value, -1+1 = 0, 0x8FFFFFFF + 1 is (We’ve run out of bits so we go to Zero) 0x00000000 allowing the number to keep incrementing.
序列号是一个有符号值。 这意味着它确实具有正 / 负值。 听起来很疯狂,但是的,我不得不对此进行更多的挖掘。 将 0x80000001 的序列号视为负值,它可以不断增加,直到达到 0x8FFFFFFF(即 -1),我们向该值加 1,-1+1 = 0,0x8FFFFFFF + 1 是(我们已经用完了比特,所以我们去零)0x00000000 允许数字继续增加。
So 0x0000000A is larger /newer than 0x852425A2
所以 0x0000000A 比 0x852425A2 更大 / 更新。
via:
-
OSPF Sequence Number Question! - Cisco Community
https://community.cisco.com/t5/switching/ospf-sequence-number-question/td-p/3220777
讨论二:OSPF LSA Sequence Numbers
When the OSPF protocol populates the Link State Database (LSDB), it uses a sequence number to determine which LSA is newer.
当 OSPF 协议填充链路状态数据库 (LSDB) 时,它使用序列号来确定哪个 LSA 较新。
What do the sequence numbers look like for OSPF LSAs?
OSPF LSA 的序列号是什么样子的?
- There are 4 bytes or 32-bits.
有 4 个字节或 32 位。 - Begins with 0x80000001 and ends at 0x7FFFFFFF.
以 0x80000001 开始,到 0x7FFFFFFF 结束。 - Every 30 minutes each LSA will age out and will be flooded:
- The sequence number will increment by one.
序列号将递增 1。
If you put these numbers into a Hex to Decimal converter, you’ll see that you end up with
0x80000001 = 2147483649
0x7FFFFFFF = 2147483647
如果你把这些数字放入十六进制到十进制的转换器中,你会看到你最终得到 0x80000001 = 2147483649 0x7FFFFFFF = 2147483647
This looks strange. Actually, it looks completely incorrect!! The reason these numbers are used is because the LSA sequence numbers are signed. That is, they include a negative or positive sign which is indicated by the very first of the 32 bits. The LSA sequence numbers will start with 0x80000001 which is compared to binary below:
这看起来很奇怪。实际上,它看起来完全不正确!!使用这些编号的原因是 LSA 序列号已签名。也就是说,它们包括一个负号或正号,由 32 位中的第一位表示。LSA 序列号将以 0x80000001 开头,下面将其与二进制文件进行比较:
Hex 0x8 0 0 0 0 0 0 1
Binary 1000 0000 0000 0000 0000 0000 0000 0001
Note the 1 in the leftmost position. This indicates a negative sign, and that digit is not used to denote the number. So 0x80000001 is equal to -1 in decimal. Now as the numbers increment, they actually decrement. What I mean is you start with -1, then -2, -3 etc. until you get to -2147483648. Then it goes to 0 and then the numbers increment up to +2147483648 which is 0x7FFFFFFF. Here is this number compared to its binary representation as well:
请注意最左侧位置的 1。这表示负号,该数字不用于表示数字。所以 0x80000001 在十进制中等于 -1。现在,随着数字的增加,它们实际上在减少。我的意思是你从 -1 开始,然后是 -2、-3 等,直到你得到 -2147483648。然后它变为 0,然后数字增加到 +2147483648,即 0x7FFFFFFF。以下是这个数字与其二进制表示的比较:
Hex 0x7 F F F F F F F
Binary 0111 1111 1111 1111 1111 1111 1111 1111
Note the 0 on the left most bit. This indicates a positive ‘+’ number. Once this number is reached, then it goes back to -1 or 0x80000001 and the process continues.
请注意最左边位的 0。这表示一个正数 “+”。一旦达到这个数字,它就会回到 -1 或 0x80000001,这个过程继续。
Now all of this is really academic, because increments occur every 30 minutes in a stable network. Never in all the history of networking have these increments wrapped around to the initial sequence number because it will take over 600 years to do so, and OSPF has been around only several decades!
现在所有这些都是纯学术的,因为在稳定的网络中,增量每 30 分钟发生一次。在整个网络历史中,这些增量从未回到初始序列号,因为这需要超过 600 年的时间,而 OSPF 仅存在几十年!
Links: 链接:
https://forum.networklessons.com/t/ospf-lsas-and-lsdb-flooding-tutorial/915/51?u=lagapides
https://networklessons.com/ospf/ospf-lsas-and-lsdb-flooding-tutorial
via:
-
OSPF LSA Sequence Numbers
https://notes.networklessons.com/ospf-lsa-sequence-numbers
其他参考
-
OSPF 中的 LSA 序列号 - CSDN 博客 iteye_13558 于 2010-03-10 15:49:57 发布
https://blog.csdn.net/iteye_13558/article/details/81829985
-
OSPF LSA Sequence Number 的起始值是 0x80000001_思科技术安全的技术博客_51CTO 博客 Cisco1841sw 2013-03-05 10:19:03
https://blog.51cto.com/1841cisco/1147372
-
OSPF 序列号问题_ospf 序号 - CSDN 博客 马立杰 于 2024-05-06 10:04:15 发布
https://blog.csdn.net/i12344/article/details/138460612