| @@ -1,469 +1,469 @@ | | | @@ -1,469 +1,469 @@ |
1 | .\" $NetBSD: route.8,v 1.62 2020/08/29 19:27:08 christos Exp $ | | 1 | .\" $NetBSD: route.8,v 1.63 2021/01/02 19:50:42 uwe Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 1983, 1991, 1993 | | 3 | .\" Copyright (c) 1983, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | | 4 | .\" The Regents of the University of California. All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" 3. Neither the name of the University nor the names of its contributors | | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
15 | .\" may be used to endorse or promote products derived from this software | | 15 | .\" may be used to endorse or promote products derived from this software |
16 | .\" without specific prior written permission. | | 16 | .\" without specific prior written permission. |
17 | .\" | | 17 | .\" |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | | 18 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
19 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 19 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 20 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 21 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
22 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 22 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
23 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 23 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
24 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 24 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 25 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 26 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 27 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | .\" SUCH DAMAGE. | | 28 | .\" SUCH DAMAGE. |
29 | .\" | | 29 | .\" |
30 | .\" @(#)route.8 8.4 (Berkeley) 6/1/94 | | 30 | .\" @(#)route.8 8.4 (Berkeley) 6/1/94 |
31 | .\" | | 31 | .\" |
32 | .Dd August 29, 2020 | | 32 | .Dd August 29, 2020 |
33 | .Dt ROUTE 8 | | 33 | .Dt ROUTE 8 |
34 | .Os | | 34 | .Os |
35 | .Sh NAME | | 35 | .Sh NAME |
36 | .Nm route | | 36 | .Nm route |
37 | .Nd manually manipulate the routing tables | | 37 | .Nd manually manipulate the routing tables |
38 | .Sh SYNOPSIS | | 38 | .Sh SYNOPSIS |
39 | .Nm | | 39 | .Nm |
40 | .Op Fl dfLnqSsTtv | | 40 | .Op Fl dfLnqSsTtv |
41 | .Ar command | | 41 | .Ar command |
42 | .Oo | | 42 | .Oo |
43 | .Op Ar modifiers | | 43 | .Op Ar modifiers |
44 | .Ar args | | 44 | .Ar args |
45 | .Oc | | 45 | .Oc |
46 | .Sh DESCRIPTION | | 46 | .Sh DESCRIPTION |
47 | .Nm | | 47 | .Nm |
48 | is a utility used to manually manipulate the network | | 48 | is a utility used to manually manipulate the network |
49 | routing tables. | | 49 | routing tables. |
50 | Except for setting up the default route, it is normally not needed, | | 50 | Except for setting up the default route, it is normally not needed, |
51 | as a system routing table management daemon such as | | 51 | as a system routing table management daemon such as |
52 | .Xr routed 8 , | | 52 | .Xr routed 8 , |
53 | should tend to this task. | | 53 | should tend to this task. |
54 | .Pp | | 54 | .Pp |
55 | .Nm | | 55 | .Nm |
56 | can be used to modify nearly any aspect of the routing policy, | | 56 | can be used to modify nearly any aspect of the routing policy, |
57 | except packet forwarding, which can be manipulated through the | | 57 | except packet forwarding, which can be manipulated through the |
58 | .Xr sysctl 8 | | 58 | .Xr sysctl 8 |
59 | command. | | 59 | command. |
60 | .Pp | | 60 | .Pp |
61 | The | | 61 | The |
62 | .Nm | | 62 | .Nm |
63 | utility supports a limited number of general options, | | 63 | utility supports a limited number of general options, |
64 | but a rich command language, enabling the user to specify | | 64 | but a rich command language, enabling the user to specify |
65 | any arbitrary request that could be delivered via the | | 65 | any arbitrary request that could be delivered via the |
66 | programmatic interface discussed in | | 66 | programmatic interface discussed in |
67 | .Xr route 4 . | | 67 | .Xr route 4 . |
68 | .Bl -tag -width Ds | | 68 | .Bl -tag -width Ds |
69 | .It Fl d | | 69 | .It Fl d |
70 | Turn on debugging | | 70 | Turn on debugging |
71 | .It Fl f | | 71 | .It Fl f |
72 | Remove all routes (as per | | 72 | Remove all routes (as per |
73 | .Cm flush ) . | | 73 | .Cm flush ) . |
74 | If used in conjunction with the | | 74 | If used in conjunction with the |
75 | .Cm add , | | 75 | .Cm add , |
76 | .Cm change , | | 76 | .Cm change , |
77 | .Cm delete | | 77 | .Cm delete |
78 | or | | 78 | or |
79 | .Cm get | | 79 | .Cm get |
80 | commands, | | 80 | commands, |
81 | .Nm | | 81 | .Nm |
82 | removes the routes before performing the command. | | 82 | removes the routes before performing the command. |
83 | .It Fl L | | 83 | .It Fl L |
84 | Don't show link layer entries in routing table. | | 84 | Don't show link layer entries in routing table. |
85 | .It Fl n | | 85 | .It Fl n |
86 | Bypasses attempts to print host and network names symbolically | | 86 | Bypasses attempts to print host and network names symbolically |
87 | when reporting actions. | | 87 | when reporting actions. |
88 | (The process of translating between symbolic | | 88 | (The process of translating between symbolic |
89 | names and numerical equivalents can be quite time consuming, and | | 89 | names and numerical equivalents can be quite time consuming, and |
90 | may require correct operation of the network; thus it may be expedient | | 90 | may require correct operation of the network; thus it may be expedient |
91 | to forgo this, especially when attempting to repair networking operations). | | 91 | to forgo this, especially when attempting to repair networking operations). |
92 | .It Fl q | | 92 | .It Fl q |
93 | Suppress all output from commands that manipulate the routing table. | | 93 | Suppress all output from commands that manipulate the routing table. |
94 | .It Fl S | | 94 | .It Fl S |
95 | Print a space when a flag is missing so that flags are vertically aligned | | 95 | Print a space when a flag is missing so that flags are vertically aligned |
96 | instead of printing the flags that are set as a contiguous string. | | 96 | instead of printing the flags that are set as a contiguous string. |
97 | .It Fl s | | 97 | .It Fl s |
98 | (short) Suppresses all output from a | | 98 | (short) Suppresses all output from a |
99 | .Cm get | | 99 | .Cm get |
100 | command except for the actual gateway that will be used. | | 100 | command except for the actual gateway that will be used. |
101 | How the gateway is printed depends on the type of route being looked up. | | 101 | How the gateway is printed depends on the type of route being looked up. |
102 | .It Fl T | | 102 | .It Fl T |
103 | Show tags in the route display. | | 103 | Show tags in the route display. |
104 | .It Fl t | | 104 | .It Fl t |
105 | Test only, don't perform any actions. | | 105 | Test only, don't perform any actions. |
106 | .It Fl v | | 106 | .It Fl v |
107 | (verbose) Print additional details. | | 107 | (verbose) Print additional details. |
108 | .El | | 108 | .El |
109 | .Pp | | 109 | .Pp |
110 | The | | 110 | The |
111 | .Nm | | 111 | .Nm |
112 | utility provides several commands: | | 112 | utility provides several commands: |
113 | .Pp | | 113 | .Pp |
114 | .Bl -tag -width Fl -compact | | 114 | .Bl -tag -width Fl -compact |
115 | .It Cm add | | 115 | .It Cm add |
116 | Add a route. | | 116 | Add a route. |
117 | .It Cm flush | | 117 | .It Cm flush |
118 | Remove all routes. | | 118 | Remove all routes. |
119 | .It Cm flushall | | 119 | .It Cm flushall |
120 | Remove all routes including the default gateway. | | 120 | Remove all routes including the default gateway. |
121 | .It Cm delete | | 121 | .It Cm delete |
122 | Delete a specific route. | | 122 | Delete a specific route. |
123 | .It Cm change | | 123 | .It Cm change |
124 | Change aspects of a route (such as its gateway). | | 124 | Change aspects of a route (such as its gateway). |
125 | .It Cm get | | 125 | .It Cm get |
126 | Lookup and display the route for a destination. | | 126 | Lookup and display the route for a destination. |
127 | .It Cm show | | 127 | .It Cm show |
128 | Print out the route table similar to "netstat \-r" (see | | 128 | Print out the route table similar to "netstat \-r" (see |
129 | .Xr netstat 1 ) . | | 129 | .Xr netstat 1 ) . |
130 | .It Cm monitor | | 130 | .It Cm monitor |
131 | Continuously report any changes to the routing information base, | | 131 | Continuously report any changes to the routing information base, |
132 | routing lookup misses, or suspected network partitionings. | | 132 | routing lookup misses, or suspected network partitionings. |
133 | .El | | 133 | .El |
134 | .Pp | | 134 | .Pp |
135 | The monitor command has the syntax | | 135 | The monitor command has the syntax |
136 | .Pp | | 136 | .Pp |
137 | .Bd -filled -offset indent -compact | | 137 | .Bd -filled -offset indent -compact |
138 | .Nm | | 138 | .Nm |
139 | .Op Fl n | | 139 | .Op Fl n |
140 | .Cm monitor | | 140 | .Cm monitor |
141 | .Op Fl c Ar count | | 141 | .Op Fl c Ar count |
142 | .Ed | | 142 | .Ed |
143 | .Pp | | 143 | .Pp |
144 | If | | 144 | If |
145 | .Ar count | | 145 | .Ar count |
146 | is specified, | | 146 | is specified, |
147 | .Nm | | 147 | .Nm |
148 | exits after receiving | | 148 | exits after receiving |
149 | .Ar count | | 149 | .Ar count |
150 | routing messages. | | 150 | routing messages. |
151 | .Pp | | 151 | .Pp |
152 | The flush command has the syntax | | 152 | The flush command has the syntax |
153 | .Pp | | 153 | .Pp |
154 | .Bd -filled -offset indent -compact | | 154 | .Bd -filled -offset indent -compact |
155 | .Nm | | 155 | .Nm |
156 | .Op Fl n | | 156 | .Op Fl n |
157 | .Cm flush | | 157 | .Cm flush |
158 | .Op Ar family | | 158 | .Op Ar family |
159 | .Ed | | 159 | .Ed |
160 | .Pp | | 160 | .Pp |
161 | If the | | 161 | If the |
162 | .Cm flush | | 162 | .Cm flush |
163 | command is specified, | | 163 | command is specified, |
164 | .Nm | | 164 | .Nm |
165 | will ``flush'' the routing tables of all gateway entries. | | 165 | will ``flush'' the routing tables of all gateway entries. |
166 | When the address family is specified by any of the | | 166 | When the address family is specified by any of the |
167 | .Fl atalk , | | 167 | .Fl atalk , |
168 | .Fl inet , | | 168 | .Fl inet , |
169 | .Fl inet6 , | | 169 | .Fl inet6 , |
170 | or | | 170 | or |
171 | .Fl mpls | | 171 | .Fl mpls |
172 | modifiers, only routes having destinations with addresses in the | | 172 | modifiers, only routes having destinations with addresses in the |
173 | delineated family will be manipulated. | | 173 | delineated family will be manipulated. |
174 | .Pp | | 174 | .Pp |
175 | The other commands have the following syntax: | | 175 | The other commands have the following syntax: |
176 | .Pp | | 176 | .Pp |
177 | .Bd -filled -offset indent -compact | | 177 | .Bd -filled -offset indent -compact |
178 | .Nm | | 178 | .Nm |
179 | .Op Fl n | | 179 | .Op Fl n |
180 | .Ar command | | 180 | .Ar command |
181 | .Op Fl net No \&| Fl host | | 181 | .Op Fl net No \&| Fl host |
182 | .Ar destination gateway | | 182 | .Ar destination gateway |
183 | .Ed | | 183 | .Ed |
184 | .Pp | | 184 | .Pp |
185 | where | | 185 | where |
186 | .Ar destination | | 186 | .Ar destination |
187 | is the destination host or network, and | | 187 | is the destination host or network, and |
188 | .Ar gateway | | 188 | .Ar gateway |
189 | is the next-hop intermediary via which packets should be routed. | | 189 | is the next-hop intermediary via which packets should be routed. |
190 | Routes to a particular host may be distinguished from those to | | 190 | Routes to a particular host may be distinguished from those to |
191 | a network by interpreting the Internet address specified as the | | 191 | a network by interpreting the Internet address specified as the |
192 | .Ar destination | | 192 | .Ar destination |
193 | argument. | | 193 | argument. |
194 | The optional modifiers | | 194 | The optional modifiers |
195 | .Fl net | | 195 | .Fl net |
196 | and | | 196 | and |
197 | .Fl host | | 197 | .Fl host |
198 | force the destination to be interpreted as a network or a host, respectively. | | 198 | force the destination to be interpreted as a network or a host, respectively. |
199 | Otherwise, if the | | 199 | Otherwise, if the |
200 | .Ar destination | | 200 | .Ar destination |
201 | has a ``local address part'' of | | 201 | has a ``local address part'' of |
202 | .Dv INADDR_ANY , | | 202 | .Dv INADDR_ANY , |
203 | or if the | | 203 | or if the |
204 | .Ar destination | | 204 | .Ar destination |
205 | is the symbolic name of a network, then the route is | | 205 | is the symbolic name of a network, then the route is |
206 | assumed to be to a network; otherwise, it is presumed to be a | | 206 | assumed to be to a network; otherwise, it is presumed to be a |
207 | route to a host. | | 207 | route to a host. |
208 | Optionally, the | | 208 | Optionally, the |
209 | .Ar destination | | 209 | .Ar destination |
210 | can also be specified in the | | 210 | can also be specified in the |
211 | .Ar net Ns / Ns Ar bits | | 211 | .Ar net Ns / Ns Ar bits |
212 | format. | | 212 | format. |
213 | .Pp | | 213 | .Pp |
214 | For example, | | 214 | For example, |
215 | .Li 128.32 | | 215 | .Li 128.32 |
216 | is interpreted as | | 216 | is interpreted as |
217 | .Fl host Li 128.0.0.32 ; | | 217 | .Fl host Li 128.0.0.32 ; |
218 | .Li 128.32.130 | | 218 | .Li 128.32.130 |
219 | is interpreted as | | 219 | is interpreted as |
220 | .Fl host Li 128.32.0.130 ; | | 220 | .Fl host Li 128.32.0.130 ; |
221 | .Fl net Li 128.32 | | 221 | .Fl net Li 128.32 |
222 | is interpreted as | | 222 | is interpreted as |
223 | .Li 128.32.0.0 ; | | 223 | .Li 128.32.0.0 ; |
224 | and | | 224 | and |
225 | .Fl net Li 128.32.130 | | 225 | .Fl net Li 128.32.130 |
226 | is interpreted as | | 226 | is interpreted as |
227 | .Li 128.32.130.0 . | | 227 | .Li 128.32.130.0 . |
228 | .Pp | | 228 | .Pp |
229 | The keyword | | 229 | The keyword |
230 | .Cm default | | 230 | .Cm default |
231 | can be used as the | | 231 | can be used as the |
232 | .Ar destination | | 232 | .Ar destination |
233 | to set up a default route to a smart | | 233 | to set up a default route to a smart |
234 | .Ar gateway . | | 234 | .Ar gateway . |
235 | If no other routes match, this default route will be used as a last resort. | | 235 | If no other routes match, this default route will be used as a last resort. |
236 | .Pp | | 236 | .Pp |
237 | If the destination is directly reachable | | 237 | If the destination is directly reachable |
238 | via an interface requiring | | 238 | via an interface requiring |
239 | no intermediary system to act as a gateway, the | | 239 | no intermediary system to act as a gateway, the |
240 | .Fl interface | | 240 | .Fl interface |
241 | modifier should be specified; | | 241 | modifier should be specified; |
242 | the gateway given is the address of this host on the common network, | | 242 | the gateway given is the address of this host on the common network, |
243 | indicating the interface to be used for transmission. | | 243 | indicating the interface to be used for transmission. |
244 | .Pp | | 244 | .Pp |
245 | The optional modifiers | | 245 | The optional modifiers |
246 | .Fl atalk , | | 246 | .Fl atalk , |
247 | and | | 247 | and |
248 | .Fl link | | 248 | .Fl link |
249 | specify that all subsequent addresses are in the | | 249 | specify that all subsequent addresses are in the |
250 | .Tn AppleTalk | | 250 | .Tn AppleTalk |
251 | address family, | | 251 | address family, |
252 | or are specified as link-level addresses in the form described in | | 252 | or are specified as link-level addresses in the form described in |
253 | .Xr link_addr 3 , | | 253 | .Xr link_addr 3 , |
254 | and the names must be numeric specifications rather than | | 254 | and the names must be numeric specifications rather than |
255 | symbolic names. | | 255 | symbolic names. |
256 | .Pp | | 256 | .Pp |
257 | The optional modifier | | 257 | The optional modifier |
258 | .Fl tag | | 258 | .Fl tag |
259 | specifies an address associated with the route. | | 259 | specifies an address associated with the route. |
260 | How the address is used is specific to the address family of | | 260 | How the address is used is specific to the address family of |
261 | the destination and the interface used to forward the packet. | | 261 | the destination and the interface used to forward the packet. |
262 | Currently route tags are consumed only by the | | 262 | Currently route tags are consumed only by the |
263 | .Xr mpls 4 | | 263 | .Xr mpls 4 |
264 | stack; therefore | | 264 | stack; therefore |
265 | .Nm | | 265 | .Nm |
266 | assumes that the subsequent addresses are in the | | 266 | assumes that the subsequent addresses are in the |
267 | .Tn MPLS | | 267 | .Tn MPLS |
268 | address family. | | 268 | address family. |
269 | See | | 269 | See |
270 | .Xr mpls 4 | | 270 | .Xr mpls 4 |
271 | for examples of setting routes involving MPLS. | | 271 | for examples of setting routes involving MPLS. |
272 | .Pp | | 272 | .Pp |
273 | The optional | | 273 | The optional |
274 | .Fl netmask | | 274 | .Fl netmask |
275 | qualifier is intended | | 275 | qualifier is intended |
276 | to achieve the effect of an | | 276 | to achieve the effect of an |
277 | .Tn ESIS | | 277 | .Tn ESIS |
278 | redirect with the netmask option, | | 278 | redirect with the netmask option, |
279 | or to manually add subnet routes with | | 279 | or to manually add subnet routes with |
280 | netmasks different from that of the implied network interface | | 280 | netmasks different from that of the implied network interface |
281 | (as would otherwise be communicated using the OSPF or ISIS routing protocols). | | 281 | (as would otherwise be communicated using the OSPF or ISIS routing protocols). |
282 | One specifies an additional ensuing address parameter | | 282 | One specifies an additional ensuing address parameter |
283 | (to be interpreted as a network mask). | | 283 | (to be interpreted as a network mask). |
284 | The implicit network mask generated in the | | 284 | The implicit network mask generated in the |
285 | .Dv AF_INET | | 285 | .Dv AF_INET |
286 | case | | 286 | case |
287 | can be overridden by making sure this option follows the destination parameter. | | 287 | can be overridden by making sure this option follows the destination parameter. |
288 | .Fl prefixlen | | 288 | .Fl prefixlen |
289 | is also available for similar purpose, in IPv4 and IPv6 case. | | 289 | is also available for similar purpose, in IPv4 and IPv6 case. |
290 | .Pp | | 290 | .Pp |
291 | Routes have associated flags which influence operation of the protocols | | 291 | Routes have associated flags which influence operation of the protocols |
292 | when sending to destinations matched by the routes. | | 292 | when sending to destinations matched by the routes. |
293 | These flags are displayed using the following ID characters in the routing | | 293 | These flags are displayed using the following ID characters in the routing |
294 | display and may be set (or sometimes cleared) | | 294 | display and may be set (or sometimes cleared) |
295 | by indicating the following corresponding modifiers: | | 295 | by indicating the following corresponding modifiers: |
296 | .Bl -column "ID" "xnoblackhole" "xRTF_BLACKHOLE" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | | 296 | .Bl -column "ID" "xnoblackhole" "xRTF_BLACKHOLE" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" |
297 | .It Sy "ID" Ta Sy "Modifier" Ta Sy " Flag Bit" Ta Sy "Description" | | 297 | .It Sy "ID" Ta Sy "Modifier" Ta Sy " Flag Bit" Ta Sy "Description" |
298 | .It Li " " Ta -iface Ta ~RTF_GATEWAY Ta destination is directly reachable | | 298 | .It Li " " Ta -iface Ta ~RTF_GATEWAY Ta destination is directly reachable |
299 | .It Li 1 Ta -proto1 Ta " RTF_PROTO1" Ta set protocol specific flag #1 | | 299 | .It Li 1 Ta -proto1 Ta " RTF_PROTO1" Ta set protocol specific flag #1 |
300 | .It Li 2 Ta -proto2 Ta " RTF_PROTO2" Ta set protocol specific flag #2 | | 300 | .It Li 2 Ta -proto2 Ta " RTF_PROTO2" Ta set protocol specific flag #2 |
301 | .It Li B Ta -blackhole Ta " RTF_BLACKHOLE" Ta discard pkts (during updates) | | 301 | .It Li B Ta -blackhole Ta " RTF_BLACKHOLE" Ta discard pkts (during updates) |
302 | .It Li b Ta "" Ta " RTF_BROADCAST" Ta Route represents a broadcast address | | | |
303 | .It Li " " Ta -noblackhole Ta ~RTF_BLACKHOLE Ta clear blackhole flag | | 302 | .It Li " " Ta -noblackhole Ta ~RTF_BLACKHOLE Ta clear blackhole flag |
| | | 303 | .It Li b Ta "" Ta " RTF_BROADCAST" Ta Route represents a broadcast address |
304 | .It Li C Ta -cloning Ta " RTF_CLONING" Ta (deprecated) same as | | 304 | .It Li C Ta -cloning Ta " RTF_CLONING" Ta (deprecated) same as |
305 | .Fl connected | | 305 | .Fl connected |
306 | .It Li " " Ta -nocloning Ta ~RTF_CLONING Ta (deprecated) same as | | 306 | .It Li " " Ta -nocloning Ta ~RTF_CLONING Ta (deprecated) same as |
307 | .Fl noconnected | | 307 | .Fl noconnected |
308 | .It Li C Ta -connected Ta " RTF_CONNECTED" Ta treat as a connected route | | 308 | .It Li C Ta -connected Ta " RTF_CONNECTED" Ta treat as a connected route |
309 | .It Li " " Ta -noconnected Ta ~RTF_CONNECTED Ta stop treating a connected route | | 309 | .It Li " " Ta -noconnected Ta ~RTF_CONNECTED Ta stop treating a connected route |
310 | .It Li D Ta "" Ta " RTF_DYNAMIC" Ta created dynamically (redirect) | | 310 | .It Li D Ta "" Ta " RTF_DYNAMIC" Ta created dynamically (redirect) |
311 | .It Li G Ta "" Ta " RTF_GATEWAY" Ta forwarded to dest by intermediary | | 311 | .It Li G Ta "" Ta " RTF_GATEWAY" Ta forwarded to dest by intermediary |
312 | .It Li H Ta "" Ta " RTF_HOST" Ta host entry (net otherwise) | | 312 | .It Li H Ta "" Ta " RTF_HOST" Ta host entry (net otherwise) |
313 | .It Li L Ta "" Ta " RTF_LLDATA" Ta local link, generated by ARP or NDP | | 313 | .It Li L Ta "" Ta " RTF_LLDATA" Ta local link, generated by ARP or NDP |
314 | .It Li l Ta "" Ta " RTF_LOCAL" Ta Route represents a local address | | 314 | .It Li l Ta "" Ta " RTF_LOCAL" Ta Route represents a local address |
315 | .It Li M Ta "" Ta " RTF_MODIFIED" Ta modified dynamically (redirect) | | 315 | .It Li M Ta "" Ta " RTF_MODIFIED" Ta modified dynamically (redirect) |
316 | .It Li p Ta -proxy Ta " RTF_ANNOUNCE" Ta make entry a link level proxy | | 316 | .It Li p Ta -proxy Ta " RTF_ANNOUNCE" Ta make entry a link level proxy |
317 | .It Li R Ta -reject Ta " RTF_REJECT" Ta send ICMP unreachable on match | | 317 | .It Li R Ta -reject Ta " RTF_REJECT" Ta send ICMP unreachable on match |
318 | .It Li " " Ta -noreject Ta ~RTF_REJECT Ta clear reject flag | | 318 | .It Li " " Ta -noreject Ta ~RTF_REJECT Ta clear reject flag |
319 | .It Li S Ta -static Ta " RTF_STATIC" Ta manually added route | | 319 | .It Li S Ta -static Ta " RTF_STATIC" Ta manually added route |
320 | .It Li " " Ta -nostatic Ta ~RTF_STATIC Ta pretend route added automatically | | 320 | .It Li " " Ta -nostatic Ta ~RTF_STATIC Ta pretend route added automatically |
321 | .It Li U Ta "" Ta " RTF_UP" Ta route usable | | 321 | .It Li U Ta "" Ta " RTF_UP" Ta route usable |
322 | .El | | 322 | .El |
323 | .Pp | | 323 | .Pp |
324 | The optional modifiers | | 324 | The optional modifiers |
325 | .Fl rtt , | | 325 | .Fl rtt , |
326 | .Fl rttvar , | | 326 | .Fl rttvar , |
327 | .Fl sendpipe , | | 327 | .Fl sendpipe , |
328 | .Fl recvpipe , | | 328 | .Fl recvpipe , |
329 | .Fl mtu , | | 329 | .Fl mtu , |
330 | .Fl hopcount , | | 330 | .Fl hopcount , |
331 | .Fl expire , | | 331 | .Fl expire , |
332 | and | | 332 | and |
333 | .Fl ssthresh | | 333 | .Fl ssthresh |
334 | provide initial values to quantities maintained in the routing entry | | 334 | provide initial values to quantities maintained in the routing entry |
335 | by transport level protocols, such as TCP or TP4. | | 335 | by transport level protocols, such as TCP or TP4. |
336 | These may be individually locked by preceding each such modifier to | | 336 | These may be individually locked by preceding each such modifier to |
337 | be locked by | | 337 | be locked by |
338 | the | | 338 | the |
339 | .Fl lock | | 339 | .Fl lock |
340 | meta-modifier, or one can | | 340 | meta-modifier, or one can |
341 | specify that all ensuing metrics may be locked by the | | 341 | specify that all ensuing metrics may be locked by the |
342 | .Fl lockrest | | 342 | .Fl lockrest |
343 | meta-modifier. | | 343 | meta-modifier. |
344 | .Pp | | 344 | .Pp |
345 | In a | | 345 | In a |
346 | .Cm change | | 346 | .Cm change |
347 | or | | 347 | or |
348 | .Cm add | | 348 | .Cm add |
349 | command where the destination and gateway are not sufficient to specify | | 349 | command where the destination and gateway are not sufficient to specify |
350 | the route the | | 350 | the route the |
351 | .Fl ifp | | 351 | .Fl ifp |
352 | or | | 352 | or |
353 | .Fl ifa | | 353 | .Fl ifa |
354 | modifiers may be used to determine the interface or interface address. | | 354 | modifiers may be used to determine the interface or interface address. |
355 | .Pp | | 355 | .Pp |
356 | All symbolic names specified for a | | 356 | All symbolic names specified for a |
357 | .Ar destination | | 357 | .Ar destination |
358 | or | | 358 | or |
359 | .Ar gateway | | 359 | .Ar gateway |
360 | are looked up first as a host name using | | 360 | are looked up first as a host name using |
361 | .Xr gethostbyname 3 . | | 361 | .Xr gethostbyname 3 . |
362 | If this lookup fails, | | 362 | If this lookup fails, |
363 | .Xr getnetbyname 3 | | 363 | .Xr getnetbyname 3 |
364 | is then used to interpret the name as that of a network. | | 364 | is then used to interpret the name as that of a network. |
365 | .Pp | | 365 | .Pp |
366 | .Nm | | 366 | .Nm |
367 | uses a routing socket and the new message types | | 367 | uses a routing socket and the new message types |
368 | .Dv RTM_ADD , | | 368 | .Dv RTM_ADD , |
369 | .Dv RTM_DELETE , | | 369 | .Dv RTM_DELETE , |
370 | .Dv RTM_GET , | | 370 | .Dv RTM_GET , |
371 | and | | 371 | and |
372 | .Dv RTM_CHANGE . | | 372 | .Dv RTM_CHANGE . |
373 | As such, only the super-user may modify | | 373 | As such, only the super-user may modify |
374 | the routing tables. | | 374 | the routing tables. |
375 | .Sh EXIT STATUS | | 375 | .Sh EXIT STATUS |
376 | .Ex -std route | | 376 | .Ex -std route |
377 | This includes the use of the | | 377 | This includes the use of the |
378 | .Cm get | | 378 | .Cm get |
379 | command to look up a route that is incomplete. | | 379 | command to look up a route that is incomplete. |
380 | .Sh EXAMPLES | | 380 | .Sh EXAMPLES |
381 | This sets the default route to 192.168.0.1: | | 381 | This sets the default route to 192.168.0.1: |
382 | .Dl route add default 192.168.0.1 | | 382 | .Dl route add default 192.168.0.1 |
383 | This shows all routes, without DNS resolution (this is useful if the | | 383 | This shows all routes, without DNS resolution (this is useful if the |
384 | DNS is not available): | | 384 | DNS is not available): |
385 | .Dl route -n show | | 385 | .Dl route -n show |
386 | To install a static route through 10.200.0.1 to reach the network | | 386 | To install a static route through 10.200.0.1 to reach the network |
387 | 192.168.1.0/28, use this: | | 387 | 192.168.1.0/28, use this: |
388 | .Dl route add -net 192.168.1.0 -netmask 255.255.255.240 10.200.0.1 | | 388 | .Dl route add -net 192.168.1.0 -netmask 255.255.255.240 10.200.0.1 |
389 | .Sh DIAGNOSTICS | | 389 | .Sh DIAGNOSTICS |
390 | .Bl -tag -width Ds | | 390 | .Bl -tag -width Ds |
391 | .It Sy "add [host \&| network ] %s: gateway %s flags %x" | | 391 | .It Sy "add [host \&| network ] %s: gateway %s flags %x" |
392 | The specified route is being added to the tables. | | 392 | The specified route is being added to the tables. |
393 | The values printed are from the routing table entry supplied in the | | 393 | The values printed are from the routing table entry supplied in the |
394 | .Xr ioctl 2 | | 394 | .Xr ioctl 2 |
395 | call. | | 395 | call. |
396 | If the gateway address used was not the primary address of the gateway | | 396 | If the gateway address used was not the primary address of the gateway |
397 | (the first one returned by | | 397 | (the first one returned by |
398 | .Xr gethostbyname 3 ) , | | 398 | .Xr gethostbyname 3 ) , |
399 | the gateway address is printed numerically as well as symbolically. | | 399 | the gateway address is printed numerically as well as symbolically. |
400 | .It Sy "delete [ host \&| network ] %s: gateway %s flags %x" | | 400 | .It Sy "delete [ host \&| network ] %s: gateway %s flags %x" |
401 | As above, but when deleting an entry. | | 401 | As above, but when deleting an entry. |
402 | .It Sy "%s %s done" | | 402 | .It Sy "%s %s done" |
403 | When the | | 403 | When the |
404 | .Cm flush | | 404 | .Cm flush |
405 | command is specified, each routing table entry deleted | | 405 | command is specified, each routing table entry deleted |
406 | is indicated with a message of this form. | | 406 | is indicated with a message of this form. |
407 | .It Sy "Network is unreachable" | | 407 | .It Sy "Network is unreachable" |
408 | An attempt to add a route failed because the gateway listed was not | | 408 | An attempt to add a route failed because the gateway listed was not |
409 | on a directly-connected network. | | 409 | on a directly-connected network. |
410 | The next-hop gateway must be given. | | 410 | The next-hop gateway must be given. |
411 | .It Sy "not in table" | | 411 | .It Sy "not in table" |
412 | A delete operation was attempted for an entry which | | 412 | A delete operation was attempted for an entry which |
413 | wasn't present in the tables. | | 413 | wasn't present in the tables. |
414 | .It Sy "routing table overflow" | | 414 | .It Sy "routing table overflow" |
415 | An add operation was attempted, but the system was | | 415 | An add operation was attempted, but the system was |
416 | low on resources and was unable to allocate memory | | 416 | low on resources and was unable to allocate memory |
417 | to create the new entry. | | 417 | to create the new entry. |
418 | .It Sy "Permission denied" | | 418 | .It Sy "Permission denied" |
419 | The attempted operation is privileged. | | 419 | The attempted operation is privileged. |
420 | Only root may modify the routing tables. | | 420 | Only root may modify the routing tables. |
421 | These privileges are enforced by the kernel. | | 421 | These privileges are enforced by the kernel. |
422 | .El | | 422 | .El |
423 | .Sh SEE ALSO | | 423 | .Sh SEE ALSO |
424 | .Xr mpls 4 , | | 424 | .Xr mpls 4 , |
425 | .Xr netintro 4 , | | 425 | .Xr netintro 4 , |
426 | .Xr route 4 , | | 426 | .Xr route 4 , |
427 | .Xr routed 8 , | | 427 | .Xr routed 8 , |
428 | .Xr sysctl 8 | | 428 | .Xr sysctl 8 |
429 | .Sh HISTORY | | 429 | .Sh HISTORY |
430 | The | | 430 | The |
431 | .Nm | | 431 | .Nm |
432 | command appeared in | | 432 | command appeared in |
433 | .Bx 4.2 . | | 433 | .Bx 4.2 . |
434 | IPv6 support was added by WIDE/KAME project. | | 434 | IPv6 support was added by WIDE/KAME project. |
435 | .Pp | | 435 | .Pp |
436 | Since | | 436 | Since |
437 | .Nx 8.0 , | | 437 | .Nx 8.0 , |
438 | .Fl cloned , | | 438 | .Fl cloned , |
439 | .Fl nocloned , | | 439 | .Fl nocloned , |
440 | .Fl llinfo | | 440 | .Fl llinfo |
441 | and | | 441 | and |
442 | .Fl xresolve | | 442 | .Fl xresolve |
443 | were obsolete and | | 443 | were obsolete and |
444 | .Fl cloning | | 444 | .Fl cloning |
445 | and | | 445 | and |
446 | .Fl nocloning | | 446 | .Fl nocloning |
447 | were deprecated. | | 447 | were deprecated. |
448 | .Fl connected | | 448 | .Fl connected |
449 | and | | 449 | and |
450 | .Fl noconnected | | 450 | .Fl noconnected |
451 | appeared in | | 451 | appeared in |
452 | .Nx 8.0 . | | 452 | .Nx 8.0 . |
453 | .Sh BUGS | | 453 | .Sh BUGS |
454 | The first paragraph may have slightly exaggerated | | 454 | The first paragraph may have slightly exaggerated |
455 | .Xr routed 8 Ns 's | | 455 | .Xr routed 8 Ns 's |
456 | abilities. | | 456 | abilities. |
457 | .Pp | | 457 | .Pp |
458 | Some uses of the | | 458 | Some uses of the |
459 | .Fl ifa | | 459 | .Fl ifa |
460 | or | | 460 | or |
461 | .Fl ifp | | 461 | .Fl ifp |
462 | modifiers with the add command will incorrectly fail with a | | 462 | modifiers with the add command will incorrectly fail with a |
463 | .Dq Network is unreachable | | 463 | .Dq Network is unreachable |
464 | message if there is no default route. | | 464 | message if there is no default route. |
465 | See case | | 465 | See case |
466 | .Dv RTM_ADD | | 466 | .Dv RTM_ADD |
467 | in | | 467 | in |
468 | .Pa sys/net/rtsock.c:route_output | | 468 | .Pa sys/net/rtsock.c:route_output |
469 | for details. | | 469 | for details. |