Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ route(1M) — SunOS 5.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

get(1)

uname(1)

in.rdisc(1M)

netstat(1M)

routed(1M)

ioctl(2)

gethostbyname(3N)

getnetbyname(3N)

hosts(4)

networks(4)

route(4)

routing(4)

attributes(5)

ARP(7P)

route(1M)

NAME

route − manually manipulate the routing tables

SYNOPSIS

route [ −fnvq ] command [[ modifiers ] args ]
route [ −fnvq ] add | change | delete | get [ host | net ] destination [ gateway [ args ] ]
route [ −n ] monitor
route [ −n ] flush

DESCRIPTION

route manually manipulates the network routing tables. These tables are normally maintained by the system routing daemon, by routed(1M), or through default routes and redirect messages from routers. 

This utility supports a limited number of general options, but a rich command language. It enables the user to specify any arbitrary request that could be delivered via the programmatic interface discussed in route(4).  route uses a routing socket and the new message types RTM_ADD, RTM_DELETE, RTM_GET, and RTM_CHANGE.  As such, only the super-user may modify the routing tables. 

OPTIONS

−f Flush the routing tables of all gateway entries.  If this is used in conjunction with one of the commands described above, route flushes the gateways before performing the command. 

−n Prevent attempts to print host and network names symbolically when reporting actions.  This is useful, for example, when all name servers are down on your local net, and you need a route before you can contact the name server. 

−v (Verbose) Print additional details. 

−q Suppress all output. 

Commands

route executes one of four commands on a route to a destination. Two additional commands operate globally on all routing information.  The (six) commands are:

add Add a route. 

change Change aspects of a route (such as its gateway). 

delete Delete a specific route. 

flush Remove all gateway entries from the routing table. 

get Lookup and display the route for a destination. 

monitor Continuously report any changes to the routing information base, routing lookup misses, or suspected network partitionings. 

The add, delete, and change commands have the following syntax:

route [ −fnvq ] command [ −net | −host ] destination gateway

where destination is the destination host or network, and gateway is the next-hop intermediary via where packets should be routed. 

OPERANDS

route executes its commands on routes to destinations. 

Destinations

All symbolic names specified for a destination or gateway are looked up first as a host name, using gethostbyname(3N).  If this lookup fails, getnetbyname(3N) is used to interpret the name as that of a network.  An optional modifier may be included on the command line before a destination, to force how route interprets a destination:

−host Forces the destination to be interpreted as a host. 

−net Forces the destination to be interpreted as a network. 

Routes to a particular host may be distinguished from those to a network by interpreting the Internet address specified as the destination. 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, the route:

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
−net 128.32.130 is interpreted as 128.32.130.0

If the destination is directly reachable via an interface requiring no intermediary system to act as a gateway, this can be indicated by including one of two optional modifiers after the destination: The −interface modifier can be included or a metric of 0 can be specified. These modifiers are illustrated in the following alternative examples:

route add default hostname -interface
route add default hostname 0

hostname is the name or IP address associated with the network interface all packets should be sent over. On a host with a single network interface, hostname is normally the  same as the nodename returned by uname −n (see uname(1)). 

In the above examples, the route does not refer to a gateway, but rather to one of the machine’s interfaces. Destinations matching such a route are sent out on the interface identified by the gateway address. For interfaces using the ARP protocol, this type of route is used to specify all destinations are local.  That is, a host should ARP for all addresses by adding a default route using one of the two commands listed above. 

The optional −netmask qualifier is intended to manually add subnet routes with netmasks different from that of the implied network interface.  The implicit network mask generated in the AF_INET case can be overridden by making sure this option, and an ensuing address parameter (to be interpreted as a network mask), follows the destination parameter. 

Routing Flags

Routes have associated flags which influence operation of the protocols when sending to destinations matched by the routes.  These flags may be set (or sometimes cleared) by including the following corresponding modifiers on the command line:

Modifier Flag Description



−cloning RTF_CLONING generates a new route on use
−xresolve RTF_XRESOLVE emit mesg on use (for external lookup)
−iface ~RTF_GATEWAY destination is directly reachable
−static RTF_STATIC manually added route
−nostatic ~RTF_STATIC pretend route added by kernel or daemon
−reject RTF_REJECT emit an ICMP unreachable when matched
−blackhole RTF_BLACKHOLE silently discard pkts (during updates)
−proto1 RTF_PROTO1 set protocol specific routing flag #1
−proto2 RTF_PROTO2 set protocol specific routing flag #2
−llinfo RTF_LLINFO validly translates proto addr to link addr

The optional modifiers:

−rtt,
−rttvar,
−sendpipe,
−recvpipe,
−mtu,
−hopcount,
−expire,
−ssthresh

provide initial values to quantities maintained in the routing entry by transport level protocols, such as TCP.  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. 

In a change or add command where the destination and gateway are not sufficient to specify the route (e.g., when several interfaces have the same address), the −ifp or −ifa modifiers may be used to determine the interface or interface address. 

FILES

/etc/hosts list of host names and net addresses

/etc/networks list of network names and addresses

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Availability SUNWcsu

SEE ALSO

get(1), uname(1), in.rdisc(1M), netstat(1M), routed(1M), ioctl(2), gethostbyname(3N), getnetbyname(3N), hosts(4), networks(4), route(4), routing(4), attributes(5), ARP(7P)

DIAGNOSTICS

add [ host|network] destination:gateway flags

The specified route is being added to the tables.  The values printed are from the routing table entry supplied in the ioctl(2) call.  If the gateway address used was not the primary address of the gateway (the first one returned by gethostbyname(3N)), the gateway address is printed numerically as well as symbolically. 

delete [ host|network] destination:gateway flags

As above, but when deleting an entry. 

destination doneWhen the −f flag is specified, or in the flush command, each routing table entry deleted is indicated with a message of this form. 

Network is
unreachable

An attempt to add a route failed because the gateway listed was not on a directly-connected network.  Give the next-hop gateway instead. 

not in table A delete operation was attempted for an entry that is  not in the table. 

routing table
overflow

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

NOTES

All destinations are local assumes that the routers implement the protocol, proxy arp. Normally, using router discovery (see in.rdisc(1M)) is more reliable than using proxy arp. 

Combining the all destinations are local route with subnet or network routes can lead to unpredictable results: the search order as it relates to the all destinations are local route are undefined and may vary from release to release. 

SunOS 5.6  —  Last change: 7 Jan 1997

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026