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