xref: /original-bsd/sbin/route/route.8 (revision 76321dfe)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)route.8	8.3 (Berkeley) 03/19/94
7.\"
8.Dd
9.Dt ROUTE 8
10.Os BSD 4.4
11.Sh NAME
12.Nm route
13.Nd manually manipulate the routing tables.
14.Sh SYNOPSIS
15.Nm route
16.Op Fl nqv
17.Ar command
18.Oo
19.Op Ar modifiers
20.Ar args
21.Oc
22.Sh DESCRIPTION
23.Nm Route
24is a utility used to manually manipulate the network
25routing tables.  It normally is not needed, as a
26system routing table management daemon such as
27.Xr routed 8 ,
28should tend to this task.
29.Pp
30The
31.Nm route :
32utility supports a limited number of general options,
33but a rich command language, enabling the user to specify
34any arbitrary request that could be delivered via the
35programmatic interface discussed in
36.Xr route 4 .
37.Pp
38.Bl -tag -width Ds
39.It Fl n
40Bypasses attempts to print host and network names symbolically
41when reporting actions.  (The process of translating between symbolic
42names and numerical equivalents can be quite time consuming, and
43may require correct operation of the network; thus it may be expedient
44to forgo this, especially when attempting to repair networking operations),
45.It Fl v
46(verbose) Print additional details.
47.It Fl q
48Suppress all output.
49.El
50.Pp
51The
52.Nm route :
53utility provides six commands:
54.Pp
55.Bl -tag -width Fl -compact
56.It Cm add
57Add a route.
58.It Cm flush
59Remove all routes.
60.It Cm delete
61Delete a specific route.
62.It Cm change
63Change aspects of a route (such as its gateway).
64.It Cm get
65Lookup and display the route for a destination.
66.It Cm monitor
67Continuously report any changes to the routing information base,
68routing lookup misses, or suspected network partitionings.
69.El
70.Pp
71The monitor command has the syntax
72.Pp
73.Bd -filled -offset indent -compact
74.Nm route Op Fl n
75.Cm monitor
76.Ed
77.Pp
78The flush command has the syntax
79.Pp
80.Bd -filled -offset indent -compact
81.Nm route Op Fl n
82.Cm flush
83.Op Ar family
84.Ed
85.Pp
86If the
87.Cm flush
88command is specified,
89.Nm route
90will ``flush'' the routing tables of all gateway entries.
91When the address family may is specified by any of the
92.Fl osi ,
93.Fl xns ,
94or
95.Fl inet
96modifiers, only routes having destinations with addresses in the
97delineated family will be deleted.
98.Pp
99The other commands have the following syntax:
100.Pp
101.Bd -filled -offset indent -compact
102.Nm route Op Fl n
103.Ar command
104.Op Fl net No \&| Fl host
105.Ar destination gateway
106.Ed
107.Pp
108where
109.Ar destination
110is the destination host or network,
111.Ar gateway
112is the next-hop intermediary via which packets should be routed.
113Routes to a particular host may be distinguished from those to
114a network by interpreting the Internet address specified as the
115.Ar destination argument.
116The optional modifiers
117.Fl net
118and
119.Fl host
120force the destination to be interpreted as a network or a host, respectively.
121Otherwise, if the
122.Ar destination
123has a ``local address part'' of
124INADDR_ANY ,
125or if the
126.Ar destination
127is the symbolic name of a network, then the route is
128assumed to be to a network; otherwise, it is presumed to be a
129route to a host.
130.Pp
131For example,
132.Li 128.32
133is interpreted as
134.Fl host Li 128.0.0.32 ;
135.Li 128.32.130
136is interpreted as
137.Fl host Li 128.32.0.130 ;
138.Fl net Li 128.32
139is interpreted as
140.Li 128.32.0.0;
141and
142.Fl net Li 128.32.130
143is interpreted as
144.Li 128.32.130.0 .
145.Pp
146If the destination is directly reachable
147via an interface requiring
148no intermediary system to act as a gateway, the
149.Fl interface
150modifier should be specified;
151the gateway given is the address of this host on the common network,
152indicating the interface to be used for transmission.
153.Pp
154The optional modifiers
155.Fl xns ,
156.Fl osi ,
157and
158.Fl link
159specify that all subsequent addresses are in the
160.Tn XNS
161.Tn OSI
162address families,
163or are specified as link-level addresses,
164and the names must be numeric specifications rather than
165symbolic names.
166.Pp
167The optional
168.Fl netmask
169qualifier is intended
170to achieve the effect of an
171.Tn OSI
172.Tn ESIS
173redirect with the netmask option,
174or to manually add subnet routes with
175netmasks different from that of the implied network interface
176(as would otherwise be communicated using the OSPF or ISIS routing protocols).
177One specifies an additional ensuing address parameter
178(to be interpreted as a network mask).
179The implicit network mask generated in the AF_INET case
180can be overridden by making sure this option follows the destination parameter.
181.Pp
182Routes have associated flags which influence operation of the protocols
183when sending to destinations matched by the routes.
184These flags may be set (or sometimes cleared)
185by indicating the following corresponding modifiers:
186.Bd -literal
187-cloning   RTF_CLONING    - generates a new route on use
188-xresolve  RTF_XRESOLVE   - emit mesg on use (for external lookup)
189-iface    ~RTF_GATEWAY    - destination is directly reachable
190-static    RTF_STATIC     - manually added route
191-nostatic ~RTF_STATIC     - pretend route added by kernel or daemon
192-reject    RTF_REJECT     - emit an ICMP unreachable when matched
193-blackhole RTF_BLACKHOLE  - silently discard pkts (during updates)
194-proto1    RTF_PROTO1     - set protocol specific routing flag #1
195-proto2    RTF_PROTO2     - set protocol specific routing flag #2
196-llinfo    RTF_LLINFO     - validly translates proto addr to link addr
197.Ed
198.Pp
199The optional modifiers
200.Fl rtt ,
201.Fl rttvar ,
202.Fl sendpipe ,
203.Fl recvpipe ,
204.Fl mtu ,
205.Fl hopcount ,
206.Fl expire ,
207and
208.Fl ssthresh
209provide initial values to quantities maintained in the routing entry
210by transport level protocols, such as TCP or TP4.
211These may be individually locked by preceding each such modifier to
212be locked by
213the
214.Fl lock
215meta-modifier, or one can
216specify that all ensuing metrics may be locked by the
217.Fl lockrest
218meta-modifier.
219.Pp
220In a
221.Cm change
222or
223.Cm add
224command where the destination and gateway are not sufficient to specify
225the route (as in the
226.Tn ISO
227case where several interfaces may have the
228same address), the
229.Fl ifp
230or
231.Fl ifa
232modifiers may be used to determine the interface or interface address.
233.Pp
234All symbolic names specified for a
235.Ar destination
236or
237.Ar gateway
238are looked up first as a host name using
239.Xr gethostbyname 3 .
240If this lookup fails,
241.Xr getnetbyname 3
242is then used to interpret the name as that of a network.
243.Pp
244.Nm Route
245uses a routing socket and the new message types
246RTM_ADD,
247RTM_DELETE,
248RTM_GET,
249and
250RTM_CHANGE.
251As such, only the super-user may modify
252the routing tables.
253.Sh DIAGNOSTICS
254.Bl -tag -width Ds
255.It Sy "add [host \&| network ] %s: gateway %s flags %x"
256The specified route is being added to the tables.  The
257values printed are from the routing table entry supplied
258in the
259.Xr ioctl 2
260call.
261If the gateway address used was not the primary address of the gateway
262(the first one returned by
263.Xr gethostbyname 3 ) ,
264the gateway address is printed numerically as well as symbolically.
265.It Sy "delete [ host &| network ] %s: gateway %s flags %x"
266As above, but when deleting an entry.
267.It Sy "%s %s done"
268When the
269.Cm flush
270command is specified, each routing table entry deleted
271is indicated with a message of this form.
272.It Sy "Network is unreachable"
273An attempt to add a route failed because the gateway listed was not
274on a directly-connected network.
275The next-hop gateway must be given.
276.It Sy "not in table"
277A delete operation was attempted for an entry which
278wasn't present in the tables.
279.It Sy "routing table overflow"
280An add operation was attempted, but the system was
281low on resources and was unable to allocate memory
282to create the new entry.
283.El
284.Sh SEE ALSO
285.Xr netintro 4 ,
286.Xr route 4 ,
287.Xr esis 4 ,
288.Xr routed 8 ,
289.Xr XNSrouted 8
290.Sh HISTORY
291The
292.Nm
293command appeared in
294.Bx 4.2 .
295.Sh BUGS
296The first paragraph may have slightly exaggerated
297.Xr routed Ns 's
298abilities.
299