ROUTE(1M) ROUTE(1M) NAME route - manually manipulate the routing tables SYNOPSIS /usr/etc/route [-nqfF] command [[modifiers] args] DESCRIPTION Route is a utility used to manually manipulate the network routing tables. It normally is not needed, as a system routing table management daemon such as routed(1M), should tend to this task. The route utility supports a limited number of general options, but a rich command language, enabling the user to specify any arbitrary request that could be delivered via the programmatic interface -n Bypasses attempts to print host and network names symbolically when reporting actions. (The process of translating between symbolic names and numerical equivalents can be quite time consuming, and may require correct operation of the network; thus it may be expedient to forgo this, especially when attempting to repair networking operations), -v (verbose) Print additional details. -q Suppress all output. -F Flush all entries, not just gateway entries, usually when restarting the system. Note that unless at least some of the major non-gateway routes are immediately restored, the system will not work. The route utility provides six commands: add Add a route. flush Remove all 'gateway' routes. Non-gateway routes are added by device drivers when the interface is configured, and so should usually not be removed. delete Delete a specific route. change Change aspects of a route (such as its gateway). 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 monitor command has the syntax route [-n] monitor The flush command has the syntax route [-n] [-F] flush If the flush command is specified, route will ``flush'' the routing tables of all gateway entries. The -F flag flushes all entries are deleted. The other commands have the following syntax: route [-n] command [-net | -host] destination gateway where destination is the destination host or network, gateway is the next-hop intermediary via which packets should be routed. Routes to a particular host may be distinguished from those to a network by interpreting the Internet address specified as the destination argument. destination may be specified with the keyword ``default'' (instead of an IP address or name) to specify a route to all possible destinations; this is the route of last resort, used by the system if no better match is found. Configuring a static default route is often useful if there is only one path available to get traffic out of the local subnet. This can be accomplished easily by adding the route to /etc/config/static- route.options. The optional modifiers 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 , 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. If the destination is directly reachable via an interface requiring no intermediary system to act as a gateway, the -interface modifier should be specified to indicate a special type of gateway value; the gateway value given is the address of this host on the common network (not he interface name), indicating the interface to be used for transmission. When a route has been added with the -interface modifier 'netstat -rn' ouput will show link# in the gateway column and the flags of the interface by default. Two interfaces can exist on the same subnet if the second interface's interface route is to a specific host on that subnet and not to a network. A second interface route to the same subnet cannot be installed since it is already installed by the first interface. The -direct modifer is used in conjunction with the -interface modifier to specify the destination and interface addresses. route add -direct 163.153.0.1 -interface 163.153.0.7 This instructs the kernel to install an interface route to the remote host. The resulting route entry will show a full 32 bit netmask, host bit off and the clone bit on even though the route is not to a network. The optional -netmask qualifier is intended to achieve the effect of an OSI ESIS redirect with the netmask option, or to manually add subnet routes with netmasks different from that of the implied network interface (as would otherwise be communicated using the OSPF or ISIS routing protocols). One specifies an additional ensuing address parameter (to be interpreted as a network mask). The implicit network mask generated in the AF_INET case can be overridden by making sure this option follows the destination parameter. For IP version 6 routing entry keys, the modifier -inet6 should be used to indicate that the following address is an IPv6 address and that the route should be inserted in the IPv6 routing table. IPv6 prefix lengths for network routes can be specified either with a forward slash followed by the prefix length in decimal appended to the IPv6 address, or using the modifier -prefixlen. For example, to add a route which will send all traffic destined to network 3ffe:a00:b00:c00::/64 to the IPv4-compatible address ::128.178.50.1 (i.e. through an automatic IPv4 tunnel), one could use: route add -inet6 3ffe::a00:b00:c00::/64 ::128.178.50.1 or route add -inet6 -prefixlen 64 3ffe::a00:b00:c00::/64 ::128.178.50.1 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 indicating the following corresponding modifiers: -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 -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, and -ssthresh provide initial values to quantities maintained in the routing entry by transport level protocols, such as TCP or TP4. 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. For IPv6 routing, -inet6 modifier should be specified to indicate that following addresses should be interpreted as IPv6 addresses where possible and that routing table modifications should be made to the IPv6 table. In addition, the -prefixlen modifier should be used to indicate that the following value is the prefix length of a route, in units of bits. In a change or add command where the destination and gateway are not sufficient to specify the route, the -ifp or -ifa modifier may be used to determine the interface. These modifiers are used in addition to the destination and gateway values. -ifa specifies an interface by IP address (not name). -ifp specifies an interface by name and link layer address: -ifp interface name:link layer address example: route add 192.1.2.3 10.10.0.34 -ifp ec0:08:00:69:ff:ff:ff This will result in a route to 192.1.2.3 with the gateway 10.10.0.34 on the ec0 interface. All symbolic names specified for a destination or gateway are looked up first as a host name using gethostbyname(3). If this lookup fails, getnetbyname(3) is then used to interpret the name as that of a network. 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. DIAGNOSTICS add [host | network ] %s: gateway %s flags %x 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(3), the gateway address is printed numerically as well as symbolically. delete [ host &| network ] %s: gateway %s flags %x As above, but when deleting an entry. %s %s done When the flush command is specified, 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. The next-hop gateway must be given. not in table A delete operation was attempted for an entry which wasn't 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. SEE ALSO netintro(7), routed(1M), ipv6(7P). BUGS The first paragraph may have slightly exaggerated routed's abilities. FILES /etc/config/static-route.options static route configuration file Page 5