Dell Networking SONiC:開啟最短路徑優先 (OSPF)

Summary: 本文說明 Dell Networking SONiC 中的開放最短路徑優先 (OSPF)。本文使用執行 Dell SONiC 4.1 的交換器。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

 
先決條件
標準介面命名用於演示概念。請參閱 Dell 文章 202172Dell Networking S-系列:基本介面組態 - SONiC 4.0 以取得介面命名的詳細資訊

索引

 


開啟最短路徑啟用 OSPFv2
在介面
上啟用 OSPF設定 OSPF 路由器 ID
設定 OSPF 區域層級認證類型
設定 OSPF 介面層級認證類型和金鑰
設定 OSPF 被動介面
設定 OSPF 虛擬連結
設定 OSPF 區域捷徑
配置 OSPF RFC 相容性
設定 OSPF 相鄰紀錄記錄
設定 OSPF LSA 計時器
設定 OSPF SPF 節流計時器
設定 OSPF 最大指標播發
設定 OSPF 路由距離
設定 OSPF 自動成本參考頻寬
設定 OSPF 短截線區域及其參數
設定 OSPF 區域間摘要路由過濾器
設定 OSPF 路由重新分發
配置 OSPF 預設路由發起

配置 OSPF 介面參數
OSPF 作業資料顯示命令
OSPFv2 順利重新啟動

 

先開啟最短路徑

 

開放最短路徑第一協定 (OSPF) 是一種鏈路狀態內部閘道路由協定 (IGRP),如 RFC2328 中所述。

OSPF 在稱為鏈路狀態通告 (LSA) 的消息中描述鏈路狀態資訊,然後通過稱為泛洪的過程傳播到鏈路狀態路由域中的所有其他路由器。因此,每個 OSPF 路由器都構建了所有鏈路狀態消息的鏈路狀態資料庫 (LSDB)。從LSDB中的LSA集合中,每個路由器都可以通過使用Edgar Djikstras最短路徑優先演演演算法,根據一些常見的指標計算到任何其他路由器的最短路徑。

Enterprise SONiC 使用 FRR 套裝來執行路由通訊協定。OSPFv2 也改編自定製的 FRR 軟體包。OPSFv2 路由守護程式與其他路由協定守護程式(如 BGP、靜態路由)一起駐留在 BGP docker 容器中。

支援的 OSPFv2 功能:

  • 乙太網路、迴路、VLAN 和連接埠通道 IPv4 介面上的 OSPF 組態
  • 預設和使用者定義的 VRF 上的 OSPFv2 組態
  • 多個 OSPF 區域和存根區域
  • 1 型至5型 LSA 
  • 虛擬連結和被動介面
  • OSPF 介面工作階段上的 BFD
  • 純文字和訊息摘要 (MD) 密碼加密
  • 類型 3 摘要 LSA 前置詞篩選和取代
  • 路由重新發佈到 OSPFv2,從路由類型 BGP、靜態、已連線、核心和預設路由
  • 路由重新分發中基於路由映射的篩選
  • OSPF ECMP 路由
  • 50K 外部路由和 5K 內部路由前綴
 

啟用 OSPFv2

透過在 VRF 內設定 OSPF 路由器來啟用 OSPFv2。使用此命令在 VRF 中設定 OSPFv2。配置 OSPF 會將模式更改為 OSPF 路由器配置模式。

若要全域啟用 OSPF,預設為 vrf:
 

DELLSONiC(conf)# router ospf

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(conf)# router ospf


或啟用 OSPF,非預設 vrf:
 

DELLSONiC(conf)# router ospf vrf Vrf-name
 
  • Vrf-name - VRF 名稱字串
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(conf)# router ospf vrf Vrf-blue


檢視 OSPF 路由器詳細資料:
 

DELLSONiC# show ip ospf
VRF Name: default
 OSPF Routing Process, Router ID: 10.10.201.1
 Supports only single TOS (TOS0) routes
 This implementation conforms to RFC2328
 RFC1583Compatibility flag is disabled
 OpaqueCapability flag is disabled
 Graceful-Restart is disabled
 Initial SPF scheduling delay 0 millisec(s)
 Minimum hold time between consecutive SPFs 50 millisec(s)
 Maximum hold time between consecutive SPFs 5000 millisec(s)
 Hold time multiplier is currently 1
 SPF algorithm last executed 1d2h7m51s ago
 Last SPF duration 23 usecs
 SPF timer is inactive
 LSA minimum interval 5000 msecs
 LSA minimum arrival 1000 msecs
 Write Multiplier set to 20
 Refresh timer 10 secs
 Maximum multiple paths(ECMP) supported  256
 Number of external LSA 0. Checksum Sum 0x00000000
 Number of opaque AS LSA 0. Checksum Sum 0x00000000
 Number of areas attached to this router: 1
Area ID: 0.0.0.0 (Backbone)
   Number of interfaces in this area: Total: 1 , Active: 1
   Number of fully adjacent neighbors in this area: 1
   Area has no authentication
   SPF algorithm executed 4 times
   Number of LSA 3
   Number of router LSA 2. Checksum Sum 0x0000ec6e
   Number of network LSA 1. Checksum Sum 0x00001a25
   Number of summary LSA 0. Checksum Sum 0x00000000
   Number of ASBR summary LSA 0. Checksum Sum 0x00000000
   Number of NSSA LSA 0. Checksum Sum 0x00000000
   Number of opaque link LSA 0. Checksum Sum 0x00000000
   Number of opaque area LSA 0. Checksum Sum 0x00000000 DELLSONiC# show ip ospf vrf Vrf-Blue
VRF Name: Vrf-Blue
 OSPF Routing Process, Router ID: 0.0.0.0
 Supports only single TOS (TOS0) routes
 This implementation conforms to RFC2328
 RFC1583Compatibility flag is disabled
 OpaqueCapability flag is disabled
{output truncated}


在介面上啟用 OSPF


在介面上啟用 OSPF 之前,請配置一個帶有 IP 位址的 IPv4 介面,並將介面綁定到所需的 VRF。要在 IPv4 介面上啟用 OSPF,您必須將 OSPF 區域 ID 與介面關聯。可在乙太網路、VLAN、連接埠通道和迴路介面上啟用 OSPF。

通過在連接兩個 OSPF 路由器的介面上啟用 OSPF,在它們之間啟用 OSPF 工作階段。此類連接介面應位於配置了 OSPF 路由器的 VRF 中,並且應屬於同一區域 ID。

使用介面模式命令在 IPv4 介面上啟用或停用 OSPF。區域 ID 可以是任何 32 位無符號整數、十進位格式或類似點點 Ipv4 的格式。

使用這兩種配置類型在介面上啟用 OSPF:

通過在介面配置模式下配置 OSPF 區域:
 
DELLSONiC(config-if-Vlan100)# ip ospf area area-id
 
  • area-id - 十進位或點線格式的 OSPF 區域 ID - A.B.C.D 或 0..4294967295


範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Vlan 100
DELLSONiC(config-if-Vlan100)# ip ospf area 0
or
DELLSONiC(config-if-Vlan100)# ip ospf area 0.0.0.0

通過在 OSPFv2 路由器配置模式下將介面的網路位址綁定或關聯到 OSPF 區域:
 
注意:使用網路命令將介面關聯到 OSPF 區域時,介面命令中的 IPv4 位址前綴長度必須等於或大於(即較小的網路)而不是網路語句中的前綴長度。
 
DELLSONiC(config-router-ospf)# network network-prefix area area-id
 
  • 網路前置碼 - A.B.C.D/遮罩
  • area-id - 十進位或點線格式的 OSPF 區域 ID - A.B.C.D 或 0..4294967295

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# network 10.10.150.0/24 area 0.0.0.0
or
DELLSONiC(config-router-ospf)# network 10.10.150.0/24 area 0

在 VRF 中,使用者應使用上述其中一種組態類型,也就是在 VRF 中一次不允許同時使用兩種組態類型組態。
 

範例:

 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Vlan 100
DELLSONiC(config-if-Vlan100)# ip vrf forwarding Vrf-Blue
DELLSONiC(config-if-Vlan100)# ip ospf area 0
or
DELLSONiC(config-if-Vlan100)# ip ospf area 0.0.0.0  
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf vrf Vrf-Blue
DELLSONiC(config-router-ospf)# network 10.10.150.0/24 area 0.0.0.0
DELLSONiC(config-router-ospf)# network 10.10.150.0/24 area 0


