Objective

This article provides instructions on how to configure IPv4 static routes on the switch through the web-based utility.

Introduction

Static routing refers to the configuration of the path selection of routers. This type of mechanism takes place in the absence of communication between routers regarding the current topology of the network and thus, manually configuring routes to the routes table on the switch is recommended. Static routes help reduce the overhead on the switch CPU. This feature also allows you to deny access to certain networks.

When routing traffic, the next hop is decided on according to the longest prefix match (LPM) algorithm. A destination IPv4 address may match multiple routes in the IPv4 Static Route Table. The device uses the matched route with the highest subnet mask, that is, the longest prefix match. If more than one default gateway is defined with the same metric value, the lowest IPv4 address from among all the configured default gateways is used.

Note: For instructions on how to configure IPv4 static routes settings on the switch through the CLI, click here.

Applicable Devices | Firmware Version

- Sx300 | 1.4.8.06 (Download latest)

- Sx350 | 2.3.0.130 (Download latest)

- SG350X | 2.3.0.130 (Download latest)

- Sx500 | 1.4.8.06 (Download latest)

Configure IPv4 Static Routes

You cannot configure a static route through a directly‑connected IP subnet where the device gets its IP address from a DHCP server. To configure a static IPv4 interface on the switch, click here for instructions.

Step 1. Log in to the web-based utility of the switch then choose IP Configuration >IPv4 Management and Interfaces > IPv4 Static Routes.

Note: The available menu options may vary depending on the device model. In this example, SG350X-48MP is used.

The following fields are displayed in the IPv4 Static Routes Table:

- Destination IP Prefix - Destination IP address prefix.

- Prefix Length - IP route prefix for the destination IP.

- Route Type - Whether the route is a reject or remote route.

- Next Hop Router IP Address - The next hop IP address or IP alias on the route.

- Metric - Cost of this hop. A lower value is recommended.

- Outgoing Interface - Outgoing interface for this route.

Note: Defining an IP SLA object tracking ID for a routing entry checks connectivity to a remote network via the specified next hop. If there is no connectivity, the object track status will be set to Down and the router will be removed from the Forwarding table.

Step 2. Click Add to add a new static route.

Step 3. Enter the destination IP address prefix in the Destination IP Prefix field.

Note: In this example, 192.168.1.0 is used.

Step 4. In the Mask area, choose from the following options:

- Network Mask - The IP route mask for the destination IP. If this option is chosen, enter the subnet mask in the Network Mask field.

- Prefix Length - The IP route prefix for the destination IP. If this option is chosen, enter the number of bits of route network address in the Prefix Length field.

Note: In this example, Prefix Length is chosen and 24 is entered. This translates to the 255.255.255.0 network mask.

Step 5. Click a Route Type from the following options:

- Reject - Rejects the route and stops routing to the destination network via all gateways. This ensures that if a frame arrives with the destination IP of this route, it is dropped. Choosing this option disables the Next Hop IP Address, Metric and IP SLA Track controls.

- Remote - Indicates that the route is a remote path. If this option is chosen, skip to Step 8.

Note: In this example, Remote is chosen.

Step 6. (Optional) In the Next Hop Router IP Address field, enter the next hop IP address or the IP alias on the route.

Note: In this example, 192.168.100.1 is entered.

Step 7. (Optional) In the Metric area, click on the radio button to define the administrative distance to the next hop. The options are:

- Use Default - The default value is 4.

- User Defined - If this option is chosen, enter the administrative distance in the corresponding field. The range is one to 255.

Note: In this example, User Defined is chosen and 2 is used.

Step 8. Click Apply then click Close.

Note: In this example, a static route to 192.168.1.0 network is established through 192.168.100.0. The defined administrative distance is 2. The route goes to a router with IP address 192.168.100.1.

Step 9. Click Save to save the settings to the startup configuration file.

You have now successfully configured the IPv4 static routes settings on your switch.