Dell Networking SONiC IPv4 and IPv6 Static Routes

Samenvatting: This article explains about configuring static routes in the 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

Prerequisites of the article

This article uses a switch running Dell SONiC 4.1. We are using standard interface naming in the configuration. To know more regarding various interface naming modes in Dell SONiC, see Dell article 202172 Dell Networking S-Series: Basic Interface Configuration - SONiC 4.0


Index

Introduction
IPv4 Static Route IPv6 Static Route

Introduction

Configure fixed, static routes to ensure that routed traffic can be exchanged with a specified destination device. For example, use a static route as a backup in case a dynamic route is not available, or to reach a network gateway if no other route is available.

Design Suggestions for static route:
  • Ensure that there are no overlapping static routes in the same VRF
  • Next hop reachability must be ensured for routing traffic 
 

IPv4 Static Route

Configuration syntax:
 
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]

Explanation:
To configure a static IPv4 route, enter the destination address prefix and these optional values:
  • (Optional) vrf vrf-name - Enter the name of the VRF instance in which you want to configure a static route. For management VRF, use mgmt.
  • dest-prefix - Enter the IPv4 prefix of the destination device. Enter an IPv4 prefix in the format A.B.C.D/mask, where mask is an IPv4 prefix-mask number from 1 to 32; for example, 10.10.10.0/24.
  • (Optional) next-hop-ip - Enter a next-hop IPv4 address as the gateway for the destination prefix.
  • (Optional) interface interface-type interface-number - Specify the switch interface through which statically routed IPv4 traffic passes to the destination, where interface-type interface-number is one of these values:
    • interface Eth slot/port[/breakout-port]
    • interface PortChannel portchannel-number
    • interface Vlan vlan-id
    • interface Loopback number
    • interface Management 0
  • (Optional) blackhole - Blocks traffic from a suspected source or a denial of service (DoS) attack by dynamically routing the traffic to a destination device or a data collection device.
    • (Optional) nexthop-vrf vrf-name - Enter the name of the VRF instance used on the next-hop device if the previously specified VRF or interface is in a different VRF. For management VRF, use mgmt. Use this parameter to configure static route leaking.
    • (Optional) tag tag-name - Enter a tag number to use to match the route in route maps, from 1 to 4294967295.
    • (Optional) track id - Enter an ID number to track the route to evaluate performance in Service Level Agreements (SLAs), from1 to 255.
    • (Optional) dest-metric - Enter the number that determines the precedence of routing paths, from 1 to 255 - the lower the number, the higher the route precedence. The static route default is 1.


IPv4 Sample Configuration

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
 

Verify IPv4 Static Routes 

Use command show ip route static or show ip route to see IPv4 static route in default routing table.

Use command show ip route vrf <VRF-NAME> or show ip route vrf <VRF-NAME> static to see IPv4 static route in default routing table.
 
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 Static Route

Configuration syntax:
 
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]

Explanation:
To configure a static IPv6 route, enter the destination address prefix and these optional values:
  • (Optional) vrf vrf-name - Enter the name of the VRF instance in which you want to configure a static route. For management VRF, use mgmt.
  • dest-prefix - Enter the IPv6 prefix of the destination device. Enter an IPv6 prefix in the format x:x:x:x:x:x:x:x/mask, where mask is an IPv6 prefix-mask number is from 1 to 128; for example, 2001:db8:1234:0000::/64.
  • (Optional) next-hop-ip - Enter a next-hop IPv6 address as the gateway for the destination prefix.
  • (Optional) interface interface-type interface-number - Specify the switch interface through which statically routed IPv4 traffic passes to the destination, where interface-type interface-number is one of these values:
    • interface Eth slot/port[/breakout-port]
    • interface PortChannel portchannel-number
    • interface Vlan vlan-id
    • interface Loopback number
    • interface Management 0
  • (Optional) blackhole - Blocks traffic from a suspected source or a denial of service (DoS) attack by dynamically routing the traffic to a destination device or a data collection device.
  • (Optional) nexthop-vrf vrf-name - Enter the name of the VRF instance used on the next-hop device if the previously specified VRF or interface is in a different VRF. For management VRF, use mgmt. Use this parameter to configure static route leaking.
  • (Optional) tag tag-name - Enter a tag number to use to match the route in route maps, from 1 to 4294967295.
  • (Optional) track id - Enter an ID number to track the route to evaluate performance in Service Level Agreements (SLAs), from1 to 255.
  • (Optional) dest-metric - Enter the number that determines the precedence of routing paths, from 1 to 255 - the lower the number, the higher the route precedence. The static route default is 1.
 

IPv6 Sample Configuration

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
 

Verify IPv6 Static Routes 

Use command show ipv6 route static or show ip route to see IPv6 static route in default routing table.

Use command show ipv6 route vrf <VRF-NAME> static to see IPv6 static route in default routing table.
 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

Extra informatie

Refer to this video:

Configure Static Routes on SONiC

Duration: 00:02:22 (hh:mm:ss)
When available, closed caption (subtitles) language settings can be chosen using the CC icon on this video player.

You can also view this video on YouTube.

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.