檢視 OSPF 工作階段

 
DELLSONiC# show ip ospf neighbor

Neighbor ID  Pri      State        Dead Time         Address             Interface                     RXmtL RqstL DBsmL            
10.10.150.2   1      Full/DR       32.346s         10.10.150.2        Vlan100:10.10.150.1                0     0     0


設定 OSPF 路由器 ID


為 VRF 中的每個 OSPF 路由器顯式配置 OSPFv2 路由器識別碼。路由器ID配置是可選的。如果配置路由器 ID,軟體會選擇該路由器 ID 作為 OSPF 路由器 ID。
每當未設定路由器 ID 時,系統都會根據以下偏好設定來選擇路由器 ID。
  • 最近使用的路由器 ID 值;(當使用者取消設定路由器 ID 時,可能會發生這種情況)。
  • FRR 建議的路由器 ID 值。FRR 會依以下順序選擇路由器 ID。
    1. FRR 全域模式設定的路由器 ID 值(如果有)。
    2. SONiC 實體和迴路介面 IPv4 位址中最高的 IPv4 位址值。
使用此路由器模式命令配置或取消配置 OSPF 路由器 ID。路由器 ID 可以是任何 32 位無符號整數、十進位格式或類似點點 Ipv4 的格式。OSPF 路由器 ID 在整個 OSPF 域中必須是唯一的。

若要設定:
 
DELLSONiC(config-router-ospf)# ospf router-id router-id

若要移除:
 
DELLSONiC(config-router-ospf)# no ospf router-id router-id
 
  • 路由器 ID - 十進位或點點格式的 OSPF 路由器 ID

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# ospf router-id 1.1.1.1


設定 OSPF 區域層級認證類型


您可以為每個區域配置 OSPFv2 身份驗證類型。配置身份驗證后,在該區域內配置的所有介面都使用配置的身份驗證類型。如果配置了任何介面模式身份驗證類型,則該介面模式身份驗證類型優先於區域級別配置。

若使用者未設定驗證類型,則會將此類型設為「無」。用戶可以啟用純文本身份驗證類型或消息摘要類型身份驗證。每當為某個區域配置認證類型時,用戶應在屬於該區域的所有OSPF介面上配置相應的認證密鑰(密碼)。

使用此路由器模式命令為某個區域配置或取消配置 OSPF 身份驗證。

若要設定:
 
DELLSONiC(config-router-ospf)# area area-id authentication [message-digest]

若要移除:
 
DELLSONiC(config-router-ospf)# no area area-id authentication [message-digest]
 
  • area-id - 十進位或點線格式的 OSPF 區域 ID - A.B.C.D 或 0..4294967295
 
範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# area 0 authentication
or
DELLSONiC(config-router-ospf)# area 0 authentication message-digest


設定 OSPF 介面層級認證類型和金鑰


為各個 OSPF 介面設定 OSPFv2 認證類型和認證金鑰或密碼。如果未由使用者配置,則身份驗證類型為 none。用戶可以啟用純文本身份驗證類型或消息摘要類型身份驗證。每當為介面配置身份驗證類型時,用戶應為該 OSPF 介面配置相應的身份驗證密鑰(密碼)。

純文字身份驗證最多可以包含八個字元。消息摘要 (MD5) 身份驗證金鑰的長度最多為 16 個字元。MD5 身份驗證類型最多可接受每個介面和介面 IP 的 255 個身份驗證金鑰。每個 MD5 身份驗證金鑰都由值範圍為 1 和 255 的身份驗證金鑰 ID 唯一標識。身份驗證金鑰以加密形式保存。

使用此介面模式命令配置或取消配置 OSPF 消息身份驗證。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf authentication [null | message-digest] [if-ip-addr]
DELLSONiC(config-if-Eth1/47)# ip ospf authentication-key key [if-ip-addr]
DELLSONiC(config-if-Eth1/47)# ip ospf message-digest-key key-id md5 key [if-ip-addr]

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf authentication [null | message-digest] [if-ip-addr]
DELLSONiC(config-if-Eth1/47)# no ip ospf authentication-key [if-ip-addr]
DELLSONiC(config-if-Eth1/47)# no ip ospf message-digest-key key-id md5 [if-ip-addr]
 
  • key - 身份驗證金鑰密碼(最多 8 或 16 個字元的字串)
  • 金鑰 ID - MD5 身份驗證金鑰識別碼(1 到 255)
  • if-ip-addr - 介面 IP 位址 - A.B.C.D

  範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Eth 1/47
DELLSONiC(config-if-Eth1/47)# ip ospf authentication
DELLSONiC(config-if-Eth1/47)# ip ospf authentication-key dellospfpswrd

DELLSONiC(config-if-Eth1/47)# ip ospf authentication 10.10.3.2
DELLSONiC(config-if-Eth1/47)# ip ospf authentication-key dellospfpswrd 10.10.3.2

DELLSONiC(config-if-Eth1/47)# ip ospf authentication message-digest
DELLSONiC(config-if-Eth1/47)# ip ospf message-digest-key 1 md5 dellospfpswrd
DELLSONiC(config-if-Eth1/47)# ip ospf message-digest-key 2 md5 dellospfpswrd

DELLSONiC(config-if-Eth1/47)# ip ospf authentication null


設定 OSPF 被動介面


使用路由器模式配置配置 OSPFv2 被動介面。在被動介面上,OSPF 不會觸發 OSPF Hello 或啟動 OSPF 會話。被動介面在路由器 LSA 中通告為存根鏈路。要預設將所有 OSPF 介面配置為被動介面,請輸入被動介面預設選項。要重新啟動所有或指定的介面,請使用無被動介面命令。

若要設定:
 
DELLSONiC(config-router-ospf)# passive-interface {default | Eth | Loopback | PortChannel | Vlan } [if-ip-addr]

若要移除:
 
DELLSONiC(config-router-ospf)# no passive-interface {default | Eth | Loopback | PortChannel | Vlan } [if-ip-addr]
 
  • 乙太幣 |環回 |連接埠通道 |VLAN - 介面名稱
  • if-ip-addr - 介面 IP 位址 - A.B.C.D

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# passive-interface default
DELLSONiC(config-router-ospf)# no passive-interface Eth 1/47


設定 OSPF 虛擬連結


OSPFv2 虛擬鏈路用於連接非主幹區域中的主幹路由器。配置虛擬鏈路的區域(稱為中轉區域)必須具有完整的路由資訊。中轉區域不能是存根區域。您必須在兩端骨幹路由器上配置虛擬鏈路。

使用 OSPF 路由器模式配置虛擬鏈路,如下所示。單一虛擬連結命令提供選項,可用於設定與虛擬連結相關的所有參數。虛擬連結可以具有明文密碼、基於消息摘要的密碼或根本不配置密碼。配置明文和消息摘要密碼時,必須配置相應的身份驗證密鑰或消息摘要密鑰參數。身份驗證金鑰(密碼)以加密形式保存在配置中。使用者在設定認證金鑰時,應一律提供實際密碼。

若要設定:
 
DELLSONiC(config-router-ospf)# area area-id virtual-link remote-id [ authentication [ null | message-digest ] | authentication-key key | message-digest-key key-id md5 key | dead-interval time-value | hello-interval time-value | retransmit-interval time-value | transmit-delay time-value ]

若要移除:
 
DELLSONiC(config-router-ospf)# no area area-id virtual-link remote-id [ authentication [ null | message-digest ] | authentication-key key | message-digest-key key-id md5 key | dead-interval time-value | hello-interval time-value | retransmit-interval time-value | transmit-delay time-value ]
 
  • area-id - 十進位或點線格式的 OSPF 區域 ID - A.B.C.D 或 0..4294967295
  • 遠端 ID - 虛線格式的遠端路由器 ID - A.B.C.D
  • key - 身份驗證金鑰密碼(最多 8 或 16 個字元的字串)
  • 金鑰 ID - MD5 身份驗證金鑰識別碼(1 到 255)
  • time-value - 以秒為單位的時間間隔值(1 到 65535)
範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# area 19 virtual-link 1.1.1.9

