1ROUTE(8) Linux Programmer's Manual ROUTE(8)
2
3
4
6 route - show / manipulate the IP routing table
7
8
10 route [-CFvnee]
11
12 route [-v] [-A family] add [-net|-host] target [netmask Nm] [gw Gw]
13 [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn]
14 [reinstate] [[dev] If]
15
16 route [-v] [-A family] del [-net|-host] target [gw Gw] [netmask Nm]
17 [metric N] [[dev] If]
18
19 route [-V] [--version] [-h] [--help]
20
21
23 This program is obsolete. For replacement check ip route.
24
25
27 Route manipulates the kernel's IP routing tables. Its primary use is
28 to set up static routes to specific hosts or networks via an interface
29 after it has been configured with the ifconfig(8) program.
30
31 When the add or del options are used, route modifies the routing
32 tables. Without these options, route displays the current contents of
33 the routing tables.
34
35
37 -A family
38 use the specified address family (eg `inet'; use `route --help'
39 for a full list).
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
119 adds the normal loopback entry, using netmask 255.0.0.0 (class A
120 net, determined from the destination address) and associated
121 with the "lo" device (assuming this device was prviously set up
122 correctly with ifconfig(8)).
123
124
125 route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0
126 adds a route to the network 192.56.76.x via "eth0". The Class C
127 netmask modifier is not really necessary here because 192.* is a
128 Class C IP address. The word "dev" can be omitted here.
129
130
131 route add default gw mango-gw
132 adds a default route (which will be used if no other route
133 matches). All packets using this route will be gatewayed
134 through "mango-gw". The device which will actually be used for
135 that route depends on how we can reach "mango-gw" - the static
136 route to "mango-gw" will have to be set up before.
137
138
139 route add ipx4 sl0
140 Adds the route to the "ipx4" host via the SLIP interface (assum‐
141 ing that "ipx4" is the SLIP host).
142
143
144 route add -net 192.57.66.0 netmask 255.255.255.0 gw ipx4
145 This command adds the net "192.57.66.x" to be gatewayed through
146 the former route to the SLIP interface.
147
148
149 route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
150 This is an obscure one documented so people know how to do it.
151 This sets all of the class D (multicast) IP routes to go via
152 "eth0". This is the correct normal configuration line with a
153 multicasting kernel.
154
155
156 route add -net 10.0.0.0 netmask 255.0.0.0 reject
157 This installs a rejecting route for the private network
158 "10.x.x.x."
159
160
162 The output of the kernel routing table is organized in the following
163 columns
164
165 Destination
166 The destination network or destination host.
167
168 Gateway
169 The gateway address or '*' if none set.
170
171 Genmask
172 The netmask for the destination net; '255.255.255.255' for a
173 host destination and '0.0.0.0' for the default route.
174
175 Flags Possible flags include
176 U (route is up)
177 H (target is a host)
178 G (use gateway)
179 R (reinstate route for dynamic routing)
180 D (dynamically installed by daemon or redirect)
181 M (modified from routing daemon or redirect)
182 A (installed by addrconf)
183 C (cache entry)
184 ! (reject route)
185
186 Metric The 'distance' to the target (usually counted in hops). It is
187 not used by recent kernels, but may be needed by routing dae‐
188 mons.
189
190 Ref Number of references to this route. (Not used in the Linux ker‐
191 nel.)
192
193 Use Count of lookups for the route. Depending on the use of -F and
194 -C this will be either route cache misses (-F) or hits (-C).
195
196 Iface Interface to which packets for this route will be sent.
197
198 MSS Default maximum segement size for TCP connections over this
199 route.
200
201 Window Default window size for TCP connections over this route.
202
203 irtt Initial RTT (Round Trip Time). The kernel uses this to guess
204 about the best TCP protocol parameters without waiting on (pos‐
205 sibly slow) answers.
206
207 HH (cached only)
208 The number of ARP entries and cached routes that refer to the
209 hardware header cache for the cached route. This will be -1 if a
210 hardware address is not needed for the interface of the cached
211 route (e.g. lo).
212
213 Arp (cached only)
214 Whether or not the hardware address for the cached route is up
215 to date.
216
218 /proc/net/ipv6_route
219 /proc/net/route
220 /proc/net/rt_cache
221
223 ip(8)
224
226 Route for Linux was originally written by Fred N. van Kempen,
227 <waltje@uwalt.nl.mugnet.org> and then modified by Johannes Stille and
228 Linus Torvalds for pl15. Alan Cox added the mss and window options for
229 Linux 1.1.22. irtt support and merged with netstat from Bernd Ecken‐
230 fels.
231
233 Currently maintained by Phil Blundell <Philip.Blundell@pobox.com>.
234
235
236
237net-tools 2 January 2000 ROUTE(8)