1 .\" $NetBSD: routed.8,v 1.43 2004/03/27 20:50:43 christos Exp $
3 .\" Copyright (c) 1983, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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 acknowledgment:
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.
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
34 .\" @(#)routed.8 8.2 (Berkeley) 12/11/93
42 .Nd network RIP and router discovery routing daemon
49 .Ar net Ns Op /mask Ns Op ,metric
54 is a daemon invoked at boot time to manage the network
56 It uses Routing Information Protocol, RIPv1 (RFC 1058),
58 and Internet Router Discovery Protocol (RFC 1256)
59 to maintain the kernel routing table.
60 The RIPv1 protocol is based on the reference
70 for Routing Information Protocol packets.
71 It also sends and receives multicast Router Discovery ICMP messages.
72 If the host is a router,
74 periodically supplies copies
75 of its routing tables to any directly connected hosts and networks.
76 It also advertises or solicits default routes using Router Discovery
79 When started (or when a network interface is later turned on),
81 uses an AF_ROUTE address family facility to find those
82 directly connected interfaces configured into the
83 system and marked "up".
84 It adds necessary routes for the interfaces
85 to the kernel routing table.
86 Soon after being first started, and provided there is at least one
87 interface on which RIP has not been disabled,
89 deletes all pre-existing
90 non-static routes in kernel table.
91 Static routes in the kernel table are preserved and
92 included in RIP responses if they have a valid RIP metric
96 If more than one interface is present (not counting the loopback interface),
97 it is assumed that the host should forward packets among the
99 After transmitting a RIP
102 Router Discovery Advertisements or Solicitations on a new interface,
103 the daemon enters a loop, listening for
104 RIP request and response and Router Discovery packets from other hosts.
110 formulates a reply based on the information maintained in its
114 packet generated contains a list of known routes, each marked
115 with a "hop count" metric (a count of 16 or greater is
116 considered "infinite").
117 The advertised metric for a route reflects the metrics associated
121 through which it is received and sent,
122 so setting the metric on an interface
123 is an effective way to steer traffic.
130 Responses do not include routes with a first hop on the requesting
131 network to implement in part
133 Requests from query programs
136 are answered with the complete table.
138 The routing table maintained by the daemon
139 includes space for several gateways for each destination
140 to speed recovery from a failing router.
143 packets received are used to update the routing tables provided they are
144 from one of the several currently recognized gateways or
145 advertise a better metric than at least one of the existing
148 When an update is applied,
150 records the change in its own tables and updates the kernel routing table
151 if the best route to the destination changes.
152 The change in the kernel routing table is reflected in the next batch of
155 If the next response is not scheduled for a while, a
157 response containing only recently changed routes is sent.
159 In addition to processing incoming packets,
161 also periodically checks the routing table entries.
162 If an entry has not been updated for 3 minutes, the entry's metric
163 is set to infinity and marked for deletion.
164 Deletions are delayed until the route has been advertised with
165 an infinite metric to ensure the invalidation
166 is propagated throughout the local internet.
170 Routes in the kernel table that are added or changed as a result
171 of ICMP Redirect messages are deleted after a while to minimize
173 When a TCP connection suffers a timeout,
176 which deletes all redirected routes
177 through the gateway involved, advances the age of all RIP routes through
178 the gateway to allow an alternate to be chosen, and advances of the
179 age of any relevant Router Discovery Protocol default routes.
181 Hosts acting as internetwork routers gratuitously supply their
182 routing tables every 30 seconds to all directly connected hosts
184 These RIP responses are sent to the broadcast address on nets that support
186 to the destination address on point-to-point links, and to the router's
187 own address on other networks.
188 If RIPv2 is enabled, multicast packets are sent on interfaces that
189 support multicasting.
191 If no response is received on a remote interface, if there are errors
192 while sending responses,
193 or if there are more errors than input or output (see
195 then the cable or some other part of the interface is assumed to be
196 disconnected or broken, and routes are adjusted appropriately.
199 .Em Internet Router Discovery Protocol
200 is handled similarly.
201 When the daemon is supplying RIP routes, it also listens for
202 Router Discovery Solicitations and sends Advertisements.
203 When it is quiet and listening to other RIP routers, it
204 sends Solicitations and listens for Advertisements.
206 a good Advertisement and it is not multi-homed,
207 it stops listening for broadcast or multicast RIP responses.
208 It tracks several advertising routers to speed recovery when the
209 currently chosen router dies.
210 If all discovered routers disappear,
211 the daemon resumes listening to RIP responses.
212 It continues listening to RIP while using Router Discovery
213 if multi-homed to ensure all interfaces are used.
215 The Router Discovery standard requires that advertisements
216 have a default "lifetime" of 30 minutes.
217 That means should something happen, a client can be without a good route for
219 It is a good idea to reduce the default to 45 seconds using
220 .Fl P Cm rdisc_interval=45
221 on the command line or
222 .Cm rdisc_interval=45
227 While using Router Discovery (which happens by default when
228 the system has a single network interface and a Router Discover Advertisement
229 is received), there is a single default route and a variable number of
230 redirected host routes in the kernel table.
231 On a host with more than one network interface,
232 this default route will be via only one of the interfaces.
233 Thus, multi-homed hosts running with
241 facility described below to support "legacy" systems
242 that can handle neither RIPv2 nor Router Discovery.
244 By default, neither Router Discovery advertisements nor solicitations
245 are sent over point to point links (e.g. PPP).
246 The netmask associated with point-to-point links (such as SLIP
247 or PPP, with the IFF_POINTOPOINT flag) is used by
249 to infer the netmask used by the remote system when RIPv1 is used.
251 The following options are available:
252 .Bl -tag -width indent
256 to supply routing information.
257 This is the default if multiple network interfaces are present on which
258 RIP or Router Discovery have not been disabled, and if the sysctl
259 net.inet.ip.forwarding=1.
261 is the opposite of the
264 This is the default when only one interface is present.
265 With this explicit option, the daemon is always in "quiet-mode" for RIP
266 and does not supply routing information to other computers.
268 do not run in the background.
269 This option is meant for interactive use.
271 used on internetwork routers to offer a route
272 to the "default" destination.
276 and is present mostly for historical reasons.
279 on the command line or
284 since a larger metric
285 will be used, reducing the spread of the potentially dangerous
287 This is typically used on a gateway to the Internet,
288 or on a gateway that uses another routing protocol whose routes
289 are not reported to other local routers.
290 Notice that because a metric of 1 is used, this feature is dangerous.
291 It is more commonly accidentally used to create chaos with a
292 routing loop than to solve problems.
294 cause host or point-to-point routes to not be advertised,
295 provided there is a network route going the same direction.
296 That is a limited kind of aggregation.
297 This option is useful on gateways to Ethernets that have other gateway
298 machines connected with point-to-point links such as SLIP.
300 cause the machine to advertise a host or point-to-point route to
301 its primary interface.
302 It is useful on multi-homed machines such as NFS servers.
303 This option should not be used except when the cost of
304 the host routes it generates is justified by the popularity of
306 It is effective only when the machine is supplying
307 routing information, because there is more than one interface.
312 option to the limited extent of advertising the host route.
314 do not ignore RIPv2 authentication if we do not care about RIPv2
316 This option is required for conformance with RFC 1723.
317 However, it makes no sense and breaks using RIP as a discovery protocol
318 to ignore all RIPv2 packets that carry authentication when this machine
319 does not care about authentication.
321 increase the debugging level, which causes more information to be logged
322 on the tracefile specified with
325 The debugging level can be increased or decreased
333 .It Fl T Ar tracefile
334 increases the debugging level to at least 1 and
335 causes debugging information to be appended to the trace file.
336 Note that because of security concerns, it is wisest to not run
338 routinely with tracing directed to a file.
340 displays and logs the version of daemon.
341 .It Fl F Ar net[/mask][,metric]
342 minimize routes in transmissions via interfaces with addresses that match
344 and synthesizes a default route to this machine with the
346 The intent is to reduce RIP traffic on slow, point-to-point links
347 such as PPP links by replacing many large UDP packets of RIP information
348 with a single, small packet containing a "fake" default route.
351 is absent, a value of 14 is assumed to limit
352 the spread of the "fake" default route.
353 This is a dangerous feature that when used carelessly can cause routing
355 Notice also that more than one interface can match the specified network
360 is equivalent to adding the parameter
368 Any other argument supplied is interpreted as the name
369 of a file in which the actions of
375 appending the name of the trace file to the command.
378 also supports the notion of
386 is started, it reads the file
388 to find such distant gateways which may not be located using
389 only information from a routing socket, to discover if some
390 of the local gateways are
392 and to obtain other parameters.
393 Gateways specified in this manner should be marked passive
394 if they are not expected to exchange routing information,
395 while gateways marked active
396 should be willing to exchange RIP packets.
399 gateways are installed in the
400 kernel's routing tables once upon startup and are not included in
401 transmitted RIP responses.
403 Distant active gateways are treated like network interfaces.
404 RIP responses are sent
408 If no responses are received, the associated route is deleted from
409 the kernel table and RIP responses advertised via other interfaces.
410 If the distant gateway resumes sending RIP responses, the associated
413 Such gateways can be useful on media that do not support broadcasts
414 or multicasts but otherwise act like classic shared media like
415 Ethernets such as some ATM networks.
416 One can list all RIP routers reachable on the HIPPI or ATM network in
420 Note that it is usually desirable to use RIPv2 in such situations
421 to avoid generating lists of inferred host routes.
425 are also passive, but are not placed in the kernel
426 routing table nor are they included in routing updates.
427 The function of external entries is to indicate
428 that another routing process
429 will install such a route if necessary,
430 and that other routes to that destination should not be installed
433 Such entries are only required when both routers may learn of routes
434 to the same destination.
438 file is comprised of a series of lines, each in
439 one of the following two formats or consist of parameters described later.
440 Blank lines and lines starting with '#' are comments.
449 .Pf \*[Lt] Cm passive No \&|
460 .Pf \*[Lt] Cm passive No \&|
468 is the name of the destination network or host.
469 It may be a symbolic network name or an Internet address
470 specified in "dot" notation (see
472 (If it is a name, then it must either be defined in
478 must have been started before
482 is an optional number between 1 and 32 indicating the netmask associated
487 is the name or address of the gateway to which RIP responses should
491 is the hop count to the destination host or network.
494 .Ar " net nname/32 " .
501 must be present to indicate whether the gateway should be treated as
505 (as described above),
506 or whether the gateway is
508 to the scope of the RIP protocol.
510 As can be seen when debugging is turned on with
512 such lines create pseudo-interfaces.
513 To set parameters for remote or external interfaces,
515 .Cm if=alias(Hname) ,
516 .Cm if=remote(Hname) ,
519 Lines that start with neither "net" nor "host" must consist of one
520 or more of the following parameter settings, separated by commas or
523 .It Cm if Ns \&= Ns Ar ifname
524 indicates that the other parameters on the line apply to the interface
527 .It Cm subnet Ns \&= Ns Ar nname[/mask][,metric]
528 advertises a route to network
532 and the supplied metric (default 1).
533 This is useful for filling "holes" in CIDR allocations.
534 This parameter must appear by itself on a line.
535 The network number must specify a full, 32-bit value, as in 192.0.2.0
538 Do not use this feature unless necessary.
540 .It Cm ripv1_mask Ns \&= Ns Ar nname/mask1,mask2
541 specifies that netmask of the network of which
547 .Cm ripv1_mask Ns \&= Ns Ar 192.0.2.16/28,27
549 as a subnet of 192.0.2.0/27 instead of 192.0.2.0/24.
550 It is better to turn on RIPv2 instead of using this facility, for example
553 .It Cm passwd Ns \&= Ns Ar XXX[|KeyID[start|stop]]
554 specifies a RIPv2 cleartext password that will be included on
555 all RIPv2 responses sent, and checked on all RIPv2 responses received.
556 Any blanks, tab characters, commas, or '#', '|', or NULL characters in the
557 password must be escaped with a backslash (\\).
558 The common escape sequences \\n, \\r, \\t, \\b, and \\xxx have their
562 must be unique but is ignored for cleartext passwords.
567 are timestamps in the form year/month/day@hour:minute.
568 They specify when the password is valid.
569 The valid password with the most future is used on output packets, unless
570 all passwords have expired, in which case the password that expired most
571 recently is used, or unless no passwords are valid yet, in which case
572 no password is output.
573 Incoming packets can carry any password that is valid, will
574 be valid within the next 24 hours, or that was valid within the preceding
576 To protect the secrets, the passwd settings are valid only in the
578 file and only when that file is readable only by UID 0.
579 .It Cm md5_passwd Ns \&= Ns Ar XXX|KeyID[start|stop]
580 specifies a RIPv2 MD5 password.
583 is required, this keyword is similar to
586 turns off aggregation of subnets in RIPv1 and RIPv2 responses.
588 turns off aggregation of networks into supernets in RIPv2 responses.
590 marks the interface to not be advertised in updates sent via other
591 interfaces, and turns off all RIP and router discovery through the interface.
593 disables all RIP processing on the specified interface.
594 If no interfaces are allowed to process RIP packets,
596 acts purely as a router discovery daemon.
598 Note that turning off RIP without explicitly turning on router
599 discovery advertisements with
605 to act as a client router discovery daemon, not advertising.
607 causes RIPv2 packets to be broadcast instead of multicast.
609 causes RIPv1 received responses to be ignored.
611 causes RIPv2 received responses to be ignored.
613 turns on RIPv2 output and causes RIPv2 advertisements to be
614 multicast when possible.
622 disables the Internet Router Discovery Protocol.
624 disables the transmission of Router Discovery Solicitations.
626 specifies that Router Discovery solicitations should be sent,
627 even on point-to-point links,
628 which by default only listen to Router Discovery messages.
630 disables the transmission of Router Discovery Advertisements.
632 specifies that Router Discovery Advertisements should be sent,
633 even on point-to-point links,
634 which by default only listen to Router Discovery messages.
636 specifies that Router Discovery packets should be broadcast instead of
638 .It Cm rdisc_pref Ns \&= Ns Ar N
639 sets the preference in Router Discovery Advertisements to the optionally
642 The default preference is 0.
643 Default routes with larger preferences are preferred by clients.
644 .It Cm rdisc_interval Ns \&= Ns Ar N
645 sets the nominal interval with which Router Discovery Advertisements
646 are transmitted to N seconds and their lifetime to 3*N.
647 .It Cm fake_default Ns \&= Ns Ar metric
648 has an identical effect to
649 .Fl F Ar net[/mask][=metric]
650 with the network and mask coming from the specified interface.
654 When RIPv2 routes are multicast, so that RIPv1 listeners cannot
655 receive them, this feature causes a RIPv1 default route to be
656 broadcast to RIPv1 listeners.
659 the default route is broadcast with a metric of 14.
660 That serves as a "poor man's router discovery" protocol.
661 .It Cm adj_inmetric Ns \&= Ns Ar delta
662 adjusts the hop count or metric of received RIP routes by
664 The metric of every received RIP route is increased by the sum
665 of two values associated with the interface.
666 One is the adj_inmetric value and the other is the interface
669 .It Cm adj_outmetric Ns \&= Ns Ar delta
670 adjusts the hop count or metric of advertised RIP routes by
672 The metric of every received RIP route is increased by the metric
673 associated with the interface by which it was received, or by 1 if
674 the interface does not have a non-zero metric.
675 The metric of the received route is then increased by the
676 adj_outmetric associated with the interface.
677 Every advertised route is increased by a total of four
679 the metric set for the interface by which it was received with
682 .Cm adj_inmetric Ar delta
683 of the receiving interface,
684 the metric set for the interface by which it is transmitted with
687 .Cm adj_outmetric Ar delta
688 of the transmitting interface.
689 .It Cm trust_gateway Ns \&= Ns Ar rname[|net1/mask1|net2/mask2|...]
690 causes RIP packets from router
692 and other routers named in other
694 keywords to be accepted, and packets from other routers to be ignored.
695 If networks are specified, then routes to other networks will be ignored
698 allows the kernel to listen ICMP Redirect messages when the system is acting
699 as a router and forwarding packets.
700 Otherwise, ICMP Redirect messages are overridden and deleted when the
701 system is acting as a router.
704 .Bl -tag -width /etc/gateways -compact
713 .%T Internet Transport Protocols
715 .%Q Xerox System Integration Standard
723 It does not always detect unidirectional failures in network interfaces,
724 for example, when the output side fails.