1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)route.8 8.1 (Berkeley) 06/05/93 7.\" 8.Dd 9.Dt ROUTE 8 10.Os BSD 4.2 11.Sh NAME 12.Nm route 13.Nd manually manipulate the routing tables (Interim) 14.Sh SYNOPSIS 15.Nm route 16.Op Fl n 17.Op Fl q 18.Op Fl v 19.Ar command 20.Oo 21.Op Ar modifiers 22.Ar args 23.Oc 24.Sh DESCRIPTION 25.Nm Route 26is a program used to manually manipulate the network 27routing tables. It normally is not needed, as the 28system routing table management daemon, 29.Xr routed 8 , 30should tend to this task. 31.Pp 32Options supported by 33.Nm route : 34.Pp 35.Bl -tag -width Ds 36.It Fl n 37Prevent attempts to print host and network names symbolically 38when reporting actions. 39.It Fl v 40(verbose) Print additional details. 41.It Fl q 42Suppress all output. 43.El 44.Pp 45Commands accepted by 46.Nm route : 47.Pp 48.Bl -tag -width Fl -compact 49.It Cm add 50Add a route. 51.It Cm flush 52Remove all routes. 53.It Cm delete 54Delete a specific route. 55.It Cm change 56Change aspects of a route (such as its gateway). 57.It Cm get 58Lookup and display the route for a destination. 59.It Cm monitor 60Continuously report any changes to the routing information base, 61routing lookup misses, or suspected network partionings. 62.El 63.Pp 64The monitor command has the syntax 65.Pp 66.Bd -filled -offset indent -compact 67.Nm route Op Fl n 68.Cm monitor 69.Ed 70.Pp 71The flush command has the syntax 72.Pp 73.Bd -filled -offset indent -compact 74.Nm route Op Fl n 75.Cm flush 76.Op Ar family 77.Ed 78.Pp 79Where the address family may be specified by any of the 80.Fl osi , 81.Fl xns , 82or 83.Fl inet 84keywords. 85.Pp 86The other commands have the following syntax: 87.Pp 88.Bd -filled -offset indent -compact 89.Nm route Op Fl n 90.Ar command 91.Op Fl net No \&| Fl host 92.Ar destination gateway 93.Ed 94.Pp 95where 96.Ar destination 97is the destination host or network, 98.Ar gateway 99is the next-hop gateway to which packets should be addressed. 100Routes to a particular host are distinguished from those to 101a network by interpreting the Internet address associated with 102.Ar destination . 103The optional keywords 104.Fl net 105and 106.Fl host 107force the destination to be interpreted as a network or a host, respectively. 108Otherwise, if the 109.Ar destination 110has a ``local address part'' of 111INADDR_ANY , 112or if the 113.Ar destination 114is the symbolic name of a network, then the route is 115assumed to be to a network; otherwise, it is presumed to be a 116route to a host. 117.Pp 118For example, 119.Li 128.32 120is interpreted as 121.Fl host Li 128.0.0.32 ; 122.Li 128.32.130 123is interpreted as 124.Fl host Li 128.32.0.130 ; 125.Fl net Li 128.32 126is interpreted as 127.Li 128.32.0.0; 128and 129.Fl net Li 128.32.130 130is interpreted as 131.Li 128.32.130.0 . 132.Pp 133If the route is via an interface rather than 134via a gateway, the 135.Fl interface 136modifier should be specified; 137the gateway given is the address of this host on the common network, 138indicating the interface to be used for transmission. 139.Pp 140The optional modifiers 141.Fl xns , 142and 143.Fl osi 144specify that all subsequent addresses are in the 145.Tn XNS 146or 147.Tn OSI 148address families, 149and the names must be numeric specifications rather than 150symbolic names. 151.Pp 152The optional 153.Fl netmask 154qualifier is intended 155to achieve the effect of an 156.Tn OSI 157.Tn ESIS 158redirect with the netmask option. 159One specifies an additional ensuing address parameter 160(to be interpreted as a network mask). 161The implicit network mask generated in the inet case 162can be overridden by making sure this option follows the destination parameter. 163.Pp 164The optional modifiers 165.Fl rtt , 166.Fl rttvar , 167.Fl sendpipe , 168.Fl recvpipe , 169.Fl mtu , 170.Fl hopcount , 171.Fl expire , 172and 173.Fl ssthresh 174provide initial values to metrics maintained in the routing entry. 175These may be individually locked by preceding each such modifier to 176be locked by 177the 178.Fl lock 179meta-modifier, or one can 180specify that all ensuing metrics may be locked by the 181.Fl lockrest 182meta-modifier. 183.Pp 184In a 185.Cm change 186or 187.Cm add 188command where the destination and gateway are not sufficient to specify 189the route (as in the 190.Tn ISO 191case where several interfaces may have the 192same address), the 193.Fl ifp 194or 195.Fl ifa 196modifiers may be used to determine the interface or interface address. 197.Pp 198All symbolic names specified for a 199.Ar destination 200or 201.Ar gateway 202are looked up first as a host name using 203.Xr gethostbyname 3 . 204If this lookup fails, 205.Xr getnetbyname 3 206is then used to interpret the name as that of a network. 207.Pp 208.Nm Route 209uses a routing socket and the new message types 210RTM_ADD, 211RTM_DELETE, 212RTM_GET, 213and 214RTM_CHANGE. 215As such, only the super-user may modify 216the routing tables. 217.Pp 218If the 219.Cm flush 220command is specified, 221.Nm route 222will ``flush'' the routing tables of all gateway entries. 223One can choose to flush only those routes whose destinations 224are of a given address family, by specifying an optional keyword 225describing which address family. 226.Sh DIAGNOSTICS 227.Bl -tag -width Ds 228.It Sy "add [host \&| network ] %s: gateway %s flags %x" 229The specified route is being added to the tables. The 230values printed are from the routing table entry supplied 231in the 232.Xr ioctl 2 233call. 234If the gateway address used was not the primary address of the gateway 235(the first one returned by 236.Xr gethostbyname 3 ) , 237the gateway address is printed numerically as well as symbolically. 238.It Sy "delete [ host &| network ] %s: gateway %s flags %x" 239As above, but when deleting an entry. 240.It Sy "%s %s done" 241When the 242.Cm flush 243command is specified, each routing table entry deleted 244is indicated with a message of this form. 245.It Sy "Network is unreachable" 246An attempt to add a route failed because the gateway listed was not 247on a directly-connected network. 248The next-hop gateway must be given. 249.It Sy "not in table" 250A delete operation was attempted for an entry which 251wasn't present in the tables. 252.It Sy "routing table overflow" 253An add operation was attempted, but the system was 254low on resources and was unable to allocate memory 255to create the new entry. 256.El 257.Sh SEE ALSO 258.Xr netintro 4 , 259.Xr route 4 , 260.Xr esis 4 , 261.Xr routed 8 , 262.Xr XNSrouted 8 263.Sh HISTORY 264The 265.Nm 266command appeared in 267.Bx 4.2 . 268.Sh BUGS 269The first paragraph may have slightly exaggerated 270.Xr routed Ns 's 271abilities. 272