1ROUTE(8)                   Linux Programmer's Manual                  ROUTE(8)
2
3
4

NAME

6       route - show / manipulate the IP routing table
7

SYNOPSIS

9       route [-CFvnee]
10
11       route  [-v]  [-A  family]  add [-net|-host] target [netmask Nm] [gw Gw]
12              [metric N] [mss M] [window W]  [irtt  I]  [reject]  [mod]  [dyn]
13              [reinstate] [[dev] If]
14
15       route  [-v]  [-A  family]  del [-net|-host] target [gw Gw] [netmask Nm]
16              [metric N] [[dev] If]
17
18       route  [-V] [--version] [-h] [--help]
19

DESCRIPTION

21       Route manipulates the kernel's IP routing tables.  Its primary  use  is
22       to  set up static routes to specific hosts or networks via an interface
23       after it has been configured with the ifconfig(8) program.
24
25       When the add or del  options  are  used,  route  modifies  the  routing
26       tables.   Without these options, route displays the current contents of
27       the routing tables.
28
29

OPTIONS

31       -A family
32              use the specified address family (eg `inet'; use `route  --help'
33              for a full list).
34
35
36       -F     operate  on the kernel's FIB (Forwarding Information Base) rout‐
37              ing table.  This is the default.
38
39       -C     operate on the kernel's routing cache.
40
41
42       -v     select verbose operation.
43
44       -n     show numerical addresses instead of trying to determine symbolic
45              host  names.  This  is useful if you are trying to determine why
46              the route to your nameserver has vanished.
47
48       -e     use netstat(8)-format for displaying  the  routing  table.   -ee
49              will  generate  a  very  long  line with all parameters from the
50              routing table.
51
52
53       del    delete a route.
54
55       add    add a new route.
56
57       target the destination network or host. You can provide IP addresses in
58              dotted decimal or host/network names.
59
60       -net   the target is a network.
61
62       -host  the target is a host.
63
64       netmask NM
65              when adding a network route, the netmask to be used.
66
67       gw GW  route  packets  via a gateway.  NOTE: The specified gateway must
68              be reachable first. This usually means that you have to set up a
69              static  route  to  the  gateway  beforehand.  If you specify the
70              address of one of your local interfaces,  it  will  be  used  to
71              decide about the interface to which the packets should be routed
72              to. This is a BSDism compatibility hack.
73
74       metric M
75              set the metric field in the routing table (used by routing  dae‐
76              mons) to M.
77
78       mss M  set the TCP Maximum Segment Size (MSS) for connections over this
79              route to M bytes.  The default is the device MTU minus  headers,
80              or a lower MTU when path mtu discovery occured. This setting can
81              be used to force smaller TCP packets on the other end when  path
82              mtu  discovery  does  not work (usually because of misconfigured
83              firewalls that block ICMP Fragmentation Needed)
84
85       window W
86              set the TCP window size for connections over  this  route  to  W
87              bytes.  This  is  typically only used on AX.25 networks and with
88              drivers unable to handle back to back frames.
89
90       irtt I set the initial round trip time (irtt) for TCP connections  over
91              this  route  to I milliseconds (1-12000). This is typically only
92              used on AX.25 networks. If omitted the RFC 1122 default of 300ms
93              is used.
94
95       reject install  a  blocking  route,  which will force a route lookup to
96              fail.  This is for example used  to  mask  out  networks  before
97              using the default route.  This is NOT for firewalling.
98
99       mod, dyn, reinstate
100              install  a  dynamic or modified route. These flags are for diag‐
101              nostic purposes, and are generally only set by routing daemons.
102
103       dev If force the route to be associated with the specified  device,  as
104              the kernel will otherwise try to determine the device on its own
105              (by checking already existing routes and device  specifications,
106              and  where  the  route is added to). In most normal networks you
107              won't need this.
108
109              If dev If is the last option on the command line, the  word  dev
110              may  be omitted, as it's the default. Otherwise the order of the
111              route modifiers (metric - netmask - gw - dev) doesn't matter.
112
113

EXAMPLES

