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