Dell Networking SONiC IPv4 和 IPv6 靜態路由

Samenvatting: 本文說明如何在 Dell SONiC Management Framework CLI 中設定靜態路由。

Dit artikel is van toepassing op Dit artikel is niet van toepassing op Dit artikel is niet gebonden aan een specifiek product. Niet alle productversies worden in dit artikel vermeld.

Instructies

文章先決條件

本文使用執行 Dell SONiC 4.1 的交換器。我們在組態中使用標準介面命名。如需進一步瞭解 Dell SONiC 中的各種介面命名模式,請參閱Dell 202172 Dell Networking S 系列文章:基本介面組態 - SONiC 4.0

 

指數

介紹
IPv4 靜態路由 IPv6 靜態路由  

簡介

設定固定式靜態路由,以確保路由的流量可與指定的目的地裝置交換。例如,如果無法使用動態路由,請使用靜態路由作為備份,或如果沒有其他路由可用,則可以連線至網路閘道。

靜態路由的設計建議:
  • 請確定相同 VRF 中沒有重複的靜態路由
  • 必須確保下一個躍點連線能力才能佈線流量
 

IPv4 靜態路由

組態語法:
 
admin@sonic:~$ sonic-cli
sonic# configure
sonic(config)# ip route [vrf vrf-name] dest-ip-prefix {next-hop-ip [interface interfacetype interface-number] | interface interface-type interface-number | blackhole} [nexthopvrf vrf-name] [tag tag-name] [track id] [dest-metric]

解釋:
若要設定靜態 IPv4 路由,請輸入目的地位址首碼和下列選用值:
  • (選用) vrf vrf-name -輸入您要設定靜態路由的 VRF 實例名稱。若為管理 VRF,請使用管理。
  • dest-prefix -輸入目的地裝置的 IPv4 前置詞。輸入 A.B.C.D/mask 格式的 IPv4 前置詞,其中遮罩是 IPv4 前置詞遮罩,從 1 到 32;例如:10.10.10.0/24。
  • (選用) 下一個躍點 ip - 輸入下一跳 IPv4 位址作為目的地前置詞的閘道。
  • (選用) 介面介面類別型介面號碼 -指定以靜態路由 IPv4 流量傳遞至目的地的交換器介面,其中介面類別型介面號碼為下列值之一:
    • 介面 Eth 插槽/埠 [/breakout-port]
    • 介面 PortChannel portchannel-number
    • 介面 Vlan vlan-id
    • 介面回路回復號碼
    • 介面管理 0
  • (選用) 黑孔- 動態將流量路由至目的地裝置或資料收集裝置,以封鎖來自可疑來源的流量或拒絕服務 (DoS) 攻擊。
    • (選用) nexthop-vrf vrf-name - 如果先前指定的 VRF 或介面位於不同的 VRF,請輸入下一跳裝置上使用的 VRF 實例名稱。若為管理 VRF,請使用管理。使用此參數設定靜態路由洩漏。
    • (選用) 標籤名稱- 輸入標籤編號以符合路由圖中的路由,從 1 到 4294967295。
    • (選用) 追蹤 ID - 輸入 ID 編號以追蹤評估服務層級協定 (SLA) 效能的途徑,從 1 到 255。
    • (選用) 取消指標- 輸入決定路由路徑優先順序的數位,從 1 到 255 - 數量越低,路由優先順序越高。靜態路由預設值為 1。


IPv4 範例組態

admin@sonic:~$ sonic-cli 
sonic# configure
sonic(config)# ip route 6.6.6.6/32 5.5.5.1
sonic(config)# ip route 7.7.7.7/32 blackhole 100
sonic(config)# ip route 4.4.4.0/24 4.4.4.1 nexthop-vrf Vrf-GREEN 200
sonic(config)# ip route vrf Vrf-RED 3.3.3.0/24 10.0.0.2 nexthop-vrf Vrf-GREEN
sonic(config)# ip route vrf Vrf-RED 8.8.8.0/24 interface Eth1/4 nexthop-vrf Vrf-GREEN 36
 

驗證 IPv4 靜態路由 

使用命令顯示 ip 路由靜態顯示 ip 路由,以在預設路由表中查看 IPv4 靜態路由。

使用命令show ip route vrf show ip route vrf static查看預設路由表中的 IPv4 靜態路由。
 
sonic# show ip route static
Codes:  K - kernel route, C - connected, S - static, B - BGP, O - OSPF
        > - selected route, * - FIB route, q - queued route, r - rejected route
       Destination        Gateway                                                                    Dist/Metric   Last Update
--------------------------------------------------------------------------------------------------------------------------------
 S>*   4.4.4.0/24         via 4.4.4.1                     Eth1/6(vrf Vrf-GREEN)                      200/0         00:54:46 ago
 S>*   6.6.6.6/32         via 5.5.5.1                     Eth1/5                                     1/0           01:09:10 ago
 S>*   7.7.7.7/32         Unreachable (blackhole)                                                    100/0         01:23:19 ago
sonic# show ip route vrf Vrf-RED
Codes:  K - kernel route, C - connected, S - static, B - BGP, O - OSPF
        > - selected route, * - FIB route, q - queued route, r - rejected route
       Destination        Gateway                                                                    Dist/Metric   Last Update
