route(1M) route(1M)
NAME [Toc] [Back]
route - manually manipulate the routing tables
SYNOPSIS [Toc] [Back]
/usr/sbin/route [-f] [-n] [-p pmtu] add [net|host] destination
[netmask mask] gateway [count]
/usr/sbin/route inet6 [-f] [-n] [-p pmtu] add [net|host]
v6destination [ / prefix] v6gateway [count]
/usr/sbin/route [-f] [-n] delete [net|host] destination
[netmask mask] gateway [count]
/usr/sbin/route inet6 [-f] [-n] delete [net|host]
v6destination [ / prefix] v6gateway [count]
/usr/sbin/route -f [-n]
/usr/sbin/route inet6 -f [-n]
DESCRIPTION [Toc] [Back]
The route command manipulates the network routing tables manually.
You must have appropriate privileges.
Subcommands [Toc] [Back]
The following subcommands are supported.
add Add the specified host or network route to the
network routing table. If the route already
exists, a message is printed and nothing changes.
delete Delete the specified host or network route from
the network routing table.
Options and Arguments [Toc] [Back]
route recognizes the following options and arguments.
inet6 Specifies an IPv6 route. When this option is
used, the destination and the gateway must have
IPv6 addresses. When this option is not used, the
command defaults to an IPv4 route and the
destination and the gateway must have IPv4
addresses.
-f Delete all route table entries that specify a
remote host for a gateway. If this is used with
one of the subcommands, the entries are deleted
before the subcommand is processed.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: Sep 2004
route(1M) route(1M)
-n Print any host and network addresses in Internet
"dot" notation for IPv4 and in "colon" notation
for IPv6, except for the default network address,
which is printed as default.
-p pmtu Specifies a path maximum transmission unit (MTU)
value for a static route. The minimum value
allowed is 68 bytes for IPv4 and 1280 bytes for
IPv6; the maximum is the MTU of the outgoing
interface for this route. This option can be
applied to both host and network routes.
net The type of destination address. If this argument
or is omitted, routes to a particular host are
host distinguished from those to a network by
interpreting the Internet address associated with
destination. For IPv4, if the destination has a
local address part of INADDR_ANY(0), the route is
assumed to be to a network; otherwise, it is
treated as a route to a host. For IPv6, if the
destination has an address that is less than 128
bits, including any leading and trailing 0's, the
route is assumed to be a network; otherwise, it is
treated as a route to a host. An exception is the
IPv6 "Unspecified Address", typically represented
as ::, which is always interpreted as the default
network route.
destination (inet only) The destination host system where the
packets will be routed. destination can be one of
the following:
+ A host name (the official name or an
alias, see gethostent(3N)).
+ A network name (the official name or an
alias, see getnetent(3N)).
+ An Internet address in "dot" notation (see
inet(3N)).
+ The keyword default, which signifies the
wildcard gateway route (see routing(7)).
v6destination (inet6 only) The destination host system where the
packets will be routed. v6destination can be one
of the following:
+ A host name (the official name or an
alias, see getaddrinfo(3N)).
+ An IPv6 address in "colon" notation (see
inet6(3N)).
+ The keyword default, which signifies the
wildcard gateway route.
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: Sep 2004
route(1M) route(1M)
prefix (inet6 only) The prefix is an integer between 0
and 128 inclusive. It specifies how many of the
leftmost contiguous bits of the v6destination
address comprise the prefix. Its format is
similar to the CIDR notation in IPv4. A prefix of
0 would be a default route. If the prefix is
omitted when adding a network route, then the
prefix would be 64 by default. It is advisable to
specify the prefix when an IPv6 network route is
added. The prefix option can be applied to
network routes only.
netmask mask (inet only) The mask that will be bit-wise ANDed
with destination to yield a net address where the
packets will be routed. mask can be specified as
a single hexadecimal number with a leading 0x,
with a "dot-notation" Internet address, or with a
pseudo-network name listed in the network table
(see networks(4)). The length of the mask, which
is the number of contiguous 1's starting from the
left-most bit position of the 32-bit field, can be
shorter than the default network mask for the
destination address. (see routing(7)). If the
netmask option is not given, mask for the route
will be derived from the netmasks associated with
the local interfaces. (see ifconfig(1M)). mask
will be defaulted to the longest netmask of those
local interfaces that have the same network
address. If there is not any local interface that
has the same network address, then mask will
default to the default value of network mask of
destination.
gateway (inet only) The gateway through which the
destination is reached. gateway can be one of the
following:
+ A host name (the official name or an
alias, see gethostent(3N)).
+ An Internet address in "dot" notation (see
inet(3N)).
v6gateway (inet6 only) The gateway through which the
destination is reached. v6gateway can be one of
the following:
+ A host name (the official name or an
alias, see getaddrinfo(3N)).
+ An IPv6 address in "colon" notation (see
inet6(3N)).
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: Sep 2004
route(1M) route(1M)
count An integer that indicates whether the gateway is a
remote host or the local host. If the route leads
to a destination through a remote gateway, count
should be a number greater than 0. If the route
leads to destination and the gateway is the local
host, count should be 0. The default for count is
zero. The result is not defined if count is
negative.
Operation [Toc] [Back]
All symbolic names specified for a destination or gateway are looked
up first as a host name using gethostbyname() for IPv4 and
getaddrinfo() for IPv6; if the host name is not found, the destination
is searched for as a network name using getnetbyname() for IPv4 only.
destination and gateway can be in "dot" notation (see inet(3N)).
v6destination and v6gateway can be in "colon" notation (see
inet6(3N)).
If the -n option is not specified, any host and network addresses are
displayed symbolically according to the name returned by
gethostbyaddr() and getnetbyaddr(), respectively, except for the
default network address (printed as default) and addresses that have
unknown names. Addresses with unknown names are printed in Internet
"dot" notation (see inet(3N)).
If the -n option is specified, any host and network addresses are
printed in Internet "dot" notation except for the default network
address which is printed as default.
If the -f option is specified, route deletes all route table entries
that specify a remote host for a gateway. If it is used with one of
the subcommands described above, the entries are deleted before the
subcommand is processed.
Path MTU Discovery is a technique for discovering the maximum size of
an IP datagram that can be sent on an internet path without causing
datagram fragmentation in the intermediate routers. In essence, a
source host that utilizes this technique initially sends out datagrams
up to the the size of the outgoing interface. The Don't Fragment (DF)
bit in the IP datagram header is set. As an intermediate router that
supports Path MTU Discovery receives a datagram that is too large to
be forwarded in one piece to the next-hop router and the DF bit is
set, the router will discard the datagram and send an ICMP Destination
Unreachable message with a code meaning "fragmentation needed and DF
set". The ICMP message will also contain the MTU of the next-hop
router. When the source host receives the ICMP message, it reduces
the path MTU of the route to the MTU in the ICMP message. With this
technique, the host route in the source host for this path will
contain the proper MTU.
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: Sep 2004
route(1M) route(1M)
The -p pmtu option is useful only if you know the network environment
well enough to enter an appropriate pmtu for a host or network route.
IP will fragment a datagram to the pmtu specified for the route on the
local host before sending the datagram out to the remote. It will
avoid fragmentation by routers along the path, if the pmtu specified
in the route command is correct.
ping can be used to find the pmtu information for the route to a
remote host. The pmtu information in the routing table can be
displayed with the netstat -r command (see netstat(1)).
The loopback interface (lo0) is automatically configured when the
system boots with the TCP/IP software. For IPv4, the default IP
address and netmask of the loopback interface are 127.0.0.1 and
255.0.0.0, respectively. For IPv6, the default IP address and prefix
of the loopback interface are ::1 and 128, respectively.
When lo0 is configured, the 127.0.0.0 loopback route for IPv4 and the
::1 loopback route for IPv6 are set up automatically so that packets
for any 127.*.*.* address and ::1 will loop back to the local host.
Users cannot add or delete any 127.*.*.* or ::1 loopback routes.
IPv6 Operation [Toc] [Back]
The keyword inet6 is required for adding or deleting IPv6 routes.
Examples
add a direct IPv6 host route
route inet6 add 2345::1 4444::3
add an indirect IPv6 (sub)network route
route inet6 add net 2222::/64 4567::8 1
delete an indirect IPv6 (sub)network route
route inet6 delete net 2222::/64 4567::8 1
Output [Toc] [Back]
add destination: gateway gateway
The specified route is being added to the tables.
delete destination: gateway gateway
The specified route is being deleted from the tables.
Flags [Toc] [Back]
The values of the count and destination type fields in the route
command determine the presence of the G and H flags in the netstat -r
display and thus the route type, as shown in the following table.
Hewlett-Packard Company - 5 - HP-UX 11i Version 2: Sep 2004
route(1M) route(1M)
Count Destination Type Flags Route Type
_________________________________________________________________
=0 network U Route to a network directly
from the local host
>0 network UG Route to a network through a
remote host gateway
=0 host UH Route to a remote host
directly from the local host
>0 host UGH Route to a remote host through
a remote host gateway
=0 default U Wildcard route directly from
the local host
>0 default UG Wildcard route through a
remote host gateway
_________________________________________________________________
DIAGNOSTICS [Toc] [Back]
The following error diagnostics can be displayed:
add a route that already exists
The specified entry is already in the routing table.
delete a route that does not exist
The specified route was not in the routing table.
cannot update loopback route
Routes for any 127.*.*.* loopback destination cannot be added or
deleted.
WARNINGS [Toc] [Back]
Reciprocal route commands must be executed on the local host, the
destination host, and all intermediate hosts if routing is to succeed
in the cases of virtual circuit connections or bidirectional datagram
transfers.
The HP-UX implementation of route does not presently support a change
subcommand.
AUTHOR [Toc] [Back]
route was developed by the University of California, Berkeley.
FILES [Toc] [Back]
/etc/networks
/etc/hosts
SEE ALSO [Toc] [Back]
netstat(1), ifconfig(1M), ndd(1M), ping(1M), getsockopt(2), recv(2),
send(2), getaddrinfo(3N), gethostent(3N), getnetent(3N), inet(3N),
Hewlett-Packard Company - 6 - HP-UX 11i Version 2: Sep 2004
route(1M) route(1M)
inet6(3N), routing(7).
Hewlett-Packard Company - 7 - HP-UX 11i Version 2: Sep 2004 [ Back ] |