1 .TH ROUTE 8 "2 January 2000" "net-tools" "Linux Programmer's Manual"
3 route \- show / manipulate the IP routing table
13 .RB [ \-net | \-host ]
39 .RB [ \-net | \-host ]
57 manipulates the kernel's IP routing tables. Its primary use is to set
58 up static routes to specific hosts or networks via an interface after
59 it has been configured with the
69 modifies the routing tables. Without these options,
71 displays the current contents of the routing tables.
76 use the specified address family (eg `inet'; use `route --help' for a full
81 operate on the kernel's FIB (Forwarding Information Base) routing
86 operate on the kernel's routing cache.
90 select verbose operation.
93 show numerical addresses instead of trying to determine symbolic host
94 names. This is useful if you are trying to determine why the route to your
95 nameserver has vanished.
99 .BR netstat (8)-format
100 for displaying the routing table.
102 will generate a very long line with all parameters from the routing table.
112 the destination network or host. You can provide IP addresses in dotted
113 decimal or host/network names.
126 when adding a network route, the netmask to be used.
129 route packets via a gateway.
131 The specified gateway must be reachable first. This usually means that
132 you have to set up a static route to the gateway beforehand. If you specify
133 the address of one of your local interfaces, it will be used to decide about
134 the interface to which the packets should be routed to. This is a BSDism
138 set the metric field in the routing table (used by routing daemons) to M.
141 set the TCP Maximum Segment Size (MSS) for connections over this route
143 The default is the device MTU minus headers, or a lower MTU when path mtu
144 discovery occured. This setting can be used to force smaller TCP packets on the
145 other end when path mtu discovery does not work (usually because of
146 misconfigured firewalls that block ICMP Fragmentation Needed)
149 set the TCP window size for connections over this route to W
150 bytes. This is typically only used on AX.25 networks and with drivers
151 unable to handle back to back frames.
154 set the initial round trip time (irtt) for TCP connections over this
155 route to I milliseconds (1-12000). This is typically only used on
156 AX.25 networks. If omitted the RFC 1122 default of 300ms is used.
159 install a blocking route, which will force a route lookup to fail.
160 This is for example used to mask out networks before using the default
161 route. This is NOT for firewalling.
163 .B mod, dyn, reinstate
164 install a dynamic or modified route. These flags are for diagnostic
165 purposes, and are generally only set by routing daemons.
168 force the route to be associated with the specified device, as the
169 kernel will otherwise try to determine the device on its own (by
170 checking already existing routes and device specifications, and where
171 the route is added to). In most normal networks you won't need this.
175 is the last option on the command line, the word
177 may be omitted, as it's the default. Otherwise the order of the route
178 modifiers (metric - netmask - gw - dev) doesn't matter.
182 .B route add -net 127.0.0.0
183 adds the normal loopback entry, using netmask 255.0.0.0 (class A net,
184 determined from the destination address) and associated with the
185 "lo" device (assuming this device was prviously set up correctly with
189 .B route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0
190 adds a route to the network 192.56.76.x via
191 "eth0". The Class C netmask modifier is not really necessary here because
192 192.* is a Class C IP address. The word "dev" can be omitted here.
195 .B route add default gw mango-gw
196 adds a default route (which will be used if no other route matches).
197 All packets using this route will be gatewayed through "mango-gw". The
198 device which will actually be used for that route depends on how we
199 can reach "mango-gw" - the static route to "mango-gw" will have to be
203 .B route add ipx4 sl0
204 Adds the route to the "ipx4" host via the SLIP interface (assuming that
205 "ipx4" is the SLIP host).
208 .B route add -net 192.57.66.0 netmask 255.255.255.0 gw ipx4
209 This command adds the net "192.57.66.x" to be gatewayed through the former
210 route to the SLIP interface.
213 .B route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
214 This is an obscure one documented so people know how to do it. This sets
215 all of the class D (multicast) IP routes to go via "eth0". This is the
216 correct normal configuration line with a multicasting kernel.
219 .B route add -net 10.0.0.0 netmask 255.0.0.0 reject
220 This installs a rejecting route for the private network "10.x.x.x."
224 The output of the kernel routing table is organized in the following columns
227 The destination network or destination host.
230 The gateway address or '*' if none set.
233 The netmask for the destination net; '255.255.255.255' for a host destination
234 and '0.0.0.0' for the
239 Possible flags include
255 route for dynamic routing)
259 installed by daemon or redirect)
263 from routing daemon or redirect)
278 The 'distance' to the target (usually counted in hops). It is not used by
279 recent kernels, but may be needed by routing daemons.
282 Number of references to this route. (Not used in the Linux kernel.)
285 Count of lookups for the route. Depending on the use of -F and -C this will
286 be either route cache misses (-F) or hits (-C).
289 Interface to which packets for this route will be sent.
292 Default maximum segement size for TCP connections over this route.
295 Default window size for TCP connections over this route.
298 Initial RTT (Round Trip Time). The kernel uses this to guess about the best
299 TCP protocol parameters without waiting on (possibly slow) answers.
302 The number of ARP entries and cached routes that refer to the hardware
303 header cache for the cached route. This will be \-1 if a hardware
304 address is not needed for the interface of the cached route (e.g. lo).
307 Whether or not the hardware address for the cached route is up to date.
310 .I /proc/net/ipv6_route
314 .I /proc/net/rt_cache
317 .I ifconfig(8), netstat(8), arp(8), rarp(8)
321 for Linux was originally written by Fred N. van Kempen,
322 <waltje@uwalt.nl.mugnet.org> and then modified by Johannes Stille and
323 Linus Torvalds for pl15. Alan Cox added the mss and window options for
324 Linux 1.1.22. irtt support and merged with netstat from Bernd Eckenfels.
326 Currently maintained by Phil Blundell <Philip.Blundell@pobox.com>.