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