Debian Codegraph @

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