]> git.saurik.com Git - apple/network_cmds.git/blame - routed.tproj/routed.8
network_cmds-176.3.1.tar.gz
[apple/network_cmds.git] / routed.tproj / routed.8
CommitLineData
7ba0088d
A
1.\" $OpenBSD: routed.8,v 1.8 1997/01/28 07:16:41 deraadt Exp $
2.\"
b7080c8e
A
3.\" Copyright (c) 1983, 1991, 1993
4.\" The Regents of the University of California. All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\" must display the following acknowledgement:
16.\" This product includes software developed by the University of
17.\" California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\" may be used to endorse or promote products derived from this software
20.\" without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\" @(#)routed.8 8.2 (Berkeley) 12/11/93
35.\"
7ba0088d 36.Dd June 1, 1996
b7080c8e 37.Dt ROUTED 8
7ba0088d 38.Os BSD 4.4
b7080c8e
A
39.Sh NAME
40.Nm routed
7ba0088d 41.Nd network RIP and router discovery routing daemon
b7080c8e 42.Sh SYNOPSIS
7ba0088d
A
43.Nm
44.Op Fl sqdghmpAt
45.Op Fl T Ar tracefile
46.Oo
47.Fl F
48.Ar net Ns Op /mask Ns Op ,metric
49.Oc
50.OP Fl P Ar parms
b7080c8e
A
51.Sh DESCRIPTION
52.Nm Routed
7ba0088d
A
53is a daemon invoked at boot time to manage the network
54routing tables.
55It uses Routing Information Protocol, RIPv1 (RFC\ 1058),
56RIPv2 (RFC\ 1723),
57and Internet Router Discovery Protocol (RFC 1256)
58to maintain the kernel routing table.
59The RIPv1 protocol is based on the reference 4.3BSD daemon.
60.Pp
61It listens on the
b7080c8e
A
62.Xr udp 4
63socket for the
64.Xr route 8
65service (see
66.Xr services 5 )
7ba0088d
A
67for Routing Information Protocol packets.
68It also sends and receives multicast Router Discovery ICMP messages.
69If the host is a router,
70.Nm
71periodically supplies copies
72of its routing tables to any directly connected hosts and networks.
73It also advertise or solicits default routes using Router Discovery
74ICMP messages.
b7080c8e 75.Pp
7ba0088d
A
76When started (or when a network interface is later turned on),
77.Nm
78uses an AF_ROUTE address family facility to find those
b7080c8e 79directly connected interfaces configured into the
7ba0088d
A
80system and marked "up".
81It adds necessary routes for the interfaces
82to the kernel routing table.
83Soon after being first started, and provided there is at least one
84interface on which RIP has not been disabled,
85.Nm
86deletes all pre-existing
87non-static routes in kernel table.
88Static routes in the kernel table are preserved and
89included in RIP responses if they have a valid RIP metric
90(see
91.Xr route 8 ).
92.Pp
93If more than one interface is present (not counting the loopback interface),
94it is assumed that the host should forward packets among the
95connected networks.
96After transmitting a RIP
b7080c8e
A
97.Em request
98and
7ba0088d
A
99Router Discovery Advertisements or Solicitations on a new interface,
100the daemon enters a loop, listening for
101RIP request and response and Router Discover packets from other hosts.
b7080c8e
A
102.Pp
103When a
104.Em request
7ba0088d
A
105packet is received,
106.Nm
b7080c8e 107formulates a reply based on the information maintained in its
7ba0088d
A
108internal tables.
109The
b7080c8e
A
110.Em response
111packet generated contains a list of known routes, each marked
7ba0088d
A
112with a "hop count" metric (a count of 16 or greater is
113considered "infinite").
114Advertised metrics reflect the metric associated with interface
115(see
116.Xr ifconfig 8 ),
117so setting the metric on an interface
118is an effective way to steer traffic.
b7080c8e 119.Pp
7ba0088d
A
120Responses do not contain routes with a first hop on the requesting
121network to implement in part
122.Em split-horizon .
7ba0088d
A
123.Pp
124The routing table maintained by the daemon
125includes space for several gateways for each destination
126to speed recovery from a failing router.
127RIP
128.Em response
129packets received are used to update the routing tables provided they are
130from one of the several currently recognized gateways or
131advertise a better metric than at least one of the existing
132gateways.
b7080c8e
A
133.Pp
134When an update is applied,
7ba0088d
A
135.Nm
136records the change in its own tables and updates the kernel routing table
137if the best route to the destination changes.
138The change in the kernel routing table is reflected in the next batch of
b7080c8e 139.Em response
7ba0088d
A
140packets sent.
141If the next response is not scheduled for a while, a
142.Em flash update
143response containing only recently changed routes is sent.
b7080c8e
A
144.Pp
145In addition to processing incoming packets,
7ba0088d 146.Nm
b7080c8e
A
147also periodically checks the routing table entries.
148If an entry has not been updated for 3 minutes, the entry's metric
7ba0088d
A
149is set to infinity and marked for deletion.
150Deletions are delayed until the route has been advertised with
151an infinite metric to insure the invalidation
152is propagated throughout the local internet.
153This is a form of
154.Em poison reverse .
155.Pp
156Routes in the kernel table that are added or changed as a result
157of ICMP Redirect messages are deleted after a while to minimize
158.Em black-holes .
159When a TCP connection suffers a timeout,
160the kernel tells
161.Nm routed ,
162which deletes all redirected routes
163through the gateway involved, advances the age of all RIP routes through
164the gateway to allow an alternate to be chosen, and advances of the
165age of any relevant Router Discovery Protocol default routes.
b7080c8e
A
166.Pp
167Hosts acting as internetwork routers gratuitously supply their
168routing tables every 30 seconds to all directly connected hosts
169and networks.
7ba0088d
A
170These RIP responses are sent to the broadcast address on nets that support
171broadcasting,
b7080c8e
A
172to the destination address on point-to-point links, and to the router's
173own address on other networks.
7ba0088d
A
174If RIPv2 is enabled, multicast packets are sent on interfaces that
175support multicasting.
176.Pp
177If no response is received on a remote interface, if there are errors
178while sending responses,
179or if there are more errors than input or output (see
180.Xr netstat 8 ),
181then the cable or some other part of the interface is assumed to be
182disconnected or broken, and routes are adjusted appropriately.
183.Pp
184The
185.Em Internet Router Discovery Protocol
186is handled similarly.
187When the daemon is supplying RIP routes, it also listens for
188Router Discovery Solicitations and sends Advertisements.
189When it is quiet and only listening to other RIP routers, it
190sends Solicitations and listens for Advertisements.
191If it receives
192a good Advertisement, it stops listening for broadcast or multicast
193RIP responses.
194It tracks several advertising routers to speed recovery when the
195currently chosen router dies.
196If all discovered routers disappear,
197the daemon resumes listening to RIP responses.
198.Pp
199While using Router Discovery (which happens by default when
200the system has a single network interface and a Router Discover Advertisement
201is received), there is a single default route and a variable number of
202redirected host routes in the kernel table.
203.Pp
204The Router Discover standard requires that advertisements
205have a default "lifetime" of 30 minutes. That means should
206something happen, a client can be without a good route for
20730 minutes. It is a good idea to reduce the default to 45
208seconds using
209.Fl P Cm rdisc_interval=45
210on the command line or
211.Cm rdisc_interval=45
212in the
213.Pa /etc/gateways
214file.
215.Pp
216See the
217.Cm pm_rdisc
218facility described below to support "legacy" systems
219that can handle neither RIPv2 nor Router Discovery.
220.Pp
221By default, neither Router Discovery advertisements nor solicitations
222are sent over point to point links (e.g. PPP).
223
b7080c8e
A
224.Pp
225Options supported by
226.Nm routed :
227.Bl -tag -width Ds
7ba0088d
A
228.It Fl s
229this option forces
230.Nm
231to supply routing information.
232This is the default if multiple network interfaces are present on which
233RIP or Router Discovery have not been disabled, and if the kernel switch
234ipforwarding=1.
235.It Fl q
236is the opposite of the
237.Fl s
238option.
b7080c8e 239.It Fl d
7ba0088d
A
240Do not run in the background.
241This option is meant for interactive use.
b7080c8e
A
242.It Fl g
243This flag is used on internetwork routers to offer a route
7ba0088d
A
244to the "default" destination.
245It is equivalent to
246.Fl F
247.Cm 0/0,1
248and is present mostly for historical reasons.
249A better choice is
250.Fl P Cm pm_rdisc
251on the command line or
252.Cm pm_rdisc in the
253.Pa /etc/gateways
254file.
255since a larger metric
256will be used, reducing the spread of the potentially dangerous
257default route.
b7080c8e
A
258This is typically used on a gateway to the Internet,
259or on a gateway that uses another routing protocol whose routes
260are not reported to other local routers.
7ba0088d
A
261Notice that because a metric of 1 is used, this feature is
262dangerous. It is more commonly accidently used to create chaos with routing
263loop than to solve problems.
264.It Fl h
265This causes host or point-to-point routes to not be advertised,
266provided there is a network route going the same direction.
267That is a limited kind of aggregation.
268This option is useful on gateways to ethernets that have other gateway
269machines connected with point-to-point links such as SLIP.
270.It Fl m
271This causes the machine to advertise a host or point-to-point route to
272its primary interface.
273It is useful on multi-homed machines such as NFS servers.
274This option should not be used except when the cost of
275the host routes it generates is justified by the popularity of
276the server.
277It is effective only when the machine is supplying
278routing information, because there is more than one interface.
279The
280.Fl m
281option overrides the
282.Fl q
283option to the limited extent of advertising the host route.
284.It Fl A
285do not ignore RIPv2 authentication if we do not care about RIPv2
286authentication.
287This option is required for conformance with RFC 1723.
288However, it makes no sense and breaks using RIP as a discovery protocol
289to ignore all RIPv2 packets that carry authentication when this machine
290does not care about authentication.
291.It Fl T Ar tracefile
292increases the debugging level to at least 1 and
293causes debugging information to be appended to the trace file.
294Note that because of security concerns, it is wisest to not run
b7080c8e 295.Nm routed
7ba0088d 296routinely with tracing directed to a file.
b7080c8e 297.It Fl t
7ba0088d
A
298increases the debugging level, which causes more information to be logged
299on the tracefile specified with
300.Fl T
301or standard out.
302The debugging level can be increased or decreased
303with the
304.Em SIGUSR1
305or
306.Em SIGUSR2
ac2f15b3 307signals.
7ba0088d
A
308.It Fl F Ar net[/mask][,metric]
309minimize routes in transmissions via interfaces with addresses that match
310.Em net/mask ,
311and synthesizes a default route to this machine with the
312.Em metric .
313The intent is to reduce RIP traffic on slow, point-to-point links
314such as PPP links by replacing many large UDP packets of RIP information
315with a single, small packet containing a "fake" default route.
316If
317.Em metric
318is absent, a value of 14 is assumed to limit
319the spread of the "fake" default route.
320
321This is a dangerous feature that when used carelessly can cause routing
322loops.
323Notice also that more than one interface can match the specified network
324number and mask.
325See also
326.Fl g .
327.It Fl P Ar parms
328is equivalent to adding the parameter
329line
330.Em parms
331to the
332.Pa /etc/gateways
333file.
b7080c8e
A
334.El
335.Pp
336Any other argument supplied is interpreted as the name
7ba0088d
A
337of a file in which the actions of
338.Nm
339should be logged.
340It is better to use
341.Fl T
342instead of
343appending the name of the trace file to the command.
344.Pp
345.Nm
346also supports the notion of
347"distant"
b7080c8e 348.Em passive
7ba0088d 349or
b7080c8e 350.Em active
7ba0088d
A
351gateways.
352When
353.Nm
354is started, it reads the file
b7080c8e 355.Pa /etc/gateways
7ba0088d
A
356to find such distant gateways which may not be located using
357only information from a routing socket, to discover if some
358of the local gateways are
359.Em passive ,
360and to obtain other parameters.
b7080c8e
A
361Gateways specified in this manner should be marked passive
362if they are not expected to exchange routing information,
363while gateways marked active
7ba0088d
A
364should be willing to exchange RIP packets.
365Routes through
366.Em passive
367gateways are installed in the
368kernel's routing tables once upon startup and are not included in
369transmitted RIP responses.
370.Pp
371Distant active gateways are treated like network interfaces.
372RIP responses are sent
373to the distant
374.Em active
375gateway.
376If no responses are received, the associated route is deleted from
377the kernel table and RIP responses advertised via other interfaces.
378If the distant gateway resumes sending RIP responses, the associated
379route is restored.
380.Pp
381Such gateways can be useful on media that do not support broadcasts
382or multicasts but otherwise act like classic shared media like
383Ethernets such as some ATM networks.
384One can list all RIP routers reachable on the ATM network in
385.Pa /etc/gateways
386with a series of
387"host" lines.
388.Pp
b7080c8e
A
389Gateways marked
390.Em external
391are also passive, but are not placed in the kernel
392routing table nor are they included in routing updates.
7ba0088d 393The function of external entries is to indicate
b7080c8e 394that another routing process
7ba0088d
A
395will install such a route if necessary,
396and that alternate routes to that destination should not be installed
397by
398.Nm routed .
b7080c8e
A
399Such entries are only required when both routers may learn of routes
400to the same destination.
401.Pp
7ba0088d 402The
b7080c8e 403.Pa /etc/gateways
7ba0088d
A
404file is comprised of a series of lines, each in
405one of the following formats or consist of parameters described below:
406.Pp
b7080c8e 407.Bd -ragged
7ba0088d
A
408.Cm net
409.Ar Nname[/mask]
b7080c8e 410.Cm gateway
7ba0088d 411.Ar Gname
b7080c8e
A
412.Cm metric
413.Ar value
414.Pf < Cm passive No \&|
415.Cm active No \&|
7ba0088d 416.Cm extern Ns >
b7080c8e 417.Ed
7ba0088d 418.Bd -ragged
b7080c8e 419.Cm host
7ba0088d
A
420.Ar Hname
421.Cm gateway
422.Ar Gname
423.Cm metric
424.Ar value
425.Pf < Cm passive No \&|
426.Cm active No \&|
427.Cm extern Ns >
428.Ed
b7080c8e 429.Pp
7ba0088d
A
430.Ar Nname
431or
432.Ar Hname
433is the name of the destination network or host.
434It may be a symbolic network name or an Internet address
435specified in "dot" notation (see
436.Xr inet 3 ).
437(If it is a name, then it must either be defined in
b7080c8e
A
438.Pa /etc/networks
439or
7ba0088d
A
440.Pa /etc/hosts ,
441or
b7080c8e 442.Xr named 8 ,
7ba0088d
A
443must have been started before
444.Nm routed Ns .)
445.Pp
446.Ar mask
447is an optional number between 1 and 32 indicating the netmask associated
448with
449.Ar Nname .
b7080c8e 450.Pp
7ba0088d
A
451.Ar Gname
452is the name or address of the gateway to which RIP responses should
b7080c8e
A
453be forwarded.
454.Pp
455.Ar Value
7ba0088d
A
456is the hop count to the destination host or network.
457.Ar " host hname "
458is equivalent to
459.Ar " net nname/32 ".
b7080c8e
A
460.Pp
461One of the keywords
462.Cm passive ,
463.Cm active
464or
465.Cm external
7ba0088d
A
466must be present to indicate whether the gateway should be treated as
467.Cm passive
b7080c8e 468or
7ba0088d 469.Cm active
b7080c8e
A
470(as described above),
471or whether the gateway is
7ba0088d
A
472.Cm external
473to the scope of the RIP protocol.
474.Pp
475Lines that start with neither "net" nor "host" must consist of one
476or more of the following parameter settings, separated by commas or
477blanks:
478.Bl -tag -width Ds
479.It Cm if Ns \&= Ns Ar ifname
480indicates that the other parameters on the line apply to the interface
481name
482.Ar ifname .
483.It Cm subnet Ns \&= Ns Ar nname[/mask][,metric]
484advertises a route to network
485.Ar nname
486with mask
487.Ar mask
488and the supplied metric (default 1).
489This is useful for filling "holes" in CIDR allocations.
490This parameter must appear by itself on a line.
491.Pp
492Do not use this feature unless necessary. It is dangerous.
493.It Cm passwd Ns \&= Ns Ar XXX
494specifies a RIPv2 password that will be included on all RIPv2
495responses sent and checked on all RIPv2 responses received.
496The password must not contain any blanks, tab characters, commas
497or '#' characters.
498.It Cm no_ag
499turns off aggregation of subnets in RIPv1 and RIPv2 responses.
500.It Cm no_super_ag
501turns off aggregation of networks into supernets in RIPv2 responses.
502.It Cm passive
503is equivalent
504.Cm no_rip Cm no_rdisc .
505.It Cm no_rip
506disables all RIP processing on the specified interface.
507If no interfaces are allowed to process RIP packets,
508.Nm
509acts purely as a router discovery daemon.
510.Cm No_rip
511is equivalent to
512.Cm no_ripv1_in no_ripv2_in no_ripv1_out no_ripv2_out .
ac2f15b3 513.Pp
7ba0088d
A
514Note that turning off RIP without explicitly turning on router
515discovery advertisements with
516.Cm rdisc_adv
517or
518.Fl s
519causes
b7080c8e 520.Nm routed
7ba0088d
A
521to act as a client router discovery daemon, not advertising.
522.It Cm no_ripv1_in
523causes RIPv1 received responses to be ignored.
524.It Cm no_ripv2_in
525causes RIPv2 received responses to be ignored.
526.It Cm ripv2_out
527turns off RIPv1 output and causes RIPv2 advertisements to be
528multicast when possible.
529.It Cm no_rdisc
530disables the Internet Router Discovery Protocol.
531.It Cm no_solicit
532disables the transmission of Router Discovery Solicitations.
533.It Cm send_solicit
534specifies that Router Discovery solicitations should be sent,
535even on point-to-point links,
536which by default only listen to Router Discovery messages.
537.It Cm no_rdisc_adv
538disables the transmission of Router Discovery Advertisements
539.It Cm rdisc_adv
540specifies that Router Discovery advertisements should be sent,
541even on point-to-point links,
542which by default only listen to Router Discovery messages
543.It Cm bcast_rdisc
544specifies that Router Discovery packets should be broadcast instead of
545multicast.
546.It Cm rdisc_pref Ns \&= Ns Ar N
547sets the preference in Router Discovery Advertisements to the integer
548.Ar N .
549.It Cm rdisc_interval Ns \&= Ns Ar N
550sets the nominal interval with which Router Discovery Advertisements
551are transmitted to N seconds and their lifetime to 3*N.
552.It Cm fake_default Ns \&= Ns Ar metric
553has an identical effect to
554.Fl F Ar net[/mask][,metric]
555with the network and mask coming from the specified interface.
556.It Cm pm_rdisc
557is similar to
558.Cm fake_default .
559When RIPv2 routes are multicast, so that RIPv1 listeners cannot
560receive them, this feature causes a RIPv1 default route to be
561broadcast to RIPv1 listeners.
562Unless modified with
563.Cm fake_default ,
564the default route is broadcast with a metric of 14.
565That serves as a "poor man's router discovery" protocol.
566.El
567.Pp
568Note that the netmask associated with point-to-point links (such as SLIP
569or PPP, with the IFF_POINTOPOINT flag) is used by
570.Nm routed
571to infer the netmask used by the remote system when RIPv1 is used.
572.Pp
b7080c8e
A
573.Sh FILES
574.Bl -tag -width /etc/gateways -compact
575.It Pa /etc/gateways
576for distant gateways
577.El
578.Sh SEE ALSO
579.Xr udp 4 ,
ac2f15b3 580.Xr icmp 4 .
b7080c8e
A
581.Rs
582.%T Internet Transport Protocols
583.%R XSIS 028112
584.%Q Xerox System Integration Standard
585.Re
586.Sh BUGS
b7080c8e
A
587It does not always detect unidirectional failures in network interfaces
588(e.g., when the output side fails).
589.Sh HISTORY
590The
591.Nm
592command appeared in
593.Bx 4.2 .