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