Make sure the prefixlength of subnets is sane.
[tinc] / doc / tinc.conf.5.in
1 .Dd 2002-04-09
2 .Dt TINC.CONF 5
3 .\" Manual page created by:
4 .\" Ivo Timmermans
5 .\" Guus Sliepen <guus@tinc-vpn.org>
6 .Sh NAME
7 .Nm tinc.conf
8 .Nd tinc daemon configuration
9 .Sh DESCRIPTION
10 The files in the
11 .Pa @sysconfdir@/tinc/
12 directory contain runtime and security information for the tinc daemon.
13 .Sh NETWORKS
14 It is perfectly ok for you to run more than one tinc daemon.
15 However, in its default form,
16 you will soon notice that you can't use two different configuration files without the
17 .Fl c
18 option.
19 .Pp
20 We have thought of another way of dealing with this: network names.
21 This means that you call
22 .Nm
23 with the
24 .Fl n
25 option, which will assign a name to this daemon.
26 .Pp
27 The effect of this is that the daemon will set its configuration root to
28 .Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa / ,
29 where 
30 .Ar NETNAME
31 is your argument to the
32 .Fl n
33 option.
34 You'll notice that messages appear in syslog as coming from
35 .Nm tincd. Ns Ar NETNAME .
36 .Pp
37 However, it is not strictly necessary that you call tinc with the
38 .Fl n
39 option.
40 In this case, the network name would just be empty,
41 and it will be used as such.
42 .Nm tinc
43 now looks for files in
44 .Pa @sysconfdir@/tinc/ ,
45 instead of 
46 .Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa / ;
47 the configuration file should be
48 .Pa @sysconfdir@/tinc/tinc.conf ,
49 and the host configuration files are now expected to be in
50 .Pa @sysconfdir@/tinc/hosts/ .
51 .Pp
52 But it is highly recommended that you use this feature of
53 .Nm tinc ,
54 because it will be so much clearer whom your daemon talks to.
55 Hence, we will assume that you use it.
56 .Sh NAMES
57 Each tinc daemon should have a name that is unique in the network which it will be part of.
58 The name will be used by other tinc daemons for identification.
59 The name has to be declared in the
60 .Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf
61 file.
62 .Pp
63 To make things easy,
64 choose something that will give unique and easy to remember names to your tinc daemon(s).
65 You could try things like hostnames, owner surnames or location names.
66 .Sh PUBLIC/PRIVATE KEYS
67 You should use 
68 .Ic tincd -K
69 to generate public/private keypairs.
70 It will generate two keys.
71 The private key should be stored in a separate file
72 .Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /rsa_key.priv
73 \-\- where 
74 .Ar NETNAME
75 stands for the network (see 
76 .Sx NETWORKS )
77 above.
78 The public key should be stored in the host configuration file
79 .Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Va NAME
80 \-\- where
81 .Va NAME
82 stands for the name of the local tinc daemon (see
83 .Sx NAMES ) .
84 .Sh SERVER CONFIGURATION
85 The server configuration of the daemon is done in the file
86 .Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf .
87 This file consists of comments (lines started with a
88 .Li # )
89 or assignments in the form of:
90 .Pp
91 .Va Variable Li = Ar Value .
92 .Pp
93 The variable names are case insensitive, and any spaces, tabs,
94 newlines and carriage returns are ignored.
95 Note: it is not required that you put in the 
96 .Li =
97 sign, but doing so improves readability.
98 If you leave it out, remember to replace it with at least one space character.
99 .Pp
100 Here are all valid variables, listed in alphabetical order.
101 The default value is given between parentheses.
102 .Bl -tag -width indent
103 .It Va AddressFamily Li = ipv4 | ipv6 | any Pq any
104 This option affects the address family of listening and outgoing sockets.
105 If
106 .Qq any
107 is selected, then depending on the operating system both IPv4 and IPv6 or just
108 IPv6 listening sockets will be created.
109 .It Va BindToAddress Li = Ar address Bq experimental
110 If your computer has more than one IPv4 or IPv6 address,
111 .Nm tinc
112 will by default listen on all of them for incoming connections.
113 It is possible to bind only to a single address with this variable.
114 .Pp
115 This option may not work on all platforms.
116 .It Va BindToInterface Li = Ar interface Bq experimental
117 If your computer has more than one network interface,
118 .Nm tinc
119 will by default listen on all of them for incoming connections.
120 It is possible to bind only to a single interface with this variable.
121 .Pp
122 This option may not work on all platforms.
123 .It Va ConnectTo Li = Ar name
124 Specifies which other tinc daemon to connect to on startup.
125 Multiple
126 .Va ConnectTo
127 variables may be specified,
128 in which case outgoing connections to each specified tinc daemon are made.
129 The names should be known to this tinc daemon
130 (i.e., there should be a host configuration file for the name on the
131 .Va ConnectTo
132 line).
133 .Pp
134 If you don't specify a host with
135 .Va ConnectTo ,
136 .Nm tinc
137 won't try to connect to other daemons at all,
138 and will instead just listen for incoming connections.
139 .It Va Device Li = Ar device Po Pa /dev/tap0 , Pa /dev/net/tun No or other depending on platform Pc
140 The virtual network device to use.
141 .Nm tinc
142 will automatically detect what kind of device it is.
143 Note that you can only use one device per daemon.
144 Under Windows, use
145 .Va Interface
146 instead of
147 .Va Device .
148 The info pages of the tinc package contain more information
149 about configuring the virtual network device.
150 .It Va GraphDumpFile Li = Ar filename Bq experimental
151 If this option is present,
152 .Nm tinc
153 will dump the current network graph to the file
154 .Ar filename
155 every minute, unless there were no changes to the graph.
156 The file is in a format that can be read by graphviz tools.
157 If
158 .Ar filename
159 starts with a pipe symbol |,
160 then the rest of the filename is interpreted as a shell command
161 that is executed, the graph is then sent to stdin.
162 .It Va Hostnames Li = yes | no Pq no
163 This option selects whether IP addresses (both real and on the VPN) should
164 be resolved. Since DNS lookups are blocking, it might affect tinc's
165 efficiency, even stopping the daemon for a few seconds every time it does
166 a lookup if your DNS server is not responding.
167 .Pp
168 This does not affect resolving hostnames to IP addresses from the
169 host configuration files.
170 .It Va Interface Li = Ar interface
171 Defines the name of the interface corresponding to the virtual network device.
172 Depending on the operating system and the type of device this may or may not actually set the name of the interface.
173 Under Windows, this variable is used to select which network interface will be used.
174 If you specified a
175 .Va Device ,
176 this variable is almost always already correctly set.
177 .It Va KeyExpire Li = Ar seconds Pq 3600
178 This option controls the period the encryption keys used to encrypt the data are valid.
179 It is common practice to change keys at regular intervals to make it even harder for crackers,
180 even though it is thought to be nearly impossible to crack a single key.
181 .It Va MACExpire Li = Ar seconds Pq 600
182 This option controls the amount of time MAC addresses are kept before they are removed.
183 This only has effect when
184 .Va Mode
185 is set to
186 .Qq switch .
187 .It Va MaxTimeout Li = Ar seconds Pq 900
188 This is the maximum delay before trying to reconnect to other tinc daemons.
189 .It Va Mode Li = router | switch | hub Pq router
190 This option selects the way packets are routed to other daemons.
191 .Bl -tag -width indent
192 .It router
193 In this mode
194 .Va Subnet
195 variables in the host configuration files will be used to form a routing table.
196 Only unicast packets of routable protocols (IPv4 and IPv6) are supported in this mode.
197 .Pp
198 This is the default mode, and unless you really know you need another mode, don't change it.
199 .It switch
200 In this mode the MAC addresses of the packets on the VPN will be used to
201 dynamically create a routing table just like an Ethernet switch does.
202 Unicast, multicast and broadcast packets of every protocol that runs over Ethernet are supported in this mode
203 at the cost of frequent broadcast ARP requests and routing table updates.
204 .Pp
205 This mode is primarily useful if you want to bridge Ethernet segments.
206 .It hub
207 This mode is almost the same as the switch mode, but instead
208 every packet will be broadcast to the other daemons
209 while no routing table is managed.
210 .El
211 .It Va Name Li = Ar name Bq required
212 This is the name which identifies this tinc daemon.
213 It must be unique for the virtual private network this daemon will connect to.
214 .It Va PingInterval Li = Ar seconds Pq 60
215 The number of seconds of inactivity that
216 .Nm tinc
217 will wait before sending a probe to the other end.
218 .It Va PingTimeout Li = Ar seconds Pq 5
219 The number of seconds to wait for a response to pings or to allow meta
220 connections to block. If the other end doesn't respond within this time,
221 the connection is terminated,
222 and the others will be notified of this.
223 .It Va PriorityInheritance Li = yes | no Po no Pc Bq experimental
224 When this option is enabled the value of the TOS field of tunneled IPv4 packets
225 will be inherited by the UDP packets that are sent out.
226 .It Va PrivateKey Li = Ar key Bq obsolete
227 The private RSA key of this tinc daemon.
228 It will allow this tinc daemon to authenticate itself to other daemons.
229 .It Va PrivateKeyFile Li = Ar filename Po Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /rsa_key.priv Pc
230 The file in which the private RSA key of this tinc daemon resides.
231 Note that there must be exactly one of
232 .Va PrivateKey
233 or
234 .Va PrivateKeyFile
235 specified in the configuration file.
236 .It Va TunnelServer Li = yes | no Po no Pc Bq experimental
237 When this option is enabled tinc will no longer forward information between other tinc daemons,
238 and will only allow nodes and subnets on the VPN which are present in the
239 .Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/
240 directory.
241 .El
242 .Sh HOST CONFIGURATION FILES
243 The host configuration files contain all information needed
244 to establish a connection to those hosts.
245 A host configuration file is also required for the local tinc daemon,
246 it will use it to read in it's listen port, public key and subnets.
247 .Pp
248 The idea is that these files are portable.
249 You can safely mail your own host configuration file to someone else.
250 That other person can then copy it to his own hosts directory,
251 and now his tinc daemon will be able to connect to your tinc daemon.
252 Since host configuration files only contain public keys,
253 no secrets are revealed by sending out this information.
254 .Bl -tag -width indent
255 .It Va Address Li = Ar address Bq recommended
256 The IP address or hostname of this tinc daemon on the real network.
257 This will only be used when trying to make an outgoing connection to this tinc daemon.
258 Multiple
259 .Va Address
260 variables can be specified, in which case each address will be tried until a working
261 connection has been established.
262 .It Va Cipher Li = Ar cipher Pq blowfish
263 The symmetric cipher algorithm used to encrypt UDP packets.
264 Any cipher supported by OpenSSL is recognised.
265 Furthermore, specifying
266 .Qq none
267 will turn off packet encryption.
268 It is best to use only those ciphers which support CBC mode.
269 .It Va Compression Li = Ar level Pq 0
270 This option sets the level of compression used for UDP packets.
271 Possible values are 0 (off), 1 (fast zlib) and any integer up to 9 (best zlib),
272 10 (fast lzo) and 11 (best lzo).
273 .It Va Digest Li = Ar digest Pq sha1
274 The digest algorithm used to authenticate UDP packets.
275 Any digest supported by OpenSSL is recognised.
276 Furthermore, specifying
277 .Qq none
278 will turn off packet authentication.
279 .It Va IndirectData Li = yes | no Pq no
280 This option specifies whether other tinc daemons besides the one you specified with
281 .Va ConnectTo
282 can make a direct connection to you.
283 This is especially useful if you are behind a firewall
284 and it is impossible to make a connection from the outside to your tinc daemon.
285 Otherwise, it is best to leave this option out or set it to no.
286 .It Va MACLength Li = Ar length Pq 4
287 The length of the message authentication code used to authenticate UDP packets.
288 Can be anything from
289 .Qq 0
290 up to the length of the digest produced by the digest algorithm.
291 .It Va PMTU Li = Ar mtu Po 1514 Pc Bq experimental
292 This option controls the initial path MTU to this node.
293 .It Va PMTUDiscovery Li = yes | no Po no Pc Bq experimental
294 When this option is enabled, tinc will try to discover the path MTU to this node.
295 After the path MTU has been discovered, it will be enforced on the VPN.
296 .It Va Port Li = Ar port Pq 655
297 The port number on which this tinc daemon is listening for incoming connections.
298 .It Va PublicKey Li = Ar key Bq obsolete
299 The public RSA key of this tinc daemon.
300 It will be used to cryptographically verify it's identity and to set up a secure connection.
301 .It Va PublicKeyFile Li = Ar filename Bq obsolete
302 The file in which the public RSA key of this tinc daemon resides.
303 .Pp
304 From version 1.0pre4 on
305 .Nm tinc
306 will store the public key directly into the host configuration file in PEM format,
307 the above two options then are not necessary.
308 Either the PEM format is used, or exactly one of the above two options must be specified
309 in each host configuration file,
310 if you want to be able to establish a connection with that host.
311 .It Va Subnet Li = Ar address Ns Op Li / Ns Ar prefixlength
312 The subnet which this tinc daemon will serve.
313 .Nm tinc
314 tries to look up which other daemon it should send a packet to by searching the appropriate subnet.
315 If the packet matches a subnet,
316 it will be sent to the daemon who has this subnet in his host configuration file.
317 Multiple
318 .Va Subnet
319 variables can be specified.
320 .Pp
321 Subnets can either be single MAC, IPv4 or IPv6 addresses,
322 in which case a subnet consisting of only that single address is assumed,
323 or they can be a IPv4 or IPv6 network address with a prefixlength.
324 Shorthand notations are not supported.
325 For example, IPv4 subnets must be in a form like 192.168.1.0/24,
326 where 192.168.1.0 is the network address and 24 is the number of bits set in the netmask.
327 Note that subnets like 192.168.1.1/24 are invalid!
328 Read a networking HOWTO/FAQ/guide if you don't understand this.
329 IPv6 subnets are notated like fec0:0:0:1:0:0:0:0/64.
330 MAC addresses are notated like 0:1a:2b:3c:4d:5e.
331 .It Va TCPOnly Li = yes | no Pq no
332 If this variable is set to yes,
333 then the packets are tunnelled over the TCP connection instead of a UDP connection.
334 This is especially useful for those who want to run a tinc daemon
335 from behind a masquerading firewall,
336 or if UDP packet routing is disabled somehow.
337 Setting this options also implicitly sets IndirectData.
338 .El
339 .Sh SCRIPTS
340 Apart from reading the server and host configuration files,
341 tinc can also run scripts at certain moments.
342 Under Windows (not Cygwin), the scripts should have the extension
343 .Pa .bat .
344 .Bl -tag -width indent
345 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-up
346 This is the most important script.
347 If it is present it will be executed right after the tinc daemon has been started and has connected to the virtual network device.
348 It should be used to set up the corresponding network interface,
349 but can also be used to start other things.
350 Under Windows you can use the Network Connections control panel instead of creating this script.
351 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-down
352 This script is started right before the tinc daemon quits.
353 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Ar HOST Ns Pa -up
354 This script is started when the tinc daemon with name
355 .Ar HOST
356 becomes reachable.
357 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Ar HOST Ns Pa -down
358 This script is started when the tinc daemon with name
359 .Ar HOST
360 becomes unreachable.
361 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /host-up
362 This script is started when any host becomes reachable.
363 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /host-down
364 This script is started when any host becomes unreachable.
365 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /subnet-up
366 This script is started when a Subnet becomes reachable.
367 The Subnet and the node it belongs to are passed in environment variables.
368 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /subnet-down
369 This script is started when a Subnet becomes unreachable.
370 .El
371 .Pp
372 The scripts are started without command line arguments, but can make use of certain environment variables.
373 Under UNIX like operating systems the names of environment variables must be preceded by a
374 .Li $ 
375 in scripts.
376 Under Windows, in
377 .Pa .bat
378 files, they have to be put between
379 .Li %
380 signs.
381 .Bl -tag -width indent
382 .It Ev NETNAME
383 If a netname was specified, this environment variable contains it.
384 .It Ev NAME
385 Contains the name of this tinc daemon.
386 .It Ev DEVICE
387 Contains the name of the virtual network device that tinc uses.
388 .It Ev INTERFACE
389 Contains the name of the virtual network interface that tinc uses.
390 This should be used for commands like
391 .Pa ifconfig .
392 .It Ev NODE
393 When a host becomes (un)reachable, this is set to its name.
394 If a subnet becomes (un)reachable, this is set to the owner of that subnet.
395 .It Ev REMOTEADDRESS
396 When a host becomes (un)reachable, this is set to its real address.
397 .It Ev REMOTEPORT
398 When a host becomes (un)reachable, this is set to the port number it uses for communication with other tinc daemons.
399 .It Ev SUBNET
400 When a subnet becomes (un)reachable, this is set to the subnet.
401 .El
402 .Sh FILES
403 The most important files are:
404 .Bl -tag -width indent
405 .It Pa @sysconfdir@/tinc/
406 The top directory for configuration files.
407 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc.conf
408 The default name of the server configuration file for net
409 .Ar NETNAME .
410 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/
411 Host configuration files are kept in this directory.
412 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-up
413 If an executable file with this name exists,
414 it will be executed right after the tinc daemon has connected to the virtual network device.
415 It can be used to set up the corresponding network interface.
416 .It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-down
417 If an executable file with this name exists,
418 it will be executed right before the tinc daemon is going to close
419 its connection to the virtual network device.
420 .El
421 .Sh SEE ALSO
422 .Xr tincd 8 ,
423 .Pa http://www.tinc-vpn.org/ ,
424 .Pa http://www.linuxdoc.org/LDP/nag2/ .
425 .Pp
426 The full documentation for
427 .Nm tinc
428 is maintained as a Texinfo manual.
429 If the info and tinc programs are properly installed at your site, the command
430 .Ic info tinc
431 should give you access to the complete manual.
432 .Pp
433 .Nm tinc
434 comes with ABSOLUTELY NO WARRANTY.
435 This is free software, and you are welcome to redistribute it under certain conditions;
436 see the file COPYING for details.