Home >

LunaSH Command Reference Guide > LunaSH Commands > network > network route add

network route add

Add a manually configured network route to the current configuration. This command should be used only on the advice of a network administrator.

Syntax

network route add <routetype> <IP_address> -device <netdevice> [-metric <metric>] [-netmask <IP_or_prefixlength>] [-gateway <IP_address>] [-force] [-ipv6]

Option Shortcut Description
<routetype>  

Specifies the type of route (network or host) you want to add.

Valid values: host, network

<IP_address>  

Specifies the IP address of the network or host you want to add to the routing table.

You can specify an IPv4 or IPv6 address. If you are configuring an IPv6 address, you must also include the -ipv6 flag in the command.

When entering an IPv6 address, you can use full or shorthand syntax. For example, the following notations are equivalent:

2001:0db3:8ba3:0000:0000:8a5e:03f0:7384

2001:db3:8ba3::8a5e:3f0:7384

-device <netdevice> -d

Specifies the network device to which you want to add the route.

Valid values: eth0, eth1

-force -f Force the action without prompting
-gateway <IP_address> -g

Specifies the gateway/router IP address if this is not a locally-connected network or host.

-ipv6 -i Specifies that the route you are adding uses IPv6 addressing.
-metric <metric> -m

Specifies the routing metric to use for the route.

Range: 0 to 65535

Default: 0

-netmask <IP_or_prefixlength> -n

Specifies the network mask for the route.

Include this option only if you are adding a network route. If not specified, the default netmask is used.

If you are configuring an IPv4 route, you must specify the network mask in dotted-decimal format (for example, 255.255.255.0)

If you are configuring an IPv6 route, you must specify the prefix length (for example, 64).

Default:

<routetype> = network

IPv4: 255.255.255.0

IPv6: 64

<routetype> = host

IPv4: 255.255.255.255

IPv6: 128

Example

lunash:>network route add network 2001:2:3:4:: -device eth1 -netmask 64 -gateway 2018:1:2:3::bbbb -ipv6
 
 
NOTICE: The network service must be restarted for new network settings to take effect.
If you are sure that you wish to restart the network, then type 'proceed', otherwise type 'quit'
 
> proceed
Proceeding...
Restarting network service...
Shutting down interface eth0:                              [  OK  ]
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface eth1:                                [  OK  ]
Routing table successfully updated.
 
Command Result : 0 (Success)