115       route add -net 127.0.0.0
116              adds the normal loopback entry, using netmask 255.0.0.0 (class A
117              net,  determined  from  the  destination address) and associated
118              with the "lo" device (assuming this device was prviously set  up
119              correctly with ifconfig(8)).
120
121
122       route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0
123              adds  a route to the network 192.56.76.x via "eth0". The Class C
124              netmask modifier is not really necessary here because 192.* is a
125              Class C IP address. The word "dev" can be omitted here.
126
127
128       route add default gw mango-gw
129              adds  a  default  route  (which  will  be used if no other route
130              matches).  All  packets  using  this  route  will  be  gatewayed
131              through  "mango-gw".  The device which will actually be used for
132              that route depends on how we can reach "mango-gw" -  the  static
133              route to "mango-gw" will have to be set up before.
134
135
136       route add ipx4 sl0
137              Adds the route to the "ipx4" host via the SLIP interface (assum‐
138              ing that "ipx4" is the SLIP host).
139
140
141       route add -net 192.57.66.0 netmask 255.255.255.0 gw ipx4
142              This command adds the net "192.57.66.x" to be gatewayed  through
143              the former route to the SLIP interface.
144
145
146       route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
147              This  is  an obscure one documented so people know how to do it.
148              This sets all of the class D (multicast) IP  routes  to  go  via
149              "eth0".  This  is  the  correct normal configuration line with a
150              multicasting kernel.
151
152
153       route add -net 10.0.0.0 netmask 255.0.0.0 reject
154              This  installs  a  rejecting  route  for  the  private   network
155              "10.x.x.x."
156
157

OUTPUT

159       The  output  of  the kernel routing table is organized in the following
160       columns
161
162       Destination
163              The destination network or destination host.
164
165       Gateway
166              The gateway address or '*' if none set.
167
168       Genmask
169              The netmask for the destination  net;  '255.255.255.255'  for  a
170              host destination and '0.0.0.0' for the default route.
171
172       Flags  Possible flags include
173              U (route is up)
174              H (target is a host)
175              G (use gateway)
176              R (reinstate route for dynamic routing)
177              D (dynamically installed by daemon or redirect)
178              M (modified from routing daemon or redirect)
179              A (installed by addrconf)
180              C (cache entry)
181              !  (reject route)
182
183       Metric The  'distance'  to  the target (usually counted in hops). It is
184              not used by recent kernels, but may be needed  by  routing  dae‐
185              mons.
186
187       Ref    Number  of references to this route. (Not used in the Linux ker‐
188              nel.)
189
190       Use    Count of lookups for the route.  Depending on the use of -F  and
191              -C this will be either route cache misses (-F) or hits (-C).
192
193       Iface  Interface to which packets for this route will be sent.
194
195       MSS    Default  maximum  segement  size  for  TCP connections over this
196              route.
197
198       Window Default window size for TCP connections over this route.
199
200       irtt   Initial RTT (Round Trip Time). The kernel  uses  this  to  guess
201              about  the best TCP protocol parameters without waiting on (pos‐
202              sibly slow) answers.
203
204       HH (cached only)
205              The number of ARP entries and cached routes that  refer  to  the
206              hardware header cache for the cached route. This will be -1 if a
207              hardware address is not needed for the interface of  the  cached
208              route (e.g. lo).
209
210       Arp (cached only)
211              Whether  or  not the hardware address for the cached route is up
212              to date.
213

FILES

215       /proc/net/ipv6_route
216       /proc/net/route
217       /proc/net/rt_cache
218

SEE ALSO

220       ifconfig(8), netstat(8), arp(8), rarp(8)
221

HISTORY

223       Route for  Linux  was  originally  written  by  Fred  N.   van  Kempen,
224       <waltje@uwalt.nl.mugnet.org>  and  then modified by Johannes Stille and
225       Linus Torvalds for pl15. Alan Cox added the mss and window options  for
226       Linux  1.1.22.  irtt  support and merged with netstat from Bernd Ecken‐
227       fels.
228

AUTHOR

230       Currently maintained by Phil Blundell <Philip.Blundell@pobox.com>.
231
232
233
234net-tools                       2 January 2000                        ROUTE(8)
Impressum