Commit | Line | Data |
---|---|---|
0e56e94a KM |
1 | .\" Copyright (c) 1983 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
dfc5a452 | 5 | .\" @(#)route.8 6.2 (Berkeley) %G% |
0e56e94a | 6 | .\" |
f10ef12a | 7 | .TH ROUTE 8C "" |
0e56e94a KM |
8 | .UC 5 |
9 | .SH NAME | |
10 | route \- manually manipulate the routing tables | |
11 | .SH SYNOPSIS | |
12 | .B /etc/route | |
13 | [ | |
14 | .B \-f | |
15 | ] [ | |
dfc5a452 MK |
16 | .B \-n |
17 | ] [ | |
0e56e94a KM |
18 | .I command args |
19 | ] | |
20 | .SH DESCRIPTION | |
21 | .I Route | |
22 | is a program used to manually manipulate the network | |
23 | routing tables. It normally is not needed, as the | |
24 | system routing table management daemon, | |
25 | .IR routed (8C), | |
26 | should tend to this task. | |
27 | .PP | |
28 | .I Route | |
dfc5a452 | 29 | accepts two commands: |
0e56e94a | 30 | .IR add , |
dfc5a452 | 31 | to add a route, and |
0e56e94a | 32 | .IR delete , |
dfc5a452 | 33 | to delete a route. |
0e56e94a KM |
34 | .PP |
35 | All commands have the following syntax: | |
36 | .PP | |
dfc5a452 | 37 | .ti +0.25i |
0e56e94a KM |
38 | .B /etc/route |
39 | .I command | |
0e56e94a | 40 | [ |
dfc5a452 MK |
41 | .B net |
42 | | | |
43 | .B host | |
44 | ] | |
45 | .I destination gateway | |
46 | [ | |
47 | .I metric | |
0e56e94a KM |
48 | ] |
49 | .PP | |
50 | where | |
51 | .I destination | |
dfc5a452 | 52 | is the destination host or network, |
0e56e94a | 53 | .I gateway |
dfc5a452 | 54 | is the next-hop gateway to which packets should be addressed, and |
0e56e94a | 55 | .I metric |
dfc5a452 | 56 | is a count indicating the number of hops to |
0e56e94a KM |
57 | the |
58 | .IR destination . | |
dfc5a452 MK |
59 | The metric is required for |
60 | .I add | |
61 | commands; it must be zero if the destination is on a directly-attached network, | |
62 | and nonzero if the route utilizes one or more gateways. | |
63 | If adding a route with metric 0, | |
64 | the gateway given is the address of this host on the common network, | |
65 | indicating the interface to be used for transmission. | |
0e56e94a KM |
66 | Routes to a particular host are distinguished from those to |
67 | a network by interpreting the Internet address associated with | |
68 | .IR destination . | |
dfc5a452 MK |
69 | The optional keywords |
70 | .B net | |
71 | and | |
72 | .B host | |
73 | force the destination to be interpreted as a network or a host, respectively. | |
74 | Otherwise, if the | |
75 | .I destination | |
76 | has a ``local address part'' of INADDR_ANY, | |
77 | or if the | |
0e56e94a | 78 | .I destination |
dfc5a452 | 79 | is the symbolic name of a network, then the route is |
0e56e94a KM |
80 | assumed to be to a network; otherwise, it is presumed to be a |
81 | route to a host. If the route is to a destination connected | |
82 | via a gateway, the | |
83 | .I metric | |
84 | should be greater than 0. All symbolic names specified for a | |
85 | .I destination | |
86 | or | |
87 | .I gateway | |
dfc5a452 MK |
88 | are looked up first as a host name using |
89 | .IR gethostbyname (3N). | |
90 | If this lookup fails, | |
91 | .IR getnetbyname (3N) | |
92 | is then used to interpret the name as that of a network. | |
0e56e94a KM |
93 | .PP |
94 | .I Route | |
95 | uses a raw socket and the SIOCADDRT and SIOCDELRT | |
96 | .IR ioctl 's | |
97 | to do its work. As such, only the super-user may modify | |
98 | the routing tables. | |
99 | .PP | |
100 | If the | |
101 | .B \-f | |
102 | option is specified, | |
103 | .I route | |
104 | will ``flush'' the routing tables of all gateway entries. | |
105 | If this is used in conjunction with one of the commands | |
106 | described above, the tables are flushed prior to the command's | |
107 | application. | |
dfc5a452 MK |
108 | .PP |
109 | The | |
110 | .B \-n | |
111 | option prevents attempts to print host and network names symbolically | |
112 | when reporting actions. | |
0e56e94a | 113 | .SH DIAGNOSTICS |
dfc5a452 | 114 | ``\fBadd [ host | network ] %s: gateway %s flags %x\fP'' |
0e56e94a KM |
115 | .br |
116 | The specified route is being added to the tables. The | |
117 | values printed are from the routing table entry supplied | |
118 | in the | |
119 | .I ioctl | |
120 | call. | |
dfc5a452 MK |
121 | If the gateway address used was not the primary address of the gateway |
122 | (the first one returned by | |
123 | .IR gethostbyname ), | |
124 | the gateway address is printed numerically as well as symbolically. | |
0e56e94a | 125 | .PP |
dfc5a452 | 126 | ``\fBdelete [ host | network ] %s: gateway %s flags %x\fP'' |
0e56e94a KM |
127 | .br |
128 | As above, but when deleting an entry. | |
129 | .PP | |
dfc5a452 | 130 | ``\fB%s %s done\fP'' |
0e56e94a KM |
131 | .br |
132 | When the | |
133 | .B \-f | |
134 | flag is specified, each routing table entry deleted | |
135 | is indicated with a message of this form. | |
136 | .PP | |
dfc5a452 MK |
137 | ``\fBNetwork is unreachable\fP'' |
138 | .br | |
139 | An attempt to add a route failed because the gateway listed was not | |
140 | on a directly-connected network. | |
141 | The next-hop gateway must be given. | |
142 | .PP | |
143 | ``\fBnot in table\fP'' | |
0e56e94a KM |
144 | .br |
145 | A delete operation was attempted for an entry which | |
146 | wasn't present in the tables. | |
147 | .PP | |
dfc5a452 | 148 | ``\fBrouting table overflow\fP'' |
0e56e94a KM |
149 | .br |
150 | An add operation was attempted, but the system was | |
151 | low on resources and was unable to allocate memory | |
152 | to create the new entry. | |
153 | .SH "SEE ALSO" | |
154 | intro(4N), | |
dfc5a452 MK |
155 | routed(8C), |
156 | XNSrouted(8C) |