1ROUTE(8) Linux System Administrator's Manual ROUTE(8)
2
3
4
6 route - show / manipulate the IP routing table
7
9 route [-CFvnNee] [-A family |-4|-6]
10
11 route [-v] [-A family |-4|-6] add [-net|-host] target [netmask Nm] [gw
12 Gw] [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn]
13 [reinstate] [[dev] If]
14
15 route [-v] [-A family |-4|-6] del [-net|-host] target [gw Gw] [netmask
16 Nm] [metric M] [[dev] If]
17
18 route [-V] [--version] [-h] [--help]
19
20
22 This program is obsolete. For replacement check ip route.
23
24
26 Route manipulates the kernel's IP routing tables. Its primary use is
27 to set up static routes to specific hosts or networks via an interface
28 after it has been configured with the ifconfig(8) program.
29
30 When the add or del options are used, route modifies the routing
31 tables. Without these options, route displays the current contents of
32 the routing tables.
33
34
36 -A family
37 use the specified address family (eg `inet'). Use route --help
38 for a full list. You can use -6 as an alias for --inet6 and -4
39 as an alias for -A inet
40
41
42 -F operate on the kernel's FIB (Forwarding Information Base) rout‐
43 ing table. This is the default.
44
45 -C operate on the kernel's routing cache.
46
47 -v select verbose operation.
48
49 -n show numerical addresses instead of trying to determine symbolic
50 host names. This is useful if you are trying to determine why
51 the route to your nameserver has vanished.
52
53 -e use netstat(8)-format for displaying the routing table. -ee
54 will generate a very long line with all parameters from the
55 routing table.
56
57 del delete a route.
58
59 add add a new route.
60
61 target the destination network or host. You can provide an addresses or
62 symbolic network or host name. Optionally you can use /prefixlen
63 notation instead of using the netmask option.
64
65 -net the target is a network.
66
67 -host the target is a host.
68
69 netmask NM
70 when adding a network route, the netmask to be used.
71
72 gw GW route packets via a gateway.
73 NOTE: The specified gateway must be reachable first. This usu‐
74 ally means that you have to set up a static route to the gateway
75 beforehand. If you specify the address of one of your local
76 interfaces, it will be used to decide about the interface to
77 which the packets should be routed to. This is a BSDism compati‐
78 bility hack.
79
80 metric M
81 set the metric field in the routing table (used by routing dae‐
82 mons) to M. If this option is not specified the metric for inet6
83 (IPv6) address family defaults to '1', for inet (IPv4) it
84 defaults to '0'. You should always specify an explicit metric
85 value to not rely on those defaults - they also differ from
86 iproute2.
87
88 mss M sets MTU (Maximum Transmission Unit) of the route to M bytes.
89 Note that the current implementation of the route command does
90 not allow the option to set the Maximum Segment Size (MSS).
91
92 window W
93 set the TCP window size for connections over this route to W
94 bytes. This is typically only used on AX.25 networks and with
95 drivers unable to handle back to back frames.
96
97 irtt I set the initial round trip time (irtt) for TCP connections over
98 this route to I milliseconds (1-12000). This is typically only
99 used on AX.25 networks. If omitted the RFC 1122 default of 300ms
100 is used.
101
102 reject install a blocking route, which will force a route lookup to
103 fail. This is for example used to mask out networks before
104 using the default route. This is NOT for firewalling.
105
106 mod, dyn, reinstate
107 install a dynamic or modified route. These flags are for diag‐
108 nostic purposes, and are generally only set by routing daemons.
109
110 dev If force the route to be associated with the specified device, as
111 the kernel will otherwise try to determine the device on its own
112 (by checking already existing routes and device specifications,
113 and where the route is added to). In most normal networks you
114 won't need this.
115
116 If dev If is the last option on the command line, the word dev
117 may be omitted, as it's the default. Otherwise the order of the
118 route modifiers (metric netmask gw dev) doesn't matter.
119
120
122 route add -net 127.0.0.0 netmask 255.0.0.0 metric 1024 dev lo
123 adds the normal loopback entry, using netmask 255.0.0.0 and
124 associated with the "lo" device (assuming this device was previ‐
125 ously set up correctly with ifconfig(8)).
126
127
128 route add -net 192.56.76.0 netmask 255.255.255.0 metric 1024 dev eth0
129 adds a route to the local network 192.56.76.x via "eth0". The
130 word "dev" can be omitted here.
131
132
133 route del default
134 deletes the current default route, which is labeled "default" or
135 0.0.0.0 in the destination field of the current routing table.
136
137
138 route add default gw mango
139 adds a default route (which will be used if no other route
140 matches). All packets using this route will be gatewayed
141 through the address of a node named "mango". The device which
142 will actually be used for that route depends on how we can reach
143 "mango" - "mango" must be on directly reachable route.
144
145
146 route add mango sl0
147 Adds the route to the host named "mango" via the SLIP interface
148 (assuming that "mango" is the SLIP host).
149
150
151 route add -net 192.57.66.0 netmask 255.255.255.0 gw mango
152 This command adds the net "192.57.66.x" to be gatewayed through
153 the former route to the SLIP interface.
154
155
156 route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
157 This is an obscure one documented so people know how to do it.
158 This sets all of the class D (multicast) IP routes to go via
159 "eth0". This is the correct normal configuration line with a
160 multicasting kernel.
161
162
163 route add -net 10.0.0.0 netmask 255.0.0.0 metric 1024 reject
164 This installs a rejecting route for the private network
165 "10.x.x.x."
166
167
168 route -6 add 2001:0002::/48 metric 1 dev eth0
169 This adds a IPv6 route with the specified metric to be directly
170 reachable via eth0.
171
172
174 The output of the kernel routing table is organized in the following
175 columns
176
177 Destination
178 The destination network or destination host.
179
180 Gateway
181 The gateway address or '*' if none set.
182
183 Genmask
184 The netmask for the destination net; '255.255.255.255' for a
185 host destination and '0.0.0.0' for the default route.
186
187 Flags Possible flags include
188 U (route is up)
189 H (target is a host)
190 G (use gateway)
191 R (reinstate route for dynamic routing)
192 D (dynamically installed by daemon or redirect)
193 M (modified from routing daemon or redirect)
194 A (installed by addrconf)
195 C (cache entry)
196 ! (reject route)
197
198 Metric The 'distance' to the target (usually counted in hops).
199
200 Ref Number of references to this route. (Not used in the Linux ker‐
201 nel.)
202
203 Use Count of lookups for the route. Depending on the use of -F and
204 -C this will be either route cache misses (-F) or hits (-C).
205
206 Iface Interface to which packets for this route will be sent.
207
208 MSS Default maximum segment size for TCP connections over this
209 route.
210
211 Window Default window size for TCP connections over this route.
212
213 irtt Initial RTT (Round Trip Time). The kernel uses this to guess
214 about the best TCP protocol parameters without waiting on (pos‐
215 sibly slow) answers.
216
217 HH (cached only)
218 The number of ARP entries and cached routes that refer to the
219 hardware header cache for the cached route. This will be -1 if a
220 hardware address is not needed for the interface of the cached
221 route (e.g. lo).
222
223 Arp (cached only)
224 Whether or not the hardware address for the cached route is up
225 to date.
226
228 /proc/net/ipv6_route
229 /proc/net/route
230 /proc/net/rt_cache
231
233 ip(8)
234
236 Route for Linux was originally written by Fred N. van Kempen,
237 <waltje@uwalt.nl.mugnet.org> and then modified by Johannes Stille and
238 Linus Torvalds for pl15. Alan Cox added the mss and window options for
239 Linux 1.1.22. irtt support and merged with netstat from Bernd Ecken‐
240 fels.
241
243 Currently maintained by Phil Blundell <Philip.Blundell@pobox.com> and
244 Bernd Eckenfels <net-tools@lina.inka.de>.
245
246
247
248net-tools 2014-02-17 ROUTE(8)