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