DELLSONiC(config-router-ospf)# area 19 virtual-link 1.1.1.9 authentication
DELLSONiC(config-router-ospf)# area 19 virtual-link 1.1.1.9 authentication-key dellospfpswrd

DELLSONiC(config-router-ospf)# area 19 virtual-link 1.1.1.9 authentication
message-digest
DELLSONiC(config-router-ospf)# area 19 virtual-link 1.1.1.9
message-digest-key 19 md5 dellospfpswrd

DELLSONiC(config-router-ospf)# area 19 virtual-link 1.1.1.9 authentication null

DELLSONiC(config-router-ospf)# area 19 virtual-link 1.1.1.9 dead-interval 60
DELLSONiC(config-router-ospf)# area 19 virtual-link 1.1.1.9 hello-interval 20
DELLSONiC(config-router-ospf)# area 19 virtual-link 1.1.1.9 retransmit-interval 15
DELLSONiC(config-router-ospf)# area 19 virtual-link 1.1.1.9 transmit-delay 10


設定 OSPF ABR 類型


OSPF 路由器 ABR 可以是 Cisco、IBM、快捷方式或標準類型。「Cisco」和「IBM」類型為等同。針對 ABR 行為的 OSPF 標準不允許 ABR 在與主幹網的連結斷開時考慮通過非主幹區域的路由,即使連接的非主幹區域中仍有其他 ABR 仍可到達主幹 - 此限制的存在主要是為了確保避免路由環路。

在此版本中的預設值“思科”或“IBM”ABR 類型中取消了此限制,允許 ABR 考慮通過非主幹網區域從其他 ABR 中學習的摘要,從而在主幹鏈路出現故障時作為最後的手段通過非主幹網區域進行路由。

ospf abr-type 命令可用來設定或取消設定 ABR 類型,如下所示。

若要設定:
 
DELLSONiC(config-router-ospf)# ospf abr-type [ cisco | ibm | shortcut | standard ]

若要移除:
 
DELLSONiC(config-router-ospf)# no ospf abr-type [ cisco | ibm | shortcut | standard ]

範例:

 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# ospf abr-type standard


設定 OSPF 區域捷徑


OSPF 主幹區域負責非主幹區域之間的路由分配。骨幹區域應該是連續的,但它並不總是意味著物理相鄰。您可以使用虛擬連接實現骨幹區域路由器連接。

通過配置快捷方式類型,您可以啟用或禁用到骨幹區域的快捷路由。當快捷方式類型為預設時,僅當 ABR 沒有指向主幹區域的連結或此連結丟失時,該區域才會用於快捷方式。當快捷方式類型為“啟用”時,每次通過它的路線更便宜時,該區域都會用於快捷方式。當快捷方式類型為“禁用”時,ABR 永遠不會將該區域用於路線快捷方式。

在 OSPF 路由器配置模式下配置或取消配置 OSPFv2 區域快捷方式類型。

若要設定:
 
DELLSONiC(config-router-ospf)# area area-id shortcut {default | enable | disable}

若要移除:
 
DELLSONiC(config-router-ospf)# no area area-id shortcut

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# area 1 shortcut enable


配置 OSPF RFC 相容性


OSPFv2 RFC2328是 RFC1583 的繼任者,根據第 16.4 節中的 G.2 節(更改),建議對路徑首選項演演演算法進行更改,以防止舊版 OSPFv2 中可能出現的路由環路。更具體地說,它要求區域間路徑和區域內主幹路徑現在具有相同的優先順序,但仍然優於外部路徑。

若要設定:
 
DELLSONiC(config-router-ospf)# compatible rfc1583

若要移除:
 
DELLSONiC(config-router-ospf)# no compatible rfc1583

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# compatible rfc1583


設定 OSPF 相鄰紀錄記錄


設定相鄰記錄,以啟用 OSPFv2 相鄰狀態記錄。使用可選的 detail 參數,將顯示相鄰狀態中的所有更改。

若要設定:
 
DELLSONiC(config-router-ospf)# log-adjacency-changes [detail]

若要移除:
 
DELLSONiC(config-router-ospf)# no log-adjacency-changes

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# log-adjacency-changes detail
 

設定 OSPF LSA 計時器


設定 OSPFv2 LSA 刷新間隔、最小間隔和節流計時器:

要配置:
 
DELLSONiC(config-router-ospf)# refresh timer refresh-time
DELLSONiC(config-router-ospf)#  timers lsa min-arrival min-arr-time
DELLSONiC(config-router-ospf)#  timers throttle lsa all throttle-time

若要移除:
 
DELLSONiC(config-router-ospf)# no refresh timer
DELLSONiC(config-router-ospf)# no timers lsa min-arrival
DELLSONiC(config-router-ospf)# no timers throttle lsa all
 
  • 刷新時間 - 刷新時間(10 到 1800 秒)
  • 最小到達時間 - 最小到達時間(0 到 600000 毫秒)
  • 節流時間 - 節流時間 (0 至 5000 毫秒)
範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)#  refresh timer 40
DELLSONiC(config-router-ospf)#  timers lsa min-arrival 30
DELLSONiC(config-router-ospf)#  timers throttle lsa all 150


設定 OSPF SPF 節流計時器


OSPFv2 SPF 演算法節流計時器會設定初始延遲、初始保持時間和計算時觸發計算的事件之間的最大保持時間。時間以毫秒為單位指定,並且必須在 0 到 600000 毫秒的範圍內。

初始延遲指定延遲 SPF 計算的最短時間量。因此,它會影響在以前任何SPF計算的保持時間之外發生的事件發生后SPF計算延遲的時間,並且還用作最短保持時間。

連續的SPF計算始終至少相隔「保持時間」毫秒。保持時間是自適應的,最初設置為使用節流命令配置的初始保持時間。在先前 SPF 計算的保持時間內發生的事件會導致初始保持時間增加,初始保持時間以使用節流命令配置的最大保持時間為界。如果自適應保持時間過去而未發生任何SPF觸發事件,則當前保持時間將重置為初始保持時間。您可以使用 show ip ospf 命令查看當前保持時間,該命令表示
為初始保持時間的乘數。

若要設定:
 
DELLSONiC(config-router-ospf)# timers throttle spf initial-delay initial-hold-time max-hold-time

若要移除:
 
DELLSONiC(config-router-ospf)# no timers throttle spf
 
  • 初始延遲 — 時間值(0 到 600000 毫秒)
  • 初始保持時間 — 時間值(0 到 600000 毫秒)
  • max-hold-time — 時間值(0 到 600000 毫秒)

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# timers throttle spf 200 400 10000

在上面的示例中,初始延遲設置為200ms,初始保持時間設置為400ms,最大保持時間為10s。因此,事件(需要SPF計算)和SPF計算之間始終至少有200毫秒。進一步的連續SPF計算總是在400ms到10s之間分開,每次在上一個SPF計算的保持時間內發生SPF觸發事件時,保持時間就會增加400ms。


設定 OSPF 最大指標播發


根據 RFC 313,OSPFv2 將其路由器 LSA 中的傳輸鏈路描述為具有無限距離(最大度量),以便其他路由器避免計算通過路由器的傳輸路徑,同時仍然能夠通過路由器到達網路。
可以通過管理方式(即無限期)或有條件地啟用此支援。最大指標路由器 LSA 的條件啟用可以在啟動後持續幾秒鐘。

在啟動后的一段時間內啟用此功能允許 OSPF 首先完全融合,而不會影響其他路由器使用的任何現有路由,同時仍允許訪問任何連接的存根鏈路和/或重新分發的路由。

以系統管理方式啟用此功能可允許基於任何原因無限期地進行管理干預。請注意,如果保存配置,則也會保存此存根路由器命令的管理表單。如果系統或 docker 稍後重新啟動,則該命令將生效,直到手動取消配置為止。

若要設定:
 
DELLSONiC(config-router-ospf)# max-metric router-lsa administrative
DELLSONiC(config-router-ospf)#  max-metric router-lsa on-startup time-value

若要移除:
 
DELLSONiC(config-router-ospf)# no max-metric router-lsa administrative
DELLSONiC(config-router-ospf)#  no max-metric router-lsa on-startup
 
  • 時間值 - 時間值(5 到 86400 秒)

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# max-metric router-lsa administrative
DELLSONiC(config-router-ospf)# max-metric router-lsa on-startup 60
 

設定 OSPF 路由距離


