Manual Pages

Table of Contents


na_route - manually manipulate the routing table


route [ -fn ] add [ inet ] [ host|net ] destination [ &netmask|/prefixlen ] gateway metric

route [ -fn ] add [ inet ] default gateway metric

route [ -fn ] delete [ inet ] [ host|net ] destination

route [ -fn ] delete [ inet ] default

route [ -fn ] add inet6 [ prefixlen prefixlen ] [ host|net ] destination gateway metric

route [ -fn ] add inet6 default gateway metric

route [ -fn ] delete inet6 [ prefixlen prefixlen ] [ host|net ] destination

route [ -fn ] delete inet6 default

route -s [ inet|inet6 ]


route allows the system administrator to manually manipulate the network routing table for the specific host or network specified by destination. The gateway argument is the next-hop gateway to which packets should be addressed for the corresponding destination. The metric argument indicates the number of "hops" to the destination. The metric argument is required for the add command; it must be zero if the destination is on a directly-attached network, and non-zero if the route is via one or more gateways.

The optional inet keyword specifies the inet (Internet protocol version 4) address family routing table and causes route to expect addresses in that format for the rest of the command. The inet6 keyword specifies the inet6 (Internet protocol version 6) address family routing table and causes route to expect addresses in that format for the rest of the command. inet6 keyword is valid only if IPv6 is enabled on the filer. If neither is specified, inet is assumed.

The add command adds the specified route for the given destination to the routing table. The delete command deletes the specified route from the routing table.

Routes to a particular host are distinguished from those to a network by interpreting the Internet address associated with destination. The optional keywords net and host force the destination to be interpreted as a network or a host, respectively. Otherwise, if the destination has a "local address part" of INADDR_ANY (i.e., 0), or if the destination is the symbolic name of a network, then the route is assumed to be to a network; otherwise, it is presumed to be a route to a host. If the route is to a destination via a gateway, the metric parameter should be greater than 0. If metric is set to 0, the gateway given is the address of this host on the common network, indicating the interface to be used for transmission.

All symbolic names specified for a destination or gateway are looked up first as a host name in the /etc/hosts database. If this lookup fails, then the name is looked up as a network name in the /etc/networks database. "default" is also a valid destination, which is used if there is no specific host or network route.

For the inet address family the netmask for a route to a network is implicitly derived from the class of the network; to override that, the destination for a network route can have /bits or &mask after it, where bits is the number of high-order bits to be set in the netmask, or mask is the netmask (either as a number - defaults to decimal, precede with 0x for hexadecimal, precede with 0 for octal - or as an IP address, e.g. Thus the network 128.42.x.x may be specified by,,,, or For the inet6 address family use the prefixlen keyword and argument to specify the network mask.


Remove all gateway entries in the routing table. This option does not display the domain names or network numbers of the route entries that are deleted. If this is used in conjunction with one of the commands, route removes the entries before performing the command.

Prints host and network numbers rather than symbolic names when reporting actions.

Shows the routing tables.


The following messages and error commands may be output by the route command:

add|delete [ host|net ] destination: gateway gateway Confirmation of an add or delete command. May be followed by an error message if the command failed to complete successfully.

network unreachable
An attempt to add a route failed because the gateway listed was not on a directly-connected network. The next-hop gateway must be given.

not in table
A delete operation was attempted for an entry which wasn't present in the table.

entry already exists
An add operation was attempted for an existing route entry.

routing table overflow
An add operation was attempted, but the system was unable to allocate memory to create the new entry.

destination gateway done
When the -f flag is specified, each routing table entry deleted is indicated with a message of this form.


In takeover mode, each filer in a cluster maintains its own routing table. You can make changes to the routing table on the live filer, or your can make changes to the routing table on the failed filer using the route command in partner mode. However, the changes you make in partner mode are lost after a giveback.


When run from a vfiler context, (e.g. via the vfiler run command), route operates on the concerned vfiler. As currently all vfilers in an ipspace share a routing table, route operates on the routing table of the concerned vfiler's ipspace.


na_partner(1), na_routed(1), na_ipspace(1), na_vfiler(1)

Table of Contents