SYNOPSIS
Adding a Route
route [-nqvC] add [-net|-host] [family]
destination[/bitmask] gateway [-link] [modifiers [args]]
Changing a Route
route [-nqv] change [-net|-host] [family]
destination gateway [-link] [modifiers [args]]
Deleting a Route
route [-nqvC] delete [-net|-host] [family]
destination[/bitmask] [-link] gateway [modifiers [args]]
Deleting All Routes
route [-nqvC] flush [family]
1 – FLAGS
-n Prints host and network names in numeric format instead of
symbolically when reporting actions.
-v Causes additional details to be printed.
-q Suppresses all output.
-C Forces route to use the old ioctl calls instead of the
current route server request path.
2 – DESCRIPTION
The route command is a program used to manually manipulate the
network routing tables. It normally is not needed, as a system
routing table management daemon, such as gated or routed, should
tend to this task.
The route command accepts these commands:
add Adds a route.
flush Removes all gateway entries from the routing tables. For
the inet6 family, it also removes all cloned routes. You
can choose to flush only those routes whose destinations
are of a given address family by specifying an optional
keyword (family) that specifies the address family.
delete Deletes a specific route.
change Changes aspects of a route (such as its gateway).
Unless the -net or -host parameters are specified on the
command line, route creates a host route or a network route by
interpreting the Internet address associated with destination
parameter. If the destination has a local address part of INADDR_
ANY, or if the destination is the symbolic name of a network, a
network route is created; otherwise, a host route is created.
For example, 128.32 is interpreted as -host 128.0.0.32,
128.32.130 is interpreted as -host 128.32.0.130; -net 128.32
is interpreted as 128.32.0.0, and -net 128.32.130 is interpreted
as 128.32.130.0.
All symbolic names specified for a destination or gateway are
looked up first as a hostname using gethostbyname(3). If this
lookup fails, getnet-byname(3) is then used to interpret the name
as that of a network.
Routes added with the route command are marked as RTF_STATIC
to differentiate them from routes added by the routing daemons
(gated or routed). The gated daemon does not remove the RTF_
STATIC routes when it is shut down.
The route command uses a routing socket and the new message types
RTM_ADD, RTM_DELETE, and RTM_CHANGE. As such, only a privileged
user may modify the routing tables.
3 – PARAMETERS
destination The destination host or network (with or
without the optional Classless Inter-Domain
Routing (CIDR) mask (/bitmask)).
gateway The next hop and gateway to which packets
should be addressed. Routes to a particular
host are distinguished from those to a
network by interpreting the Internet address
associated with destination.
[-net | -host] Forces the destination to be interpreted
as a network addres or as a host address,
respectively. Otherwise, if the destination
has a local address part of INADDR_ANY, 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.
For example, 128.32 is interpreted as -host
128.0.0.32, 128.32.130 is interpreted as -host
128.32.0.130; -net 128.32 is interpreted as
128.32.0.0, and -net 128.32.130 is interpreted
as 128.32.130.0.
[family] Specifies the optional address family of the
destination and gateway parameters. Possible
values are: -inet (the default) and -inet6.
If the -link parameter is not specified,
this also specifies the address family of
the gateway parameter.
[-link] Specifies that the gateway is a link layer
address. If the -link parameter is not
specified, the address family of the gateway
parameter is the same as the destination.
The optional modifiers -rtt, -rttvar, -sendpipe, -recvpipe, -
mtu, -hopcount, -expire, and -ssthresh provide initial values
to metrics maintained in the routing entry. These may be
individually locked by preceding each such modifier to be locked
by the -lock meta-modifier, or one can specify that all ensuing
metrics may be locked by the -lockrest meta-modifier.
The optional modifiers -reject and -blackhole specify route
behavior different from a normal route. A normal route allows
packets to be forwarded out on it. Packets sent to reject routes
are dropped and messages designating the route as unreachable
are sent to the packet originators. Packets sent to blackhole
routes are also dropped, but no notification is sent to the
packet originators. In both cases, you must specify 127.0.0.1
(localhost) as the gateway argument.
The -netmask mask option specifies the subnet mask to use for
the routing entry. Networks that use a nonstandard subnet must
include this option. Specify this option after any optional
modifiers. Do not specify this option if you specify a CIDR
bitmask (/bitmask).
If the flush command is specified, route will flush the routing
tables of all gateway entries. One can choose to flush only
those routes whose destinations are of a given address family by
specifying an optional keyword describing which address family.
4 – MODIFIERS
Modifiers provide initial values to metrics and other information
maintained in the routing entry. All modifiers and their
arguments are optional and must appear after the gateway field on
the command line. The modifiers for the add, change, and delete
commands are as follows:
-all Specifies that the kernel add or delete the specified
route on all interfaces (for example, tu0 and tu1) that
are in the same subnet as the gateway. Use this modifier
only with the add and delete modifiers. Do not use -all
with the -dev and -olddev modifiers.
-blackhole
Specifies that this route is a blackhole route.
Packets sent to blackhole routes are dropped, and no
notification is sent to the packet originators. This
is different from a normal route, which allows packets
to be forwarded out on it. You must specify 127.0.0.1
(localhost) as the gateway argument.
-cloning
Generates a new route on use of this route.
-dev device
Specifies the interface device (for example, tu0 and
fta0) to use in the routing entry. Use this modifier
when you want to designate a particular interface for a
route. If you do not specify this modifier, the route is
added on the first interface that is found.
-genmask mask
Specifies that the netmask mask is used for all routes
cloned from this route.
-hopcount count
Sets this route's maximum hopcount to count.
-iface | -interface
Specifies that this route is via an interface instead of
via a gateway (gateway is the default). This means the
destination is reachable directly via an interface; no
intermediate system is required. The gateway parameter
is the address of this host on the common network,
indicating the interface to be used for transmission.
-inet Sets this route's type as AF_INET. When used with
the delete or flush commands, only AF_INET routes are
deleted.
-inet6 Sets this route's type as AF_INET6. When used with
the delete or flush commands, only AF_INET6 routes are
deleted.
-iso Sets this route's type as AF_ISO. When used with
the delete or flush commands, only AF_ISO routes are
deleted.
-link Sets this route's type as AF_LINK. When used with
the delete or flush commands, only AF_LINK routes are
deleted.
- Specifies that this route contains valid link-layer
llinfo information.
-lock Locks the metric set by next modifier specified on the
command line in the routing entry. A locked metric is
not modified by the kernel. The following metrics can
be locked: mtu, hopcount, recvpipe, sendpipe, ssthresh,
rtt, and rttvar.
-lockrest
Locks the metrics set by all modifiers that follow on
the command line in the routing entry. A locked metric
is not modified by the kernel. The following metrics can
be locked: mtu, hopcount, recvpipe, sendpipe, ssthresh,
rtt, and rttvar.
-mtu size
Sets this route's maximum transmission unit (MTU), in
bytes, to size.
-netmask mask
Specifies the subnet mask to use for the routing entry.
Networks that use a nonstandard subnet must include
this modifier. Specify this modifier after any optional
modifiers. Do not specify this modifier if you specify
a CIDR bitmask (/bitmask). Do not specify this modifier
with the change command.
-nofragtopmtu
Specifies that fragment to path MTU size is disabled for
this route.
-nopmtudisc
Specifies that path MTU discovery is disabled for this
route.
-olddev device
Specifies the old interface device (for example, tu0
and fta0) in the routing entry that you want to change.
Use this modifier with the change command only to move a
route from one interface to another. See the "Examples"
section.
-oldgateway name
Specifies the old gateway in the routing entry that
you want to change. Use this modifier with the change
command only. See the "Examples" section.
-oldinterface
Specifies the old interface in the routing entry that
you want to change. Use this modifier with the change
command only.
-osi Sets this route's type as AF_ISO. When used with
the delete or flush commands, only AF_ISO routes are
deleted.
-precedence value
Sets the precedence of the route to value. Among
equivalent routes to the same destination, the route
with the lower precedence is preferred.
-recvpipe bandwidth
Sets this route's inbound delay bandwidth product (in
bytes) to bandwidth.
- Specifies that this route is a reject route. Packets
reject sent to reject routes are dropped and messages
designating the route as unreachable are sent to the
packet originators. This is different from a normal
route, which allows packets to be forwarded out on it.
You must specify 127.0.0.1 (localhost) as the gateway
argument.
-rtt time
Sets this route's round trip time (in microseconds) to
time.
-rttvar variance
Sets this route's round trip time variance (in
microseconds) to variance.
-sendpipe bandwidth
Sets this route's outbound delay bandwidth product (in
bytes) to bandwidth.
-ssthresh threshold
Sets this route's outbound gateway buffer limit (in
bytes) to threshold.
5 – RESTRICTIONS
You must be superuser in order to run the route command and to
modify the routing tables.
6 – EXAMPLES
1. To add gateway 128.32.0.130 as a default gateway, enter the
following command:
TCPIP> route add default 128.32.0.130
2. To add a route to host milan via gateway 128.32.0.130, enter
the following command:
TCPIP> route add -host milan 128.32.0.130
3. To delete an existing route via gateway 128.32.0.130 to host
milan, enter the following command:
TCPIP> route delete -host milan 128.32.0.130
4. To add a route with a precedence value of 1 to host milan via
gateway 128.32.0.130, enter the following command:
TCPIP> route add -precedence 1 -host milan 128.32.0.130
5. To change an existing route for host milan via gateway
128.32.0.130 to use a new gateway 128.32.10.101, enter the
following command:
TCPIP> route change -oldgateway 128.32.0.130 -oldinterface le0 \
-host milan 128.32.10.101
6. To add a route to network 212.232.32 via gateway 128.32.0.130,
enter the following command:
TCPIP> route add -net 212.232.32/22 128.32.0.130
7. To add an IPv6 route to network feco:10:50::/48 through the
configured tunnel interface ipt0, enter the following command:
TCPIP> route add -inet6 fec0:10:50::48 -inet6 fe80::a0a:2805 -dev ipt0
8. To add a route to network 212.232.32/22 via gateway
128.32.0.130 and lock the MTU size at 1500, enter the
following command:
TCPIP> route add -net 197.45.63/24 214.89.32.235 -lock -mtu 1500
9. To add a route to network 212.232.32/22 via gateway
128.32.0.130 and lock the MTU size and hop count, enter the
following command:
TCPIP> route add -net 197.45.63/24 214.89.32.235 -lockrest -mtu 1500 \
-hopcount 2
10. To change existing network route 206.98.17 via gateway
206.98.17.45 from using interface device tu0 to tu1, enter
the following command:
TCPIP> route change -net 206.98.17 206.98.17.45 -olddev tu0 -dev tu1
This assumes that interface device tu1 is configured with an
IP address in the same subnet as tu0.
11. To change existing network route 206.98.17 from using gateway
206.98.17.45 to 206.98.17.162, enter the following command:
TCPIP> route change -net 206.98.17 206.98.17.162 -oldgateway 206.98.17.45
12. To change existing network route 206.98.17 using interface
device tu0 and gateway 206.98.17.45 to use device tu1 and
gateway 206.98.17.162, enter the following command:
TCPIP> route change -net 206.98.17 206.98.17.162 -olddev tu0 -dev tu1 \
-oldgateway 206.98.17.45
13. To add a route to host 219.67.129.16 via gateway 219.67.122.41
using interface device tu1, enter the following command:
TCPIP> route add -host 219.67.129.16 219.67.122.41 -dev tu1
14. To delete a route to network 219.84.6 via gateway 219.84.6.79
using interface device fta0, enter the following command:
TCPIP> route delete -net 219.84.6 219.84.6.79 -olddev fta0
15. To add a route to host 202.54.164.79 via gateway 202.54.163.11
using all interfaces connected to the 202.54.163/24 subnet,
enter the following command:
TCPIP> route add -host 202.54.164.79 202.54.163.11 -all
7 – DIAGNOSTICS
Message Description
Add [host | network] %s: gateway %s options %x
The specified route is being added to the tables. If
the gateway address used was not the primary address of
the gateway (the first one returned by gethostbyname),
the gateway address is printed numerically as well as
symbolically.
Bitmask cannot be used with change command
The optional /bitmask parameter was specified with the
change command. Do not specify a bit mask with the change
command.
Change [ host | network ] %s: gateway %s oldgateway %s\
oldinterface %s
The specified route is being modified in the tables.
Delete [ host | network ] %s: gateway %s options %x
The specified route is being deleted from the tables. If
the gateway address used was not the primary address of
the gateway (the first one returned by gethostbyname),
the gateway address is printed numerically as well as
symbolically.
%s %s done
When you use the flush command, each routing table entry
deleted is indicated with a message of this form.
Entry exist
An add operation was attempted for an entry that already
exists in the routing tables.
Gateway must be 127.0.0.1 for reject and blackhole routes.
The gateway value is incorrect for creating reject and
blackhole routes.
Invalid bitmask
The bitmask specified is not in the range of 1 to 32,
inclusive.
Netmask cannot be used with bitmask.
The -netmask modifier was specified together with a CIDR
bit mask.
Netmask cannot be used with change command
The optional -netmask modifier was specified with the
change command. Do not specify a network mask with the
change command.
Network is 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 that was
not present in the tables.
Routing table overflow
An add operation was attempted, but the system was low on
resources and was unable to allocate memory to create the
new entry.
8 – FILES
SYS$SYSTEM:TCPIP$ROUTE
Specifies the command path.