使用路由器內使用者配置的路由距離分配 OSPFv2 計算路由。您可以在所有 OSPFv2 生成的路由上設定距離值。距離值配置也可以根據 OSPF 路由的源完成,例如區域內路由、區域間路由和相對於當前路由器的外部路由。

若要設定:
 
DELLSONiC(config-router-ospf)# distance distance-value
DELLSONiC(config-router-ospf)# distance ospf intra-area distance-value
DELLSONiC(config-router-ospf)# distance ospf inter-area distance-value
DELLSONiC(config-router-ospf)# distance ospf external distance-value

若要移除:
 
DELLSONiC(config-router-ospf)# no distance
DELLSONiC(config-router-ospf)# no distance ospf intra-area
DELLSONiC(config-router-ospf)# no distance ospf inter-area
DELLSONiC(config-router-ospf)# no distance ospf external
 
  • 距離值 - 所有類型的路線的距離值 (1...255)
範例:
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# distance 25
DELLSONiC(config-router-ospf)# distance ospf intra-area 30
DELLSONiC(config-router-ospf)# distance ospf inter-area 30
DELLSONiC(config-router-ospf)# distance ospf external 60


設定 OSPF 自動成本參考頻寬


OSPFv2 根據 OSPF 介面成本計算路由成本。介面成本可以手動配置,也可以自動計算。手動配置的介面成本優先於自動計算的介面成本。

介面成本自動計算是通過考慮參考頻寬和介面/鏈路頻寬來計算的。參考頻寬的成本被認為是具有成本1。默認參考頻寬為 100 GB。連結頻寬是依據設定的連結頻寬或連結實際速度或預設連結頻寬 (10G) 的優先順序選擇。連結成本的計算方法如下。

鏈路成本=(參考頻寬)/(鏈路頻寬+0.5)

計算的鏈路成本可以小於1,在這種情況下,始終四捨五入為鏈路成本1。

若要設定:
 
DELLSONiC(config-router-ospf)# auto-cost reference-bandwidth ref-bandwidth

若要移除:
 
DELLSONiC(config-router-ospf)# no auto-cost reference-bandwidth
 
  • 參考頻寬 - 參考頻寬(1 至 4294967 兆位)

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# auto-cost reference-bandwidth 10000


設定 OSPF 短截線區域及其參數


將 OSPFv2 區域配置為具有或不具有摘要路由的存根區域。存根區域是沒有路由器源自 OSPF 外部路由的區域。因此,這是所有外部路由都可以通過 ABR 到達的區域。因此,此類區域的 ABR 不需要將 AS-外部 LSA 或 ASBR-摘要 LSA 傳遞到該區域。他們只需要將網路摘要 LSA 以及預設路由摘要傳入此類區域。任何匯總存根區域都無法阻止 ABR 甚至將區域間摘要注入指定的存根區域。

若要設定:
 
DELLSONiC(config-router-ospf)# area area-id stub [no-summary]
DELLSONiC(config-router-ospf)# area area-id default-cost cost-value

若要移除:
 
DELLSONiC(config-router-ospf)# no area area-id stub [no-summary]
DELLSONiC(config-router-ospf)# no area area-id default-cost
 
  • area-id - 十進位或點線格式的 OSPF 區域 ID - A.B.C.D 或 0..4294967295
  • 成本值 - 預設成本 (0 到 16777215)

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# area 1 stub
DELLSONiC(config-router-ospf)# area 2 stub no-summary
DELLSONiC(config-router-ospf)# area 2 default-cost 30
 

設定 OSPF 區域間摘要路由過濾器


使用前綴清單和範圍清單在 ABR 處管理 OSPFv2 區域間摘要 LSA 路由傳播。

使用 in 前綴清單篩選出進入 ABR 區域的傳入路由。同樣,使用 out 前綴清單篩選出某個區域的傳出路由。

範圍清單還可用於管理某個地區的前綴廣告。使用範圍清單可以修改前綴以及要播發的開銷或路由前綴。此選項將指定區域的區域內路徑匯總到一個向其他區域宣佈的 Type-3 摘要 LSA 中。您只能在 ABR 中使用此配置,並且只能匯總路由器 LSA 和網路 LSA。

若要設定:
 
DELLSONiC(config-router-ospf)# area area-id filter-list prefix prefix-list in
DELLSONiC(config-router-ospf)# area area-id filter-list prefix prefix-list out
DELLSONiC(config-router-ospf)# area area-id range ip-prefix
DELLSONiC(config-router-ospf)# area area-id range ip-prefix not-advertise
DELLSONiC(config-router-ospf)# area area-id range ip-prefix cost cost-value
DELLSONiC(config-router-ospf)# area area-id range ip-prefix advertise cost cost-value
DELLSONiC(config-router-ospf)# area area-id range ip-prefix substitute sub-ip-prefix

若要移除:
 
DELLSONiC(config-router-ospf)# no area area-id filter-list prefix in
DELLSONiC(config-router-ospf)# no area area-id filter-list prefix out
DELLSONiC(config-router-ospf)# no area area-id range ip-prefix
DELLSONiC(config-router-ospf)# no area area-id range ip-prefix not-advertise
DELLSONiC(config-router-ospf)# no area area-id range ip-prefix cost
DELLSONiC(config-router-ospf)# no area area-id range ip-prefix advertise cost
DELLSONiC(config-router-ospf)# no area area-id range ip-prefix substitute
 
  • area-id - 十進位或點線格式的 OSPF 區域 ID - A.B.C.D 或 0..4294967295
  • 首碼清單 - IPv4 首碼清單名稱
  • ip-prefix - 摘要路由位址範圍前綴 - A.B.C.D/mask 
  • 成本值 - 成本值 - <0..16777215> 
  • 子 ip-前綴 - 位址前綴 - A.B.C.D/mask 

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# area 0 filter-list prefix arealistin in
DELLSONiC(config-router-ospf)# area 0 filter-list prefix arealistout out
 

設定 OSPF 路由重新分發


OSPFv2 可以將外部路由重新分發到 OSPF 路由域。將 BGP 路由、靜態路由、連接的路由和內核路由重新分發到 OSPF 路由域。除了顯式指定的成本和指標類型外,還使用路由映射管理路由重新分發。

若要設定:
 
DELLSONiC(config-router-ospf)# redistribute {kernel | connected | static| bgp} [metric metric-value| metric-type metric-type-value | route-map rmap-name}
DELLSONiC(config-router-ospf)# default-metric metric-value

若要移除:
 
DELLSONiC(config-router-ospf)# no redistribute {kernel | connected | static | bgp} [metric | metric-type | route-map}
DELLSONiC(config-router-ospf)# no default-metric
 
  • 指標值 - 應用於路由的路由成本(0 到 16777214)
  • 指標類型值 - 指標類型(1 和 2)
  • rmap 名稱 - 要應用於路由的路由映射的名稱

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# redistribute bgp
DELLSONiC(config-router-ospf)# redistribute static metric 20 metric-type 1
DELLSONiC(config-router-ospf)# redistribute bgp route-map ospf-rmap
DELLSONiC(config-router-ospf)# redistribute bgp metric 20 metric-type 1 route-map ospfrmap
DELLSONiC(config-router-ospf)# default-metric 30
 

設定 OSPF 預設路由來源


默認路由可以源自 OSPF 路由域。此選項啟動一個 AS-外部 LSA,描述進入指定指標和指標類型的所有支援外部路由區域的預設路由。如果指定了“始終”選項,則始終通告預設路由,即使路由表中不存在預設路由也是如此。

若要設定:
 
DELLSONiC(config-router-ospf)# default-information originate [{ always | metric metric-value| metric-type metric-type-value | route-map rmap-name }]

若要移除:
 
DELLSONiC(config-router-ospf)# no default-information originate [{ always | metric | metric-type | route-map }]
 
  • 指標值 - 應用於路由的路由成本(0 到 16777214)
  • 指標類型值 - 指標類型(1 和 2)
  • rmap 名稱 - 要應用於路由的路由映射的名稱

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# router ospf
DELLSONiC(config-router-ospf)# default-information originate
DELLSONiC(config-router-ospf)# default-information originate always
DELLSONiC(config-router-ospf)# default-information originate route-map ospf-rmap
DELLSONiC(config-router-ospf)# default-information originate metric 20 metric-type 1 route-map ospfrmap
 

