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 set the TCP Maximum Segment Size (MSS) for connections over this
85 route to M bytes. The default is the device MTU minus headers,
86 or a lower MTU when path mtu discovery occured. This setting can
87 be used to force smaller TCP packets on the other end when path
88 mtu discovery does not work (usually because of misconfigured
89 firewalls that block ICMP Fragmentation Needed)
90
91 window W
92 set the TCP window size for connections over this route to W
93 bytes. This is typically only used on AX.25 networks and with
94 drivers unable to handle back to back frames.
95
96 irtt I set the initial round trip time (irtt) for TCP connections over
97 this route to I milliseconds (1-12000). This is typically only
98 used on AX.25 networks. If omitted the RFC 1122 default of 300ms
99 is used.
100
101 reject install a blocking route, which will force a route lookup to
102 fail. This is for example used to mask out networks before
103 using the default route. This is NOT for firewalling.
104
105 mod, dyn, reinstate
106 install a dynamic or modified route. These flags are for diag‐
107 nostic purposes, and are generally only set by routing daemons.
108
109 dev If force the route to be associated with the specified device, as
110 the kernel will otherwise try to determine the device on its own
111 (by checking already existing routes and device specifications,
112 and where the route is added to). In most normal networks you
113 won't need this.
114
115 If dev If is the last option on the command line, the word dev
116 may be omitted, as it's the default. Otherwise the order of the
117 route modifiers (metric - netmask - gw - dev) doesn't matter.
118
119
121 route add -net 127.0.0.0
122 adds the normal loopback entry, using netmask 255.0.0.0 (class A
123 net, determined from the destination address) and associated
124 with the "lo" device (assuming this device was prviously set up
125 correctly with ifconfig(8)).
126
127
128 route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0
129 adds a route to the network 192.56.76.x via "eth0". The Class C
130 netmask modifier is not really necessary here because 192.* is a
131 Class C IP address. The word "dev" can be omitted here.
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 segement 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>.
237
238
239
240net-tools 2 January 2000 ROUTE(8)