ROUTE(8) UNIX Programmer's Manual ROUTE(8) NAME route - manually manipulate the routing tables SYNOPSIS /sbin/route [ -f ] [ -n ] [ _c_o_m_m_a_n_d _a_r_g_s ] DESCRIPTION _R_o_u_t_e is a program used to manually manipulate the network routing tables. It normally is not needed, as the system routing table management daemon, _r_o_u_t_e_d(8), should tend to this task. _R_o_u_t_e accepts two commands: _a_d_d, to add a route, and _d_e_l_e_t_e, to delete a route. All commands have the following syntax: /sbin/route _c_o_m_m_a_n_d [ net | host ] _d_e_s_t_i_n_a_t_i_o_n _g_a_t_e_w_a_y [ _m_e_t_r_i_c ] where _d_e_s_t_i_n_a_t_i_o_n is the destination host or network, _g_a_t_e_- _w_a_y is the next-hop gateway to which packets should be addressed, and _m_e_t_r_i_c is a count indicating the number of hops to the _d_e_s_t_i_n_a_t_i_o_n. The metric is required for _a_d_d commands; it must be zero if the destination is on a directly-attached network, and nonzero if the route utilizes one or more gateways. If adding a route with metric 0, the gateway given is the address of this host on the common net- work, indicating the interface to be used for transmission. Routes to a particular host are distinguished from those to a network by interpreting the Internet address associated with _d_e_s_t_i_n_a_t_i_o_n. The optional keywords net and host force the destination to be interpreted as a network or a host, respectively. Otherwise, if the _d_e_s_t_i_n_a_t_i_o_n has a ``local address part'' of INADDR_ANY, or if the _d_e_s_t_i_n_a_t_i_o_n 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 connected via a gateway, the _m_e_t_r_i_c should be greater than 0. All symbolic names specified for a _d_e_s_t_i_n_a_t_i_o_n or _g_a_t_e_w_a_y are looked up first as a host name using _g_e_t_h_o_s_t_b_y_n_a_m_e(3N). If this lookup fails, _g_e_t_n_e_t_b_y_n_a_m_e(3N) is then used to interpret the name as that of a network. _R_o_u_t_e uses a raw socket and the SIOCADDRT and SIOCDELRT _i_o_c_t_l's to do its work. As such, only the super-user may modify the routing tables. If the -f option is specified, _r_o_u_t_e will ``flush'' the routing tables of all gateway entries. If this is used in conjunction with one of the commands described above, the tables are flushed prior to the command's application. Printed 11/24/99 November 16, 1996 1 ROUTE(8) UNIX Programmer's Manual ROUTE(8) The -n option prevents attempts to print host and network names symbolically when reporting actions. 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 _i_o_c_t_l call. If the gateway address used was not the primary address of the gateway (the first one returned by _g_e_t_h_o_s_t_b_y_n_a_m_e), 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 -f flag 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 gate- way 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 intro(4N), routed(8), XNSrouted(8) Printed 11/24/99 November 16, 1996 2