設定 OSPF 介面參數


在 SONiC 介面組態模式下設定 OSPF 介面參數。介面組態包括:
  • 與介面的區域關聯
  • 介面類型、MTU
  • 訊息認證參數
  • 工作階段計時器間隔參數
  • BFD

通過指定介面 IPv4 位址,介面參數還可以與介面的特定介面位址相關聯。指定介面位址時,此類配置參數僅適用於與相應介面位址關聯的 OSPF 會話。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf area area-id [if-ip-addr]

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf area area-id [if-ip-addr]
 
  • area-id - 十進位或點線格式的 OSPF 區域 ID - A.B.C.D 或 0..4294967295
  • if-ip-addr - 介面 IP 位址

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# int Eth 1/47
DELLSONiC(config-if-Eth1/47)# ip ospf area 10
DELLSONiC(config-if-Eth1/47)# ip ospf area 0.0.0.0 10.3.1.2

在 OSPF 介面組態模式下設定 OSPFv2 介面網路類型。默認情況下,OSPF 介面網路屬於網路類型廣播。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf network {broadcast | point-to-point}

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf network {broadcast | point-to-point}

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# int Eth 1/47
DELLSONiC(config-if-Eth1/47)# ip ospf network broadcast

DELLSONiC(config)# int Eth 1/8
DELLSONiC(config-if-Eth1/8)# ip ospf network point-to-point

在 OSPF 介面組態模式下設定 OSPFv2 介面工作階段優先順序參數。優先順序最高的路由器更有資格成為指定路由器。將值設置為 0 會使路由器不符合成為指定路由器的條件。預設值為 1。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf priority priority-value [if-ip-addr]

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf priority [if-ip-addr]
 
  • 優先順序值 - 工作階段優先順序(0 到 255)
  • if-ip-addr - 介面 IP 位址

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# int Eth 1/47
DELLSONiC(config-if-Eth1/47)# ip ospf priority 10

在 OSPF 介面組態模式下設定 OSPFv2 介面工作階段認證參數:

要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf authentication [null | message-digest] [if-ip-addr]
DELLSONiC(config-if-Eth1/47)# ip ospf authentication-key key [if-ip-addr]
DELLSONiC(config-if-Eth1/47)# ip ospf message-digest-key key-id md5 key [if-ip-addr]

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf authentication [null | message-digest] [if-ip-addr]
DELLSONiC(config-if-Eth1/47)# no ip ospf authentication-key [if-ip-addr]
DELLSONiC(config-if-Eth1/47)# no ip ospf message-digest-key key-id md5 [if-ip-addr]
 
  • if-ip-addr - 介面 IPv4 位址
  • key - 身份驗證金鑰密碼(最多 8 或 16 個字元)
  • 金鑰 ID - MD5 身份驗證金鑰識別碼(1 到 255)
  • if-ip-addr - 介面 IP 位址

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Eth1/1
DELLSONiC(config-if-Eth1/1)# ip ospf authentication
DELLSONiC(config-if-Eth1/1)# ip ospf authentication-key ospfpswd

DELLSONiC(config)# interface Eth1/2
DELLSONiC(config-if-Eth1/2)# ip ospf authentication 10.10.3.2
DELLSONiC(config-if-Eth1/2)# ip ospf authentication-key ospfpswd 10.10.3.2

DELLSONiC(config)# interface Eth1/3
DELLSONiC(config-if-Eth1/3)# ip ospf authentication message-digest
DELLSONiC(config-if-Eth1/3)# ip ospf message-digest-key 1 md5 ospfpswd1
DELLSONiC(config-if-Eth1/3)# ip ospf message-digest-key 2 md5 ospfpswd2
DELLSONiC(config-if-Eth1/3)# ip ospf message-digest-key 9 md5 ospfpswd9

DELLSONiC(config)# interface Eth1/4
DELLSONiC(config-if-Eth1/4)# ip ospf authentication null

在 OSPF 介面組態模式下設定 OSPFv2 介面工作階段 BFD。OSPF 介面 BFD 預設為停用。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf bfd

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf bfd

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Eth1/1
DELLSONiC(config-if-Eth1/1)# ip ospf bfd

在 OSPF 介面組態模式下設定 OSPFv2 介面成本。成本值設置為路由器 LSA 的指標欄位,並用於 SPF 計算。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf cost cost-value [if-ip-addr]

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf cost [if-ip-addr]
 
  • if-ip-addr - 介面 IP 位址
  • 成本-值 - 介面成本(1 至 65535)

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Eth1/1
DELLSONiC(config-if-Eth1/1)# ip ospf cost 50

在 OSPF 介面組態模式下,設定忽略 OSPFv2 介面工作階段 MTU。默認情況下不會忽略 MTU。如果未設定 MTU 忽略,OSPF 工作階段介面末端的 MTU 值應相符。當存在大量 OSPF 路由前綴並且路由器 LSA 消息無法在 MTU 大小內容納它們時,配置 MTU 忽略並不能保證會話建立。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf mtu-ignore [if-ip-addr]

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf mtu-ignore [if-ip-addr]
 
  • if-ip-addr - 介面 IP 位址

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Eth1/1
DELLSONiC(config-if-Eth1/1)# ip ospf mtu-ignore

在 OSPF 介面組態模式下設定 OSPFv2 介面工作階段問候計時器。配置后,在指定介面上每隔計時器值秒發送 Hello 數據包。對於連接到公共網路的所有路由器,此值必須相同。預設值為 10 秒。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf hello-interval time-interval [if-ip-addr]

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf hello-interval [if-ip-addr]
 
  • if-ip-addr - 介面 IP 位址
  • 時間間隔 - 計時器值(1 到 65535 秒)

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Eth1/1
DELLSONiC(config-if-Eth1/1)# ip ospf hello-interval 15

在 OSPF 介面配置模式下配置 OSPFv2 介面會話傳輸延遲計時器。配置后,LSA 的年齡在傳輸時應按此值遞增。預設值為 1 秒。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf transmit-delay time-interval [if-ip-addr]

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf transmit-delay [if-ip-addr]
 
  • if-ip-addr - 介面 IP 位址
  • 時間間隔 - 計時器值(1 到 65535 秒)

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Eth1/1
DELLSONiC(config-if-Eth1/1)# ip ospf transmit-delay 20

在 OSPF 介面組態模式下設定 OSPFv2 介面工作階段重新傳輸間隔計時器。重新傳輸資料庫描述和鏈路狀態請求數據包時使用此值。預設值為 5 秒。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf retransmit-interval time-interval [if-ip-addr]

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf retransmit-interval [if-ip-addr]
 
  • if-ip-addr - 介面 IP 位址
  • 時間間隔 - 計時器值(2 到 65535 秒)

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Eth1/1
DELLSONiC(config-if-Eth1/1)# ip ospf retransmit-interval 25

在 OSPF 介面組態模式下設定 OSPFv2 介面失效間隔。OSPF 路由器失效間隔計時器值用於會話等待或不活動計時器。對於連接到公共網路的所有路由器,此值必須相同。預設值為 40 秒。如果指定了“最小”而不是顯式等待時間,則死區間設置為 1 秒,並且必須指定 hello-乘數。Hello-乘數指定每秒發送多少個 Hellos。乘數值可以是 1(每 500 毫秒)到 10(每 50 毫秒)。因此,OSPF 可以有 1s 收斂時間。如果指定了此形式,則在 Hello 數據包中通告的 hello-interval 設置為 0,並且不檢查收到的 Hello 數據包上的 hello-interval,因此 hello-multiplier 在公共鏈路上的多個路由器之間不需要相同。

若要設定:
 
DELLSONiC(config-if-Eth1/47)# ip ospf dead-interval time-interval [if-ip-addr]
DELLSONiC(config-if-Eth1/47)# ip ospf dead-interval minimal hello-multiplier multiplier [if-ip-addr]

若要移除:
 
DELLSONiC(config-if-Eth1/47)# no ip ospf dead-interval [if-ip-addr]
DELLSONiC(config-if-Eth1/47)# no ip ospf dead-interval minimal hello-multiplier [if-ip-addr]
 
  • if-ip-addr - 介面 IP 位址
  • 時間間隔 - 計時器值(1 到 65535 秒)
  • 乘數 - 死區間 hello 乘數值(1 到 10 秒)

