1*144c6bcdSlogwang.\" Copyright (c) 1983, 1991, 1993 2*144c6bcdSlogwang.\" The Regents of the University of California. All rights reserved. 3*144c6bcdSlogwang.\" 4*144c6bcdSlogwang.\" Redistribution and use in source and binary forms, with or without 5*144c6bcdSlogwang.\" modification, are permitted provided that the following conditions 6*144c6bcdSlogwang.\" are met: 7*144c6bcdSlogwang.\" 1. Redistributions of source code must retain the above copyright 8*144c6bcdSlogwang.\" notice, this list of conditions and the following disclaimer. 9*144c6bcdSlogwang.\" 2. Redistributions in binary form must reproduce the above copyright 10*144c6bcdSlogwang.\" notice, this list of conditions and the following disclaimer in the 11*144c6bcdSlogwang.\" documentation and/or other materials provided with the distribution. 12*144c6bcdSlogwang.\" 4. Neither the name of the University nor the names of its contributors 13*144c6bcdSlogwang.\" may be used to endorse or promote products derived from this software 14*144c6bcdSlogwang.\" without specific prior written permission. 15*144c6bcdSlogwang.\" 16*144c6bcdSlogwang.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17*144c6bcdSlogwang.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18*144c6bcdSlogwang.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19*144c6bcdSlogwang.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20*144c6bcdSlogwang.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21*144c6bcdSlogwang.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22*144c6bcdSlogwang.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23*144c6bcdSlogwang.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24*144c6bcdSlogwang.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25*144c6bcdSlogwang.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26*144c6bcdSlogwang.\" SUCH DAMAGE. 27*144c6bcdSlogwang.\" 28*144c6bcdSlogwang.\" @(#)route.8 8.3 (Berkeley) 3/19/94 29*144c6bcdSlogwang.\" $FreeBSD$ 30*144c6bcdSlogwang.\" 31*144c6bcdSlogwang.Dd November 11, 2014 32*144c6bcdSlogwang.Dt ROUTE 8 33*144c6bcdSlogwang.Os 34*144c6bcdSlogwang.Sh NAME 35*144c6bcdSlogwang.Nm route 36*144c6bcdSlogwang.Nd manually manipulate the routing tables 37*144c6bcdSlogwang.Sh SYNOPSIS 38*144c6bcdSlogwang.Nm 39*144c6bcdSlogwang.Op Fl dnqtv 40*144c6bcdSlogwang.Ar command 41*144c6bcdSlogwang.Oo 42*144c6bcdSlogwang.Op Ar modifiers 43*144c6bcdSlogwang.Ar args 44*144c6bcdSlogwang.Oc 45*144c6bcdSlogwang.Sh DESCRIPTION 46*144c6bcdSlogwangThe 47*144c6bcdSlogwang.Nm 48*144c6bcdSlogwangutility is used to manually manipulate the network 49*144c6bcdSlogwangrouting tables. 50*144c6bcdSlogwangIt normally is not needed, as a 51*144c6bcdSlogwangsystem routing table management daemon, such as 52*144c6bcdSlogwang.Xr routed 8 , 53*144c6bcdSlogwangshould tend to this task. 54*144c6bcdSlogwang.Pp 55*144c6bcdSlogwangThe 56*144c6bcdSlogwang.Nm 57*144c6bcdSlogwangutility supports a limited number of general options, 58*144c6bcdSlogwangbut a rich command language, enabling the user to specify 59*144c6bcdSlogwangany arbitrary request that could be delivered via the 60*144c6bcdSlogwangprogrammatic interface discussed in 61*144c6bcdSlogwang.Xr route 4 . 62*144c6bcdSlogwang.Pp 63*144c6bcdSlogwangThe following options are available: 64*144c6bcdSlogwang.Bl -tag -width indent 65*144c6bcdSlogwang.It Fl 4 66*144c6bcdSlogwangSpecify 67*144c6bcdSlogwang.Cm inet 68*144c6bcdSlogwangaddress family as family hint for subcommands. 69*144c6bcdSlogwang.It Fl 6 70*144c6bcdSlogwangSpecify 71*144c6bcdSlogwang.Cm inet 72*144c6bcdSlogwangaddress family as family hint for subcommands. 73*144c6bcdSlogwang.It Fl d 74*144c6bcdSlogwangRun in debug-only mode, i.e., do not actually modify the routing table. 75*144c6bcdSlogwang.It Fl n 76*144c6bcdSlogwangBypass attempts to print host and network names symbolically 77*144c6bcdSlogwangwhen reporting actions. 78*144c6bcdSlogwang(The process of translating between symbolic 79*144c6bcdSlogwangnames and numerical equivalents can be quite time consuming, and 80*144c6bcdSlogwangmay require correct operation of the network; thus it may be expedient 81*144c6bcdSlogwangto forget this, especially when attempting to repair networking operations). 82*144c6bcdSlogwang.It Fl t 83*144c6bcdSlogwangRun in test-only mode. 84*144c6bcdSlogwang.Pa /dev/null 85*144c6bcdSlogwangis used instead of a socket. 86*144c6bcdSlogwang.It Fl v 87*144c6bcdSlogwang(verbose) Print additional details. 88*144c6bcdSlogwang.It Fl q 89*144c6bcdSlogwangSuppress all output from the 90*144c6bcdSlogwang.Cm add , change , delete , 91*144c6bcdSlogwangand 92*144c6bcdSlogwang.Cm flush 93*144c6bcdSlogwangcommands. 94*144c6bcdSlogwang.El 95*144c6bcdSlogwang.Pp 96*144c6bcdSlogwangThe 97*144c6bcdSlogwang.Nm 98*144c6bcdSlogwangutility provides the following commands: 99*144c6bcdSlogwang.Pp 100*144c6bcdSlogwang.Bl -tag -width Fl -compact 101*144c6bcdSlogwang.It Cm add 102*144c6bcdSlogwangAdd a route. 103*144c6bcdSlogwang.It Cm flush 104*144c6bcdSlogwangRemove all routes. 105*144c6bcdSlogwang.It Cm delete 106*144c6bcdSlogwangDelete a specific route. 107*144c6bcdSlogwang.It Cm del 108*144c6bcdSlogwangAnother name for the 109*144c6bcdSlogwang.Cm delete 110*144c6bcdSlogwangcommand. 111*144c6bcdSlogwang.It Cm change 112*144c6bcdSlogwangChange aspects of a route (such as its gateway). 113*144c6bcdSlogwang.It Cm get 114*144c6bcdSlogwangLookup and display the route for a destination. 115*144c6bcdSlogwang.It Cm monitor 116*144c6bcdSlogwangContinuously report any changes to the routing information base, 117*144c6bcdSlogwangrouting lookup misses, or suspected network partitionings. 118*144c6bcdSlogwang.It Cm show 119*144c6bcdSlogwangAnother name for the 120*144c6bcdSlogwang.Cm get 121*144c6bcdSlogwangcommand. 122*144c6bcdSlogwang.El 123*144c6bcdSlogwang.Pp 124*144c6bcdSlogwangThe monitor command has the syntax: 125*144c6bcdSlogwang.Pp 126*144c6bcdSlogwang.Bd -ragged -offset indent -compact 127*144c6bcdSlogwang.Nm 128*144c6bcdSlogwang.Op Fl n 129*144c6bcdSlogwang.Cm monitor Op Fl fib Ar number 130*144c6bcdSlogwang.Ed 131*144c6bcdSlogwang.Pp 132*144c6bcdSlogwangThe flush command has the syntax: 133*144c6bcdSlogwang.Pp 134*144c6bcdSlogwang.Bd -ragged -offset indent -compact 135*144c6bcdSlogwang.Nm 136*144c6bcdSlogwang.Oo Fl n Cm flush Oc Oo Ar family Oc Op Fl fib Ar number 137*144c6bcdSlogwang.Ed 138*144c6bcdSlogwang.Pp 139*144c6bcdSlogwangIf the 140*144c6bcdSlogwang.Cm flush 141*144c6bcdSlogwangcommand is specified, 142*144c6bcdSlogwang.Nm 143*144c6bcdSlogwangwill ``flush'' the routing tables of all gateway entries. 144*144c6bcdSlogwangWhen the address family may is specified by any of the 145*144c6bcdSlogwang.Fl osi , 146*144c6bcdSlogwang.Fl xns , 147*144c6bcdSlogwang.Fl inet6 , 148*144c6bcdSlogwangor 149*144c6bcdSlogwang.Fl inet 150*144c6bcdSlogwangmodifiers, only routes having destinations with addresses in the 151*144c6bcdSlogwangdelineated family will be deleted. 152*144c6bcdSlogwangAdditionally, 153*144c6bcdSlogwang.Fl 4 154*144c6bcdSlogwangor 155*144c6bcdSlogwang.Fl 6 156*144c6bcdSlogwangcan be used as aliases for 157*144c6bcdSlogwang.Fl inet 158*144c6bcdSlogwangand 159*144c6bcdSlogwang.Fl inet6 160*144c6bcdSlogwangmodifiers. 161*144c6bcdSlogwangWhen a 162*144c6bcdSlogwang.Fl fib 163*144c6bcdSlogwangoption is specified, the operation will be applied to 164*144c6bcdSlogwangthe specified FIB 165*144c6bcdSlogwang.Pq routing table . 166*144c6bcdSlogwang.Pp 167*144c6bcdSlogwangThe other commands have the following syntax: 168*144c6bcdSlogwang.Pp 169*144c6bcdSlogwang.Bd -ragged -offset indent -compact 170*144c6bcdSlogwang.Nm 171*144c6bcdSlogwang.Op Fl n 172*144c6bcdSlogwang.Ar command 173*144c6bcdSlogwang.Op Fl net No \&| Fl host 174*144c6bcdSlogwang.Ar destination gateway 175*144c6bcdSlogwang.Op Ar netmask 176*144c6bcdSlogwang.Op Fl fib Ar number 177*144c6bcdSlogwang.Ed 178*144c6bcdSlogwang.Pp 179*144c6bcdSlogwangwhere 180*144c6bcdSlogwang.Ar destination 181*144c6bcdSlogwangis the destination host or network, 182*144c6bcdSlogwang.Ar gateway 183*144c6bcdSlogwangis the next-hop intermediary via which packets should be routed. 184*144c6bcdSlogwangRoutes to a particular host may be distinguished from those to 185*144c6bcdSlogwanga network by interpreting the Internet address specified as the 186*144c6bcdSlogwang.Ar destination 187*144c6bcdSlogwangargument. 188*144c6bcdSlogwangThe optional modifiers 189*144c6bcdSlogwang.Fl net 190*144c6bcdSlogwangand 191*144c6bcdSlogwang.Fl host 192*144c6bcdSlogwangforce the destination to be interpreted as a network or a host, respectively. 193*144c6bcdSlogwangOtherwise, if the 194*144c6bcdSlogwang.Ar destination 195*144c6bcdSlogwanghas a 196*144c6bcdSlogwang.Dq local address part 197*144c6bcdSlogwangof 198*144c6bcdSlogwangINADDR_ANY 199*144c6bcdSlogwang.Pq Li 0.0.0.0 , 200*144c6bcdSlogwangor if the 201*144c6bcdSlogwang.Ar destination 202*144c6bcdSlogwangis the symbolic name of a network, then the route is 203*144c6bcdSlogwangassumed to be to a network; otherwise, it is presumed to be a 204*144c6bcdSlogwangroute to a host. 205*144c6bcdSlogwangOptionally, the 206*144c6bcdSlogwang.Ar destination 207*144c6bcdSlogwangcould also be specified in the 208*144c6bcdSlogwang.Ar net Ns / Ns Ar bits 209*144c6bcdSlogwangformat. 210*144c6bcdSlogwang.Pp 211*144c6bcdSlogwangFor example, 212*144c6bcdSlogwang.Li 128.32 213*144c6bcdSlogwangis interpreted as 214*144c6bcdSlogwang.Fl host Li 128.0.0.32 ; 215*144c6bcdSlogwang.Li 128.32.130 216*144c6bcdSlogwangis interpreted as 217*144c6bcdSlogwang.Fl host Li 128.32.0.130 ; 218*144c6bcdSlogwang.Fl net Li 128.32 219*144c6bcdSlogwangis interpreted as 220*144c6bcdSlogwang.Li 128.32.0.0; 221*144c6bcdSlogwang.Fl net Li 128.32.130 222*144c6bcdSlogwangis interpreted as 223*144c6bcdSlogwang.Li 128.32.130.0; 224*144c6bcdSlogwangand 225*144c6bcdSlogwang.Li 192.168.64/20 226*144c6bcdSlogwangis interpreted as 227*144c6bcdSlogwang.Fl net Li 192.168.64 Fl netmask Li 255.255.240.0 . 228*144c6bcdSlogwang.Pp 229*144c6bcdSlogwangA 230*144c6bcdSlogwang.Ar destination 231*144c6bcdSlogwangof 232*144c6bcdSlogwang.Ar default 233*144c6bcdSlogwangis a synonym for the default route. 234*144c6bcdSlogwangFor 235*144c6bcdSlogwang.Li IPv4 236*144c6bcdSlogwangit is 237*144c6bcdSlogwang.Fl net Fl inet Li 0.0.0.0 , 238*144c6bcdSlogwangand for 239*144c6bcdSlogwang.Li IPv6 240*144c6bcdSlogwangit is 241*144c6bcdSlogwang.Fl net Fl inet6 Li :: . 242*144c6bcdSlogwang.Pp 243*144c6bcdSlogwangIf the destination is directly reachable 244*144c6bcdSlogwangvia an interface requiring 245*144c6bcdSlogwangno intermediary system to act as a gateway, the 246*144c6bcdSlogwang.Fl interface 247*144c6bcdSlogwangmodifier should be specified; 248*144c6bcdSlogwangthe gateway given is the address of this host on the common network, 249*144c6bcdSlogwangindicating the interface to be used for transmission. 250*144c6bcdSlogwangAlternately, if the interface is point to point the name of the interface 251*144c6bcdSlogwangitself may be given, in which case the route remains valid even 252*144c6bcdSlogwangif the local or remote addresses change. 253*144c6bcdSlogwang.Pp 254*144c6bcdSlogwangThe optional modifiers 255*144c6bcdSlogwang.Fl xns , 256*144c6bcdSlogwang.Fl osi , 257*144c6bcdSlogwangand 258*144c6bcdSlogwang.Fl link 259*144c6bcdSlogwangspecify that all subsequent addresses are in the 260*144c6bcdSlogwang.Tn XNS 261*144c6bcdSlogwangor 262*144c6bcdSlogwang.Tn OSI 263*144c6bcdSlogwangaddress families, 264*144c6bcdSlogwangor are specified as link-level addresses, 265*144c6bcdSlogwangand the names must be numeric specifications rather than 266*144c6bcdSlogwangsymbolic names. 267*144c6bcdSlogwang.Pp 268*144c6bcdSlogwangThe optional 269*144c6bcdSlogwang.Fl netmask 270*144c6bcdSlogwangmodifier is intended 271*144c6bcdSlogwangto achieve the effect of an 272*144c6bcdSlogwang.Tn OSI 273*144c6bcdSlogwang.Tn ESIS 274*144c6bcdSlogwangredirect with the netmask option, 275*144c6bcdSlogwangor to manually add subnet routes with 276*144c6bcdSlogwangnetmasks different from that of the implied network interface 277*144c6bcdSlogwang(as would otherwise be communicated using the OSPF or ISIS routing protocols). 278*144c6bcdSlogwangOne specifies an additional ensuing address parameter 279*144c6bcdSlogwang(to be interpreted as a network mask). 280*144c6bcdSlogwangThe implicit network mask generated in the AF_INET case 281*144c6bcdSlogwangcan be overridden by making sure this option follows the destination parameter. 282*144c6bcdSlogwang.Pp 283*144c6bcdSlogwangFor 284*144c6bcdSlogwang.Dv AF_INET6 , 285*144c6bcdSlogwangthe 286*144c6bcdSlogwang.Fl prefixlen 287*144c6bcdSlogwangqualifier 288*144c6bcdSlogwangis available instead of the 289*144c6bcdSlogwang.Fl mask 290*144c6bcdSlogwangqualifier because non-continuous masks are not allowed in IPv6. 291*144c6bcdSlogwangFor example, 292*144c6bcdSlogwang.Fl prefixlen Li 32 293*144c6bcdSlogwangspecifies network mask of 294*144c6bcdSlogwang.Li ffff:ffff:0000:0000:0000:0000:0000:0000 295*144c6bcdSlogwangto be used. 296*144c6bcdSlogwangThe default value of prefixlen is 64 to get along with 297*144c6bcdSlogwangthe aggregatable address. 298*144c6bcdSlogwangBut 0 is assumed if 299*144c6bcdSlogwang.Cm default 300*144c6bcdSlogwangis specified. 301*144c6bcdSlogwangNote that the qualifier works only for 302*144c6bcdSlogwang.Dv AF_INET6 303*144c6bcdSlogwangaddress family. 304*144c6bcdSlogwang.Pp 305*144c6bcdSlogwangRoutes have associated flags which influence operation of the protocols 306*144c6bcdSlogwangwhen sending to destinations matched by the routes. 307*144c6bcdSlogwangThese flags may be set (or sometimes cleared) 308*144c6bcdSlogwangby indicating the following corresponding modifiers: 309*144c6bcdSlogwang.Bd -literal 310*144c6bcdSlogwang-xresolve RTF_XRESOLVE - emit mesg on use (for external lookup) 311*144c6bcdSlogwang-iface ~RTF_GATEWAY - destination is directly reachable 312*144c6bcdSlogwang-static RTF_STATIC - manually added route 313*144c6bcdSlogwang-nostatic ~RTF_STATIC - pretend route added by kernel or daemon 314*144c6bcdSlogwang-reject RTF_REJECT - emit an ICMP unreachable when matched 315*144c6bcdSlogwang-blackhole RTF_BLACKHOLE - silently discard pkts (during updates) 316*144c6bcdSlogwang-proto1 RTF_PROTO1 - set protocol specific routing flag #1 317*144c6bcdSlogwang-proto2 RTF_PROTO2 - set protocol specific routing flag #2 318*144c6bcdSlogwang.Ed 319*144c6bcdSlogwang.Pp 320*144c6bcdSlogwangThe optional modifiers 321*144c6bcdSlogwang.Fl rtt , 322*144c6bcdSlogwang.Fl rttvar , 323*144c6bcdSlogwang.Fl sendpipe , 324*144c6bcdSlogwang.Fl recvpipe , 325*144c6bcdSlogwang.Fl mtu , 326*144c6bcdSlogwang.Fl hopcount , 327*144c6bcdSlogwang.Fl expire , 328*144c6bcdSlogwangand 329*144c6bcdSlogwang.Fl ssthresh 330*144c6bcdSlogwangprovide initial values to quantities maintained in the routing entry 331*144c6bcdSlogwangby transport level protocols, such as TCP or TP4. 332*144c6bcdSlogwangThese may be individually locked by preceding each such modifier to 333*144c6bcdSlogwangbe locked by 334*144c6bcdSlogwangthe 335*144c6bcdSlogwang.Fl lock 336*144c6bcdSlogwangmeta-modifier, or one can 337*144c6bcdSlogwangspecify that all ensuing metrics may be locked by the 338*144c6bcdSlogwang.Fl lockrest 339*144c6bcdSlogwangmeta-modifier. 340*144c6bcdSlogwang.Pp 341*144c6bcdSlogwangNote that 342*144c6bcdSlogwang.Fl expire 343*144c6bcdSlogwangaccepts expiration time of the route as the number of seconds since the 344*144c6bcdSlogwangEpoch 345*144c6bcdSlogwang.Pq see Xr time 3 . 346*144c6bcdSlogwangWhen the first character of the number is 347*144c6bcdSlogwang.Dq + 348*144c6bcdSlogwangor 349*144c6bcdSlogwang.Dq - , 350*144c6bcdSlogwangit is interpreted as a value relative to the current time. 351*144c6bcdSlogwang.Pp 352*144c6bcdSlogwangThe optional modifier 353*144c6bcdSlogwang.Fl fib Ar number 354*144c6bcdSlogwangspecifies that the command will be applied to a non-default FIB. 355*144c6bcdSlogwangThe 356*144c6bcdSlogwang.Ar number 357*144c6bcdSlogwangmust be smaller than the 358*144c6bcdSlogwang.Va net.fibs 359*144c6bcdSlogwang.Xr sysctl 8 360*144c6bcdSlogwangMIB. 361*144c6bcdSlogwangWhen this modifier is not specified, 362*144c6bcdSlogwangor a negative number is specified, 363*144c6bcdSlogwangthe default FIB shown in the 364*144c6bcdSlogwang.Va net.my_fibnum 365*144c6bcdSlogwang.Xr sysctl 8 366*144c6bcdSlogwangMIB will be used. 367*144c6bcdSlogwang.Pp 368*144c6bcdSlogwangThe 369*144c6bcdSlogwang.Ar number 370*144c6bcdSlogwangallows multiple FIBs by a comma-separeted list and/or range 371*144c6bcdSlogwangspecification. 372*144c6bcdSlogwangThe 373*144c6bcdSlogwang.Qq Fl fib Li 2,4,6 374*144c6bcdSlogwangmeans the FIB number 2, 4, and 6. 375*144c6bcdSlogwangThe 376*144c6bcdSlogwang.Qq Fl fib Li 1,3-5,6 377*144c6bcdSlogwangmeans the 1, 3, 4, 5, and 6. 378*144c6bcdSlogwang.Pp 379*144c6bcdSlogwangIn a 380*144c6bcdSlogwang.Cm change 381*144c6bcdSlogwangor 382*144c6bcdSlogwang.Cm add 383*144c6bcdSlogwangcommand where the destination and gateway are not sufficient to specify 384*144c6bcdSlogwangthe route (as in the 385*144c6bcdSlogwang.Tn ISO 386*144c6bcdSlogwangcase where several interfaces may have the 387*144c6bcdSlogwangsame address), the 388*144c6bcdSlogwang.Fl ifp 389*144c6bcdSlogwangor 390*144c6bcdSlogwang.Fl ifa 391*144c6bcdSlogwangmodifiers may be used to determine the interface or interface address. 392*144c6bcdSlogwang.Pp 393*144c6bcdSlogwangAll symbolic names specified for a 394*144c6bcdSlogwang.Ar destination 395*144c6bcdSlogwangor 396*144c6bcdSlogwang.Ar gateway 397*144c6bcdSlogwangare looked up first as a host name using 398*144c6bcdSlogwang.Xr gethostbyname 3 . 399*144c6bcdSlogwangIf this lookup fails, 400*144c6bcdSlogwang.Xr getnetbyname 3 401*144c6bcdSlogwangis then used to interpret the name as that of a network. 402*144c6bcdSlogwang.Pp 403*144c6bcdSlogwangThe 404*144c6bcdSlogwang.Nm 405*144c6bcdSlogwangutility uses a routing socket and the new message types 406*144c6bcdSlogwang.Dv RTM_ADD , RTM_DELETE , RTM_GET , 407*144c6bcdSlogwangand 408*144c6bcdSlogwang.Dv RTM_CHANGE . 409*144c6bcdSlogwangAs such, only the super-user may modify 410*144c6bcdSlogwangthe routing tables. 411*144c6bcdSlogwang.Sh EXIT STATUS 412*144c6bcdSlogwang.Ex -std 413*144c6bcdSlogwang.Sh EXAMPLES 414*144c6bcdSlogwangAdd a default route to the network routing table. 415*144c6bcdSlogwangThis will send all packets for destinations not available in the routing table 416*144c6bcdSlogwangto the default gateway at 192.168.1.1: 417*144c6bcdSlogwang.Pp 418*144c6bcdSlogwang.Dl route add -net 0.0.0.0/0 192.168.1.1 419*144c6bcdSlogwang.Pp 420*144c6bcdSlogwangA shorter version of adding a default route can also be written as: 421*144c6bcdSlogwang.Pp 422*144c6bcdSlogwang.Dl route add default 192.168.1.1 423*144c6bcdSlogwang.Pp 424*144c6bcdSlogwangAdd a static route to the 172.16.10.0/24 network via the 172.16.1.1 gateway: 425*144c6bcdSlogwang.Pp 426*144c6bcdSlogwang.Dl route add -net 172.16.10.0/24 172.16.1.1 427*144c6bcdSlogwang.Pp 428*144c6bcdSlogwangChange the gateway of an already established static route in the routing table: 429*144c6bcdSlogwang.Pp 430*144c6bcdSlogwang.Dl route change -net 172.16.10.0/24 172.16.1.2 431*144c6bcdSlogwang.Pp 432*144c6bcdSlogwangDisplay the route for a destination network: 433*144c6bcdSlogwang.Pp 434*144c6bcdSlogwang.Dl route show 172.16.10.0 435*144c6bcdSlogwang.Pp 436*144c6bcdSlogwangDelete a static route from the routing table: 437*144c6bcdSlogwang.Pp 438*144c6bcdSlogwang.Dl route delete -net 172.16.10.0/24 172.16.1.2 439*144c6bcdSlogwang.Pp 440*144c6bcdSlogwangRemove all routes from the routing table: 441*144c6bcdSlogwang.Pp 442*144c6bcdSlogwang.Dl route flush 443*144c6bcdSlogwang.Sh DIAGNOSTICS 444*144c6bcdSlogwang.Bl -diag 445*144c6bcdSlogwang.It "add [host \&| network ] %s: gateway %s flags %x" 446*144c6bcdSlogwangThe specified route is being added to the tables. 447*144c6bcdSlogwangThe 448*144c6bcdSlogwangvalues printed are from the routing table entry supplied 449*144c6bcdSlogwangin the 450*144c6bcdSlogwang.Xr ioctl 2 451*144c6bcdSlogwangcall. 452*144c6bcdSlogwangIf the gateway address used was not the primary address of the gateway 453*144c6bcdSlogwang(the first one returned by 454*144c6bcdSlogwang.Xr gethostbyname 3 ) , 455*144c6bcdSlogwangthe gateway address is printed numerically as well as symbolically. 456*144c6bcdSlogwang.It "delete [ host \&| network ] %s: gateway %s flags %x" 457*144c6bcdSlogwangAs above, but when deleting an entry. 458*144c6bcdSlogwang.It "%s %s done" 459*144c6bcdSlogwangWhen the 460*144c6bcdSlogwang.Cm flush 461*144c6bcdSlogwangcommand is specified, each routing table entry deleted 462*144c6bcdSlogwangis indicated with a message of this form. 463*144c6bcdSlogwang.It "Network is unreachable" 464*144c6bcdSlogwangAn attempt to add a route failed because the gateway listed was not 465*144c6bcdSlogwangon a directly-connected network. 466*144c6bcdSlogwangThe next-hop gateway must be given. 467*144c6bcdSlogwang.It "not in table" 468*144c6bcdSlogwangA delete operation was attempted for an entry which 469*144c6bcdSlogwangwas not present in the tables. 470*144c6bcdSlogwang.It "routing table overflow" 471*144c6bcdSlogwangAn add operation was attempted, but the system was 472*144c6bcdSlogwanglow on resources and was unable to allocate memory 473*144c6bcdSlogwangto create the new entry. 474*144c6bcdSlogwang.It "gateway uses the same route" 475*144c6bcdSlogwangA 476*144c6bcdSlogwang.Cm change 477*144c6bcdSlogwangoperation resulted in a route whose gateway uses the 478*144c6bcdSlogwangsame route as the one being changed. 479*144c6bcdSlogwangThe next-hop gateway should be reachable through a different route. 480*144c6bcdSlogwang.El 481*144c6bcdSlogwang.Sh SEE ALSO 482*144c6bcdSlogwang.\".Xr esis 4 , 483*144c6bcdSlogwang.Xr netintro 4 , 484*144c6bcdSlogwang.Xr route 4 , 485*144c6bcdSlogwang.Xr arp 8 , 486*144c6bcdSlogwang.Xr routed 8 487*144c6bcdSlogwang.\".Xr XNSrouted 8 488*144c6bcdSlogwang.Sh HISTORY 489*144c6bcdSlogwangThe 490*144c6bcdSlogwang.Nm 491*144c6bcdSlogwangutility appeared in 492*144c6bcdSlogwang.Bx 4.2 . 493*144c6bcdSlogwang.Sh BUGS 494*144c6bcdSlogwangThe first paragraph may have slightly exaggerated 495*144c6bcdSlogwang.Xr routed 8 Ns 's 496*144c6bcdSlogwangabilities. 497*144c6bcdSlogwang.Pp 498*144c6bcdSlogwangCurrently, routes with the 499*144c6bcdSlogwang.Dv RTF_BLACKHOLE 500*144c6bcdSlogwangflag set need to have the gateway set to an instance of the 501*144c6bcdSlogwang.Xr lo 4 502*144c6bcdSlogwangdriver, using the 503*144c6bcdSlogwang.Fl iface 504*144c6bcdSlogwangoption, for the flag to have any effect; unless IP fast forwarding 505*144c6bcdSlogwangis enabled, in which case the meaning of the flag will always 506*144c6bcdSlogwangbe honored. 507