only executable by group dialer
[unix-history] / usr / src / sbin / route / route.8
CommitLineData
2944ec97
KB
1.\" Copyright (c) 1983 The Regents of the University of California.
2.\" All rights reserved.
0e56e94a 3.\"
2944ec97
KB
4.\" Redistribution and use in source and binary forms are permitted
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
0e56e94a 15.\"
2944ec97
KB
16.\" @(#)route.8 6.3 (Berkeley) %G%
17.\"
18.TH ROUTE 8 ""
0e56e94a
KM
19.UC 5
20.SH NAME
21route \- manually manipulate the routing tables
22.SH SYNOPSIS
23.B /etc/route
24[
25.B \-f
26] [
dfc5a452
MK
27.B \-n
28] [
0e56e94a
KM
29.I command args
30]
31.SH DESCRIPTION
32.I Route
33is a program used to manually manipulate the network
34routing tables. It normally is not needed, as the
35system routing table management daemon,
36.IR routed (8C),
37should tend to this task.
38.PP
39.I Route
dfc5a452 40accepts two commands:
0e56e94a 41.IR add ,
dfc5a452 42to add a route, and
0e56e94a 43.IR delete ,
dfc5a452 44to delete a route.
0e56e94a
KM
45.PP
46All commands have the following syntax:
47.PP
dfc5a452 48.ti +0.25i
0e56e94a
KM
49.B /etc/route
50.I command
0e56e94a 51[
dfc5a452
MK
52.B net
53|
54.B host
55]
56.I destination gateway
57[
58.I metric
0e56e94a
KM
59]
60.PP
61where
62.I destination
dfc5a452 63is the destination host or network,
0e56e94a 64.I gateway
dfc5a452 65is the next-hop gateway to which packets should be addressed, and
0e56e94a 66.I metric
dfc5a452 67is a count indicating the number of hops to
0e56e94a
KM
68the
69.IR destination .
dfc5a452
MK
70The metric is required for
71.I add
72commands; it must be zero if the destination is on a directly-attached network,
73and nonzero if the route utilizes one or more gateways.
74If adding a route with metric 0,
75the gateway given is the address of this host on the common network,
76indicating the interface to be used for transmission.
0e56e94a
KM
77Routes to a particular host are distinguished from those to
78a network by interpreting the Internet address associated with
79.IR destination .
dfc5a452
MK
80The optional keywords
81.B net
82and
83.B host
84force the destination to be interpreted as a network or a host, respectively.
85Otherwise, if the
86.I destination
87has a ``local address part'' of INADDR_ANY,
88or if the
0e56e94a 89.I destination
dfc5a452 90is the symbolic name of a network, then the route is
0e56e94a
KM
91assumed to be to a network; otherwise, it is presumed to be a
92route to a host. If the route is to a destination connected
93via a gateway, the
94.I metric
95should be greater than 0. All symbolic names specified for a
96.I destination
97or
98.I gateway
dfc5a452
MK
99are looked up first as a host name using
100.IR gethostbyname (3N).
101If this lookup fails,
102.IR getnetbyname (3N)
103is then used to interpret the name as that of a network.
0e56e94a
KM
104.PP
105.I Route
106uses a raw socket and the SIOCADDRT and SIOCDELRT
107.IR ioctl 's
108to do its work. As such, only the super-user may modify
109the routing tables.
110.PP
111If the
112.B \-f
113option is specified,
114.I route
115will ``flush'' the routing tables of all gateway entries.
116If this is used in conjunction with one of the commands
117described above, the tables are flushed prior to the command's
118application.
dfc5a452
MK
119.PP
120The
121.B \-n
122option prevents attempts to print host and network names symbolically
123when reporting actions.
0e56e94a 124.SH DIAGNOSTICS
dfc5a452 125``\fBadd [ host | network ] %s: gateway %s flags %x\fP''
0e56e94a
KM
126.br
127The specified route is being added to the tables. The
128values printed are from the routing table entry supplied
129in the
130.I ioctl
131call.
dfc5a452
MK
132If the gateway address used was not the primary address of the gateway
133(the first one returned by
134.IR gethostbyname ),
135the gateway address is printed numerically as well as symbolically.
0e56e94a 136.PP
dfc5a452 137``\fBdelete [ host | network ] %s: gateway %s flags %x\fP''
0e56e94a
KM
138.br
139As above, but when deleting an entry.
140.PP
dfc5a452 141``\fB%s %s done\fP''
0e56e94a
KM
142.br
143When the
144.B \-f
145flag is specified, each routing table entry deleted
146is indicated with a message of this form.
147.PP
dfc5a452
MK
148``\fBNetwork is unreachable\fP''
149.br
150An attempt to add a route failed because the gateway listed was not
151on a directly-connected network.
152The next-hop gateway must be given.
153.PP
154``\fBnot in table\fP''
0e56e94a
KM
155.br
156A delete operation was attempted for an entry which
157wasn't present in the tables.
158.PP
dfc5a452 159``\fBrouting table overflow\fP''
0e56e94a
KM
160.br
161An add operation was attempted, but the system was
162low on resources and was unable to allocate memory
163to create the new entry.
164.SH "SEE ALSO"
2944ec97 165netintro(4), routed(8), XNSrouted(8)