範例:
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure terminal
DELLSONiC(config)# interface Eth1/1
DELLSONiC(config-if-Eth1/1)# ip ospf dead-interval 60
DELLSONiC(config-if-Eth1/1)# ip ospf dead-interval minimal hello-multiplier 4
 

OSPF 作業資料顯示命令


SONiC 提供的顯示命令,以顯示 OSPF 路由器、OSPF 工作階段和 OSPF 介面的運作狀態。
 

檢視 OSPF 路由器資訊

 
show ip ospf [vrf vrf-name]
 
  • VRF 名稱 - VRF 名稱

範例:

 
DELLSONiC# show ip ospf
OSPF Routing Process, Router ID: 1.1.1.1
 Supports only single TOS (TOS0) routes
 This implementation conforms to RFC2328
 RFC1583Compatibility flag is enabled
 OpaqueCapability flag is disabled
 Initial SPF scheduling delay 0 millisec(s)
 Minimum hold time between consecutive SPFs 50 millisec(s)
 Maximum hold time between consecutive SPFs 5000 millisec(s)
 Hold time multiplier is currently 1
 time is 92031756
 SPF algorithm last executed 1065d4h22m ago
 Last SPF duration 0.0s
 SPF timer is inactive
 LSA minimum interval 5000 msecs
 LSA minimum arrival 1000 msecs
 Write Multiplier set to 20
 Refresh timer 10 secs
 Number of external LSA 0. Checksum Sum 0x0
 Number of opaque AS LSA 0. Checksum Sum 0x0
 Number of areas attached to this router: 2
 Area ID: 0.0.0.0 (Backbone)
 Number of interfaces in this area: Total: 1 , Active: 1
 Number of fully adjacent neighbors in this area: 1
 Area has no authentication
 SPF algorithm executed 8 times
 Number of LSA 3
 Number of router LSA 2. Checksum Sum 0x40f64b4000000000
 Number of network LSA 1. Checksum Sum 0x40d5adc000000000
 Number of summary LSA 0. Checksum Sum 0x0
 Number of ASBR summary LSA 0. Checksum Sum 0x0
 Number of NSSA LSA 0. Checksum Sum 0x0
 Number of opaque link LSA . Checksum Sum 0x
 Number of opaque area LSA 0. Checksum Sum 0x0
 Area ID: 0.0.0.1
 Number of interfaces in this area: Total: 1 , Active: 1
 Number of fully adjacent neighbors in this area: 0
 Area has no authentication
 SPF algorithm executed 1 times
 Number of LSA 2
 Number of router LSA 0. Checksum Sum 0x0
 Number of network LSA 0. Checksum Sum 0x0
 Number of summary LSA 2. Checksum Sum 0x40f1f61000000000
 Number of ASBR summary LSA 0. Checksum Sum 0x0
 Number of NSSA LSA 0. Checksum Sum 0x0
 Number of opaque link LSA . Checksum Sum 0x
 Number of opaque area LSA 0. Checksum Sum 0x0


檢視 OSPF 芳鄰資訊

 
show ip ospf [vrf vrf-name ] neighbor [detail | if-name | nbr-ip ]
 
  • VRF 名稱 - VRF 名稱
  • if-name - OSPF 介面名稱
  • nbr-IP - 鄰居路由器 ID

範例:
 
DELLSONiC# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface RXmtL
RqstL DBsmL
10.59.142.247 1 Full/Backup 37.343s 64.1.1.2 Eth 1/2:64.1.1.1 0
 0 0
DELLSONiC# show ip ospf neighbor Eth1/3 | no-more
Neighbor ID Pri State Dead Time Address Interface RXmtL
RqstL DBsmL
2.2.2.2 1 Full/Backup 38.245s 64.1.1.2 Eth 1/4:64.1.1.1 0
 0 0
DELLSONiC# show ip ospf neighbor detail
Neighbor 10.59.142.247, interface address 64.1.1.2
 In the area 0.0.0.0 via interface Eth 1/2
 Neighbor priority is 1, State is Full, 6 state changes
 Most recent state change statistics:
 Progressive change 7h3m25s ago
 DR is 64.1.1.1, BDR is 64.1.1.2
 Options 2 *|-|-|-|-|-|E|-
 Dead timer due in 30.687s
 Database Summary List 0
 Link State Request List 0
 Link State Retransmission List 0
 Thread Inactivity Timer on
 Thread Database Description Retransmission off
 Thread Link State Request Retransmission on
 Thread Link State Update Retransmission on


Leaf1# show ip ospf neighbor 2.2.2.2
 Neighbor 2.2.2.2, interface address 64.1.1.2
 In the area 0.0.0.0 via interface Eth 1/2
 Neighbor priority is 1, State is Full, 5 state changes
 Most recent state change statistics:
 Progressive change 0h1m11s ago
 DR is 64.1.1.1, BDR is 64.1.1.2
 Options 2 *|-|-|-|-|-|E|-
 Dead timer due in 33.203s
 Database Summary List 0
 Link State Request List 0
 Link State Retransmission List 0
 Thread Inactivity Timer on
 Thread Database Description Retransmision off
 Thread Link State Request Retransmission on
 Thread Link State Update Retransmission on


檢視 OSPF 介面資訊

 
show ip ospf interface [if-name | traffic ]
 
  • if-name - OSPF 介面名稱

範例:
 
DELLSONiC# show ip ospf interface
VRF Name: default
Eth 1/2 is up
 ifindex 128, MTU 9100 bytes, BW 25000 Mbit UP,BROADCAST,RUNNING,MULTICAST
 Internet Address 64.1.1.1/24, Broadcast 64.1.1.255, Area 0.0.0.0
 MTU mismatch detection: enabled
 Router ID 10.59.143.131, Network Type BROADCAST, Cost: 4
 Transmit Delay is 1 sec, State DR, Priority 1
 Backup Designated Router (ID) 10.59.142.247, Interface Address 64.1.1.2
 Saved Network-LSA sequence number 0x8000000f
 Multicast group memberships: OSPFAllRouters OSPFDesignatedRouters
 Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
 Hello due in 9.023s
 Neighbor Count is 1, Adjacent neighbor count is 1


DELLSONiC# show ip ospf interface Eth 1/3
VRF Name: default
Eth 1/4 is up
 ifindex 926, MTU 9100 bytes, BW 25000 Mbit UP,BROADCAST,RUNNING,MULTICAST
 Internet Address 65.1.1.1/24, Broadcast 65.1.1.255, Area 0.0.0.1
 MTU mismatch detection: enabled
 Router ID 1.1.1.1, Network Type BROADCAST, Cost: 4
 Transmit Delay is 1 sec, State DR, Priority 1
 Backup Designated Router (ID) 2.2.2.2, Interface Address 65.1.1.2
 Multicast group memberships: OSPFAllRouters OSPFDesignatedRouters
 Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
 Hello due in 7.957s
 Neighbor Count is 1, Adjacent neighbor count is 1


DELLSONiC# show ip ospf interface traffic
Interface HELLO DB-Desc LS-Req LS-Update LS-Ack
 Rx/Tx Rx/Tx Rx/Tx Rx/Tx Rx/Tx
-----------------------------------------------------------------------------------------
---
Eth 1/2 2563/2563 3/3 1/1 17/30 29/16
Leaf1# show ip ospf interface traffic Eth1/3
Interface HELLO DB-Desc LS-Req LS-Update LS-Ack
 Rx/Tx Rx/Tx Rx/Tx Rx/Tx Rx/Tx
-----------------------------------------------------------------------------------------

Eth1/3 19/22 2/3 1/1 3/3 2/2
 

檢視 OSPF 資料庫資訊

 
show ip ospf [vrf vrf-name ] database [asbr-summary | external | network | router | summary | opaque-link]
 
  • vrf-name — VRF 名稱

範例:
 
DELLSONiC# show ip ospf database
VRF Name: default
 OSPF Router with ID (5.5.5.5)
 Router Link States (Area 0.0.0.0)
Link ID ADV Router Age Seq# CkSum Link count
3.3.3.3 3.3.3.3 988 0x80000003 0x04ec 1
5.5.5.5 5.5.5.5 988 0x80000008 0x6f6b 1
 Net Link States (Area 0.0.0.0)
