Debian Codegraph @

upstream/fedora-44/man8/route.8

raw
1 .TH ROUTE 8 "2014\-02\-17" "net\-tools" "Linux System Administrator's Manual"
2 .SH NAME
3 route \- show / manipulate the IP routing table
4 .SH SYNOPSIS
5 .B route
6 .RB [ \-CFvnNee ]
7 .RB [ \-A
8 family
9 .RB | \-4 | \-6 ]
10 .TP
11 .B route
12 .RB [ \-v ]
13 .RB [ \-A
14 family
15 .RB | \-4 | \-6 ]
16 .B add
17 .RB [ \-net | \-host ]
18 .I target
19 .RB [ netmask
20 .IR Nm ]
21 .RB [ gw
22 .IR Gw ]
23 .RB [ metric
24 .IR N ]
25 .RB [ mss
26 .IR M ]
27 .RB [ window
28 .IR W ]
29 .RB [ irtt
30 .IR I ]
31 .RB [ reject ]
32 .RB [ mod ]
33 .RB [ dyn ]
34 .RB [ reinstate ]
35 .RB [[ dev ]
36 .IR If ]
37 .TP
38 .B route
39 .RB [ \-v ]
40 .RB [ \-A
41 .I family
42 .RB | \-4 | \-6 ]
43 .B del
44 .RB [ \-net | \-host ]
45 .I target
46 .RB [ gw
47 .IR Gw ]
48 .RB [ netmask
49 .IR Nm ]
50 .RB [ metric
51 .IR M ]
52 .RB [[ dev ]
53 .IR If ]
54 .TP
55 .B route
56 .RB [ \-V ]
57 .RB [ \-\-version ]
58 .RB [ \-h ]
59 .RB [ \-\-help ]
60
61 .SH NOTE
62 .P
63 This program is obsolete. For replacement check \fBip route\fR.
64
65 .SH DESCRIPTION
66 .B Route
67 manipulates the kernel's IP routing tables. Its primary use is to set
68 up static routes to specific hosts or networks via an interface after
69 it has been configured with the
70 .BR ifconfig (8)
71 program.
72
73 When the
74 .B add
75 or
76 .B del
77 options are used,
78 .B route
79 modifies the routing tables. Without these options,
80 .B route
81 displays the current contents of the routing tables.
82
83 .SH OPTIONS
84 .TP
85 \fB\-A \fIfamily\fR
86 use the specified address family (eg `inet'). Use
87 .B route \-\-help
88 for a full list. You can use
89 .B \-6
90 as an alias for
91 .B \-\-inet6
92 and
93 .B \-4
94 as an alias for
95 .B \-A inet
96 .
97
98 .TP
99 .B \-F
100 operate on the kernel's FIB (Forwarding Information Base) routing
101 table.
102 This is the default.
103 .TP
104 .B \-C
105 operate on the kernel's routing cache.
106 .TP
107 .B \-v
108 select verbose operation.
109 .TP
110 .B \-n
111 show numerical addresses instead of trying to determine symbolic host
112 names. This is useful if you are trying to determine why the route to your
113 nameserver has vanished.
114 .TP
115 .B \-e
116 use
117 .BR netstat (8)\-format
118 for displaying the routing table.
119 .B \-ee
120 will generate a very long line with all parameters from the routing table.
121 .TP
122 .B del
123 delete a route.
124 .TP
125 .B add
126 add a new route.
127 .TP
128 .I target
129 the destination network or host. You can provide an addresses or symbolic
130 network or host name. Optionally you can use \fB/\fIprefixlen\fR notation
131 instead of using the \fBnetmask\fR option.
132 .TP
133 .B \-net
134 the
135 .I target
136 is a network.
137 .TP
138 .B \-host
139 the
140 .I target
141 is a host.
142 .TP
143 \fBnetmask \fINM\fR
144 when adding a network route, the netmask to be used.
145 .TP
146 \fBgw \fIGW\fR
147 route packets via a gateway.
148 .br
149 .B NOTE:
150 The specified gateway must be reachable first. This usually means that
151 you have to set up a static route to the gateway beforehand. If you specify
152 the address of one of your local interfaces, it will be used to decide about
153 the interface to which the packets should be routed to. This is a BSDism
154 compatibility hack.
155 .TP
156 \fBmetric \fIM\fR
157 set the metric field in the routing table (used by routing daemons) to \fIM\fR. If this option is not specified the metric for inet6 (IPv6) address family defaults to '1', for inet (IPv4) it defaults to '0'. You should always specify an explicit metric value to not rely on those defaults - they also differ from iproute2.
158 .TP
159 \fBmss \fIM\fR
160 sets MTU (Maximum Transmission Unit) of the route to \fIM\fR bytes.
161 Note that the current implementation of the route command does not allow
162 the option to set the Maximum Segment Size (MSS).
163 .TP
164 \fBwindow \fIW\fR
165 set the TCP window size for connections over this route to \fIW\fR
166 bytes. This is typically only used on AX.25 networks and with drivers
167 unable to handle back to back frames.
168 .TP
169 \fBirtt \fII\fR
170 set the initial round trip time (irtt) for TCP connections over this
171 route to \fII\fR milliseconds (1-12000). This is typically only used on
172 AX.25 networks. If omitted the RFC 1122 default of 300ms is used.
173 .TP
174 .B reject
175 install a blocking route, which will force a route lookup to fail.
176 This is for example used to mask out networks before using the default
177 route. This is NOT for firewalling.
178 .TP
179 .B mod, dyn, reinstate
180 install a dynamic or modified route. These flags are for diagnostic
181 purposes, and are generally only set by routing daemons.
182 .TP
183 \fBdev \fIIf\fR
184 force the route to be associated with the specified device, as the
185 kernel will otherwise try to determine the device on its own (by
186 checking already existing routes and device specifications, and where
187 the route is added to). In most normal networks you won't need this.
188
189 If \fBdev \fIIf\fR
190 is the last option on the command line, the word
191 .B dev
192 may be omitted, as it's the default. Otherwise the order of the route
193 modifiers (\fBmetric netmask gw dev\fR) doesn't matter.
194
195 .SH EXAMPLES
196 .TP
197 .B route add \-net 127.0.0.0 netmask 255.0.0.0 metric 1024 dev lo
198 adds the normal loopback entry, using netmask 255.0.0.0 and associated with the
199 "lo" device (assuming this device was previously set up correctly with
200 .BR ifconfig (8)).
201
202 .TP
203 .B route add \-net 192.56.76.0 netmask 255.255.255.0 metric 1024 dev eth0
204 adds a route to the local network 192.56.76.x via
205 "eth0". The word "dev" can be omitted here.
206
207 .TP
208 .B route del default
209 deletes the current default route, which is labeled "default" or 0.0.0.0
210 in the destination field of the current routing table.
211
212 .TP
213 .B route add default gw mango
214 adds a default route (which will be used if no other route matches).
215 All packets using this route will be gatewayed through the address of a node
216 named "mango". The
217 device which will actually be used for that route depends on how we
218 can reach "mango" - "mango" must be on directly reachable route.
219
220 .TP
221 .B route add mango sl0
222 Adds the route to the host named "mango" via the SLIP interface (assuming that
223 "mango" is the SLIP host).
224
225 .TP
226 .B route add \-net 192.57.66.0 netmask 255.255.255.0 gw mango
227 This command adds the net "192.57.66.x" to be gatewayed through the former
228 route to the SLIP interface.
229
230 .TP
231 .B route add \-net 224.0.0.0 netmask 240.0.0.0 dev eth0
232 This is an obscure one documented so people know how to do it. This sets
233 all of the class D (multicast) IP routes to go via "eth0". This is the
234 correct normal configuration line with a multicasting kernel.
235
236 .TP
237 .B route add \-net 10.0.0.0 netmask 255.0.0.0 metric 1024 reject
238 This installs a rejecting route for the private network "10.x.x.x."
239
240 .TP
241 .B route -6 add 2001:0002::/48 metric 1 dev eth0
242 This adds a IPv6 route with the specified metric to be directly reachable via eth0.
243
244 .LP
245 .SH OUTPUT
246 The output of the kernel routing table is organized in the following columns
247 .TP
248 .B Destination
249 The destination network or destination host.
250 .TP
251 .B Gateway
252 The gateway address or '*' if none set.
253 .TP
254 .B Genmask
255 The netmask for the destination net; '255.255.255.255' for a host destination
256 and '0.0.0.0' for the
257 .B default
258 route.
259 .TP
260 .B Flags
261 Possible flags include
262 .br
263 .B U
264 (route is
265 .BR up )
266 .br
267 .B H
268 (target is a
269 .BR host )
270 .br
271 .B G
272 (use
273 .BR gateway )
274 .br
275 .B R
276 .RB ( reinstate
277 route for dynamic routing)
278 .br
279 .B D
280 .RB ( dynamically
281 installed by daemon or redirect)
282 .br
283 .B M
284 .RB ( modified
285 from routing daemon or redirect)
286 .br
287 .B A
288 (installed by
289 .BR addrconf )
290 .br
291 .B C
292 .RB ( cache
293 entry)
294 .br
295 .B !
296 .RB ( reject
297 route)
298 .TP
299 .B Metric
300 The 'distance' to the target (usually counted in hops).
301 .TP
302 .B Ref
303 Number of references to this route. (Not used in the Linux kernel.)
304 .TP
305 .B Use
306 Count of lookups for the route. Depending on the use of \-F and \-C this will
307 be either route cache misses (\-F) or hits (\-C).
308 .TP
309 .B Iface
310 Interface to which packets for this route will be sent.
311 .TP
312 .B MSS
313 Default maximum segment size for TCP connections over this route.
314 .TP
315 .B Window
316 Default window size for TCP connections over this route.
317 .TP
318 .B irtt
319 Initial RTT (Round Trip Time). The kernel uses this to guess about the best
320 TCP protocol parameters without waiting on (possibly slow) answers.
321 .TP
322 .B HH (cached only)
323 The number of ARP entries and cached routes that refer to the hardware
324 header cache for the cached route. This will be \-1 if a hardware
325 address is not needed for the interface of the cached route (e.g. lo).
326 .TP
327 .B Arp (cached only)
328 Whether or not the hardware address for the cached route is up to date.
329 .LP
330 .SH FILES
331 .I /proc/net/ipv6_route
332 .br
333 .I /proc/net/route
334 .br
335 .I /proc/net/rt_cache
336 .LP
337 .SH "SEE ALSO"
338 .IR ip (8)
339 .LP
340 .SH HISTORY
341 .B Route
342 for Linux was originally written by Fred N. van Kempen,
343 <[email protected]> and then modified by Johannes Stille and
344 Linus Torvalds for pl15. Alan Cox added the mss and window options for
345 Linux 1.1.22. irtt support and merged with netstat from Bernd Eckenfels.
346 .SH AUTHOR
347 Currently maintained by Phil Blundell <[email protected]> and Bernd Eckenfels <[email protected]>.