1.\" Copyright (c) 1983, 1991 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)routed.8 6.6 (Berkeley) 3/16/91 33.\" 34.Dd March 16, 1991 35.Dt ROUTED 8 36.Os BSD 4.2 37.Sh NAME 38.Nm routed 39.Nd network routing daemon 40.Sh SYNOPSIS 41.Nm routed 42.Op Fl d 43.Op Fl g 44.Op Fl q 45.Op Fl s 46.Op Fl t 47.Op Ar logfile 48.Sh DESCRIPTION 49.Nm Routed 50is invoked at boot time to manage the network routing tables. 51The routing daemon uses a variant of the Xerox NS Routing 52Information Protocol in maintaining up to date kernel routing 53table entries. 54It used a generalized protocol capable of use with multiple 55address types, but is currently used only for Internet routing 56within a cluster of networks. 57.Pp 58In normal operation 59.Nm routed 60listens on the 61.Xr udp 4 62socket for the 63.Xr route 8 64service (see 65.Xr services 5 ) 66for routing information packets. If the host is an 67internetwork router, it periodically supplies copies 68of its routing tables to any directly connected hosts 69and networks. 70.Pp 71When 72.Nm routed 73is started, it uses the 74.Dv SIOCGIFCONF 75.Xr ioctl 2 76to find those 77directly connected interfaces configured into the 78system and marked ``up'' (the software loopback interface 79is ignored). If multiple interfaces 80are present, it is assumed that the host will forward packets 81between networks. 82.Nm Routed 83then transmits a 84.Em request 85packet on each interface (using a broadcast packet if 86the interface supports it) and enters a loop, listening 87for 88.Em request 89and 90.Em response 91packets from other hosts. 92.Pp 93When a 94.Em request 95packet is received, 96.Nm routed 97formulates a reply based on the information maintained in its 98internal tables. The 99.Em response 100packet generated contains a list of known routes, each marked 101with a ``hop count'' metric (a count of 16, or greater, is 102considered ``infinite''). The metric associated with each 103route returned provides a metric 104.Em relative to the sender . 105.Pp 106.Em Response 107packets received by 108.Nm routed 109are used to update the routing tables if one of the following 110conditions is satisfied: 111.Bl -enum 112.It 113No routing table entry exists for the destination network 114or host, and the metric indicates the destination is ``reachable'' 115(i.e. the hop count is not infinite). 116.It 117The source host of the packet is the same as the router in the 118existing routing table entry. That is, updated information is 119being received from the very internetwork router through which 120packets for the destination are being routed. 121.It 122The existing entry in the routing table has not been updated for 123some time (defined to be 90 seconds) and the route is at least 124as cost effective as the current route. 125.It 126The new route describes a shorter route to the destination than 127the one currently stored in the routing tables; the metric of 128the new route is compared against the one stored in the table 129to decide this. 130.El 131.Pp 132When an update is applied, 133.Nm routed 134records the change in its internal tables and updates the kernel 135routing table. 136The change is reflected in the next 137.Em response 138packet sent. 139.Pp 140In addition to processing incoming packets, 141.Nm routed 142also periodically checks the routing table entries. 143If an entry has not been updated for 3 minutes, the entry's metric 144is set to infinity and marked for deletion. Deletions are delayed 145an additional 60 seconds to insure the invalidation is propagated 146throughout the local internet. 147.Pp 148Hosts acting as internetwork routers gratuitously supply their 149routing tables every 30 seconds to all directly connected hosts 150and networks. 151The response is sent to the broadcast address on nets capable of that function, 152to the destination address on point-to-point links, and to the router's 153own address on other networks. 154The normal routing tables are bypassed when sending gratuitous responses. 155The reception of responses on each network is used to determine that the 156network and interface are functioning correctly. 157If no response is received on an interface, another route may be chosen 158to route around the interface, or the route may be dropped if no alternative 159is available. 160.Pp 161Options supported by 162.Nm routed : 163.Bl -tag -width Ds 164.It Fl d 165Enable additional debugging information to be logged, 166such as bad packets received. 167.It Fl g 168This flag is used on internetwork routers to offer a route 169to the ``default'' destination. 170This is typically used on a gateway to the Internet, 171or on a gateway that uses another routing protocol whose routes 172are not reported to other local routers. 173.It Fl s 174Supplying this 175option forces 176.Nm routed 177to supply routing information whether it is acting as an internetwork 178router or not. 179This is the default if multiple network interfaces are present, 180or if a point-to-point link is in use. 181.It Fl q 182This 183is the opposite of the 184.Fl s 185option. 186.It Fl t 187If the 188.Fl t 189option is specified, all packets sent or received are 190printed on the standard output. In addition, 191.Nm routed 192will not divorce itself from the controlling terminal 193so that interrupts from the keyboard will kill the process. 194.El 195.Pp 196Any other argument supplied is interpreted as the name 197of file in which 198.Nm routed Ns \'s 199actions should be logged. This log contains information 200about any changes to the routing tables and, if not tracing all packets, 201a history of recent messages sent and received which are related to 202the changed route. 203.Pp 204In addition to the facilities described above, 205.Nm routed 206supports the notion of ``distant'' 207.Em passive 208and 209.Em active 210gateways. When 211.Nm routed 212is started up, it reads the file 213.Pa /etc/gateways 214to find gateways which may not be located using 215only information from the 216.Dv SIOGIFCONF 217.Xr ioctl 2 . 218Gateways specified in this manner should be marked passive 219if they are not expected to exchange routing information, 220while gateways marked active 221should be willing to exchange routing information (i.e. 222they should have a 223.Nm routed 224process running on the machine). 225Routes through passive gateways are installed in the 226kernel's routing tables once upon startup. 227Such routes are not included in 228any routing information transmitted. 229Active gateways are treated equally to network 230interfaces. Routing information is distributed 231to the gateway and if no routing information is 232received for a period of the time, the associated 233route is deleted. 234Gateways marked 235.Em external 236are also passive, but are not placed in the kernel 237routing table nor are they included in routing updates. 238The function of external entries is to inform 239.Nm routed 240that another routing process 241will install such a route, and that alternate routes to that destination 242should not be installed. 243Such entries are only required when both routers may learn of routes 244to the same destination. 245.Pp 246The 247.Pa /etc/gateways 248is comprised of a series of lines, each in 249the following format: 250.Bd -ragged 251.Pf < Cm net No \&| 252.Cm host Ns > 253.Ar name1 254.Cm gateway 255.Ar name2 256.Cm metric 257.Ar value 258.Pf < Cm passive No \&| 259.Cm active No \&| 260.Cm external Ns > 261.Ed 262.Pp 263The 264.Cm net 265or 266.Cm host 267keyword indicates if the route is to a network or specific host. 268.Pp 269.Ar Name1 270is the name of the destination network or host. This may be a 271symbolic name located in 272.Pa /etc/networks 273or 274.Pa /etc/hosts 275(or, if started after 276.Xr named 8 , 277known to the name server), 278or an Internet address specified in ``dot'' notation; see 279.Xr inet 3 . 280.Pp 281.Ar Name2 282is the name or address of the gateway to which messages should 283be forwarded. 284.Pp 285.Ar Value 286is a metric indicating the hop count to the destination host 287or network. 288.Pp 289One of the keywords 290.Cm passive , 291.Cm active 292or 293.Cm external 294indicates if the gateway should be treated as 295.Em passive 296or 297.Em active 298(as described above), 299or whether the gateway is 300.Em external 301to the scope of the 302.Nm routed 303protocol. 304.Pp 305Internetwork routers that are directly attached to the Arpanet or Milnet 306should use the Exterior Gateway Protocol 307.Pq Tn EGP 308to gather routing information 309rather then using a static routing table of passive gateways. 310.Tn EGP 311is required in order to provide routes for local networks to the rest 312of the Internet system. 313Sites needing assistance with such configurations 314should contact the Computer Systems Research Group at Berkeley. 315.Sh FILES 316.Bl -tag -width /etc/gateways -compact 317.It Pa /etc/gateways 318for distant gateways 319.El 320.Sh SEE ALSO 321.Xr udp 4 , 322.Xr icmp 4 , 323.Xr XNSrouted 8 , 324.Xr htable 8 325.Rs 326.%T Internet Transport Protocols 327.%R XSIS 028112 328.%Q Xerox System Integration Standard 329.Re 330.Sh BUGS 331The kernel's routing tables may not correspond to those of 332.Nm routed 333when redirects change or add routes. 334.Nm Routed 335should note any redirects received by reading 336the 337.Tn ICMP 338packets received via a raw socket. 339.Pp 340.Nm Routed 341should incorporate other routing protocols, 342such as Xerox 343.Tn \&NS 344.Pq Xr XNSrouted 8 345and 346.Tn EGP . 347Using separate processes for each requires configuration options 348to avoid redundant or competing routes. 349.Pp 350.Nm Routed 351should listen to intelligent interfaces, such as an 352.Tn IMP , 353to gather more information. 354It does not always detect unidirectional failures in network interfaces 355(e.g., when the output side fails). 356.Sh HISTORY 357The 358.Nm 359command appeared in 360.Bx 4.2 . 361