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 路由,請輸入目的地位址首碼和下列選用值:
|
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 路由,請輸入目的地位址前置詞和下列選用值:
|
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.