Link ID ADV Router Age Seq# CkSum
10.10.10.2 5.5.5.5 988 0x80000002 0xcc38
 Link-Local Opaque-LSA (Area 0.0.0.0)
Opaque-Type/Id ADV Router Age Seq# CkSum
3.0.0.0 3.3.3.3 89 0x80000001 0x4a24
DELLSONiC# show ip ospf database network
VRF Name: default
 OSPF Router with ID (10.59.143.131)
 Net Link States (Area 0.0.0.0)
 LS age: 1602
 Options: 0x2 : *|-|-|-|-|-|E|-
 LS Flags: 0x3
 LS Type: network-LSA
 Link State ID: 64.1.1.1 (address of Designated Router)
 Advertising Router: 10.59.143.131
 LS Seq Number: 8000000f
 Checksum: 0x1c70
 Length: 32
 Network Mask: /24
 Attached Router: 10.59.142.247
 Attached Router: 10.59.143.131

DELLSONiC# show ip ospf database summary
VRF Name: default
 OSPF Router with ID (1.1.1.1)
 Summary Link States (Area 0.0.0.0)
 LS age: 468
 Options: 0x2 : *|-|-|-|-|-|E|-
 LS Flags: 0x11
 LS Type: summary-LSA
 Link State ID: 65.1.1.0 (summary Network Number)
 Advertising Router: 1.1.1.1
 LS Seq Number: 80000001
 Checksum: 0x0e04
 Length: 28
 Network Mask: /24
 TOS: 0 Metric: 4
 LS age: 429
 Options: 0x2 : *|-|-|-|-|-|E|-
 LS Flags: 0x6
 LS Type: summary-LSA
 Link State ID: 65.1.1.0 (summary Network Number)
 Advertising Router: 2.2.2.2
 LS Seq Number: 80000002
 Checksum: 0xed1f
 Length: 28
 Network Mask: /24
 TOS: 0 Metric: 4
 Summary Link States (Area 0.0.0.1)
 LS age: 468
 Options: 0x2 : *|-|-|-|-|-|E|-
 LS Flags: 0x11
 LS Type: summary-LSA
 Link State ID: 64.1.1.0 (summary Network Number)
 Advertising Router: 1.1.1.1
 LS Seq Number: 80000001
 Checksum: 0x1bf7
 Length: 28
 Network Mask: /24
 TOS: 0 Metric: 4
 LS age: 429
 Options: 0x2 : *|-|-|-|-|-|E|-
 LS Flags: 0x6
 LS Type: summary-LSA
 Link State ID: 64.1.1.0 (summary Network Number)
 Advertising Router: 2.2.2.2
 LS Seq Number: 80000002
 Checksum: 0xfa13
 Length: 28
 Network Mask: /24
 TOS: 0 Metric: 4

DELLSONiC# show ip ospf database asbr-summary
VRF Name: default
 OSPF Router with ID (1.1.1.1)
 ASBR-Summary Link States (Area 0.0.0.0)
 LS age: 38
 Options: 0x2 : *|-|-|-|-|-|E|-
 LS Type: summary-LSA
 Link State ID: 2.2.2.2 (AS Boundary Router address)
 Advertising Router: 1.1.1.1
 LS Seq Number: 80000001
 Checksum: 0x0b41
 Length: 28
 Network Mask: /0
 TOS: 0 Metric: 4

DELLSONiC# show ip ospf database external
VRF Name: default
 OSPF Router with ID (1.1.1.1)
 AS External Link States
LS age: 52
 Options: 0x2 : *|-|-|-|-|-|E|-
 LS Flags: 0x6
 LS Type: AS-external-LSA
 Link State ID: 25.1.1.1 (External Network Number)
 Advertising Router: 2.2.2.2
 LS Seq Number: 80000001
 Checksum: 0x0892
 Length: 36
 Network Mask: /32
 Metric Type: 2 (Larger than any link state path)
 TOS: 0
 Metric: 20
 Forward Address: 0.0.0.0
 External Route Tag: 0

DELLSONiC# show ip ospf database self-originate
VRF Name: default
 OSPF Router with ID (1.1.1.1)
 Router Link States (Area 0.0.0.0)
Link ID ADV Router Age Seq# CkSum Link count
1.1.1.1 1.1.1.1 777 0x80000004 0x7b42 1
 Net Link States (Area 0.0.0.0)
Link ID ADV Router Age Seq# CkSum
64.1.1.1 1.1.1.1 777 0x80000001 0x8581
 Summary Link States (Area 0.0.0.0)
Link ID ADV Router Age Seq# CkSum Route
65.1.1.0 1.1.1.1 816 0x80000001 0x0e04 65.1.1.0/24
 ASBR-Summary Link States (Area 0.0.0.0)
Link ID ADV Router Age Seq# CkSum
2.2.2.2 1.1.1.1 360 0x80000001 0x0b41
 Router Link States (Area 0.0.0.1)
Link ID ADV Router Age Seq# CkSum Link count
1.1.1.1 1.1.1.1 776 0x80000004 0x8d2e 1
 Net Link States (Area 0.0.0.1)
Link ID ADV Router Age Seq# CkSum
65.1.1.1 1.1.1.1 776 0x80000001 0x788d
 Summary Link States (Area 0.0.0.1)
Link ID ADV Router Age Seq# CkSum Route
64.1.1.0 1.1.1.1 816 0x80000001 0x1bf7 64.1.1.0/24

DELLSONiC# show ip ospf database network adv-router 1.1.1.1
VRF Name: default
 OSPF Router with ID (1.1.1.1)
 Net Link States (Area 0.0.0.0)
 LS age: 886
 Options: 0x2 : *|-|-|-|-|-|E|-
 LS Flags: 0x3
 LS Type: network-LSA
 Link State ID: 64.1.1.1 (address of Designated Router)
 Advertising Router: 1.1.1.1
 LS Seq Number: 80000001
Checksum: 0x8581
 Length: 32
 Network Mask: /24
 Attached Router: 1.1.1.1
 Attached Router: 2.2.2.2
 Net Link States (Area 0.0.0.1)
 LS age: 886
 Options: 0x2 : *|-|-|-|-|-|E|-
 LS Flags: 0x3
 LS Type: network-LSA
 Link State ID: 65.1.1.1 (address of Designated Router)
 Advertising Router: 1.1.1.1
 LS Seq Number: 80000001
 Checksum: 0x788d
 Length: 32
 Network Mask: /24
 Attached Router: 1.1.1.1
 Attached Router: 2.2.2.2
DELLSONiC# show ip ospf database opaque-link
VRF Name: default
 OSPF Router with ID (5.5.5.5)
 Link-Local Opaque-LSA (Area 0.0.0.0)
 LS age: 94
 Options: 0x66 : *|O|-|-|-|-|E|-
 LS Flags: 0x6
 LS Type: Link-Local Opaque-LSA
 Link State ID: 3.0.0.0 (Link-Local Opaque-Type/ID)
 Advertising Router: 3.3.3.3
 LS Seq Number: 80000001
 Checksum: 0x4a24
 Length: 44


檢視 OSPF 路由資訊

 
show ip ospf [ vrf vrf-name ] route
 
  • VRF 名稱 - VRF 名稱

範例:

 
DELLSONiC# show ip ospf vrf Vrf1 route | no-more
VRF Name: Vrf1
============ OSPF network routing table ============
N 101.1.1.0/24 [10] area: 0.0.0.0
 directly attached to Vlan101
============ OSPF router routing table =============
============ OSPF external routing table ===========
 

OSPFv2 順利重新開機


重新啟動參與 OSPF 的路由器時,會有一段時間流量丟失,直到路由器重新連線並重新學習路由。

RFC 3623 指定了 OSPF 的順利重啟增強功能,如下所示:
  • 嘗試正常重啟的路由器發起鏈路本地 Opaque-LSA (Grace-LSA),宣佈其打算在指定的時間或寬限期內執行正常重啟。
  • 在寬限期內,鄰居繼續在其 LSA 中宣佈重新啟動路由器,就好像它完全相鄰(即 OSPF 鄰居狀態為“完全”),但前提是網路拓撲保持靜態(即,鏈路狀態資料庫中具有 LS 類型 1 到 5 且 7 的 LSA 內容保持不變, 並允許定期刷新)。