--------------------------------------------------------------------------------------------------------------------------------
 S>*   3.3.3.0/24         via 10.0.0.2                    Eth1/9(vrf Vrf-GREEN)                      1/0           00:00:17 ago
 S>*   8.8.8.0/24         Direct                          Eth1/4(vrf Vrf-GREEN)                      36/0          01:00:35 ago
 

IPv6 靜態路由

組態語法:
 
admin@sonic:~$ sonic-cli
sonic# configure
sonic(config)# ipv6 route [vrf vrf-name] dest-ipv6-prefix {next-hop-ipv6 [interface interface-type interface-number] | interface interface-type interface-number | blackhole} [nexthop-vrf vrf-name] [tag tag-name] [track id] [dest-metric]

解釋:
若要設定靜態 IPv6 路由,請輸入目的地位址前置詞和下列選用值:
  • (選用) vrf vrf-name - 輸入您要設定靜態路由的 VRF 實例名稱。若為管理 VRF,請使用管理。
  • dest-prefix -輸入目的地裝置的 IPv6 前置詞。以 x:x:x:x:x:x:x:x:x:x/mask 的格式輸入 IPv6 前置詞,其中遮罩是 IPv6 前置詞遮罩,從 1 到 128;例如,2001:db8:1234:0000::/64。
  • (選配) next-hop-ip -輸入下一跳 IPv6 位址作為目的地前置詞的閘道。
  • (選用) 介面介面類別型介面號碼 - 指定以靜態路由的 IPv4 流量傳遞至目的地的交換器介面,其中介面類別型介面號碼為下列值之一:
    • 介面 Eth 插槽/埠 [/breakout-port]
    • 介面 PortChannel portchannel-number
    • 介面 Vlan vlan-id
    • 介面回路回復號碼
    • 介面管理 0
  • (選配) 黑孔 -動態將流量路由至目的地裝置或資料收集裝置,以封鎖來自可疑來源或拒絕服務 (DoS) 攻擊的流量。
  • (選用) nexthop-vrf vrf-name -如果先前指定的 VRF 或介面為不同的 VRF,請輸入下一跳裝置上使用的 VRF 實例名稱。若為管理 VRF,請使用管理。使用此參數設定靜態路由洩漏。
  • (選用) 標籤名稱- 輸入標籤編號以符合路由圖中的路由,從 1 到 4294967295。
  • (選用) 通路 ID -輸入 ID 編號以追蹤評估服務層級協定 (SLA) 效能的途徑,從 1 到 255。
  • (選用) 取消指標- 輸入決定路由路徑優先順序的數位,從 1 到 255 - 數量越低,路由優先順序越高。靜態路由預設值為 1。
 

IPv6 範例組態

admin@sonic:~$ sonic-cli
sonic# configure
sonic(config)# ipv6 route 3030::3300/120 3030::3301 36
sonic(config)# ipv6 route 2001:db6::/32 interface Eth1/7 150
sonic(config)# ipv6 route 2006::/24 blackhole 200
sonic(config)# ipv6 route vrf Vrf-RED 1001::/24 interface Eth1/4 nexthop-vrf Vrf-GREEN 20
sonic(config)# ipv6 route vrf Vrf-RED 1002::/24 interface Eth1/2 nexthop-vrf Vrf-GREEN 50
 

確認 IPv6 靜態路由 

使用命令顯示 ipv6 路由靜態顯示 ip 路由,以在預設路由表中查看 IPv6 靜態路由。

使用命令show ipv6 route vrf 靜態,以在預設路由表中查看 IPv6 靜態路由。
 sonic# show ipv6 route static
Codes:  K - kernel route, C - connected, S - static, B - BGP, O - OSPF
        > - selected route, * - FIB route, q - queued route, r - rejected route
       Destination                                 Gateway                                                                                          Dist/Metric   Last Update
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 S>*   2001:db6::/32                               Direct                                                 Eth1/7                                    150/0         00:01:07 ago
 S>*   2006::/24                                   Unreachable (blackhole)                                                                          200/0         00:19:06 ago
 S     3030::3300/120                              via 3030::3301                                                                                   36/0          00:08:52 ago
sonic# show ipv6 route vrf Vrf-RED static
Codes:  K - kernel route, C - connected, S - static, B - BGP, O - OSPF
        > - selected route, * - FIB route, q - queued route, r - rejected route
       Destination                                 Gateway                                                                                          Dist/Metric   Last Update
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 S>*   1001::/24                                   Direct                                                 Eth1/4(vrf Vrf-GREEN)                     20/0          00:14:44 ago
 S>    1002::/24                                   Direct                                                 Eth1/2(vrf Vrf-GREEN)                     50/0          00:14:30 ago

Getroffen producten

Enterprise SONiC Distribution, PowerSwitch E3200-ON Series, Dell EMC Networking N3200-ON, PowerSwitch S5212F-ON, PowerSwitch S5224F-ON, PowerSwitch S5232F-ON, PowerSwitch S5248F-ON, PowerSwitch S5296F-ON, PowerSwitch Z9100-ON, PowerSwitch Z9264F-ON , PowerSwitch Z9332F-ON, PowerSwitch Z9432F-ON ...
Artikeleigenschappen
Artikelnummer: 000218054
Artikeltype: How To
Laatst aangepast: 25 jun. 2025
Versie:  5
Vind antwoorden op uw vragen via andere Dell gebruikers
Support Services
Controleer of uw apparaat wordt gedekt door Support Services.