xref: /freebsd/sbin/route/route.8 (revision 9ec35e3cb46dd6268f3f6e88a8f33841dd4fa2b7)
18fae3551SRodney W. Grimes.\" Copyright (c) 1983, 1991, 1993
28fae3551SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
38fae3551SRodney W. Grimes.\"
48fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
58fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions
68fae3551SRodney W. Grimes.\" are met:
78fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
88fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
98fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
108fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
118fae3551SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
138fae3551SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
148fae3551SRodney W. Grimes.\"    without specific prior written permission.
158fae3551SRodney W. Grimes.\"
168fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
178fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
188fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
198fae3551SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
208fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
218fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
228fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
238fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
248fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
258fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
268fae3551SRodney W. Grimes.\" SUCH DAMAGE.
278fae3551SRodney W. Grimes.\"
288fae3551SRodney W. Grimes.\"     @(#)route.8	8.3 (Berkeley) 3/19/94
297f3dea24SPeter Wemm.\" $FreeBSD$
308fae3551SRodney W. Grimes.\"
31b3b6ff23SRyan Stone.Dd February 16, 2018
328fae3551SRodney W. Grimes.Dt ROUTE 8
331d36c899SRuslan Ermilov.Os
348fae3551SRodney W. Grimes.Sh NAME
358fae3551SRodney W. Grimes.Nm route
361cc580efSPhilippe Charnier.Nd manually manipulate the routing tables
378fae3551SRodney W. Grimes.Sh SYNOPSIS
387c7fb079SRuslan Ermilov.Nm
391cc580efSPhilippe Charnier.Op Fl dnqtv
408fae3551SRodney W. Grimes.Ar command
418fae3551SRodney W. Grimes.Oo
428fae3551SRodney W. Grimes.Op Ar modifiers
438fae3551SRodney W. Grimes.Ar args
448fae3551SRodney W. Grimes.Oc
458fae3551SRodney W. Grimes.Sh DESCRIPTION
46629e80efSPhilippe CharnierThe
47629e80efSPhilippe Charnier.Nm
48629e80efSPhilippe Charnierutility is used to manually manipulate the network
499806e231SRuslan Ermilovrouting tables.
509806e231SRuslan ErmilovIt normally is not needed, as a
5176a88626SChristian Brueffersystem routing table management daemon, such as
528fae3551SRodney W. Grimes.Xr routed 8 ,
538fae3551SRodney W. Grimesshould tend to this task.
548fae3551SRodney W. Grimes.Pp
558fae3551SRodney W. GrimesThe
561cc580efSPhilippe Charnier.Nm
578fae3551SRodney W. Grimesutility supports a limited number of general options,
588fae3551SRodney W. Grimesbut a rich command language, enabling the user to specify
598fae3551SRodney W. Grimesany arbitrary request that could be delivered via the
608fae3551SRodney W. Grimesprogrammatic interface discussed in
618fae3551SRodney W. Grimes.Xr route 4 .
628fae3551SRodney W. Grimes.Pp
631cc580efSPhilippe CharnierThe following options are available:
641cc580efSPhilippe Charnier.Bl -tag -width indent
6517ed2e8eSAlexander V. Chernikov.It Fl 4
6617ed2e8eSAlexander V. ChernikovSpecify
6717ed2e8eSAlexander V. Chernikov.Cm inet
6817ed2e8eSAlexander V. Chernikovaddress family as family hint for subcommands.
6917ed2e8eSAlexander V. Chernikov.It Fl 6
7017ed2e8eSAlexander V. ChernikovSpecify
7124328efbSKonstantin Belousov.Cm inet6
7217ed2e8eSAlexander V. Chernikovaddress family as family hint for subcommands.
7376a88626SChristian Brueffer.It Fl d
7476a88626SChristian BruefferRun in debug-only mode, i.e., do not actually modify the routing table.
758fae3551SRodney W. Grimes.It Fl n
761cc580efSPhilippe CharnierBypass attempts to print host and network names symbolically
779806e231SRuslan Ermilovwhen reporting actions.
789806e231SRuslan Ermilov(The process of translating between symbolic
798fae3551SRodney W. Grimesnames and numerical equivalents can be quite time consuming, and
808fae3551SRodney W. Grimesmay require correct operation of the network; thus it may be expedient
8132704e57SDaniel Harristo forget this, especially when attempting to repair networking operations).
8231a1fa79SDavid E. O'Brien.It Fl t
8331a1fa79SDavid E. O'BrienRun in test-only mode.
8431a1fa79SDavid E. O'Brien.Pa /dev/null
8531a1fa79SDavid E. O'Brienis used instead of a socket.
868fae3551SRodney W. Grimes.It Fl v
878fae3551SRodney W. Grimes(verbose) Print additional details.
888fae3551SRodney W. Grimes.It Fl q
89999ffea5SRuslan ErmilovSuppress all output from the
90259fcfd3SRuslan Ermilov.Cm add , change , delete ,
91999ffea5SRuslan Ermilovand
92999ffea5SRuslan Ermilov.Cm flush
93999ffea5SRuslan Ermilovcommands.
948fae3551SRodney W. Grimes.El
958fae3551SRodney W. Grimes.Pp
968fae3551SRodney W. GrimesThe
971cc580efSPhilippe Charnier.Nm
98064b93d5SAnton Berezinutility provides the following commands:
998fae3551SRodney W. Grimes.Pp
1008fae3551SRodney W. Grimes.Bl -tag -width Fl -compact
1018fae3551SRodney W. Grimes.It Cm add
1028fae3551SRodney W. GrimesAdd a route.
1038fae3551SRodney W. Grimes.It Cm flush
1048fae3551SRodney W. GrimesRemove all routes.
1058fae3551SRodney W. Grimes.It Cm delete
1068fae3551SRodney W. GrimesDelete a specific route.
107064b93d5SAnton Berezin.It Cm del
108064b93d5SAnton BerezinAnother name for the
109064b93d5SAnton Berezin.Cm delete
110064b93d5SAnton Berezincommand.
1118fae3551SRodney W. Grimes.It Cm change
1128fae3551SRodney W. GrimesChange aspects of a route (such as its gateway).
1138fae3551SRodney W. Grimes.It Cm get
1148fae3551SRodney W. GrimesLookup and display the route for a destination.
1158fae3551SRodney W. Grimes.It Cm monitor
1168fae3551SRodney W. GrimesContinuously report any changes to the routing information base,
1178fae3551SRodney W. Grimesrouting lookup misses, or suspected network partitionings.
11846b035ebSJoel Dahl.It Cm show
11946b035ebSJoel DahlAnother name for the
12046b035ebSJoel Dahl.Cm get
12146b035ebSJoel Dahlcommand.
1228fae3551SRodney W. Grimes.El
1238fae3551SRodney W. Grimes.Pp
1241cc580efSPhilippe CharnierThe monitor command has the syntax:
1258fae3551SRodney W. Grimes.Pp
12646eea498SRuslan Ermilov.Bd -ragged -offset indent -compact
1277c7fb079SRuslan Ermilov.Nm
1287c7fb079SRuslan Ermilov.Op Fl n
1299ba63ff5SHiroki Sato.Cm monitor Op Fl fib Ar number
1308fae3551SRodney W. Grimes.Ed
1318fae3551SRodney W. Grimes.Pp
1321cc580efSPhilippe CharnierThe flush command has the syntax:
1338fae3551SRodney W. Grimes.Pp
13446eea498SRuslan Ermilov.Bd -ragged -offset indent -compact
1357c7fb079SRuslan Ermilov.Nm
136*9ec35e3cSRyan Stone.Op Fl n
137*9ec35e3cSRyan Stone.Cm flush Oc Oo Ar family Oc Op Fl fib Ar number
1388fae3551SRodney W. Grimes.Ed
1398fae3551SRodney W. Grimes.Pp
1408fae3551SRodney W. GrimesIf the
1418fae3551SRodney W. Grimes.Cm flush
1428fae3551SRodney W. Grimescommand is specified,
1431cc580efSPhilippe Charnier.Nm
1448fae3551SRodney W. Grimeswill ``flush'' the routing tables of all gateway entries.
1458fae3551SRodney W. GrimesWhen the address family may is specified by any of the
1468fae3551SRodney W. Grimes.Fl osi ,
1478fae3551SRodney W. Grimes.Fl xns ,
148cfa1ca9dSYoshinobu Inoue.Fl inet6 ,
1498fae3551SRodney W. Grimesor
150120dc21bSAlexander V. Chernikov.Fl inet
1518fae3551SRodney W. Grimesmodifiers, only routes having destinations with addresses in the
152120dc21bSAlexander V. Chernikovdelineated family will be deleted.
153120dc21bSAlexander V. ChernikovAdditionally,
15417ed2e8eSAlexander V. Chernikov.Fl 4
15517ed2e8eSAlexander V. Chernikovor
15617ed2e8eSAlexander V. Chernikov.Fl 6
15717ed2e8eSAlexander V. Chernikovcan be used as aliases for
15817ed2e8eSAlexander V. Chernikov.Fl inet
15917ed2e8eSAlexander V. Chernikovand
16017ed2e8eSAlexander V. Chernikov.Fl inet6
16117ed2e8eSAlexander V. Chernikovmodifiers.
1629ba63ff5SHiroki SatoWhen a
1639ba63ff5SHiroki Sato.Fl fib
1649ba63ff5SHiroki Satooption is specified, the operation will be applied to
1659ba63ff5SHiroki Satothe specified FIB
1669ba63ff5SHiroki Sato.Pq routing table .
1678fae3551SRodney W. Grimes.Pp
168b3b6ff23SRyan StoneThe add command has the following syntax:
169b3b6ff23SRyan Stone.Pp
170b3b6ff23SRyan Stone.Bd -ragged -offset indent -compact
171b3b6ff23SRyan Stone.Nm
172b3b6ff23SRyan Stone.Op Fl n
173b3b6ff23SRyan Stone.Cm add
174b3b6ff23SRyan Stone.Op Fl net No \&| Fl host
175b3b6ff23SRyan Stone.Ar destination gateway
176b3b6ff23SRyan Stone.Op Ar netmask
177b3b6ff23SRyan Stone.Op Fl fib Ar number
178b3b6ff23SRyan Stone.Ed
179b3b6ff23SRyan Stone.Pp
180b3b6ff23SRyan Stoneand the other commands have the following syntax:
1818fae3551SRodney W. Grimes.Pp
18246eea498SRuslan Ermilov.Bd -ragged -offset indent -compact
1837c7fb079SRuslan Ermilov.Nm
1847c7fb079SRuslan Ermilov.Op Fl n
1858fae3551SRodney W. Grimes.Ar command
1868fae3551SRodney W. Grimes.Op Fl net No \&| Fl host
187b3b6ff23SRyan Stone.Ar destination
188b3b6ff23SRyan Stone.Op Ar gateway Op Ar netmask
1899ba63ff5SHiroki Sato.Op Fl fib Ar number
1908fae3551SRodney W. Grimes.Ed
1918fae3551SRodney W. Grimes.Pp
1928fae3551SRodney W. Grimeswhere
1938fae3551SRodney W. Grimes.Ar destination
1948fae3551SRodney W. Grimesis the destination host or network,
1958fae3551SRodney W. Grimes.Ar gateway
1968fae3551SRodney W. Grimesis the next-hop intermediary via which packets should be routed.
1978fae3551SRodney W. GrimesRoutes to a particular host may be distinguished from those to
1988fae3551SRodney W. Grimesa network by interpreting the Internet address specified as the
199ce6da1a9SRuslan Ermilov.Ar destination
200ce6da1a9SRuslan Ermilovargument.
2018fae3551SRodney W. GrimesThe optional modifiers
2028fae3551SRodney W. Grimes.Fl net
2038fae3551SRodney W. Grimesand
2048fae3551SRodney W. Grimes.Fl host
2058fae3551SRodney W. Grimesforce the destination to be interpreted as a network or a host, respectively.
2068fae3551SRodney W. GrimesOtherwise, if the
2078fae3551SRodney W. Grimes.Ar destination
20878c65517SGuy Helmerhas a
20978c65517SGuy Helmer.Dq local address part
21078c65517SGuy Helmerof
21178c65517SGuy HelmerINADDR_ANY
21278c65517SGuy Helmer.Pq Li 0.0.0.0 ,
2138fae3551SRodney W. Grimesor if the
2148fae3551SRodney W. Grimes.Ar destination
2158fae3551SRodney W. Grimesis the symbolic name of a network, then the route is
2168fae3551SRodney W. Grimesassumed to be to a network; otherwise, it is presumed to be a
2178fae3551SRodney W. Grimesroute to a host.
218ce6da1a9SRuslan ErmilovOptionally, the
219ce6da1a9SRuslan Ermilov.Ar destination
220ce6da1a9SRuslan Ermilovcould also be specified in the
2211b33d61dSRuslan Ermilov.Ar net Ns / Ns Ar bits
222ce6da1a9SRuslan Ermilovformat.
2238fae3551SRodney W. Grimes.Pp
2248fae3551SRodney W. GrimesFor example,
2258fae3551SRodney W. Grimes.Li 128.32
2268fae3551SRodney W. Grimesis interpreted as
2278fae3551SRodney W. Grimes.Fl host Li 128.0.0.32 ;
2288fae3551SRodney W. Grimes.Li 128.32.130
2298fae3551SRodney W. Grimesis interpreted as
2308fae3551SRodney W. Grimes.Fl host Li 128.32.0.130 ;
2318fae3551SRodney W. Grimes.Fl net Li 128.32
2328fae3551SRodney W. Grimesis interpreted as
2338fae3551SRodney W. Grimes.Li 128.32.0.0;
2348fae3551SRodney W. Grimes.Fl net Li 128.32.130
2358fae3551SRodney W. Grimesis interpreted as
236ce6da1a9SRuslan Ermilov.Li 128.32.130.0;
237ce6da1a9SRuslan Ermilovand
2381b33d61dSRuslan Ermilov.Li 192.168.64/20
239ce6da1a9SRuslan Ermilovis interpreted as
2401b33d61dSRuslan Ermilov.Fl net Li 192.168.64 Fl netmask Li 255.255.240.0 .
2418fae3551SRodney W. Grimes.Pp
24278c65517SGuy HelmerA
24378c65517SGuy Helmer.Ar destination
24478c65517SGuy Helmerof
24578c65517SGuy Helmer.Ar default
2469ba63ff5SHiroki Satois a synonym for the default route.
2479ba63ff5SHiroki SatoFor
2489ba63ff5SHiroki Sato.Li IPv4
2499ba63ff5SHiroki Satoit is
2509ba63ff5SHiroki Sato.Fl net Fl inet Li 0.0.0.0 ,
2519ba63ff5SHiroki Satoand for
2529ba63ff5SHiroki Sato.Li IPv6
2539ba63ff5SHiroki Satoit is
2549ba63ff5SHiroki Sato.Fl net Fl inet6 Li :: .
25578c65517SGuy Helmer.Pp
2568fae3551SRodney W. GrimesIf the destination is directly reachable
2578fae3551SRodney W. Grimesvia an interface requiring
2588fae3551SRodney W. Grimesno intermediary system to act as a gateway, the
2598fae3551SRodney W. Grimes.Fl interface
2608fae3551SRodney W. Grimesmodifier should be specified;
2618fae3551SRodney W. Grimesthe gateway given is the address of this host on the common network,
2628fae3551SRodney W. Grimesindicating the interface to be used for transmission.
263aa648cf8SJulian ElischerAlternately, if the interface is point to point the name of the interface
264aa648cf8SJulian Elischeritself may be given, in which case the route remains valid even
265072a289aSJulian Elischerif the local or remote addresses change.
2668fae3551SRodney W. Grimes.Pp
2678fae3551SRodney W. GrimesThe optional modifiers
2688fae3551SRodney W. Grimes.Fl xns ,
2698fae3551SRodney W. Grimes.Fl osi ,
2708fae3551SRodney W. Grimesand
2718fae3551SRodney W. Grimes.Fl link
2728fae3551SRodney W. Grimesspecify that all subsequent addresses are in the
27345c203fcSGleb Smirnoff.Tn XNS
274144b3534SJulian Elischeror
27545c203fcSGleb Smirnoff.Tn OSI
2768fae3551SRodney W. Grimesaddress families,
2778fae3551SRodney W. Grimesor are specified as link-level addresses,
2788fae3551SRodney W. Grimesand the names must be numeric specifications rather than
2798fae3551SRodney W. Grimessymbolic names.
2808fae3551SRodney W. Grimes.Pp
2818fae3551SRodney W. GrimesThe optional
2828fae3551SRodney W. Grimes.Fl netmask
283eee9b17eSPhilippe Charniermodifier is intended
2848fae3551SRodney W. Grimesto achieve the effect of an
2858fae3551SRodney W. Grimes.Tn OSI
2868fae3551SRodney W. Grimes.Tn ESIS
2878fae3551SRodney W. Grimesredirect with the netmask option,
2888fae3551SRodney W. Grimesor to manually add subnet routes with
2898fae3551SRodney W. Grimesnetmasks different from that of the implied network interface
2908fae3551SRodney W. Grimes(as would otherwise be communicated using the OSPF or ISIS routing protocols).
2918fae3551SRodney W. GrimesOne specifies an additional ensuing address parameter
2928fae3551SRodney W. Grimes(to be interpreted as a network mask).
2938fae3551SRodney W. GrimesThe implicit network mask generated in the AF_INET case
2948fae3551SRodney W. Grimescan be overridden by making sure this option follows the destination parameter.
2958fae3551SRodney W. Grimes.Pp
296cfa1ca9dSYoshinobu InoueFor
297cfa1ca9dSYoshinobu Inoue.Dv AF_INET6 ,
298cfa1ca9dSYoshinobu Inouethe
299cfa1ca9dSYoshinobu Inoue.Fl prefixlen
300cfa1ca9dSYoshinobu Inouequalifier
301cfa1ca9dSYoshinobu Inoueis available instead of the
302cfa1ca9dSYoshinobu Inoue.Fl mask
303cfa1ca9dSYoshinobu Inouequalifier because non-continuous masks are not allowed in IPv6.
304cfa1ca9dSYoshinobu InoueFor example,
305cfa1ca9dSYoshinobu Inoue.Fl prefixlen Li 32
306cfa1ca9dSYoshinobu Inouespecifies network mask of
307cfa1ca9dSYoshinobu Inoue.Li ffff:ffff:0000:0000:0000:0000:0000:0000
308cfa1ca9dSYoshinobu Inoueto be used.
309cfa1ca9dSYoshinobu InoueThe default value of prefixlen is 64 to get along with
310cfa1ca9dSYoshinobu Inouethe aggregatable address.
311cfa1ca9dSYoshinobu InoueBut 0 is assumed if
312cfa1ca9dSYoshinobu Inoue.Cm default
313cfa1ca9dSYoshinobu Inoueis specified.
314cfa1ca9dSYoshinobu InoueNote that the qualifier works only for
315cfa1ca9dSYoshinobu Inoue.Dv AF_INET6
316cfa1ca9dSYoshinobu Inoueaddress family.
317cfa1ca9dSYoshinobu Inoue.Pp
3188fae3551SRodney W. GrimesRoutes have associated flags which influence operation of the protocols
3198fae3551SRodney W. Grimeswhen sending to destinations matched by the routes.
3208fae3551SRodney W. GrimesThese flags may be set (or sometimes cleared)
3218fae3551SRodney W. Grimesby indicating the following corresponding modifiers:
3228fae3551SRodney W. Grimes.Bd -literal
3238fae3551SRodney W. Grimes-xresolve  RTF_XRESOLVE   - emit mesg on use (for external lookup)
3248fae3551SRodney W. Grimes-iface    ~RTF_GATEWAY    - destination is directly reachable
3258fae3551SRodney W. Grimes-static    RTF_STATIC     - manually added route
3268fae3551SRodney W. Grimes-nostatic ~RTF_STATIC     - pretend route added by kernel or daemon
3278fae3551SRodney W. Grimes-reject    RTF_REJECT     - emit an ICMP unreachable when matched
3288fae3551SRodney W. Grimes-blackhole RTF_BLACKHOLE  - silently discard pkts (during updates)
3298fae3551SRodney W. Grimes-proto1    RTF_PROTO1     - set protocol specific routing flag #1
3308fae3551SRodney W. Grimes-proto2    RTF_PROTO2     - set protocol specific routing flag #2
3318fae3551SRodney W. Grimes.Ed
3328fae3551SRodney W. Grimes.Pp
3338fae3551SRodney W. GrimesThe optional modifiers
3348fae3551SRodney W. Grimes.Fl rtt ,
3358fae3551SRodney W. Grimes.Fl rttvar ,
3368fae3551SRodney W. Grimes.Fl sendpipe ,
3378fae3551SRodney W. Grimes.Fl recvpipe ,
3388fae3551SRodney W. Grimes.Fl mtu ,
3398fae3551SRodney W. Grimes.Fl hopcount ,
3408fae3551SRodney W. Grimes.Fl expire ,
3418fae3551SRodney W. Grimesand
3428fae3551SRodney W. Grimes.Fl ssthresh
3438fae3551SRodney W. Grimesprovide initial values to quantities maintained in the routing entry
3448fae3551SRodney W. Grimesby transport level protocols, such as TCP or TP4.
3458fae3551SRodney W. GrimesThese may be individually locked by preceding each such modifier to
3468fae3551SRodney W. Grimesbe locked by
3478fae3551SRodney W. Grimesthe
3488fae3551SRodney W. Grimes.Fl lock
3498fae3551SRodney W. Grimesmeta-modifier, or one can
3508fae3551SRodney W. Grimesspecify that all ensuing metrics may be locked by the
3518fae3551SRodney W. Grimes.Fl lockrest
3528fae3551SRodney W. Grimesmeta-modifier.
3538fae3551SRodney W. Grimes.Pp
354de109e29SHiroki SatoNote that
355de109e29SHiroki Sato.Fl expire
356de109e29SHiroki Satoaccepts expiration time of the route as the number of seconds since the
357de109e29SHiroki SatoEpoch
358de109e29SHiroki Sato.Pq see Xr time 3 .
359de109e29SHiroki SatoWhen the first character of the number is
360de109e29SHiroki Sato.Dq +
361de109e29SHiroki Satoor
362de109e29SHiroki Sato.Dq - ,
363de109e29SHiroki Satoit is interpreted as a value relative to the current time.
364de109e29SHiroki Sato.Pp
3659ba63ff5SHiroki SatoThe optional modifier
3669ba63ff5SHiroki Sato.Fl fib Ar number
3679ba63ff5SHiroki Satospecifies that the command will be applied to a non-default FIB.
3689ba63ff5SHiroki SatoThe
3699ba63ff5SHiroki Sato.Ar number
3709ba63ff5SHiroki Satomust be smaller than the
3719ba63ff5SHiroki Sato.Va net.fibs
3729ba63ff5SHiroki Sato.Xr sysctl 8
3739ba63ff5SHiroki SatoMIB.
3749ba63ff5SHiroki SatoWhen this modifier is not specified,
3759ba63ff5SHiroki Satoor a negative number is specified,
3769ba63ff5SHiroki Satothe default FIB shown in the
3779ba63ff5SHiroki Sato.Va net.my_fibnum
3789ba63ff5SHiroki Sato.Xr sysctl 8
3799ba63ff5SHiroki SatoMIB will be used.
3809ba63ff5SHiroki Sato.Pp
3819ba63ff5SHiroki SatoThe
3829ba63ff5SHiroki Sato.Ar number
3839ba63ff5SHiroki Satoallows multiple FIBs by a comma-separeted list and/or range
3849ba63ff5SHiroki Satospecification.
3859ba63ff5SHiroki SatoThe
3869ba63ff5SHiroki Sato.Qq Fl fib Li 2,4,6
3879ba63ff5SHiroki Satomeans the FIB number 2, 4, and 6.
3889ba63ff5SHiroki SatoThe
3899ba63ff5SHiroki Sato.Qq Fl fib Li 1,3-5,6
3909ba63ff5SHiroki Satomeans the 1, 3, 4, 5, and 6.
3919ba63ff5SHiroki Sato.Pp
3928fae3551SRodney W. GrimesIn a
3938fae3551SRodney W. Grimes.Cm change
3948fae3551SRodney W. Grimesor
3958fae3551SRodney W. Grimes.Cm add
3968fae3551SRodney W. Grimescommand where the destination and gateway are not sufficient to specify
3978fae3551SRodney W. Grimesthe route (as in the
3988fae3551SRodney W. Grimes.Tn ISO
3998fae3551SRodney W. Grimescase where several interfaces may have the
4008fae3551SRodney W. Grimessame address), the
4018fae3551SRodney W. Grimes.Fl ifp
4028fae3551SRodney W. Grimesor
4038fae3551SRodney W. Grimes.Fl ifa
4048fae3551SRodney W. Grimesmodifiers may be used to determine the interface or interface address.
4058fae3551SRodney W. Grimes.Pp
4068fae3551SRodney W. GrimesAll symbolic names specified for a
4078fae3551SRodney W. Grimes.Ar destination
4088fae3551SRodney W. Grimesor
4098fae3551SRodney W. Grimes.Ar gateway
4108fae3551SRodney W. Grimesare looked up first as a host name using
4118fae3551SRodney W. Grimes.Xr gethostbyname 3 .
4128fae3551SRodney W. GrimesIf this lookup fails,
4138fae3551SRodney W. Grimes.Xr getnetbyname 3
4148fae3551SRodney W. Grimesis then used to interpret the name as that of a network.
4158fae3551SRodney W. Grimes.Pp
416629e80efSPhilippe CharnierThe
417629e80efSPhilippe Charnier.Nm
418629e80efSPhilippe Charnierutility uses a routing socket and the new message types
4191c59bf7dSRuslan Ermilov.Dv RTM_ADD , RTM_DELETE , RTM_GET ,
4208fae3551SRodney W. Grimesand
4211c59bf7dSRuslan Ermilov.Dv RTM_CHANGE .
4228fae3551SRodney W. GrimesAs such, only the super-user may modify
4238fae3551SRodney W. Grimesthe routing tables.
4246087df9eSRuslan Ermilov.Sh EXIT STATUS
4256087df9eSRuslan Ermilov.Ex -std
42646b035ebSJoel Dahl.Sh EXAMPLES
42746b035ebSJoel DahlAdd a default route to the network routing table.
42846b035ebSJoel DahlThis will send all packets for destinations not available in the routing table
42946b035ebSJoel Dahlto the default gateway at 192.168.1.1:
43046b035ebSJoel Dahl.Pp
43146b035ebSJoel Dahl.Dl route add -net 0.0.0.0/0 192.168.1.1
43246b035ebSJoel Dahl.Pp
43346b035ebSJoel DahlA shorter version of adding a default route can also be written as:
43446b035ebSJoel Dahl.Pp
43546b035ebSJoel Dahl.Dl route add default 192.168.1.1
43646b035ebSJoel Dahl.Pp
43746b035ebSJoel DahlAdd a static route to the 172.16.10.0/24 network via the 172.16.1.1 gateway:
43846b035ebSJoel Dahl.Pp
43946b035ebSJoel Dahl.Dl route add -net 172.16.10.0/24 172.16.1.1
44046b035ebSJoel Dahl.Pp
44146b035ebSJoel DahlChange the gateway of an already established static route in the routing table:
44246b035ebSJoel Dahl.Pp
44346b035ebSJoel Dahl.Dl route change -net 172.16.10.0/24 172.16.1.2
44446b035ebSJoel Dahl.Pp
44546b035ebSJoel DahlDisplay the route for a destination network:
44646b035ebSJoel Dahl.Pp
44746b035ebSJoel Dahl.Dl route show 172.16.10.0
44846b035ebSJoel Dahl.Pp
44946b035ebSJoel DahlDelete a static route from the routing table:
45046b035ebSJoel Dahl.Pp
45146b035ebSJoel Dahl.Dl route delete -net 172.16.10.0/24 172.16.1.2
45246b035ebSJoel Dahl.Pp
45346b035ebSJoel DahlRemove all routes from the routing table:
45446b035ebSJoel Dahl.Pp
45546b035ebSJoel Dahl.Dl route flush
4568fae3551SRodney W. Grimes.Sh DIAGNOSTICS
45719ab52cbSDima Dorfman.Bl -diag
45819ab52cbSDima Dorfman.It "add [host \&| network ] %s: gateway %s flags %x"
4599806e231SRuslan ErmilovThe specified route is being added to the tables.
4609806e231SRuslan ErmilovThe
4618fae3551SRodney W. Grimesvalues printed are from the routing table entry supplied
4628fae3551SRodney W. Grimesin the
4638fae3551SRodney W. Grimes.Xr ioctl 2
4648fae3551SRodney W. Grimescall.
4658fae3551SRodney W. GrimesIf the gateway address used was not the primary address of the gateway
4668fae3551SRodney W. Grimes(the first one returned by
4678fae3551SRodney W. Grimes.Xr gethostbyname 3 ) ,
4688fae3551SRodney W. Grimesthe gateway address is printed numerically as well as symbolically.
46919ab52cbSDima Dorfman.It "delete [ host \&| network ] %s: gateway %s flags %x"
4708fae3551SRodney W. GrimesAs above, but when deleting an entry.
47119ab52cbSDima Dorfman.It "%s %s done"
4728fae3551SRodney W. GrimesWhen the
4738fae3551SRodney W. Grimes.Cm flush
4748fae3551SRodney W. Grimescommand is specified, each routing table entry deleted
4758fae3551SRodney W. Grimesis indicated with a message of this form.
47619ab52cbSDima Dorfman.It "Network is unreachable"
4778fae3551SRodney W. GrimesAn attempt to add a route failed because the gateway listed was not
4788fae3551SRodney W. Grimeson a directly-connected network.
4798fae3551SRodney W. GrimesThe next-hop gateway must be given.
48019ab52cbSDima Dorfman.It "not in table"
4818fae3551SRodney W. GrimesA delete operation was attempted for an entry which
4820227791bSRuslan Ermilovwas not present in the tables.
48319ab52cbSDima Dorfman.It "routing table overflow"
4848fae3551SRodney W. GrimesAn add operation was attempted, but the system was
4858fae3551SRodney W. Grimeslow on resources and was unable to allocate memory
4868fae3551SRodney W. Grimesto create the new entry.
4871d36c899SRuslan Ermilov.It "gateway uses the same route"
4881d36c899SRuslan ErmilovA
4891d36c899SRuslan Ermilov.Cm change
4901d36c899SRuslan Ermilovoperation resulted in a route whose gateway uses the
4911d36c899SRuslan Ermilovsame route as the one being changed.
4921d36c899SRuslan ErmilovThe next-hop gateway should be reachable through a different route.
4938fae3551SRodney W. Grimes.El
4948fae3551SRodney W. Grimes.Sh SEE ALSO
4955521ff5aSRuslan Ermilov.\".Xr esis 4 ,
4968fae3551SRodney W. Grimes.Xr netintro 4 ,
4978fae3551SRodney W. Grimes.Xr route 4 ,
4981c59bf7dSRuslan Ermilov.Xr arp 8 ,
499bcff8e2aSMike Pritchard.Xr routed 8
500bcff8e2aSMike Pritchard.\".Xr XNSrouted 8
5018fae3551SRodney W. Grimes.Sh HISTORY
5028fae3551SRodney W. GrimesThe
5038fae3551SRodney W. Grimes.Nm
504629e80efSPhilippe Charnierutility appeared in
5058fae3551SRodney W. Grimes.Bx 4.2 .
5068fae3551SRodney W. Grimes.Sh BUGS
5078fae3551SRodney W. GrimesThe first paragraph may have slightly exaggerated
5081cc580efSPhilippe Charnier.Xr routed 8 Ns 's
5098fae3551SRodney W. Grimesabilities.
5102c9743caSBruce M Simpson.Pp
5112c9743caSBruce M SimpsonCurrently, routes with the
51221414470SRuslan Ermilov.Dv RTF_BLACKHOLE
5132c9743caSBruce M Simpsonflag set need to have the gateway set to an instance of the
5142c9743caSBruce M Simpson.Xr lo 4
5152c9743caSBruce M Simpsondriver, using the
5162c9743caSBruce M Simpson.Fl iface
5172c9743caSBruce M Simpsonoption, for the flag to have any effect; unless IP fast forwarding
5182c9743caSBruce M Simpsonis enabled, in which case the meaning of the flag will always
5192c9743caSBruce M Simpsonbe honored.
520