set forwarding

Purpose

Configures IP routing, or forwarding of IP datagrams, between network interfaces. IP routing must be enabled to allow the Network Address Table (NAT) and port forwarding features to work properly.

The set forwarding command enables addition of static route entries to the IP routing table. Static routes instruct the device to route packets for a known destination host or network, to (through) a router or gateway different from the default gateway. They explicitly define the next “hop” from a router for a particular destination. This is sometimes necessary to communicate with hosts on a different subnet than the Digi device, or to provide a more direct or efficient route to such hosts than may be provided by using the default gateway or other routes.

Required privileges

For Digi products with two or more users, to use this command, permissions must be set to set permissions s‑router=read to display IP forwarding settings, and set permissions s‑router=rw to display and set forwarding settings. See set permissions for details on setting user permissions for commands.s

Syntax

Enable or disable IP forwarding:

set forwarding ipforwardingenabled={on|off}

Add a static route entry

Note that this command cannot be used to add, change or delete a default gateway entry; the default gateway is managed internally by the device.

To add a static route entry, all of the options must be entered.

set forwarding 
staticrouteindex={1-16}
action=add
enabled={on|off}
net=destination ip address
mask=subnet mask
gateway=ip address
metric={1-16}
interface=interface name

Change existing static route entries

The staticrouteindex and action parameters are required for all static route entry management commands.

set forwarding 
staticrouteindex={1-16}
action=change
[one or more additional static route options, listed above]
[mask=subnet mask]
[gateway=ip address]
[metric={1-16}]
[interface=interface name]

Delete a static route

set forwarding 
staticrouteindex={1-16}
action=delete

Enable a static route table entry

To enable a static route entry, all of the static-route options must be specified (on this or a previous command) and valid. That is, an entry can be enabled only if it is completely valid.

When a new entry is added or a change is made to a static route entry and that entry is enabled, the change is applied immediately to the IP routing table. If a static route entry is disabled or deleted, it is removed immediately from the IP routing table.

Display IP forwarding settings

show forwarding

Display the current active IP routing table

display route

Options

ipforwarding={on|off}

Enables or disables IP forwarding.

on

Enables IP forwarding.

off

Disables IP forwarding.

staticrouteindex={1-16}

Specifies which of the 8 static route table entries is to be acted upon.

action={add|change|delete}

Specifies the action to be performed on the selected static route table entry.

add

Add a new entry.

change

Change one or more options of an existing entry.

delete

Delete an entry, resetting all its options to defaults (empty).

enabled={on|off}

Enables or disables a static route table entry.

on

Enables an entry. All its options must be specified and valid to enable an entry. The enabled entry is immediately added to the device's IP routing table.

off

Disables an entry. If the entry was previously enabled and added to the device's IP routing table, that entry is immediately removed from the IP routing table.

net=destination ip address

Specifies the IP address of destination network or host to which the static route applies. This static route table entry defines how packets will be routed by the device when they are sent to the destination network or host.

mask=subnet mask

The subnetwork mask to be used for the static route, which is used in conjunction with the destination IP address. A subnetwork mask of 255.255.255.255 indicates that the destination IP address is a specific host rather than a network.

gateway=ip address

The IP address of the gateway for this static route. When the device routes packets that are destined for the specified destination IP address (host or network), those packets are sent to this gateway as their first “hop.”

metric={1-16}

Specifies the metric, or the “cost” to reach the destination. This is the “distance” in terms of number of “hops” for the routed packets to get to the destination.

interface=interface name

Specifies the name of the local network interface through which routed packets are sent for this static route. Valid interface names are: eth0, ppp2, ppp4, vpn0, vpn1, vpn2, vpn3, vpn4. To view the current list of interface names, enter a display netdevice command. For devices that support PPP interfaces, the actual PPP interface name may vary.

Examples

Enable IP forwarding

#> set forwarding ipforwarding=on

Add a static route entry

This command adds a static route for packets destined to hosts on the 10.10.0.0 network. These packets are sent through the eth0 interface to a local router 10.30.1.1. In this example, the device on which this static route is added has an IP address of 10.30.1.188, and the router 10.30.1.1 is on its local subnetwork.

#> set forwarding staticrouteindex=1 action=add enabled=on net=10.10.0.0 mask=255.255.0.0 gateway=10.30.1.1 metric=2 interface=eth0

See also