順利重啟允許重啟路由器通知其鄰居它將重啟。當鄰居被告知狀況時,它們會繼續將流量轉發到重新啟動節點。由於重啟節點的轉發表在正常重啟期間保留,因此避免了流量丟失。


排定性服務中斷


Enterprise SONiC 僅在計畫內服務中斷時才支援 OSPF 順利重啟。

已為 OSPF 實例啟用正常重啟。系統暖重新開機是使用暖重新開機命令觸發。


重新啟動和協助程式節點


通過順利重啟,有兩種類型的設備參與 OSPF 網路。它們是重新啟動和幫助程序節點。

重新啟動節點是正常重新啟動而不會丟失流量的設備。當重新啟動節點執行正常重啟時,它會在所有 OSPF 介面上泛洪鏈路本地不透明 LSA (grace-LSA)。這些寬限 LSA 通知幫助路由器鄰居打算重新啟動。

幫助程式節點可説明重新啟動節點,以便不會丟失流量。幫助程式節點監視網路的拓撲更改。如果網路中沒有更改,幫助程式將繼續通告其 LSA,就好像重新啟動節點一直處於連續的 OSPF 操作中一樣。説明程式 LSA 繼續在網段上列出與重新啟動節點的鄰接關係,而不考慮重新啟動節點的同步狀態。


設定 OSPFv2 順利重新開機


若要設定順利重啟,請按照下列步驟操作:

1.啟用順利重新開機。
 
DELLSONiC(config-router-ospf)# graceful-restart [grace-period grace-period]
 
  • 寬限期 - 鄰居或説明者認為重新啟動節點失效的寬限期。範圍為 1 到 1800 秒。默認寬限期為 120 秒

2.配置 OSPFv2 不透明功能,以説明重新啟動路由器啟動寬限 LSA。
 
DELLSONiC (config-router-ospf)# capability opaque

3.在系統上為所有或特定路由器 ID 設定 OSPFv2 順利重啟助手。在用於幫助重新啟動路由器的所有節點上執行此操作。
 
DELLSONiC (config-router-ospf)# graceful-restart helper enable [router-id]
 
  • 路由器ID — 使用路由器ID為特定鄰居配置平穩重新啟動幫助程序支援。

4.(選擇性)在幫助程序節點上配置寬限時間。此配置確定幫助程式支援正常重啟的時間段。
 
DELLSONiC (config-router-ospf)# graceful-restart helper supported-grace-time grace-time
 
  • 寬限時間 — 配置寬限時間。範圍為 10 到 1800 秒。預設值為 120 秒。

5.(選擇性)在說明程式節點上設定嚴格的 LSA 檢查。如果配置了此命令,則説明程式會在發生 LSA 更改時取消正常重啟,這會影響重啟路由器。嚴格 LSA 檢查預設為啟用。
 
DELLSONiC (config-router-ospf)# graceful-restart helper strict-lsa-checking

6.(選擇性)僅為計劃的重新啟動配置幫助程序支援。
 
DELLSONiC (config-router-ospf)# graceful-restart helper planned-only
 

檢視 OSPFv2 順利重新開機資訊


使用以下命令查看順利重新啟動幫助程式資訊。

檢視一般 OSPF 資訊,包括是否已啟用順利重新開機和不透明功能。
 
sonic# show ip ospf
VRF Name: default
OSPF Routing Process, Router ID: 1.1.1.2
Supports only single TOS (TOS0) routes
This implementation conforms to RFC2328
RFC1583Compatibility flag is disabled
OpaqueCapability flag is enabled
Graceful-Restart is enabled
Stub router advertisement is configured
 Enabled for 600s after start-up
Initial SPF scheduling delay 0 millisec(s)
Minimum hold time between consecutive SPFs 50 millisec(s)
Maximum hold time between consecutive SPFs 5000 millisec(s)
Hold time multiplier is currently 1
SPF algorithm last executed 19h39m37s ago
Last SPF duration 72320 usecs
SPF timer is inactive
LSA minimum interval 5000 msecs
LSA minimum arrival 0 msecs
Write Multiplier set to 20
Refresh timer 10 secs
Maximum multiple paths(ECMP) supported 256
Number of external LSA 0. Checksum Sum 0x00000000
Number of opaque AS LSA 0. Checksum Sum 0x00000000
Number of areas attached to this router: 1
Area ID: 0.0.0.0 (Backbone)
 Number of interfaces in this area: Total: 224 , Active: 224
 Number of fully adjacent neighbors in this area: 32
 Area has simple password authentication
 SPF algorithm executed 247 times
 Number of LSA 6068
 Number of router LSA 6. Checksum Sum 0x00020692
 Number of network LSA 62. Checksum Sum 0x001ab353
 Number of summary LSA 6000. Checksum Sum 0x0bc36229
 Number of ASBR summary LSA 0. Checksum Sum 0x00000000
 Number of NSSA LSA 0. Checksum Sum 0x00000000
 Number of opaque link LSA 0. Checksum Sum 0x00000000
 Number of opaque area LSA 0. Checksum Sum 0x00000000

檢視 OSPF 芳鄰資訊和有關順利重啟說明程式的詳細資料。
 
sonic# show ip ospf neighbor detail
Neighbor 13.13.13.13, interface address 192.168.10.1
 In the area 0.0.0.0 via interface Ethernet64
 Neighbor priority is 1, State is Full, 6 state changes
 Most recent state change statistics:
 Progressive change 17h32m19s ago
 DR is 192.168.10.1, BDR is 192.168.10.2
 Options 66 *|O|-|-|-|-|E|-
 Dead timer due in 0.717s
 Database Summary List 0
 Link State Request List 0
  Link State Retransmission List 0
 Thread Inactivity Timer on
 Thread Database Description Retransmision off
 Thread Link State Request Retransmission on
 Thread Link State Update Retransmission on
 Graceful restart Helper info:
 Graceful Restart HELPER Status: Inprogress
 Graceful Restart grace period time: 250 (seconds).
 Graceful Restart reason: Software restart

檢視 OSPF 順利重新開機協助程式資訊。
 
sonic# show ip ospf graceful-restart helper
 VRF Name: default
 OSPF Router with ID (14.14.14.14)
 Graceful restart helper support enabled.
 Strict LSA check is enabled.
 Helper supported for planned restarts only.
 Supported Graceful restart interval: 1600(in seconds).
 Enable Router List:
 ['13.13.13.13']

檢視 OSPF 詳細順利重啟協助程式資訊。
 
sonic# show ip ospf graceful-restart helper detail
 VRF Name: default
 OSPF Router with ID (14.14.14.14)
 Graceful restart helper support enabled.
 Strict LSA check is enabled.
 Helper supported for planned restarts only.
 Supported Graceful restart interval: 1600(in seconds).
 Enable Router List:
 ['13.13.13.13']
 Number of Active neighbours in graceful restart: 4
 Neighbour 1:
 Address: 192.168.10.1
 Routerid: 13.13.13.13
 Received Grace period: 250(in seconds).
 Actual Grace period: 250(in seconds).
 Remaining GraceTime: 245(in seconds).
 Graceful Restart reason: Software restart.
 Neighbour 2:
 Address: 192.168.20.1
 Routerid: 13.13.13.13
 Received Grace period: 250(in seconds).
 Actual Grace period: 250(in seconds).
 Remaining GraceTime: 245(in seconds).
 Graceful Restart reason: Software restart.
 Neighbour 3:
 Address: 192.168.30.1
 Routerid: 13.13.13.13
 Received Grace period: 250(in seconds).
 Actual Grace period: 250(in seconds).
 Remaining GraceTime: 245(in seconds).
 Graceful Restart reason: Software restart.
 Neighbour 4:
 Address: 192.168.40.1
 Routerid: 13.13.13.13
 Received Grace period: 250(in seconds).
 Actual Grace period: 250(in seconds).
 Remaining GraceTime: 245(in seconds).
 Graceful Restart reason: Software restart.

Affected Products

Enterprise SONiC Distribution, PowerSwitch N3000 Series, PowerSwitch S5212F-ON, PowerSwitch S5224F-ON, PowerSwitch S5232F-ON, PowerSwitch S5248F-ON, PowerSwitch S5296F-ON, PowerSwitch Z9264F-ON, PowerSwitch Z9332F-ON
Article Properties
Article Number: 000218990
Article Type: How To
Last Modified: 29 Feb 2024
Version:  1
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.