1*01869ca4Swiz.\" $NetBSD: routed.8,v 1.45 2017/07/03 21:33:42 wiz Exp $ 20114e805Scgd.\" 34c8599d3Smycroft.\" Copyright (c) 1983, 1991, 1993 44c8599d3Smycroft.\" The Regents of the University of California. All rights reserved. 561f28255Scgd.\" 661f28255Scgd.\" Redistribution and use in source and binary forms, with or without 761f28255Scgd.\" modification, are permitted provided that the following conditions 861f28255Scgd.\" are met: 961f28255Scgd.\" 1. Redistributions of source code must retain the above copyright 1061f28255Scgd.\" notice, this list of conditions and the following disclaimer. 1161f28255Scgd.\" 2. Redistributions in binary form must reproduce the above copyright 1261f28255Scgd.\" notice, this list of conditions and the following disclaimer in the 1361f28255Scgd.\" documentation and/or other materials provided with the distribution. 1461f28255Scgd.\" 3. All advertising materials mentioning features or use of this software 1594b2d428Schristos.\" must display the following acknowledgment: 1661f28255Scgd.\" This product includes software developed by the University of 1761f28255Scgd.\" California, Berkeley and its contributors. 1861f28255Scgd.\" 4. Neither the name of the University nor the names of its contributors 1961f28255Scgd.\" may be used to endorse or promote products derived from this software 2061f28255Scgd.\" without specific prior written permission. 2161f28255Scgd.\" 2261f28255Scgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2361f28255Scgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2461f28255Scgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2561f28255Scgd.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2661f28255Scgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2761f28255Scgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2861f28255Scgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2961f28255Scgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3061f28255Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3161f28255Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3261f28255Scgd.\" SUCH DAMAGE. 3361f28255Scgd.\" 340114e805Scgd.\" @(#)routed.8 8.2 (Berkeley) 12/11/93 35346aa5ddScgd.\" 36a63a57aaSwiz.Dd May 17, 2004 3761f28255Scgd.Dt ROUTED 8 3873f545bbSwiz.Os 3961f28255Scgd.Sh NAME 409f84449aSmrg.Nm routed , 419f84449aSmrg.Nm rdisc 42fc1a5246Sthorpej.Nd network RIP and router discovery routing daemon 4361f28255Scgd.Sh SYNOPSIS 44756b1291Schristos.Nm routed 45a63a57aaSwiz.Op Fl sqdghmAtv 46fc1a5246Sthorpej.Op Fl T Ar tracefile 47fc1a5246Sthorpej.Oo 48fc1a5246Sthorpej.Fl F 49fc1a5246Sthorpej.Ar net Ns Op /mask Ns Op ,metric 50fc1a5246Sthorpej.Oc 510505614dSkleink.Op Fl P Ar parms 5261f28255Scgd.Sh DESCRIPTION 533f50343aSlukem.Nm 54ab0be9beSlukemis a daemon invoked at boot time to manage the network 55fc1a5246Sthorpejrouting tables. 5647190e80SwizIt uses Routing Information Protocol, RIPv1 (RFC 1058), 5747190e80SwizRIPv2 (RFC 1723), 58fc1a5246Sthorpejand Internet Router Discovery Protocol (RFC 1256) 59fc1a5246Sthorpejto maintain the kernel routing table. 6034a98169SperryThe RIPv1 protocol is based on the reference 6134a98169Sperry.Bx 4.3 6234a98169Sperrydaemon. 6361f28255Scgd.Pp 64fc1a5246SthorpejIt listens on the 6561f28255Scgd.Xr udp 4 6661f28255Scgdsocket for the 6761f28255Scgd.Xr route 8 6861f28255Scgdservice (see 6961f28255Scgd.Xr services 5 ) 70fc1a5246Sthorpejfor Routing Information Protocol packets. 71fc1a5246SthorpejIt also sends and receives multicast Router Discovery ICMP messages. 72fc1a5246SthorpejIf the host is a router, 73fc1a5246Sthorpej.Nm 74fc1a5246Sthorpejperiodically supplies copies 75fc1a5246Sthorpejof its routing tables to any directly connected hosts and networks. 76d30d25dcSwizIt also advertises or solicits default routes using Router Discovery 77fc1a5246SthorpejICMP messages. 7861f28255Scgd.Pp 79fc1a5246SthorpejWhen started (or when a network interface is later turned on), 80fc1a5246Sthorpej.Nm 81fc1a5246Sthorpejuses an AF_ROUTE address family facility to find those 8261f28255Scgddirectly connected interfaces configured into the 83fc1a5246Sthorpejsystem and marked "up". 84fc1a5246SthorpejIt adds necessary routes for the interfaces 85fc1a5246Sthorpejto the kernel routing table. 86fc1a5246SthorpejSoon after being first started, and provided there is at least one 87fc1a5246Sthorpejinterface on which RIP has not been disabled, 88fc1a5246Sthorpej.Nm 89fc1a5246Sthorpejdeletes all pre-existing 90fc1a5246Sthorpejnon-static routes in kernel table. 91fc1a5246SthorpejStatic routes in the kernel table are preserved and 92fc1a5246Sthorpejincluded in RIP responses if they have a valid RIP metric 93fc1a5246Sthorpej(see 94fc1a5246Sthorpej.Xr route 8 ) . 95fc1a5246Sthorpej.Pp 96fc1a5246SthorpejIf more than one interface is present (not counting the loopback interface), 97fc1a5246Sthorpejit is assumed that the host should forward packets among the 98fc1a5246Sthorpejconnected networks. 99fc1a5246SthorpejAfter transmitting a RIP 10061f28255Scgd.Em request 10161f28255Scgdand 102fc1a5246SthorpejRouter Discovery Advertisements or Solicitations on a new interface, 103fc1a5246Sthorpejthe daemon enters a loop, listening for 104e7512e5aSchristosRIP request and response and Router Discovery packets from other hosts. 10561f28255Scgd.Pp 10661f28255ScgdWhen a 10761f28255Scgd.Em request 10861f28255Scgdpacket is received, 109fc1a5246Sthorpej.Nm 11061f28255Scgdformulates a reply based on the information maintained in its 111fc1a5246Sthorpejinternal tables. 112fc1a5246SthorpejThe 11361f28255Scgd.Em response 11461f28255Scgdpacket generated contains a list of known routes, each marked 115fc1a5246Sthorpejwith a "hop count" metric (a count of 16 or greater is 116fc1a5246Sthorpejconsidered "infinite"). 117f93fe60aSchristosThe advertised metric for a route reflects the metrics associated 118f93fe60aSchristoswith interfaces 119fc1a5246Sthorpej(see 120f93fe60aSchristos.Xr ifconfig 8 ) 121cb647c57Swizthrough which it is received and sent, 122fc1a5246Sthorpejso setting the metric on an interface 123fc1a5246Sthorpejis an effective way to steer traffic. 124f93fe60aSchristosSee also 125f93fe60aSchristos.Cm adj_inmetric 126f93fe60aSchristosand 127f93fe60aSchristos.Cm adj_outmetric 128f93fe60aSchristosparameters below. 12961f28255Scgd.Pp 1306d8ef4dfSthorpejResponses do not include routes with a first hop on the requesting 131fc1a5246Sthorpejnetwork to implement in part 132fc1a5246Sthorpej.Em split-horizon . 133fc1a5246SthorpejRequests from query programs 134fc1a5246Sthorpejsuch as 135fc1a5246Sthorpej.Xr rtquery 8 136fc1a5246Sthorpejare answered with the complete table. 137fc1a5246Sthorpej.Pp 138fc1a5246SthorpejThe routing table maintained by the daemon 139fc1a5246Sthorpejincludes space for several gateways for each destination 140fc1a5246Sthorpejto speed recovery from a failing router. 141fc1a5246SthorpejRIP 142fc1a5246Sthorpej.Em response 143fc1a5246Sthorpejpackets received are used to update the routing tables provided they are 144fc1a5246Sthorpejfrom one of the several currently recognized gateways or 145fc1a5246Sthorpejadvertise a better metric than at least one of the existing 146fc1a5246Sthorpejgateways. 14761f28255Scgd.Pp 14861f28255ScgdWhen an update is applied, 149fc1a5246Sthorpej.Nm 150fc1a5246Sthorpejrecords the change in its own tables and updates the kernel routing table 151fc1a5246Sthorpejif the best route to the destination changes. 152fc1a5246SthorpejThe change in the kernel routing table is reflected in the next batch of 15361f28255Scgd.Em response 154fc1a5246Sthorpejpackets sent. 155fc1a5246SthorpejIf the next response is not scheduled for a while, a 156fc1a5246Sthorpej.Em flash update 157fc1a5246Sthorpejresponse containing only recently changed routes is sent. 15861f28255Scgd.Pp 15961f28255ScgdIn addition to processing incoming packets, 160fc1a5246Sthorpej.Nm 16161f28255Scgdalso periodically checks the routing table entries. 16261f28255ScgdIf an entry has not been updated for 3 minutes, the entry's metric 163fc1a5246Sthorpejis set to infinity and marked for deletion. 164fc1a5246SthorpejDeletions are delayed until the route has been advertised with 1655b09090eSadan infinite metric to ensure the invalidation 166fc1a5246Sthorpejis propagated throughout the local internet. 167fc1a5246SthorpejThis is a form of 168fc1a5246Sthorpej.Em poison reverse . 169fc1a5246Sthorpej.Pp 170fc1a5246SthorpejRoutes in the kernel table that are added or changed as a result 171fc1a5246Sthorpejof ICMP Redirect messages are deleted after a while to minimize 172fc1a5246Sthorpej.Em black-holes . 173fc1a5246SthorpejWhen a TCP connection suffers a timeout, 174fc1a5246Sthorpejthe kernel tells 175990562bfSwiz.Nm , 176fc1a5246Sthorpejwhich deletes all redirected routes 177fc1a5246Sthorpejthrough the gateway involved, advances the age of all RIP routes through 178fc1a5246Sthorpejthe gateway to allow an alternate to be chosen, and advances of the 179fc1a5246Sthorpejage of any relevant Router Discovery Protocol default routes. 18061f28255Scgd.Pp 18161f28255ScgdHosts acting as internetwork routers gratuitously supply their 18261f28255Scgdrouting tables every 30 seconds to all directly connected hosts 18361f28255Scgdand networks. 184fc1a5246SthorpejThese RIP responses are sent to the broadcast address on nets that support 185fc1a5246Sthorpejbroadcasting, 18661f28255Scgdto the destination address on point-to-point links, and to the router's 18761f28255Scgdown address on other networks. 188fc1a5246SthorpejIf RIPv2 is enabled, multicast packets are sent on interfaces that 189fc1a5246Sthorpejsupport multicasting. 190fc1a5246Sthorpej.Pp 191fc1a5246SthorpejIf no response is received on a remote interface, if there are errors 192fc1a5246Sthorpejwhile sending responses, 193fc1a5246Sthorpejor if there are more errors than input or output (see 1943d7afc6dSfair.Xr netstat 1 ) , 195fc1a5246Sthorpejthen the cable or some other part of the interface is assumed to be 196fc1a5246Sthorpejdisconnected or broken, and routes are adjusted appropriately. 197fc1a5246Sthorpej.Pp 198fc1a5246SthorpejThe 199fc1a5246Sthorpej.Em Internet Router Discovery Protocol 200fc1a5246Sthorpejis handled similarly. 201fc1a5246SthorpejWhen the daemon is supplying RIP routes, it also listens for 202fc1a5246SthorpejRouter Discovery Solicitations and sends Advertisements. 2036d8ef4dfSthorpejWhen it is quiet and listening to other RIP routers, it 204fc1a5246Sthorpejsends Solicitations and listens for Advertisements. 205fc1a5246SthorpejIf it receives 2066d8ef4dfSthorpeja good Advertisement and it is not multi-homed, 2076d8ef4dfSthorpejit stops listening for broadcast or multicast RIP responses. 208fc1a5246SthorpejIt tracks several advertising routers to speed recovery when the 209fc1a5246Sthorpejcurrently chosen router dies. 210fc1a5246SthorpejIf all discovered routers disappear, 211fc1a5246Sthorpejthe daemon resumes listening to RIP responses. 21262f94a66SchristosIt continues listening to RIP while using Router Discovery 2136d8ef4dfSthorpejif multi-homed to ensure all interfaces are used. 214fc1a5246Sthorpej.Pp 2158cd71f8bSmikelThe Router Discovery standard requires that advertisements 216cb647c57Swizhave a default "lifetime" of 30 minutes. 217cb647c57SwizThat means should something happen, a client can be without a good route for 218cb647c57Swiz30 minutes. 21909cbac4eSwizIt is a good idea to reduce the default to 45 seconds using 220fc1a5246Sthorpej.Fl P Cm rdisc_interval=45 221fc1a5246Sthorpejon the command line or 222fc1a5246Sthorpej.Cm rdisc_interval=45 223fc1a5246Sthorpejin the 224fc1a5246Sthorpej.Pa /etc/gateways 225fc1a5246Sthorpejfile. 226fc1a5246Sthorpej.Pp 22794b2d428SchristosWhile using Router Discovery (which happens by default when 22894b2d428Schristosthe system has a single network interface and a Router Discover Advertisement 22994b2d428Schristosis received), there is a single default route and a variable number of 23094b2d428Schristosredirected host routes in the kernel table. 23194b2d428SchristosOn a host with more than one network interface, 23294b2d428Schristosthis default route will be via only one of the interfaces. 233cb647c57SwizThus, multi-homed hosts running with 23465c4d369Swiz.Fl q 23565c4d369Swizmight need 23694b2d428Schristos.Cm no_rdisc 23794b2d428Schristosdescribed below. 23894b2d428Schristos.Pp 239fc1a5246SthorpejSee the 240fc1a5246Sthorpej.Cm pm_rdisc 241fc1a5246Sthorpejfacility described below to support "legacy" systems 242fc1a5246Sthorpejthat can handle neither RIPv2 nor Router Discovery. 243fc1a5246Sthorpej.Pp 244e7512e5aSchristosBy default, neither Router Discovery advertisements nor solicitations 245fc1a5246Sthorpejare sent over point to point links (e.g. PPP). 246e7512e5aSchristosThe netmask associated with point-to-point links (such as SLIP 247e7512e5aSchristosor PPP, with the IFF_POINTOPOINT flag) is used by 2483f50343aSlukem.Nm 249e7512e5aSchristosto infer the netmask used by the remote system when RIPv1 is used. 25061f28255Scgd.Pp 25194b2d428SchristosThe following options are available: 25294b2d428Schristos.Bl -tag -width indent 25361f28255Scgd.It Fl s 25494b2d428Schristosforce 255fc1a5246Sthorpej.Nm 256fc1a5246Sthorpejto supply routing information. 257cb647c57SwizThis is the default if multiple network interfaces are present on which 258d8ad9235SkleinkRIP or Router Discovery have not been disabled, and if the sysctl 259d8ad9235Skleinknet.inet.ip.forwarding=1. 26061f28255Scgd.It Fl q 26161f28255Scgdis the opposite of the 26261f28255Scgd.Fl s 26361f28255Scgdoption. 264e7512e5aSchristosThis is the default when only one interface is present. 2654fea751dSchristosWith this explicit option, the daemon is always in "quiet-mode" for RIP 2664fea751dSchristosand does not supply routing information to other computers. 267fc1a5246Sthorpej.It Fl d 26894b2d428Schristosdo not run in the background. 269fc1a5246SthorpejThis option is meant for interactive use. 270fc1a5246Sthorpej.It Fl g 27194b2d428Schristosused on internetwork routers to offer a route 272fc1a5246Sthorpejto the "default" destination. 273fc1a5246SthorpejIt is equivalent to 274fc1a5246Sthorpej.Fl F 275fc1a5246Sthorpej.Cm 0/0,1 276fc1a5246Sthorpejand is present mostly for historical reasons. 277fc1a5246SthorpejA better choice is 278fc1a5246Sthorpej.Fl P Cm pm_rdisc 279fc1a5246Sthorpejon the command line or 28094b2d428Schristos.Cm pm_rdisc 28194b2d428Schristosin the 282fc1a5246Sthorpej.Pa /etc/gateways 283fc1a5246Sthorpejfile. 284fc1a5246Sthorpejsince a larger metric 285fc1a5246Sthorpejwill be used, reducing the spread of the potentially dangerous 286fc1a5246Sthorpejdefault route. 287fc1a5246SthorpejThis is typically used on a gateway to the Internet, 288fc1a5246Sthorpejor on a gateway that uses another routing protocol whose routes 289fc1a5246Sthorpejare not reported to other local routers. 290cb647c57SwizNotice that because a metric of 1 is used, this feature is dangerous. 291cb647c57SwizIt is more commonly accidentally used to create chaos with a 29278aeeb96Sabsrouting loop than to solve problems. 293fc1a5246Sthorpej.It Fl h 29494b2d428Schristoscause host or point-to-point routes to not be advertised, 295fc1a5246Sthorpejprovided there is a network route going the same direction. 296fc1a5246SthorpejThat is a limited kind of aggregation. 29794b2d428SchristosThis option is useful on gateways to Ethernets that have other gateway 298fc1a5246Sthorpejmachines connected with point-to-point links such as SLIP. 299fc1a5246Sthorpej.It Fl m 30094b2d428Schristoscause the machine to advertise a host or point-to-point route to 301fc1a5246Sthorpejits primary interface. 302fc1a5246SthorpejIt is useful on multi-homed machines such as NFS servers. 303fc1a5246SthorpejThis option should not be used except when the cost of 304fc1a5246Sthorpejthe host routes it generates is justified by the popularity of 305fc1a5246Sthorpejthe server. 306fc1a5246SthorpejIt is effective only when the machine is supplying 307fc1a5246Sthorpejrouting information, because there is more than one interface. 308fc1a5246SthorpejThe 309fc1a5246Sthorpej.Fl m 310fc1a5246Sthorpejoption overrides the 311fc1a5246Sthorpej.Fl q 312fc1a5246Sthorpejoption to the limited extent of advertising the host route. 313fc1a5246Sthorpej.It Fl A 314fc1a5246Sthorpejdo not ignore RIPv2 authentication if we do not care about RIPv2 315fc1a5246Sthorpejauthentication. 316fc1a5246SthorpejThis option is required for conformance with RFC 1723. 317fc1a5246SthorpejHowever, it makes no sense and breaks using RIP as a discovery protocol 318fc1a5246Sthorpejto ignore all RIPv2 packets that carry authentication when this machine 319fc1a5246Sthorpejdoes not care about authentication. 32061f28255Scgd.It Fl t 32194b2d428Schristosincrease the debugging level, which causes more information to be logged 322fc1a5246Sthorpejon the tracefile specified with 323fc1a5246Sthorpej.Fl T 324fc1a5246Sthorpejor standard out. 325fc1a5246SthorpejThe debugging level can be increased or decreased 326fc1a5246Sthorpejwith the 327fc1a5246Sthorpej.Em SIGUSR1 328fc1a5246Sthorpejor 329fc1a5246Sthorpej.Em SIGUSR2 330fc1a5246Sthorpejsignals or with the 3313d7afc6dSfair.Xr rtquery 8 332fc1a5246Sthorpejcommand. 3336d8ef4dfSthorpej.It Fl T Ar tracefile 3346d8ef4dfSthorpejincreases the debugging level to at least 1 and 3356d8ef4dfSthorpejcauses debugging information to be appended to the trace file. 3366d8ef4dfSthorpejNote that because of security concerns, it is wisest to not run 33794b2d428Schristos.Nm 3386d8ef4dfSthorpejroutinely with tracing directed to a file. 3396d8ef4dfSthorpej.It Fl v 340d30d25dcSwizdisplays and logs the version of daemon. 341fc1a5246Sthorpej.It Fl F Ar net[/mask][,metric] 342fc1a5246Sthorpejminimize routes in transmissions via interfaces with addresses that match 343fc1a5246Sthorpej.Em net/mask , 344fc1a5246Sthorpejand synthesizes a default route to this machine with the 345fc1a5246Sthorpej.Em metric . 346fc1a5246SthorpejThe intent is to reduce RIP traffic on slow, point-to-point links 347fc1a5246Sthorpejsuch as PPP links by replacing many large UDP packets of RIP information 348fc1a5246Sthorpejwith a single, small packet containing a "fake" default route. 349fc1a5246SthorpejIf 350fc1a5246Sthorpej.Em metric 351fc1a5246Sthorpejis absent, a value of 14 is assumed to limit 352fc1a5246Sthorpejthe spread of the "fake" default route. 353fc1a5246SthorpejThis is a dangerous feature that when used carelessly can cause routing 354fc1a5246Sthorpejloops. 355fc1a5246SthorpejNotice also that more than one interface can match the specified network 356fc1a5246Sthorpejnumber and mask. 357fc1a5246SthorpejSee also 358fc1a5246Sthorpej.Fl g . 359fc1a5246Sthorpej.It Fl P Ar parms 360fc1a5246Sthorpejis equivalent to adding the parameter 361fc1a5246Sthorpejline 362fc1a5246Sthorpej.Em parms 363fc1a5246Sthorpejto the 364fc1a5246Sthorpej.Pa /etc/gateways 365fc1a5246Sthorpejfile. 36661f28255Scgd.El 36761f28255Scgd.Pp 36861f28255ScgdAny other argument supplied is interpreted as the name 369fc1a5246Sthorpejof a file in which the actions of 370fc1a5246Sthorpej.Nm 371fc1a5246Sthorpejshould be logged. 372fc1a5246SthorpejIt is better to use 373fc1a5246Sthorpej.Fl T 374fc1a5246Sthorpejinstead of 375fc1a5246Sthorpejappending the name of the trace file to the command. 37661f28255Scgd.Pp 377fc1a5246Sthorpej.Nm 378fc1a5246Sthorpejalso supports the notion of 379fc1a5246Sthorpej"distant" 38061f28255Scgd.Em passive 381fc1a5246Sthorpejor 38261f28255Scgd.Em active 383fc1a5246Sthorpejgateways. 384fc1a5246SthorpejWhen 385fc1a5246Sthorpej.Nm 386fc1a5246Sthorpejis started, it reads the file 38761f28255Scgd.Pa /etc/gateways 388fc1a5246Sthorpejto find such distant gateways which may not be located using 389fc1a5246Sthorpejonly information from a routing socket, to discover if some 390fc1a5246Sthorpejof the local gateways are 391fc1a5246Sthorpej.Em passive , 392fc1a5246Sthorpejand to obtain other parameters. 39361f28255ScgdGateways specified in this manner should be marked passive 39461f28255Scgdif they are not expected to exchange routing information, 39561f28255Scgdwhile gateways marked active 396fc1a5246Sthorpejshould be willing to exchange RIP packets. 397fc1a5246SthorpejRoutes through 398fc1a5246Sthorpej.Em passive 399fc1a5246Sthorpejgateways are installed in the 400fc1a5246Sthorpejkernel's routing tables once upon startup and are not included in 401fc1a5246Sthorpejtransmitted RIP responses. 402fc1a5246Sthorpej.Pp 403fc1a5246SthorpejDistant active gateways are treated like network interfaces. 404fc1a5246SthorpejRIP responses are sent 405fc1a5246Sthorpejto the distant 406fc1a5246Sthorpej.Em active 407fc1a5246Sthorpejgateway. 408fc1a5246SthorpejIf no responses are received, the associated route is deleted from 409fc1a5246Sthorpejthe kernel table and RIP responses advertised via other interfaces. 410fc1a5246SthorpejIf the distant gateway resumes sending RIP responses, the associated 411fc1a5246Sthorpejroute is restored. 412fc1a5246Sthorpej.Pp 413fc1a5246SthorpejSuch gateways can be useful on media that do not support broadcasts 414fc1a5246Sthorpejor multicasts but otherwise act like classic shared media like 415fc1a5246SthorpejEthernets such as some ATM networks. 41662f94a66SchristosOne can list all RIP routers reachable on the HIPPI or ATM network in 417fc1a5246Sthorpej.Pa /etc/gateways 418fc1a5246Sthorpejwith a series of 419fc1a5246Sthorpej"host" lines. 4206d8ef4dfSthorpejNote that it is usually desirable to use RIPv2 in such situations 4216d8ef4dfSthorpejto avoid generating lists of inferred host routes. 422fc1a5246Sthorpej.Pp 42361f28255ScgdGateways marked 42461f28255Scgd.Em external 42561f28255Scgdare also passive, but are not placed in the kernel 42661f28255Scgdrouting table nor are they included in routing updates. 427fc1a5246SthorpejThe function of external entries is to indicate 42861f28255Scgdthat another routing process 429e7512e5aSchristoswill install such a route if necessary, 43094b2d428Schristosand that other routes to that destination should not be installed 431fc1a5246Sthorpejby 432990562bfSwiz.Nm . 43361f28255ScgdSuch entries are only required when both routers may learn of routes 43461f28255Scgdto the same destination. 43561f28255Scgd.Pp 43661f28255ScgdThe 437b1998ea4Sperry.Pa /etc/gateways 438f93fe60aSchristosfile is comprised of a series of lines, each in 4396d8ef4dfSthorpejone of the following two formats or consist of parameters described later. 4406d8ef4dfSthorpejBlank lines and lines starting with '#' are comments. 441fc1a5246Sthorpej.Pp 44261f28255Scgd.Bd -ragged 443fc1a5246Sthorpej.Cm net 444fc1a5246Sthorpej.Ar Nname[/mask] 44561f28255Scgd.Cm gateway 446fc1a5246Sthorpej.Ar Gname 44761f28255Scgd.Cm metric 44861f28255Scgd.Ar value 449*01869ca4Swiz.Pf < Cm passive No \&| 45061f28255Scgd.Cm active No \&| 451*01869ca4Swiz.Cm extern Ns > 452fc1a5246Sthorpej.Ed 453fc1a5246Sthorpej.Bd -ragged 454fc1a5246Sthorpej.Cm host 455fc1a5246Sthorpej.Ar Hname 456fc1a5246Sthorpej.Cm gateway 457fc1a5246Sthorpej.Ar Gname 458fc1a5246Sthorpej.Cm metric 459fc1a5246Sthorpej.Ar value 460*01869ca4Swiz.Pf < Cm passive No \&| 461fc1a5246Sthorpej.Cm active No \&| 462*01869ca4Swiz.Cm extern Ns > 46361f28255Scgd.Ed 46461f28255Scgd.Pp 465fc1a5246Sthorpej.Ar Nname 46661f28255Scgdor 467fc1a5246Sthorpej.Ar Hname 468fc1a5246Sthorpejis the name of the destination network or host. 469fc1a5246SthorpejIt may be a symbolic network name or an Internet address 470fc1a5246Sthorpejspecified in "dot" notation (see 471fc1a5246Sthorpej.Xr inet 3 ) . 472fc1a5246Sthorpej(If it is a name, then it must either be defined in 47361f28255Scgd.Pa /etc/networks 47461f28255Scgdor 475fc1a5246Sthorpej.Pa /etc/hosts , 476fc1a5246Sthorpejor 47761f28255Scgd.Xr named 8 , 478fc1a5246Sthorpejmust have been started before 479990562bfSwiz.Nm . ) 48061f28255Scgd.Pp 48194b2d428Schristos.Ar Mask 482fc1a5246Sthorpejis an optional number between 1 and 32 indicating the netmask associated 483fc1a5246Sthorpejwith 484fc1a5246Sthorpej.Ar Nname . 485fc1a5246Sthorpej.Pp 486fc1a5246Sthorpej.Ar Gname 487fc1a5246Sthorpejis the name or address of the gateway to which RIP responses should 48861f28255Scgdbe forwarded. 48961f28255Scgd.Pp 49061f28255Scgd.Ar Value 491fc1a5246Sthorpejis the hop count to the destination host or network. 49294b2d428Schristos.Ar " Host hname " 493fc1a5246Sthorpejis equivalent to 494fc1a5246Sthorpej.Ar " net nname/32 " . 49561f28255Scgd.Pp 49661f28255ScgdOne of the keywords 49761f28255Scgd.Cm passive , 49861f28255Scgd.Cm active 49961f28255Scgdor 50061f28255Scgd.Cm external 501fc1a5246Sthorpejmust be present to indicate whether the gateway should be treated as 502fc1a5246Sthorpej.Cm passive 50361f28255Scgdor 504fc1a5246Sthorpej.Cm active 50561f28255Scgd(as described above), 50661f28255Scgdor whether the gateway is 507fc1a5246Sthorpej.Cm external 508fc1a5246Sthorpejto the scope of the RIP protocol. 50961f28255Scgd.Pp 5106d8ef4dfSthorpejAs can be seen when debugging is turned on with 5116d8ef4dfSthorpej.Fl t , 51262f94a66Schristossuch lines create pseudo-interfaces. 5136d8ef4dfSthorpejTo set parameters for remote or external interfaces, 5146d8ef4dfSthorpeja line starting with 5156d8ef4dfSthorpej.Cm if=alias(Hname) , 5166d8ef4dfSthorpej.Cm if=remote(Hname) , 5176d8ef4dfSthorpejetc. should be used. 518f93fe60aSchristos.Ss Parameters 519fc1a5246SthorpejLines that start with neither "net" nor "host" must consist of one 520fc1a5246Sthorpejor more of the following parameter settings, separated by commas or 521fc1a5246Sthorpejblanks: 522fc1a5246Sthorpej.Bl -tag -width Ds 523fc1a5246Sthorpej.It Cm if Ns \&= Ns Ar ifname 524fc1a5246Sthorpejindicates that the other parameters on the line apply to the interface 525fc1a5246Sthorpejname 526fc1a5246Sthorpej.Ar ifname . 527fc1a5246Sthorpej.It Cm subnet Ns \&= Ns Ar nname[/mask][,metric] 528fc1a5246Sthorpejadvertises a route to network 529b1998ea4Sperry.Ar nname 530fc1a5246Sthorpejwith mask 531b1998ea4Sperry.Ar mask 532fc1a5246Sthorpejand the supplied metric (default 1). 533fc1a5246SthorpejThis is useful for filling "holes" in CIDR allocations. 534fc1a5246SthorpejThis parameter must appear by itself on a line. 5356d8ef4dfSthorpejThe network number must specify a full, 32-bit value, as in 192.0.2.0 5366d8ef4dfSthorpejinstead of 192.0.2. 537fc1a5246Sthorpej.Pp 538cb647c57SwizDo not use this feature unless necessary. 539cb647c57SwizIt is dangerous. 5406d8ef4dfSthorpej.It Cm ripv1_mask Ns \&= Ns Ar nname/mask1,mask2 5416d8ef4dfSthorpejspecifies that netmask of the network of which 54265c4d369Swiz.Cm nname/mask1 5436d8ef4dfSthorpejis 5446d8ef4dfSthorpeja subnet should be 5456d8ef4dfSthorpej.Cm mask2 . 54665c4d369SwizFor example 54765c4d369Swiz.Cm ripv1_mask Ns \&= Ns Ar 192.0.2.16/28,27 54865c4d369Swizmarks 192.0.2.16/28 54994b2d428Schristosas a subnet of 192.0.2.0/27 instead of 192.0.2.0/24. 55062f94a66SchristosIt is better to turn on RIPv2 instead of using this facility, for example 55165c4d369Swizwith 55265c4d369Swiz.Cm ripv2_out . 5536d8ef4dfSthorpej.It Cm passwd Ns \&= Ns Ar XXX[|KeyID[start|stop]] 554e7512e5aSchristosspecifies a RIPv2 cleartext password that will be included on 555e7512e5aSchristosall RIPv2 responses sent, and checked on all RIPv2 responses received. 556e7512e5aSchristosAny blanks, tab characters, commas, or '#', '|', or NULL characters in the 557e7512e5aSchristospassword must be escaped with a backslash (\\). 558e7512e5aSchristosThe common escape sequences \\n, \\r, \\t, \\b, and \\xxx have their 559e7512e5aSchristosusual meanings. 560e7512e5aSchristosThe 561e7512e5aSchristos.Cm KeyID 562e7512e5aSchristosmust be unique but is ignored for cleartext passwords. 563e7512e5aSchristosIf present, 564e7512e5aSchristos.Cm start 565e7512e5aSchristosand 566e7512e5aSchristos.Cm stop 567e7512e5aSchristosare timestamps in the form year/month/day@hour:minute. 568e7512e5aSchristosThey specify when the password is valid. 569e7512e5aSchristosThe valid password with the most future is used on output packets, unless 570e7512e5aSchristosall passwords have expired, in which case the password that expired most 571e7512e5aSchristosrecently is used, or unless no passwords are valid yet, in which case 572e7512e5aSchristosno password is output. 573e7512e5aSchristosIncoming packets can carry any password that is valid, will 574f93fe60aSchristosbe valid within the next 24 hours, or that was valid within the preceding 575f93fe60aSchristos24 hours. 576e7512e5aSchristosTo protect the secrets, the passwd settings are valid only in the 577e7512e5aSchristos.Em /etc/gateways 578e7512e5aSchristosfile and only when that file is readable only by UID 0. 5796d8ef4dfSthorpej.It Cm md5_passwd Ns \&= Ns Ar XXX|KeyID[start|stop] 58094b2d428Schristosspecifies a RIPv2 MD5 password. 581e7512e5aSchristosExcept that a 582e7512e5aSchristos.Cm KeyID 583e7512e5aSchristosis required, this keyword is similar to 584e7512e5aSchristos.Cm passwd . 585fc1a5246Sthorpej.It Cm no_ag 586fc1a5246Sthorpejturns off aggregation of subnets in RIPv1 and RIPv2 responses. 587fc1a5246Sthorpej.It Cm no_super_ag 588fc1a5246Sthorpejturns off aggregation of networks into supernets in RIPv2 responses. 589fc1a5246Sthorpej.It Cm passive 590e7512e5aSchristosmarks the interface to not be advertised in updates sent via other 591e7512e5aSchristosinterfaces, and turns off all RIP and router discovery through the interface. 592fc1a5246Sthorpej.It Cm no_rip 593fc1a5246Sthorpejdisables all RIP processing on the specified interface. 594fc1a5246SthorpejIf no interfaces are allowed to process RIP packets, 595fc1a5246Sthorpej.Nm 596fc1a5246Sthorpejacts purely as a router discovery daemon. 59794b2d428Schristos.Pp 598fc1a5246SthorpejNote that turning off RIP without explicitly turning on router 599fc1a5246Sthorpejdiscovery advertisements with 600fc1a5246Sthorpej.Cm rdisc_adv 601fc1a5246Sthorpejor 602fc1a5246Sthorpej.Fl s 603fc1a5246Sthorpejcauses 6043f50343aSlukem.Nm 605e7512e5aSchristosto act as a client router discovery daemon, not advertising. 6066d8ef4dfSthorpej.It Cm no_rip_mcast 6076d8ef4dfSthorpejcauses RIPv2 packets to be broadcast instead of multicast. 608fc1a5246Sthorpej.It Cm no_ripv1_in 609fc1a5246Sthorpejcauses RIPv1 received responses to be ignored. 610fc1a5246Sthorpej.It Cm no_ripv2_in 611fc1a5246Sthorpejcauses RIPv2 received responses to be ignored. 612fc1a5246Sthorpej.It Cm ripv2_out 61362f94a66Schristosturns on RIPv2 output and causes RIPv2 advertisements to be 614fc1a5246Sthorpejmulticast when possible. 615e7512e5aSchristos.It Cm ripv2 616e7512e5aSchristosis equivalent to 617e7512e5aSchristos.Cm no_ripv1_in 618e7512e5aSchristosand 619e7512e5aSchristos.Cm no_ripv1_out . 62062f94a66SchristosThis enables RIPv2. 621fc1a5246Sthorpej.It Cm no_rdisc 622fc1a5246Sthorpejdisables the Internet Router Discovery Protocol. 623fc1a5246Sthorpej.It Cm no_solicit 624e7512e5aSchristosdisables the transmission of Router Discovery Solicitations. 625fc1a5246Sthorpej.It Cm send_solicit 626fc1a5246Sthorpejspecifies that Router Discovery solicitations should be sent, 627fc1a5246Sthorpejeven on point-to-point links, 628fc1a5246Sthorpejwhich by default only listen to Router Discovery messages. 629fc1a5246Sthorpej.It Cm no_rdisc_adv 63094b2d428Schristosdisables the transmission of Router Discovery Advertisements. 631fc1a5246Sthorpej.It Cm rdisc_adv 632e7512e5aSchristosspecifies that Router Discovery Advertisements should be sent, 633fc1a5246Sthorpejeven on point-to-point links, 63494b2d428Schristoswhich by default only listen to Router Discovery messages. 635fc1a5246Sthorpej.It Cm bcast_rdisc 636fc1a5246Sthorpejspecifies that Router Discovery packets should be broadcast instead of 637fc1a5246Sthorpejmulticast. 638fc1a5246Sthorpej.It Cm rdisc_pref Ns \&= Ns Ar N 6396d8ef4dfSthorpejsets the preference in Router Discovery Advertisements to the optionally 6406d8ef4dfSthorpejsigned integer 641fc1a5246Sthorpej.Ar N . 6426d8ef4dfSthorpejThe default preference is 0. 6437ed77138SchristosDefault routes with larger preferences are preferred by clients. 644fc1a5246Sthorpej.It Cm rdisc_interval Ns \&= Ns Ar N 645fc1a5246Sthorpejsets the nominal interval with which Router Discovery Advertisements 646fc1a5246Sthorpejare transmitted to N seconds and their lifetime to 3*N. 647fc1a5246Sthorpej.It Cm fake_default Ns \&= Ns Ar metric 648fc1a5246Sthorpejhas an identical effect to 649e7512e5aSchristos.Fl F Ar net[/mask][=metric] 65094b2d428Schristoswith the network and mask coming from the specified interface. 651fc1a5246Sthorpej.It Cm pm_rdisc 652fc1a5246Sthorpejis similar to 653fc1a5246Sthorpej.Cm fake_default . 654fc1a5246SthorpejWhen RIPv2 routes are multicast, so that RIPv1 listeners cannot 655fc1a5246Sthorpejreceive them, this feature causes a RIPv1 default route to be 656fc1a5246Sthorpejbroadcast to RIPv1 listeners. 657fc1a5246SthorpejUnless modified with 658fc1a5246Sthorpej.Cm fake_default , 659fc1a5246Sthorpejthe default route is broadcast with a metric of 14. 660fc1a5246SthorpejThat serves as a "poor man's router discovery" protocol. 661f93fe60aSchristos.It Cm adj_inmetric Ns \&= Ns Ar delta 662f93fe60aSchristosadjusts the hop count or metric of received RIP routes by 663f93fe60aSchristos.Ar delta . 664f93fe60aSchristosThe metric of every received RIP route is increased by the sum 665f93fe60aSchristosof two values associated with the interface. 666f93fe60aSchristosOne is the adj_inmetric value and the other is the interface 667f93fe60aSchristosmetric set with 668f93fe60aSchristos.Xr ifconfig 8 . 669f93fe60aSchristos.It Cm adj_outmetric Ns \&= Ns Ar delta 670f93fe60aSchristosadjusts the hop count or metric of advertised RIP routes by 671f93fe60aSchristos.Ar delta . 672f93fe60aSchristosThe metric of every received RIP route is increased by the metric 673f93fe60aSchristosassociated with the interface by which it was received, or by 1 if 674f93fe60aSchristosthe interface does not have a non-zero metric. 675f93fe60aSchristosThe metric of the received route is then increased by the 676f93fe60aSchristosadj_outmetric associated with the interface. 677f93fe60aSchristosEvery advertised route is increased by a total of four 678f93fe60aSchristosvalues, 679f93fe60aSchristosthe metric set for the interface by which it was received with 680f93fe60aSchristos.Xr ifconfig 8 , 681f93fe60aSchristosthe 682f93fe60aSchristos.Cm adj_inmetric Ar delta 683f93fe60aSchristosof the receiving interface, 684f93fe60aSchristosthe metric set for the interface by which it is transmitted with 685f93fe60aSchristos.Xr ifconfig 8 , 686f93fe60aSchristosand the 687f93fe60aSchristos.Cm adj_outmetric Ar delta 688f93fe60aSchristosof the transmitting interface. 6896d8ef4dfSthorpej.It Cm trust_gateway Ns \&= Ns Ar rname[|net1/mask1|net2/mask2|...] 690f93fe60aSchristoscauses RIP packets from router 691f93fe60aSchristos.Ar rname 692f93fe60aSchristosand other routers named in other 693e7512e5aSchristos.Cm trust_gateway 6946d8ef4dfSthorpejkeywords to be accepted, and packets from other routers to be ignored. 6956d8ef4dfSthorpejIf networks are specified, then routes to other networks will be ignored 6966d8ef4dfSthorpejfrom that router. 697e7512e5aSchristos.It Cm redirect_ok 698f93fe60aSchristosallows the kernel to listen ICMP Redirect messages when the system is acting 699e7512e5aSchristosas a router and forwarding packets. 700f93fe60aSchristosOtherwise, ICMP Redirect messages are overridden and deleted when the 701f93fe60aSchristossystem is acting as a router. 702fc1a5246Sthorpej.El 70361f28255Scgd.Sh FILES 70461f28255Scgd.Bl -tag -width /etc/gateways -compact 70561f28255Scgd.It Pa /etc/gateways 70661f28255Scgdfor distant gateways 70761f28255Scgd.El 70861f28255Scgd.Sh SEE ALSO 70961f28255Scgd.Xr icmp 4 , 71094b2d428Schristos.Xr udp 4 , 711f6f00e26Smsaitoh.Xr rtquery 8 71261f28255Scgd.Rs 71361f28255Scgd.%T Internet Transport Protocols 71461f28255Scgd.%R XSIS 028112 71561f28255Scgd.%Q Xerox System Integration Standard 71661f28255Scgd.Re 71761f28255Scgd.Sh HISTORY 71861f28255ScgdThe 71961f28255Scgd.Nm 72061f28255Scgdcommand appeared in 72161f28255Scgd.Bx 4.2 . 722cb647c57Swiz.Sh BUGS 723cb647c57SwizIt does not always detect unidirectional failures in network interfaces, 724cb647c57Swizfor example, when the output side fails. 725