abbfeb31daf9dcb959fcb82334ccbf79de808574
[tinc] / doc / tinc.texi
1 \input texinfo   @c -*-texinfo-*-
2 @c $Id: tinc.texi,v 1.8.4.23 2002/03/01 14:25:10 guus Exp $
3 @c %**start of header
4 @setfilename tinc.info
5 @settitle tinc Manual
6 @setchapternewpage odd
7 @c %**end of header
8
9 @ifinfo
10 @dircategory Networking tools
11 @direntry
12 * tinc: (tinc).              The tinc Manual.
13 @end direntry
14
15 This is the info manual for tinc, a Virtual Private Network daemon.
16
17 Copyright @copyright{} 1998-2002 Ivo Timmermans
18 <itimmermans@@bigfoot.com>, Guus Sliepen <guus@@sliepen.warande.net> and
19 Wessel Dankers <wsl@@nl.linux.org>.
20
21 $Id: tinc.texi,v 1.8.4.23 2002/03/01 14:25:10 guus Exp $
22
23 Permission is granted to make and distribute verbatim copies of this
24 manual provided the copyright notice and this permission notice are
25 preserved on all copies.
26
27 Permission is granted to copy and distribute modified versions of this
28 manual under the conditions for verbatim copying, provided that the
29 entire resulting derived work is distributed under the terms of a
30 permission notice identical to this one.
31
32 @end ifinfo
33
34 @titlepage
35 @title tinc Manual
36 @subtitle Setting up a Virtual Private Network with tinc
37 @author Ivo Timmermans and Guus Sliepen
38
39 @page
40 @vskip 0pt plus 1filll
41 @cindex copyright
42 Copyright @copyright{} 1998-2002 Ivo Timmermans
43 <itimmermans@@bigfoot.com>, Guus Sliepen <guus@@sliepen.warande.net> and
44 Wessel Dankers <wsl@@nl.linux.org>.
45
46 $Id: tinc.texi,v 1.8.4.23 2002/03/01 14:25:10 guus Exp $
47
48 Permission is granted to make and distribute verbatim copies of this
49 manual provided the copyright notice and this permission notice are
50 preserved on all copies.
51
52 Permission is granted to copy and distribute modified versions of this
53 manual under the conditions for verbatim copying, provided that the
54 entire resulting derived work is distributed under the terms of a
55 permission notice identical to this one.
56
57 @end titlepage
58
59 @c ==================================================================
60 @node Top, Introduction, (dir), (dir)
61
62 @menu
63 * Introduction::                Introduction
64 * Preparations::
65 * Installation::
66 * Configuration::
67 * Running tinc::
68 * Technical information::
69 * About us::
70 * Concept Index::               All used terms explained
71 @end menu
72
73
74 @contents
75
76 @c ==================================================================
77 @node    Introduction, Preparations, Top, Top
78 @chapter Introduction
79
80 @cindex tinc
81 tinc is a Virtual Private Network (VPN) daemon that uses tunneling and
82 encryption to create a secure private network between hosts on the
83 Internet.
84
85 Because the tunnel appears to the IP level network code as a normal
86 network device, there is no need to adapt any existing software.
87 The encrypted tunnels allows VPN sites to share information with each other
88 over the Internet without exposing any information to others.
89
90 This document is the manual for tinc.  Included are chapters on how to
91 configure your computer to use tinc, as well as the configuration
92 process of tinc itself.
93
94 @menu
95 * VPNs::                        Virtual Private Networks in general
96 * tinc::                        about tinc
97 * Supported platforms::
98 @end menu
99
100 @c ==================================================================
101 @node    VPNs, tinc, Introduction, Introduction
102 @section Virtual Private Networks
103
104 @cindex VPN
105 A Virtual Private Network or VPN is a network that can only be accessed
106 by a few elected computers that participate.  This goal is achievable in
107 more than just one way.
108
109 @cindex private
110 Private networks can consist of a single stand-alone Ethernet LAN.  Or
111 even two computers hooked up using a null-modem cable.  In these cases,
112 it is
113 obvious that the network is @emph{private}, no one can access it from the
114 outside.  But if your computers are linked to the Internet, the network
115 is not private anymore, unless one uses firewalls to block all private
116 traffic.  But then, there is no way to send private data to trusted
117 computers on the other end of the Internet.
118
119 @cindex virtual
120 This problem can be solved by using @emph{virtual} networks.  Virtual
121 networks can live on top of other networks, but they use encapsulation to
122 keep using their private address space so they do not interfere with
123 the Internet.  Mostly, virtual networks appear like a singe LAN, even though
124 they can span the entire world.  But virtual networks can't be secured
125 by using firewalls, because the traffic that flows through it has to go
126 through the Internet, where other people can look at it.
127
128 As is the case with either type of VPN, anybody could eavesdrop.  Or
129 worse, alter data.  Hence it's probably advisable to encrypt the data
130 that flows over the network.
131
132 When one introduces encryption, we can form a true VPN.  Other people may
133 see encrypted traffic, but if they don't know how to decipher it (they
134 need to know the key for that), they cannot read the information that flows
135 through the VPN.  This is what tinc was made for.
136
137
138 @c ==================================================================
139 @node    tinc, Supported platforms, VPNs, Introduction
140 @section tinc
141
142 @cindex vpnd
143 I really don't quite remember what got us started, but it must have been
144 Guus' idea.  He wrote a simple implementation (about 50 lines of C) that
145 used the ethertap device that Linux knows of since somewhere
146 about kernel 2.1.60.  It didn't work immediately and he improved it a
147 bit.  At this stage, the project was still simply called @samp{vpnd}.
148
149 Since then, a lot has changed---to say the least.
150
151 @cindex tincd
152 tinc now supports encryption, it consists of a single daemon (tincd) for
153 both the receiving and sending end, it has become largely
154 runtime-configurable---in short, it has become a full-fledged
155 professional package.
156
157 @cindex Traditional VPNs
158 @cindex scalability
159 tinc also allows more than two sites to connect to eachother and form a single VPN.
160 Traditionally VPNs are created by making tunnels, which only have two endpoints.
161 Larger VPNs with more sites are created by adding more tunnels.
162 tinc takes another approach: only endpoints are specified,
163 the software itself will take care of creating the tunnels.
164 This allows for easier configuration and improved scalability.
165
166 A lot can---and will be---changed. We have a number of things that we would like to
167 see in the future releases of tinc.  Not everything will be available in
168 the near future.  Our first objective is to make tinc work perfectly as
169 it stands, and then add more advanced features.
170
171 Meanwhile, we're always open-minded towards new ideas.  And we're
172 available too.
173
174
175 @c ==================================================================
176 @node    Supported platforms,  , tinc, Introduction
177 @section Supported platforms
178
179 @cindex platforms
180 tinc has been verified to work under Linux, FreeBSD, OpenBSD and Solaris, with
181 various hardware architectures.  These are some of the platforms
182 that are supported by the universal tun/tap device driver or other virtual network device drivers.
183 Without such a driver, tinc will most
184 likely compile and run, but it will not be able to send or receive data
185 packets.
186
187 @cindex release
188 For an up to date list of supported platforms, please check the list on
189 our website:
190 @uref{http://tinc.nl.linux.org/platforms.html}.
191
192
193 @c ==================================================================
194 @subsection Linux
195
196 @cindex Linux
197 tinc was first written for Linux running on an intel x86 processor, so
198 this is the best supported platform.  The protocol however, and actually
199 anything about tinc, has been rewritten to support random byte ordering
200 and arbitrary word length.  So in theory it should run on other
201 processors that Linux runs on.  It has already been verified to run on
202 alpha and sparc processors as well.
203
204 tinc uses the ethertap device or the universal tun/tap driver. The former is provided in the standard kernel
205 from version 2.1.60 up to 2.3.x, but has been replaced in favour of the tun/tap driver in kernel versions 2.4.0 and later.
206
207
208 @c ==================================================================
209 @subsection FreeBSD
210
211 @cindex FreeBSD
212 tinc on FreeBSD relies on the universal tun/tap driver for its data
213 acquisition from the kernel.  Therefore, tinc will work on the same platforms
214 as this driver.  These are: FreeBSD 3.x, 4.x, 5.x.
215
216
217 @c ==================================================================
218 @subsection OpenBSD
219
220 @cindex OpenBSD
221 tinc on OpenBSD relies on the tun driver for its data
222 acquisition from the kernel. It has been verified to work under at least OpenBSD 2.9.
223
224
225 @c ==================================================================
226 @subsection Solaris
227
228 @cindex Solaris
229 tinc on Solaris relies on the universal tun/tap driver for its data
230 acquisition from the kernel.  Therefore, tinc will work on the same platforms
231 as this driver.  These are: Solaris, 2.1.x.
232
233
234 @c
235 @c
236 @c
237 @c
238 @c
239 @c
240 @c       Preparing your system
241 @c
242 @c
243 @c
244 @c
245 @c
246
247 @c ==================================================================
248 @node    Preparations, Installation, Introduction, Top
249 @chapter Preparations
250
251 This chapter contains information on how to prepare your system to
252 support tinc.
253
254 @menu
255 * Configuring the kernel::
256 * Libraries::
257 @end menu
258
259
260 @c ==================================================================
261 @node    Configuring the kernel, Libraries, Preparations, Preparations
262 @section Configuring the kernel
263
264 @cindex RedHat
265 @cindex Debian
266 @cindex netlink_dev
267 @cindex tun
268 @cindex ethertap
269 If you are running Linux, chances are good that your kernel already supports
270 all the devices that tinc needs for proper operation.  For example, the
271 standard kernel from Redhat Linux already has support for ethertap and netlink
272 compiled in.  Debian users can use the modconf utility to select the modules.
273 If your Linux distribution supports this method of selecting devices, look out
274 for something called `ethertap', and `netlink_dev' if it is using a kernel
275 version prior to 2.4.0. In that case you will need both these devices.  If you
276 are using kernel 2.4.0 or later, you need to select `tun'.
277
278 @cindex Kernel-HOWTO
279 If you can install these devices in a similar manner, you may skip this section.
280 Otherwise, you will have to recompile the kernel in order to turn on the required features.
281 If you are unfamiliar with the process of configuring and compiling a new kernel,
282 you should read the @uref{http://howto.linuxberg.com/LDP/HOWTO/Kernel-HOWTO.html, Kernel HOWTO} first.
283
284 @menu
285 * Configuration of Linux kernels 2.1.60 up to 2.4.0::
286 * Configuration of Linux kernels 2.4.0 and higher::
287 * Configuration of FreeBSD kernels::
288 * Configuration of OpenBSD kernels::
289 * Configuration of Solaris kernels::
290 @end menu
291
292
293 @c ==================================================================
294 @node       Configuration of Linux kernels 2.1.60 up to 2.4.0, Configuration of Linux kernels 2.4.0 and higher, Configuring the kernel, Configuring the kernel
295 @subsection Configuration of Linux kernels 2.1.60 up to 2.4.0
296
297 Here are the options you have to turn on when configuring a new kernel:
298
299 @example
300 Code maturity level options
301 [*] Prompt for development and/or incomplete code/drivers
302 Networking options
303 [*] Kernel/User netlink socket
304 <M> Netlink device emulation
305 Network device support
306 <M> Ethertap network tap
307 @end example
308
309 If you want to run more than one instance of tinc or other programs that use
310 the ethertap, you have to compile the ethertap driver as a module, otherwise
311 you can also choose to compile it directly into the kernel.
312
313 If you decide to build any of these as dynamic kernel modules, it's a good idea
314 to add these lines to @file{/etc/modules.conf}:
315
316 @example
317 alias char-major-36 netlink_dev
318 alias tap0 ethertap
319 options tap0 -o tap0 unit=0
320 alias tap1 ethertap
321 options tap1 -o tap1 unit=1
322 ...
323 alias tap@emph{N} ethertap
324 options tap@emph{N} -o tap@emph{N} unit=@emph{N}
325 @end example
326
327 Add as much alias/options lines as necessary.
328
329
330 @c ==================================================================
331 @node       Configuration of Linux kernels 2.4.0 and higher, Configuration of FreeBSD kernels, Configuration of Linux kernels 2.1.60 up to 2.4.0, Configuring the kernel
332 @subsection Configuration of Linux kernels 2.4.0 and higher
333
334 Here are the options you have to turn on when configuring a new kernel:
335
336 @example
337 Code maturity level options
338 [*] Prompt for development and/or incomplete code/drivers
339 Network device support
340 <M> Universal tun/tap device driver support
341 @end example
342
343 It's not necessary to compile this driver as a module, even if you are going to
344 run more than one instance of tinc.
345
346 If you have an early 2.4 kernel, you can choose both the tun/tap driver and the
347 `Ethertap network tap' device.  This latter is marked obsolete, and chances are
348 that it won't even function correctly anymore.  Make sure you select the
349 universal tun/tap driver.
350
351 If you decide to build the tun/tap driver as a kernel module, add these lines
352 to @file{/etc/modules.conf}:
353
354 @example
355 alias char-major-10-200 tun
356 @end example
357
358
359 @c ==================================================================
360 @node       Configuration of FreeBSD kernels, Configuration of OpenBSD kernels, Configuration of Linux kernels 2.4.0 and higher, Configuring the kernel
361 @subsection Configuration of FreeBSD kernels
362
363 This section will contain information on how to configure your FreeBSD
364 kernel to support the universal tun/tap device.  For 4.1 and higher
365 versions, this is included in the default kernel configuration, for earlier
366 systems (4.0 and earlier), you need to install the universal tun/tap driver
367 yourself.
368
369 Unfortunately somebody still has to write the text.
370
371
372 @c ==================================================================
373 @node       Configuration of OpenBSD kernels, Configuration of Solaris kernels, Configuration of FreeBSD kernels, Configuring the kernel
374 @subsection Configuration of OpenBSD kernels
375
376 This section will contain information on how to configure your OpenBSD
377 kernel to support the tun device.  For 2.9 and 3.0 systems,
378 this is included in the default kernel configuration.
379
380 Unfortunately somebody still has to write the text.
381
382
383 @c ==================================================================
384 @node       Configuration of Solaris kernels,  , Configuration of OpenBSD kernels, Configuring the kernel
385 @subsection Configuration of Solaris kernels
386
387 This section will contain information on how to configure your Solaris
388 kernel to support the universal tun/tap device.  You need to install
389 this driver yourself.
390
391 Unfortunately somebody still has to write the text.
392
393
394 @c ==================================================================
395 @node    Libraries,  , Configuring the kernel, Preparations
396 @section Libraries
397
398 @cindex requirements
399 @cindex libraries
400 Before you can configure or build tinc, you need to have the OpenSSL
401 library installed on your system.  If you try to configure tinc without
402 having installed it, configure will give you an error message, and stop.
403
404 @menu
405 * OpenSSL::
406 @end menu
407
408
409 @c ==================================================================
410 @node       OpenSSL,  , Libraries, Libraries
411 @subsection OpenSSL
412
413 @cindex OpenSSL
414 For all cryptography-related functions, tinc uses the functions provided
415 by the OpenSSL library.
416
417 If this library is not installed, you wil get an error when configuring
418 tinc for build.  Support for running tinc without having OpenSSL
419 installed @emph{may} be added in the future.
420
421 You can use your operating system's package manager to install this if
422 available.  Make sure you install the development AND runtime versions
423 of this package.
424
425 If you have to install OpenSSL manually, you can get the source code
426 from @url{http://www.openssl.org/}.  Instructions on how to configure,
427 build and install this package are included within the package.  Please
428 make sure you build development and runtime libraries (which is the
429 default).
430
431 If you installed the OpenSSL libraries from source, it may be necessary
432 to let configure know where they are, by passing configure one of the
433 --with-openssl-* parameters.
434
435 @example
436 --with-openssl=DIR      OpenSSL library and headers prefix
437 --with-openssl-include=DIR OpenSSL headers directory
438                         (Default is OPENSSL_DIR/include)
439 --with-openssl-lib=DIR  OpenSSL library directory
440                         (Default is OPENSSL_DIR/lib)
441 @end example
442
443
444 @subsubheading License
445
446 @cindex license
447 Since the license under which OpenSSL is distributed is not directly
448 compatible with the terms of the GNU GPL
449 @uref{http://www.openssl.org/support/faq.html#LEGAL2}, therefore we
450 include an addition to the GPL (see also the file COPYING.README):
451
452 @quotation
453 This program is released under the GPL with the additional exemption
454 that compiling, linking, and/or using OpenSSL is allowed.  You may
455 provide binary packages linked to the OpenSSL libraries, provided that
456 all other requirements of the GPL are met.
457 @end quotation
458
459
460 @c
461 @c
462 @c
463 @c      Installing tinc
464 @c
465 @c
466 @c
467 @c
468
469 @c ==================================================================
470 @node    Installation, Configuration, Preparations, Top
471 @chapter Installation
472
473 If you use Debian, you may want to install one of the
474 precompiled packages for your system.  These packages are equipped with
475 system startup scripts and sample configurations.
476
477 If you cannot use one of the precompiled packages, or you want to compile tinc
478 for yourself, you can use the source.  The source is distributed under
479 the GNU General Public License (GPL).  Download the source from the
480 @uref{http://tinc.nl.linux.org/download.html, download page}, which has
481 the checksums of these files listed; you may wish to check these with
482 md5sum before continuing.
483
484 tinc comes in a convenient autoconf/automake package, which you can just
485 treat the same as any other package.  Which is just untar it, type
486 `configure' and then `make'.
487 More detailed instructions are in the file @file{INSTALL}, which is
488 included in the source distribution.
489
490 @menu
491 * Building and installing tinc::
492 * System files::
493 @end menu
494
495
496 @c ==================================================================
497 @node    Building and installing tinc, System files, Installation, Installation
498 @section Building and installing tinc
499
500 Detailed instructions on configuring the source, building tinc and installing tinc
501 can be found in the file called @file{INSTALL}.
502
503 @cindex binary package
504 If you happen to have a binary package for tinc for your distribution,
505 you can use the package management tools of that distribution to install tinc.
506 The documentation that comes along with your distribution will tell you how to do that.
507
508
509 @c ==================================================================
510 @node    System files,  , Building and installing tinc, Installation
511 @section System files
512
513 Before you can run tinc, you must make sure you have all the needed
514 files on your system.
515
516 @menu
517 * Device files::
518 * Other files::
519 @end menu
520
521
522 @c ==================================================================
523 @node       Device files, Other files, System files, System files
524 @subsection Device files
525
526 @cindex device files
527 First, you'll need the special device file(s) that form the interface
528 between the kernel and the daemon.
529
530 The permissions for these files have to be such that only the super user
531 may read/write to this file.  You'd want this, because otherwise
532 eavesdropping would become a bit too easy.  This does, however, imply
533 that you'd have to run tincd as root.
534
535 If you use Linux and have a kernel version prior to 2.4.0, you have to make the
536 ethertap devices:
537
538 @example
539 mknod -m 600 /dev/tap0 c 36 16
540 chown 0.0 /dev/tap0
541 mknod -m 600 /dev/tap1 c 36 17
542 chown 0.0 /dev/tap0
543 ...
544 mknod -m 600 /dev/tap@emph{N} c 36 @emph{N+16}
545 chown 0.0 /dev/tap@emph{N}
546 @end example
547
548 There is a maximum of 16 ethertap devices.
549
550 If you use the universal tun/tap driver, you have to create the
551 following device file (unless it already exist):
552
553 @example
554 mknod -m 600 /dev/tun c 10 200
555 chown 0.0 /dev/tun
556 @end example
557
558 If you use Linux, and you run the new 2.4 kernel using the devfs filesystem,
559 then the tun/tap device will probably be automatically generated as
560 @file{/dev/misc/net/tun}.
561
562 Unlike the ethertap device, you do not need multiple device files if
563 you are planning to run multiple tinc daemons.
564
565
566 @c ==================================================================
567 @node       Other files,  , Device files, System files
568 @subsection Other files
569
570 @subsubheading @file{/etc/networks}
571
572 You may add a line to @file{/etc/networks} so that your VPN will get a
573 symbolic name.  For example:
574
575 @example
576 myvpn 10.0.0.0
577 @end example
578
579 @subsubheading @file{/etc/services}
580
581 @cindex port numbers
582 You may add this line to @file{/etc/services}.  The effect is that you
583 may supply a @samp{tinc} as a valid port number to some programs.  The
584 number 655 is registered with the IANA.
585
586 @example
587 tinc            655/tcp    TINC
588 tinc            655/udp    TINC
589 #                          Ivo Timmermans <itimmermans@@bigfoot.com>
590 @end example
591
592
593 @c
594 @c
595 @c
596 @c
597 @c         Configuring tinc
598 @c
599 @c
600 @c
601 @c
602
603
604 @c ==================================================================
605 @node    Configuration, Running tinc, Installation, Top
606 @chapter Configuration
607
608 @menu
609 * Configuration introduction::
610 * Multiple networks::
611 * How connections work::
612 * Configuration files::
613 * Generating keypairs::
614 * Network interfaces::
615 * Example configuration::
616 @end menu
617
618 @c ==================================================================
619 @node    Configuration introduction, Multiple networks, Configuration, Configuration
620 @section Configuration introduction
621
622 @cindex Network Administrators Guide
623 Before actually starting to configure tinc and editing files,
624 make sure you have read this entire section so you know what to expect.
625 Then, make it clear to yourself how you want to organize your VPN:
626 What are the nodes (computers running tinc)?
627 What IP addresses/subnets do they have?
628 What is the network mask of the entire VPN?
629 Do you need special firewall rules?
630 Do you have to set up masquerading or forwarding rules?
631 These questions can only be answered by yourself,
632 you will not find the answers in this documentation.
633 Make sure you have an adequate understanding of networks in general.
634 A good resource on networking is the
635 @uref{http://www.linuxdoc.org/LDP/nag2/, Linux Network Administrators Guide}.
636
637 If you have everything clearly pictured in your mind,
638 proceed in the following order:
639 First, generate the configuration files (@file{tinc.conf}, your host configuration file, @file{tinc-up} and perhaps @file{tinc-down}).
640 Then generate the keypairs.
641 Finally, distribute the host configuration files.
642 These steps are described in the subsections below.
643
644
645 @c ==================================================================
646 @node    Multiple networks, How connections work, Configuration introduction, Configuration
647 @section Multiple networks
648
649 @cindex multiple networks
650 @cindex netname
651 In order to allow you to run more than one tinc daemon on one computer,
652 for instance if your computer is part of more than one VPN,
653 you can assign a ``netname'' to your VPN.
654 It is not required if you only run one tinc daemon,
655 it doesn't even have to be the same on all the sites of your VPN,
656 but it is recommended that you choose one anyway.
657
658 We will asume you use a netname throughout this document.
659 This means that you call tincd with the -n argument,
660 which will assign a netname to this daemon.
661
662 The effect of this is that the daemon will set its configuration
663 ``root'' to /etc/tinc/netname/, where netname is your argument to the -n
664 option.  You'll notice that it appears in syslog as ``tinc.netname''.
665
666 However, it is not strictly necessary that you call tinc with the -n
667 option.  In this case, the network name would just be empty, and it will
668 be used as such.  tinc now looks for files in /etc/tinc/, instead of
669 /etc/tinc/netname/; the configuration file should be /etc/tinc/tinc.conf,
670 and the host configuration files are now expected to be in /etc/tinc/hosts/.
671
672 But it is highly recommended that you use this feature of tinc, because
673 it will be so much clearer whom your daemon talks to.  Hence, we will
674 assume that you use it.
675
676
677 @c ==================================================================
678 @node    How connections work, Configuration files, Multiple networks, Configuration
679 @section How connections work
680
681 When tinc starts up, it parses the command-line options and then
682 reads in the configuration file.
683 If it sees a `ConnectTo' value pointing to another tinc daemon in the file,
684 it will try to connect to that other one.
685 Whether this succeeds or not and whether `ConnectTo' is specified or not,
686 tinc will listen for incoming connection from other deamons.
687 If you did specify a `ConnectTo' value and the other side is not responding,
688 tinc will keep retrying.
689 This means that once started, tinc will stay running until you tell it to stop,
690 and failures to connect to other tinc daemons will not stop your tinc daemon
691 for trying again later.
692 This means you don't have to intervene if there are any network problems.
693
694 @cindex client
695 @cindex server
696 There is no real distinction between a server and a client in tinc.
697 If you wish, you can view a tinc daemon without a `ConnectTo' value as a server,
698 and one which does specify such a value as a client.
699 It does not matter if two tinc daemons have a `ConnectTo' value pointing to eachother however.
700
701
702 @c ==================================================================
703 @node    Configuration files, Generating keypairs, How connections work, Configuration
704 @section Configuration files
705
706 The actual configuration of the daemon is done in the file
707 @file{/etc/tinc/netname/tinc.conf} and at least one other file in the directory
708 @file{/etc/tinc/netname/hosts/}.
709
710 These file consists of comments (lines started with a #) or assignments
711 in the form of
712
713 @example
714 Variable = Value.
715 @end example
716
717 The variable names are case insensitive, and any spaces, tabs, newlines
718 and carriage returns are ignored.  Note: it is not required that you put
719 in the `=' sign, but doing so improves readability.  If you leave it
720 out, remember to replace it with at least one space character.
721
722 In this section all valid variables are listed in alphabetical order.
723 The default value is given between parentheses,
724 other comments are between square brackets and
725 required directives are given in @strong{bold}.
726
727 @menu
728 * Main configuration variables::
729 * Host configuration variables::
730 * How to configure::
731 @end menu
732
733
734 @c ==================================================================
735 @node    Main configuration variables, Host configuration variables, Configuration files, Configuration files
736 @subsection Main configuration variables
737
738 @table @asis
739 @cindex AddressFamily
740 @item AddressFamily = <ipv4|ipv6|any> (ipv4) [experimental]
741 This option affects the address family of listening and outgoing sockets.
742 If "any" is selected, then depending on the operating system
743 both IPv4 and IPv6 or just IPv6 listening sockets will be created.
744
745 Mixing IPv4 and IPv6 may not work as desired. 
746 It's best to choose one address family
747 and use that for all tinc daemons on the VPN.
748
749 @cindex BindToInterface
750 @item BindToInterface = <interface> [experimental]
751 If you have more than one network interface in your computer, tinc will
752 by default listen on all of them for incoming connections.  It is
753 possible to bind tinc to a single interface like eth0 or ppp0 with this
754 variable.
755
756 This option may not work on all platforms.
757
758 @cindex BindToIP
759 @item BindToIP = <address> [experimental]
760 If your computer has more than one IP address on a single interface (for
761 example if you are running virtual hosts), tinc will by default listen
762 on all of them for incoming connections.  It is possible to bind tinc to
763 a single IP address with this variable.  It is still possible to listen
764 on several interfaces at the same time though, if they share the same IP
765 address.
766
767 This option may not work on all platforms.
768
769 @cindex ConnectTo
770 @item @strong{ConnectTo = <name>}
771 Specifies which host to connect to on startup.  Multiple ConnectTo
772 variables may be specified, if connecting to the first one fails then
773 tinc will try the next one, and so on.  It is possible to specify
774 hostnames for dynamic IP addresses (like those given on dyndns.org),
775 tinc will not cache the resolved IP address.
776
777 If you don't specify a host with ConnectTo, regardless of whether a
778 value for ConnectPort is given, tinc won't connect at all, and will
779 instead just listen for incoming connections.
780
781 @cindex Device
782 @item @strong{Device = <device>} (/dev/tap0 or /dev/misc/net/tun)
783 The virtual network device to use.  Note that you can only use one device per
784 daemon.  See also @ref{Device files}.
785
786 @cindex Hostnames
787 @item Hostnames = <yes|no> (no)
788 This option selects whether IP addresses (both real and on the VPN)
789 should be resolved.  Since DNS lookups are blocking, it might affect
790 tinc's efficiency, even stopping the daemon for a few seconds everytime
791 it does a lookup if your DNS server is not responding.
792
793 This does not affect resolving hostnames to IP addresses from the
794 configuration file.
795
796 @cindex Interface
797 @item Interface = <interface>
798 Defines the name of the interface corresponding to the virtual network device.
799 Depending on the operating system and the type of device this may or may not actually set the name.
800 Currently this option only affects the Linux tun/tap device.
801
802 @cindex Mode
803 @item Mode = <router|switch|hub> (router)
804 This option selects the way packets are routed to other daemons.
805
806 @table @asis
807 @cindex router
808 @item router
809 In this mode Subnet
810 variables in the host configuration files will be used to form a routing table.
811 Only unicast packets of routable protocols (IPv4 and IPv6) are supported in this mode.
812
813 @cindex switch
814 @item switch
815 In this mode the MAC addresses of the packets on the VPN will be used to
816 dynamically create a routing table just like an Ethernet switch does.
817 Unicast, multicast and broadcast packets of every protocol that runs over Ethernet are supported in this mode
818 at the cost of frequent broadcast ARP requests and routing table updates.
819
820 @cindex hub
821 @item hub
822 This mode is almost the same as the switch mode, but instead
823 every packet will be broadcast to the other daemons
824 while no routing table is managed.
825 @end table
826
827 @cindex KeyExpire
828 @item KeyExpire = <seconds> (3600)
829 This option controls the time the encryption keys used to encrypt the data
830 are valid.  It is common practice to change keys at regular intervals to
831 make it even harder for crackers, even though it is thought to be nearly
832 impossible to crack a single key.
833
834 @cindex MACExpire
835 @item MACExpire = <seconds> (600)
836 This option controls the amount of time MAC addresses are kept before they are removed.
837 This only has effect when Mode is set to "switch".
838
839 @cindex Name
840 @item @strong{Name = <name>}
841 This is a symbolic name for this connection.  It can be anything
842
843 @cindex PingTimeout
844 @item PingTimeout = <seconds> (60)
845 The number of seconds of inactivity that tinc will wait before sending a
846 probe to the other end.  If that other end doesn't answer within that
847 same amount of seconds, the connection is terminated, and the others
848 will be notified of this.
849
850 @cindex PriorityInheritance
851 @item PriorityInheritance = <yes|no> (no) [experimental]
852 When this option is enabled the value of the TOS field of tunneled IPv4 packets
853 will be inherited by the UDP packets that are sent out.
854
855 @cindex PrivateKey
856 @item PrivateKey = <key> [obsolete]
857 This is the RSA private key for tinc. However, for safety reasons it is
858 advised to store private keys of any kind in separate files. This prevents
859 accidental eavesdropping if you are editting the configuration file.
860
861 @cindex PrivateKeyFile
862 @item @strong{PrivateKeyFile = <path>} [recommended]
863 This is the full path name of the RSA private key file that was
864 generated by ``tincd --generate-keys''.  It must be a full path, not a
865 relative directory.
866
867 Note that there must be exactly one of PrivateKey
868 or PrivateKeyFile
869 specified in the configuration file.
870
871 @end table
872
873
874 @c ==================================================================
875 @node    Host configuration variables, How to configure, Main configuration variables, Configuration files
876 @subsection Host configuration variables
877
878 @table @asis
879 @cindex Address
880 @item @strong{Address = <IP address|hostname>} [recommended]
881 This variable is only required if you want to connect to this host.  It
882 must resolve to the external IP address where the host can be reached,
883 not the one that is internal to the VPN.
884
885 @cindex Cipher
886 @item Cipher = <cipher> (blowfish)
887 The symmetric cipher algorithm used to encrypt UDP packets.
888 Any cipher supported by OpenSSL is recognized.
889
890 @cindex Compression
891 @item Compression = <level> (0)
892 This option sets the level of compression used for UDP packets.
893 Possible values are 0 (off), 1 (fast) and any integer up to 9 (best).
894
895 @cindex Digest
896 @item Digest = <digest> (sha1)
897 The digest algorithm used to authenticate UDP packets.
898 Any digest supported by OpenSSL is recognized.
899 Furthermore, specifying "none" will turn off packet authentication.
900
901 @cindex IndirectData
902 @item IndirectData = <yes|no> (no) [experimental]
903 This option specifies whether other tinc daemons besides the one you
904 specified with ConnectTo can make a direct connection to you.  This is
905 especially useful if you are behind a firewall and it is impossible to
906 make a connection from the outside to your tinc daemon.  Otherwise, it
907 is best to leave this option out or set it to no.
908
909 @cindex MACLength
910 @item MACLength = <length> (4)
911 The length of the message authentication code used to authenticate UDP packets.
912 Can be anything from 0
913 up to the length of the digest produced by the digest algorithm.
914
915 @cindex Port
916 @item Port = <port> (655)
917 Connect to the upstream host (given with the ConnectTo directive) on
918 port port.  port may be given in decimal (default), octal (when preceded
919 by a single zero) o hexadecimal (prefixed with 0x).  port is the port
920 number for both the UDP and the TCP (meta) connections.
921
922 @cindex PublicKey
923 @item PublicKey = <key> [obsolete]
924 This is the RSA public key for this host.
925
926 @cindex PublicKeyFile
927 @item PublicKeyFile = <path> [obsolete]
928 This is the full path name of the RSA public key file that was generated
929 by ``tincd --generate-keys''.  It must be a full path, not a relative
930 directory.
931
932 @cindex PEM format
933 From version 1.0pre4 on tinc will store the public key directly into the
934 host configuration file in PEM format, the above two options then are not
935 necessary. Either the PEM format is used, or exactly
936 @strong{one of the above two options} must be specified
937 in each host configuration file, if you want to be able to establish a
938 connection with that host.
939
940 @cindex Subnet
941 @item Subnet = <address[/masklength]>
942 The subnet which this tinc daemon will serve.
943 tinc tries to look up which other daemon it should send a packet to by searching the appropiate subnet.
944 If the packet matches a subnet,
945 it will be sent to the daemon who has this subnet in his host configuration file.
946 Multiple subnet lines can be specified for each daemon.
947
948 Subnets can either be single MAC, IPv4 or IPv6 addresses,
949 in which case a subnet consisting of only that single address is assumed,
950 or they can be a IPv4 or IPv6 network address with a masklength.
951 For example, IPv4 subnets must be in a form like 192.168.1.0/24,
952 where 192.168.1.0 is the network address and 24 is the number of bits set in the netmask.
953 Note that subnets like 192.168.1.1/24 are invalid!
954
955 @cindex CIDR notation
956 masklength is the number of bits set to 1 in the netmask part; for
957 example: netmask 255.255.255.0 would become /24, 255.255.252.0 becomes
958 /22. This conforms to standard CIDR notation as described in
959 @uref{ftp://ftp.isi.edu/in-notes/rfc1519.txt, RFC1519}
960
961 @cindex TCPonly
962 @item TCPonly = <yes|no> (no) [experimental]
963 If this variable is set to yes, then the packets are tunnelled over a
964 TCP connection instead of a UDP connection.  This is especially useful
965 for those who want to run a tinc daemon from behind a masquerading
966 firewall, or if UDP packet routing is disabled somehow. This is
967 experimental code, try this at your own risk. It may not work at all.
968 Setting this options also implicitly sets IndirectData.
969 @end table
970
971
972 @c ==================================================================
973 @node    How to configure,  , Host configuration variables, Configuration files
974 @subsection How to configure
975
976 @subsubheading Step 1.  Creating the main configuration file
977
978 The main configuration file will be called @file{/etc/tinc/netname/tinc.conf}.
979 Adapt the following example to create a basic configuration file:
980
981 @example
982 Name = @emph{yourname}
983 Device = @emph{/dev/tap0}
984 PrivateKeyFile = /etc/tinc/@emph{netname}/rsa_key.priv
985 @end example
986
987 Then, if you know to which other tinc daemon(s) yours is going to connect,
988 add `ConnectTo' values.
989
990 @subsubheading Step 2.  Creating your host configuration file
991
992 If you added a line containing `Name = yourname' in the main configuarion file,
993 you will need to create a host configuration file @file{/etc/tinc/netname/hosts/yourname}.
994 Adapt the following example to create a host configuration file:
995
996 @example
997 Address = @emph{your.real.hostname.org}
998 Subnet = @emph{192.168.1.0/24}
999 @end example
1000
1001 You can also use an IP address instead of a hostname.
1002 The `Subnet' specifies the address range that is local for @emph{your part of the VPN only}.
1003 If you have multiple address ranges you can specify more than one `Subnet'.
1004 You might also need to add a `Port' if you want your tinc daemon to run on a different port number than the default (655).
1005
1006
1007 @c ==================================================================
1008 @node    Generating keypairs, Network interfaces, Configuration files, Configuration
1009 @section Generating keypairs
1010
1011 @cindex key generation
1012 Now that you have already created the main configuration file and your host configuration file,
1013 you can easily create a public/private keypair by entering the following command:
1014
1015 @example
1016 tincd -n @emph{netname} -K
1017 @end example
1018
1019 tinc will generate a public and a private key and ask you where to put them.
1020 Just press enter to accept the defaults.
1021
1022
1023 @c ==================================================================
1024 @node    Network interfaces, Example configuration, Generating keypairs, Configuration
1025 @section Network interfaces
1026
1027 Before tinc can start transmitting data over the tunnel, it must
1028 set up the virtual network interface.
1029
1030 First, decide which IP addresses you want to have associated with these
1031 devices, and what network mask they must have.
1032
1033 tinc will open a virtual network device (@file{/dev/tun}, @file{/dev/tap0} or similar),
1034 which will also create a network interface called something like `tun0', `tap0', or,
1035 if you are using the Linux tun/tap driver, the network interface will by default have the same name as the netname.
1036
1037 @cindex tinc-up
1038 You can configure the network interface by putting ordinary ifconfig, route, and other commands
1039 to a script named @file{/etc/tinc/netname/tinc-up}. When tinc starts, this script
1040 will be executed. When tinc exits, it will execute the script named
1041 @file{/etc/tinc/netname/tinc-down}, but normally you don't need to create that script.
1042
1043 An example @file{tinc-up} script:
1044
1045 @example
1046 #!/bin/sh
1047 ifconfig $INTERFACE hw ether fe:fd:0:0:0:0
1048 ifconfig $INTERFACE 192.168.1.1 netmask 255.255.0.0
1049 ifconfig $INTERFACE -arp
1050 @end example
1051
1052 @cindex MAC address
1053 @cindex hardware address
1054 The first line sets up the MAC address of the network interface.
1055 Due to the nature of how Ethernet and tinc work, it has to be set to fe:fd:0:0:0:0
1056 for tinc to work in it's normal mode.
1057 If you configured tinc to work in `switch' or `hub' mode, the hardware address should instead
1058 be set to a unique address instead of fe:fd:0:0:0:0.
1059
1060 You can use the environment variable $INTERFACE to get the name of the interface.
1061 If you are using the ethertap driver however, you need to replace it with tap@emph{N},
1062 corresponding to the device file name.
1063
1064 @cindex ifconfig
1065 The next line gives the interface an IP address and a netmask.
1066 The kernel will also automatically add a route to this interface, so normally you don't need
1067 to add route commands to the @file{tinc-up} script.
1068 The kernel will also bring the interface up after this command.
1069 @cindex netmask
1070 The netmask is the mask of the @emph{entire} VPN network, not just your
1071 own subnet.
1072
1073 @cindex arp
1074 The last line tells the kernel not to use ARP on that interface.
1075 Again this has to do with how Ethernet and tinc work.
1076 Use this option only if you are running tinc under Linux and are using tinc's normal routing mode.
1077
1078
1079 @c ==================================================================
1080 @node    Example configuration,  , Network interfaces, Configuration
1081 @section Example configuration
1082
1083
1084 @cindex example
1085 Imagine the following situation.  Branch A of our example `company' wants to connect
1086 three branch offices in B, C and D using the Internet.  All four offices
1087 have a 24/7 connection to the Internet.
1088
1089 A is going to serve as the center of the network.  B and C will connect
1090 to A, and D will connect to C.  Each office will be assigned their own IP
1091 network, 10.x.0.0.
1092
1093 @example
1094 A: net 10.1.0.0 mask 255.255.0.0 gateway 10.1.54.1 internet IP 1.2.3.4
1095 B: net 10.2.0.0 mask 255.255.0.0 gateway 10.2.1.12 internet IP 2.3.4.5
1096 C: net 10.3.0.0 mask 255.255.0.0 gateway 10.3.69.254 internet IP 3.4.5.6
1097 D: net 10.4.0.0 mask 255.255.0.0 gateway 10.4.3.32 internet IP 4.5.6.7
1098 @end example
1099
1100 ``gateway'' is the VPN IP address of the machine that is running the
1101 tincd.  ``internet IP'' is the IP address of the firewall, which does not
1102 need to run tincd, but it must do a port forwarding of TCP&UDP on port
1103 655 (unless otherwise configured).
1104
1105 In this example, it is assumed that eth0 is the interface that points to
1106 the inner (physical) LAN of the office, although this could also be the
1107 same as the interface that leads to the Internet.  The configuration of
1108 the real interface is also shown as a comment, to give you an idea of
1109 how these example host is set up. All branches use the netname `company'
1110 for this particular VPN.
1111
1112 @subsubheading For Branch A
1113
1114 @emph{BranchA} would be configured like this:
1115
1116 In @file{/etc/tinc/company/tinc-up}:
1117
1118 @example
1119 # Real interface of internal network:
1120 # ifconfig eth0 10.1.54.1 netmask 255.255.0.0 broadcast 10.1.255.255
1121
1122 ifconfig tap0 hw ether fe:fd:0:0:0:0
1123 ifconfig tap0 10.1.54.1 netmask 255.0.0.0
1124 ifconfig tap0 -arp
1125 @end example
1126
1127 and in @file{/etc/tinc/company/tinc.conf}:
1128
1129 @example
1130 Name = BranchA
1131 PrivateKey = /etc/tinc/company/rsa_key.priv
1132 Device = /dev/tap0
1133 @end example
1134
1135 On all hosts, /etc/tinc/company/hosts/BranchA contains:
1136
1137 @example
1138 Subnet = 10.1.0.0/16
1139 Address = 1.2.3.4
1140
1141 Note that the IP addresses of eth0 and tap0 are the same.
1142 This is quite possible, if you make sure that the netmasks of the interfaces are different.
1143 It is in fact recommended to give give both real internal network interfaces and tap interfaces the same IP address,
1144 since that will make things a lot easier to remember and set up.
1145
1146 -----BEGIN RSA PUBLIC KEY-----
1147 ...
1148 -----END RSA PUBLIC KEY-----
1149 @end example
1150
1151
1152 @subsubheading For Branch B
1153
1154 In @file{/etc/tinc/company/tinc-up}:
1155
1156 @example
1157 # Real interface of internal network:
1158 # ifconfig eth0 10.2.43.8 netmask 255.255.0.0 broadcast 10.2.255.255
1159
1160 ifconfig tap0 hw ether fe:fd:0:0:0:0
1161 ifconfig tap0 10.2.1.12 netmask 255.0.0.0
1162 ifconfig tap0 -arp
1163 @end example
1164
1165 and in @file{/etc/tinc/company/tinc.conf}:
1166
1167 @example
1168 Name = BranchB
1169 ConnectTo = BranchA
1170 PrivateKey = /etc/tinc/company/rsa_key.priv
1171 @end example
1172
1173 Note here that the internal address (on eth0) doesn't have to be the
1174 same as on the tap0 device.  Also, ConnectTo is given so that no-one can
1175 connect to this node.
1176
1177 On all hosts, in @file{/etc/tinc/company/hosts/BranchB}:
1178
1179 @example
1180 Subnet = 10.2.0.0/16
1181 Address = 2.3.4.5
1182
1183 -----BEGIN RSA PUBLIC KEY-----
1184 ...
1185 -----END RSA PUBLIC KEY-----
1186 @end example
1187
1188
1189 @subsubheading For Branch C
1190
1191 In @file{/etc/tinc/company/tinc-up}:
1192
1193 @example
1194 # Real interface of internal network:
1195 # ifconfig eth0 10.3.69.254 netmask 255.255.0.0 broadcast 10.3.255.255
1196
1197 ifconfig tap1 hw ether fe:fd:0:0:0:0
1198 ifconfig tap1 10.3.69.254 netmask 255.0.0.0
1199 ifconfig tap1 -arp
1200 @end example
1201
1202 and in @file{/etc/tinc/company/tinc.conf}:
1203
1204 @example
1205 Name = BranchC
1206 ConnectTo = BranchA
1207 Device = /dev/tap1
1208 @end example
1209
1210 C already has another daemon that runs on port 655, so they have to
1211 reserve another port for tinc. It knows the portnumber it has to listen on
1212 from it's own host configuration file.
1213
1214 On all hosts, in @file{/etc/tinc/company/hosts/BranchC}:
1215
1216 @example
1217 Address = 3.4.5.6
1218 Subnet = 10.3.0.0/16
1219 Port = 2000
1220
1221 -----BEGIN RSA PUBLIC KEY-----
1222 ...
1223 -----END RSA PUBLIC KEY-----
1224 @end example
1225
1226
1227 @subsubheading For Branch D
1228
1229 In @file{/etc/tinc/company/tinc-up}:
1230
1231 @example
1232 # Real interface of internal network:
1233 # ifconfig eth0 10.4.3.32 netmask 255.255.0.0 broadcast 10.4.255.255
1234
1235 ifconfig company hw ether fe:fd:0a:04:03:20
1236 ifconfig company 10.4.3.32 netmask 255.0.0.0
1237 ifconfig company -arp
1238 @end example
1239
1240 and in @file{/etc/tinc/company/tinc.conf}:
1241
1242 @example
1243 Name = BranchD
1244 ConnectTo = BranchC
1245 Device = /dev/misc/net/tun
1246 PrivateKeyFile = /etc/tinc/company/rsa_key.priv
1247 @end example
1248
1249 D will be connecting to C, which has a tincd running for this network on
1250 port 2000. It knows the port number from the host configuration file.
1251 Also note that since D uses the tun/tap driver, the network interface
1252 will not be called `tun' or `tap0' or something like that, but will
1253 have the same name as netname.
1254
1255 On all hosts, in @file{/etc/tinc/company/hosts/BranchD}:
1256
1257 @example
1258 Subnet = 10.4.0.0/16
1259 Address = 4.5.6.7
1260
1261 -----BEGIN RSA PUBLIC KEY-----
1262 ...
1263 -----END RSA PUBLIC KEY-----
1264 @end example
1265
1266 @subsubheading Key files
1267
1268 A, B, C and D all have generated a public/private keypair with the following command:
1269
1270 @example
1271 tincd -n company -K
1272 @end example
1273
1274 The private key is stored in @file{/etc/tinc/company/rsa_key.priv},
1275 the public key is put into the host configuration file in the @file{/etc/tinc/company/hosts/} directory.
1276 During key generation, tinc automatically guesses the right filenames based on the -n option and
1277 the Name directive in the @file{tinc.conf} file (if it is available).
1278
1279 @subsubheading Starting
1280
1281 After each branch has finished configuration and they have distributed
1282 the host configuration files amongst them, they can start their tinc daemons.
1283 They don't necessarily have to wait for the other branches to have started
1284 their daemons, tinc will try connecting until they are available.
1285
1286
1287 @c ==================================================================
1288 @node    Running tinc, Technical information, Configuration, Top
1289 @chapter Running tinc
1290
1291 If everything else is done, you can start tinc by typing the following command:
1292
1293 @example
1294 tincd -n @emph{netname}
1295 @end example
1296
1297 @cindex daemon
1298 tinc will detach from the terminal and continue to run in the background like a good daemon.
1299 If there are any problems however you can try to increase the debug level
1300 and look in the syslog to find out what the problems are.
1301
1302 @menu
1303 * Runtime options::
1304 * Error messages::
1305 @end menu
1306
1307
1308 @c ==================================================================
1309 @node    Runtime options, Error messages,  , Running tinc
1310 @section Runtime options
1311
1312 Besides the settings in the configuration file, tinc also accepts some
1313 command line options.
1314
1315 This list is a longer version of that in the manpage.  The latter is
1316 generated automatically, so may be more up-to-date.
1317
1318 @cindex command line
1319 @cindex runtime options
1320 @cindex options
1321 @c from the manpage
1322 @table @samp
1323 @item --bypass-security
1324 Disables encryption and authentication.
1325 Only useful for debugging.
1326
1327 @item -c, --config=PATH
1328 Read configuration options from the directory PATH.  The default is
1329 @file{/etc/tinc/netname/}.
1330
1331 @cindex debug level
1332 @item -d, --debug=LEVEL
1333 Set debug level to LEVEL.  The higher the debug level, the more gets
1334 logged.  Everything goes via syslog.
1335
1336 @item -K, --generate-keys[=BITS]
1337 Generate public/private keypair of BITS length. If BITS is not specified,
1338 1024 is the default. tinc will ask where you want to store the files,
1339 but will default to the configuration directory (you can use the -c or -n option
1340 in combination with -K). After that, tinc will quit.
1341
1342 @item --help
1343 Display a short reminder of these runtime options and terminate.
1344
1345 @item -k, --kill
1346 Attempt to kill a running tincd and exit.  A TERM signal (15) gets sent
1347 to the daemon that his its PID in @file{/var/run/tinc.NETNAME.pid}.
1348 Use it in conjunction with the -n option to make sure you kill the right tinc daemon.
1349
1350 @item -n, --net=NETNAME
1351 Connect to net NETNAME.  @xref{Multiple networks}.
1352
1353 @item -D, --no-detach
1354 Don't fork and detach.
1355 This will also disable the automatic restart mechanism for fatal errors.
1356
1357 @item --version
1358 Output version information and exit.
1359
1360 @end table
1361
1362
1363 @c ==================================================================
1364 @node    Error messages,  , Runtime options, Running tinc
1365 @section Error messages
1366
1367 What follows is a list of the most common error messages you can see
1368 when configuring tinc.  Most of these messages are visible in the syslog
1369 only, so keep an eye on it!
1370
1371 @table @strong
1372 @item Could not open /dev/tap0: No such device
1373
1374 @itemize
1375 @item You forgot to `modprobe netlink_dev' or `modprobe ethertap'.
1376 @item You forgot to compile `Netlink device emulation' in the kernel.
1377 @end itemize
1378
1379 @item Can't write to /dev/misc/net/tun: No such device
1380
1381 @itemize
1382 @item You forgot to `modprobe tun'.
1383 @item You forgot to compile `Universal TUN/TAP driver' in the kernel.
1384 @end itemize
1385
1386 @item Packet with destination 1.2.3.4 is looping back to us!
1387
1388 @itemize
1389 @item Something is not configured right. Packets are being sent out to the
1390 virtual network device, but according to the Subnet directives in your host configuration
1391 file, those packets should go to your own host. Most common mistake is that
1392 you have a Subnet line in your host configuration file with a netmask which is
1393 just as large as the netmask of the virtual network interface. The latter should in almost all
1394 cases be larger. Rethink your configuration.
1395 Note that you will only see this message if you specified a debug
1396 level of 5 or higher!
1397 @item Chances are that a `Subnet = ...' line in the host configuration file of this tinc daemon is wrong.
1398 Change it to a subnet that is accepted locally by another interface,
1399 or if that is not the case, try changing the prefix length into /32. 
1400 @end itemize
1401
1402 @item Network doesn't work, syslog shows only packets of length 46
1403
1404 @cindex arp
1405 @example
1406 Jan 1 12:00:00 host tinc.net[1234]: Read packet of length 46 from tap device
1407 Jan 1 12:00:00 host tinc.net[1234]: Trying to look up 0.0.192.168 in connection list failed!
1408 @end example
1409 @itemize
1410 @item Add the `ifconfig $INTERFACE -arp' to tinc-up.
1411 @end itemize
1412
1413 @item Network address and subnet mask do not match!
1414
1415 @itemize
1416 @item The Subnet field must contain a @emph{network} address.
1417 @item If you only want to use one IP address, set the netmask to /32.
1418 @end itemize
1419
1420 @item This is a bug: net.c:253: 24: Some error
1421
1422 @itemize
1423 @item This is something that should not have happened.
1424 Please report this, and tell us exactly what went wrong before you got
1425 this message.  In normal operation, these errors should not occur.
1426 @end itemize
1427
1428 @item Error reading RSA key file `rsa_key.priv': No such file or directory
1429
1430 @itemize
1431 @item You must specify the complete pathname.
1432 Specifying a relative path does not make sense here.  tinc changes its
1433 directory to / when starting (to avoid keeping a mount point busy); and
1434 even if we built in a default directory to look for these files, the key
1435 files are bound to be in a different directory.
1436 @end itemize
1437
1438 @end table
1439
1440 @c ==================================================================
1441 @node    Technical information, About us, Running tinc, Top
1442 @chapter Technical information
1443
1444
1445 @menu
1446 * The connection::
1447 * The meta-protocol::
1448 * Security::
1449 @end menu
1450
1451
1452 @c ==================================================================
1453 @node    The connection, The meta-protocol, Technical information, Technical information
1454 @section The connection
1455
1456 @cindex connection
1457 tinc is a daemon that takes VPN data and transmit that to another host
1458 computer over the existing Internet infrastructure.
1459
1460 @menu
1461 * The UDP tunnel::
1462 * The meta-connection::
1463 @end menu
1464
1465
1466 @c ==================================================================
1467 @node    The UDP tunnel, The meta-connection, The connection, The connection
1468 @subsection The UDP tunnel
1469
1470 @cindex virtual network device
1471 @cindex frame type
1472 The data itself is read from a character device file, the so-called
1473 @emph{virtual network device}.  This device is associated with a network
1474 interface.  Any data sent to this interface can be read from the device,
1475 and any data written to the device gets sent from the interface.  Data to
1476 and from the device is formatted as if it were a normal Ethernet card,
1477 so a frame is preceded by two MAC addresses and a @emph{frame type}
1478 field.
1479
1480 So when tinc reads an Ethernet frame from the device, it determines its
1481 type. When tinc is in it's default routing mode, it can handle IPv4 and IPv6
1482 packets. Depending on the Subnet lines, it will send the packets off to their destination.
1483 In the `switch' and `hub' mode, tinc will use broadcasts and MAC address discovery
1484 to deduce the destination of the packets.
1485 Since the latter modes only depend on the link layer information,
1486 any protocol that runs over Ethernet is supported (for instance IPX and Appletalk).
1487
1488 After the destination has been determined, a sequence number will be added to the packet.
1489 The packet will then be encrypted and a message authentication
1490 code will be appended.
1491
1492 @cindex encapsulating
1493 @cindex UDP
1494 When that is done, time has come to actually transport the
1495 packet to the destination computer.  We do this by sending the packet
1496 over an UDP connection to the destination host.  This is called
1497 @emph{encapsulating}, the VPN packet (though now encrypted) is
1498 encapsulated in another IP datagram.
1499
1500 When the destination receives this packet, the same thing happens, only
1501 in reverse.  So it checks the message authentication code, decrypts the contents of the UDP datagram,
1502 checks the sequence number
1503 and writes the decrypted information to its own virtual network device.
1504
1505 To let the kernel on the receiving end accept the packet, the destination MAC
1506 address must match that of the virtual network interface.
1507 If tinc is in it's default routing mode, ARP does not work, so the correct destination MAC cannot be set
1508 by the sending daemons.
1509 tinc solves this by always overwriting the
1510 destination MAC address with fe:fd:0:0:0:0. That is also the reason why you must
1511 set the MAC address of your tap interface to that address.
1512
1513
1514 @c ==================================================================
1515 @node    The meta-connection,  , The UDP tunnel, The connection
1516 @subsection The meta-connection
1517
1518 Having only an UDP connection available is not enough.  Though suitable
1519 for transmitting data, we want to be able to reliably send other
1520 information, such as routing and session key information to somebody.
1521
1522 @cindex TCP
1523 TCP is a better alternative, because it already contains protection
1524 against information being lost, unlike UDP.
1525
1526 So we establish two connections.  One for the encrypted VPN data, and one
1527 for other information, the meta-data.  Hence, we call the second
1528 connection the meta-connection.  We can now be sure that the
1529 meta-information doesn't get lost on the way to another computer.
1530
1531 @cindex data-protocol
1532 @cindex meta-protocol
1533 Like with any communication, we must have a protocol, so that everybody
1534 knows what everything stands for, and how she should react.  Because we
1535 have two connections, we also have two protocols.  The protocol used for
1536 the UDP data is the ``data-protocol,'' the other one is the
1537 ``meta-protocol.''
1538
1539 The reason we don't use TCP for both protocols is that UDP is much
1540 better for encapsulation, even while it is less reliable.  The real
1541 problem is that when TCP would be used to encapsulate a TCP stream
1542 that's on the private network, for every packet sent there would be
1543 three ACKs sent instead of just one.  Furthermore, if there would be
1544 a timeout, both TCP streams would sense the timeout, and both would
1545 start re-sending packets.
1546
1547
1548 @c ==================================================================
1549 @node    The meta-protocol, Security, The connection, Technical information
1550 @section The meta-protocol
1551
1552 The meta protocol is used to tie all tinc daemons together, and
1553 exchange information about which tinc daemon serves which virtual
1554 subnet.
1555
1556 The meta protocol consists of requests that can be sent to the other
1557 side.  Each request has a unique number and several parameters.  All
1558 requests are represented in the standard ASCII character set.  It is
1559 possible to use tools such as telnet or netcat to connect to a tinc
1560 daemon and to read and write requests by hand, provided that one
1561 understands the numeric codes sent.
1562
1563 The authentication scheme is described in @ref{Authentication protocol}. After a
1564 successful authentication, the server and the client will exchange all the
1565 information about other tinc daemons and subnets they know of, so that both
1566 sides (and all the other tinc daemons behind them) have their information
1567 synchronised.
1568
1569 @cindex ADD_EDGE
1570 @cindex ADD_SUBNET
1571 @example
1572 daemon  message
1573 --------------------------------------------------------------------------
1574 origin  ADD_EDGE node1 12.23.34.45 655 node2 21.32.43.54 655 222 0
1575                     |       |       |  \___________________/  |  +-> options
1576                     |       |       |             |           +----> weight
1577                     |       |       |             +----------------> see below
1578                     |       |       +--> UDP port
1579                     |       +----------> real address
1580                     +------------------> name of node on one side of the edge
1581
1582 origin  ADD_SUBNET node 192.168.1.0/24
1583                      |         |     +--> masklength
1584                      |         +--------> IPv4 network address
1585                      +------------------> owner of this subnet
1586 --------------------------------------------------------------------------
1587 @end example
1588
1589 @cindex DEL_EDGE
1590 In case a connection between two daemons is closed or broken, DEL_EDGE messages
1591 are sent to inform the other daemons of that fact. Each daemon will calculate a
1592 new route to the the daemons, or mark them unreachable if there isn't any.
1593
1594 The keys used to encrypt VPN packets are not sent out directly. This is
1595 because it would generate a lot of traffic on VPNs with many daemons, and
1596 chances are that not every tinc daemon will ever send a packet to every
1597 other daemon. Instead, if a daemon needs a key it sends a request for it
1598 via the meta connection of the nearest hop in the direction of the
1599 destination. If any hop on the way has already learned the key, it will
1600 act as a proxy and forward its copy back to the requester.
1601
1602 @cindex REQ_KEY
1603 @cindex ANS_KEY
1604 @cindex KEY_CHANGED
1605 @example
1606 daemon  message
1607 --------------------------------------------------------------------------
1608 daemon  REQ_KEY origin destination
1609                    |       +--> name of the tinc daemon it wants the key from
1610                    +----------> name of the daemon that wants the key      
1611
1612 daemon  ANS_KEY origin destination 4ae0b0a82d6e0078 91 64 4
1613                    |       |       \______________/ |  |  +--> MAC length
1614                    |       |               |        |  +-----> digest algorithm
1615                    |       |               |        +--------> cipher algorithm
1616                    |       |               +--> 128 bits key
1617                    |       +--> name of the daemon that wants the key
1618                    +----------> name of the daemon that uses this key
1619
1620 daemon  KEY_CHANGED origin
1621                       +--> daemon that has changed it's packet key
1622 --------------------------------------------------------------------------
1623 @end example
1624
1625 There is also a mechanism to check if hosts are still alive. Since network
1626 failures or a crash can cause a daemon to be killed without properly
1627 shutting down the TCP connection, this is necessary to keep an up to date
1628 connection list. PINGs are sent at regular intervals, except when there
1629 is also some other traffic. A little bit of salt (random data) is added
1630 with each PING and PONG message, to make sure that long sequences of PING/PONG
1631 messages without any other traffic won't result in known plaintext.
1632
1633 @cindex PING
1634 @cindex PONG
1635 @example
1636 daemon  message
1637 --------------------------------------------------------------------------
1638 origin  PING
1639 dest.   PONG
1640 --------------------------------------------------------------------------
1641 @end example
1642
1643 This basically covers what is sent over the meta connection by
1644 tinc.
1645
1646
1647 @c ==================================================================
1648 @node    Security,  , The meta-protocol, Technical information
1649 @section About tinc's encryption and other security-related issues.
1650
1651 @cindex TINC
1652 @cindex Cabal
1653 tinc got its name from ``TINC,'' short for @emph{There Is No Cabal}; the
1654 alleged Cabal was/is an organisation that was said to keep an eye on the
1655 entire Internet.  As this is exactly what you @emph{don't} want, we named
1656 the tinc project after TINC.
1657
1658 @cindex SVPN
1659 But in order to be ``immune'' to eavesdropping, you'll have to encrypt
1660 your data.  Because tinc is a @emph{Secure} VPN (SVPN) daemon, it does
1661 exactly that: encrypt.
1662 tinc uses blowfish encryption in CBC mode, sequence numbers and message authentication codes
1663 to make sure eavesdroppers cannot get and cannot change any information at all from the packets they can intercept.
1664
1665 @menu
1666 * Authentication protocol::
1667 * Encryption of network packets::
1668 @end menu
1669
1670
1671 @c ==================================================================
1672 @node    Authentication protocol, Encryption of network packets, Security, Security
1673 @subsection Authentication protocol
1674
1675 @cindex authentication
1676 A new scheme for authentication in tinc has been devised, which offers some
1677 improvements over the protocol used in 1.0pre2 and 1.0pre3. Explanation is
1678 below.
1679
1680 @cindex ID
1681 @cindex META_KEY
1682 @cindex CHALLENGE
1683 @cindex CHAL_REPLY
1684 @cindex ACK
1685 @example
1686 daemon  message
1687 --------------------------------------------------------------------------
1688 client  <attempts connection>
1689
1690 server  <accepts connection>
1691
1692 client  ID client 12
1693               |   +---> version
1694               +-------> name of tinc daemon
1695
1696 server  ID server 12
1697               |   +---> version
1698               +-------> name of tinc daemon
1699
1700 client  META_KEY 5f0823a93e35b69e...7086ec7866ce582b
1701                  \_________________________________/
1702                                  +-> RSAKEYLEN bits totally random string S1,
1703                                      encrypted with server's public RSA key
1704
1705 server  META_KEY 6ab9c1640388f8f0...45d1a07f8a672630
1706                  \_________________________________/
1707                                  +-> RSAKEYLEN bits totally random string S2,
1708                                      encrypted with client's public RSA key
1709
1710 From now on:
1711  - the client will symmetrically encrypt outgoing traffic using S1
1712  - the server will symmetrically encrypt outgoing traffic using S2
1713
1714 client  CHALLENGE da02add1817c1920989ba6ae2a49cecbda0
1715                   \_________________________________/
1716                                  +-> CHALLEN bits totally random string H1
1717
1718 server  CHALLENGE 57fb4b2ccd70d6bb35a64c142f47e61d57f
1719                   \_________________________________/
1720                                  +-> CHALLEN bits totally random string H2
1721
1722 client  CHAL_REPLY 816a86
1723                       +-> 160 bits SHA1 of H2
1724
1725 server  CHAL_REPLY 928ffe
1726                       +-> 160 bits SHA1 of H1
1727
1728 After the correct challenge replies are received, both ends have proved
1729 their identity. Further information is exchanged.
1730
1731 client  ACK 655 12.23.34.45 123 0
1732              |       |       |  +-> options
1733              |       |       +----> estimated weight
1734              |       +------------> IP address of server as seen by client
1735              +--------------------> UDP port of client
1736
1737 server  ACK 655 21.32.43.54 321 0
1738              |       |       |  +-> options
1739              |       |       +----> estimated weight
1740              |       +------------> IP address of client as seen by server
1741              +--------------------> UDP port of server
1742 --------------------------------------------------------------------------
1743 @end example
1744
1745 This new scheme has several improvements, both in efficiency and security.
1746
1747 First of all, the server sends exactly the same kind of messages over the wire
1748 as the client. The previous versions of tinc first authenticated the client,
1749 and then the server. This scheme even allows both sides to send their messages
1750 simultaneously, there is no need to wait for the other to send something first.
1751 This means that any calculations that need to be done upon sending or receiving
1752 a message can also be done in parallel. This is especially important when doing
1753 RSA encryption/decryption. Given that these calculations are the main part of
1754 the CPU time spent for the authentication, speed is improved by a factor 2.
1755
1756 Second, only one RSA encrypted message is sent instead of two. This reduces the
1757 amount of information attackers can see (and thus use for a cryptographic
1758 attack). It also improves speed by a factor two, making the total speedup a
1759 factor 4.
1760
1761 Third, and most important:
1762 The symmetric cipher keys are exchanged first, the challenge is done
1763 afterwards. In the previous authentication scheme, because a man-in-the-middle
1764 could pass the challenge/chal_reply phase (by just copying the messages between
1765 the two real tinc daemons), but no information was exchanged that was really
1766 needed to read the rest of the messages, the challenge/chal_reply phase was of
1767 no real use. The man-in-the-middle was only stopped by the fact that only after
1768 the ACK messages were encrypted with the symmetric cipher. Potentially, it
1769 could even send it's own symmetric key to the server (if it knew the server's
1770 public key) and read some of the metadata the server would send it (it was
1771 impossible for the mitm to read actual network packets though). The new scheme
1772 however prevents this.
1773
1774 This new scheme makes sure that first of all, symmetric keys are exchanged. The
1775 rest of the messages are then encrypted with the symmetric cipher. Then, each
1776 side can only read received messages if they have their private key. The
1777 challenge is there to let the other side know that the private key is really
1778 known, because a challenge reply can only be sent back if the challenge is
1779 decrypted correctly, and that can only be done with knowledge of the private
1780 key.
1781
1782 Fourth: the first thing that is send via the symmetric cipher encrypted
1783 connection is a totally random string, so that there is no known plaintext (for
1784 an attacker) in the beginning of the encrypted stream.
1785
1786
1787 @c ==================================================================
1788 @node    Encryption of network packets,  , Authentication protocol, Security
1789 @subsection Encryption of network packet
1790 @cindex encryption
1791
1792 A data packet can only be sent if the encryption key is known to both
1793 parties, and the connection is  activated. If the encryption key is not
1794 known, a request is sent to the destination using the meta connection
1795 to retrieve it. The packet is stored in a queue while waiting for the
1796 key to arrive.
1797
1798 @cindex UDP
1799 The UDP packet containing the network packet from the VPN has the following layout:
1800
1801 @example
1802 ... | IP header | UDP header | seqno | VPN packet | MAC | UDP trailer
1803                              \___________________/\_____/
1804                                        |             |
1805                                        V             +---> digest algorithm
1806                          Encrypted with symmetric cipher
1807 @end example
1808
1809 So, the entire VPN packet is encrypted using a symmetric cipher. A 32 bits
1810 sequence number is added in front of the actual VPN packet, to act as a unique
1811 IV for each packet and to prevent replay attacks. A message authentication code
1812 is added to the UDP packet to prevent alteration of packets. By default the
1813 first 4 bytes of the digest are used for this, but this can be changed using
1814 the MACLength configuration variable.
1815
1816 @c ==================================================================
1817 @node    About us, Concept Index, Technical information, Top
1818 @chapter About us
1819
1820
1821 @menu
1822 * Contact Information::
1823 * Authors::
1824 @end menu
1825
1826
1827 @c ==================================================================
1828 @node    Contact Information, Authors, About us, About us
1829 @section Contact information
1830
1831 @cindex website
1832 tinc's website is at @url{http://tinc.nl.linux.org/},
1833 this server is located in the Netherlands.
1834
1835 @cindex IRC
1836 We have an IRC channel on the Open Projects IRC network.  Connect to
1837 @uref{http://openprojects.nu/services/irc.html, irc.openprojects.net},
1838 and join channel #tinc.
1839
1840
1841 @c ==================================================================
1842 @node    Authors,  , Contact Information, About us
1843 @section Authors
1844
1845 @table @asis
1846 @item Ivo Timmermans (zarq) (@email{itimmermans@@bigfoot.com})
1847 Main coder/hacker and maintainer of the package.
1848
1849 @item Guus Sliepen (guus) (@email{guus@@sliepen.warande.net})
1850 Originator of it all, co-author.
1851
1852 @item Wessel Dankers (Ubiq) (@email{wsl@@nl.linux.org})
1853 For the name `tinc' and various suggestions.
1854
1855 @end table
1856
1857 We have received a lot of valuable input from users.  With their help,
1858 tinc has become the flexible and robust tool that it is today.  We have
1859 composed a list of contributions, in the file called @file{THANKS} in
1860 the source distribution.
1861
1862
1863 @c ==================================================================
1864 @node    Concept Index,  , About us, Top
1865 @c        node-name,    next, previous,        up
1866 @unnumbered Concept Index
1867
1868 @c ==================================================================
1869 @printindex cp
1870
1871
1872 @c ==================================================================
1873 @contents
1874 @bye