1 \input texinfo @c -*-texinfo-*-
2 @c $Id: tinc.texi,v 1.8.4.10 2000/12/05 08:54:22 zarq Exp $
11 * tinc: (tinc). The tinc Manual.
14 This is the info manual for tinc, a Virtual Private Network daemon.
16 Copyright @copyright{} 1998,199,2000 Ivo Timmermans
17 <itimmermans@@bigfoot.com>, Guus Sliepen <guus@@sliepen.warande.net> and
18 Wessel Dankers <wsl@@nl.linux.org>.
20 $Id: tinc.texi,v 1.8.4.10 2000/12/05 08:54:22 zarq Exp $
22 Permission is granted to make and distribute verbatim copies of this
23 manual provided the copyright notice and this permission notice are
24 preserved on all copies.
26 Permission is granted to copy and distribute modified versions of this
27 manual under the conditions for verbatim copying, provided that the
28 entire resulting derived work is distributed under the terms of a
29 permission notice identical to this one.
35 @subtitle Setting up a Virtual Private Network with tinc
36 @author Ivo Timmermans and Guus Sliepen
39 @vskip 0pt plus 1filll
41 Copyright @copyright{} 1998,1999,2000 Ivo Timmermans
42 <itimmermans@@bigfoot.com>, Guus Sliepen <guus@@sliepen.warande.net> and
43 Wessel Dankers <wsl@@nl.linux.org>.
45 $Id: tinc.texi,v 1.8.4.10 2000/12/05 08:54:22 zarq Exp $
47 Permission is granted to make and distribute verbatim copies of this
48 manual provided the copyright notice and this permission notice are
49 preserved on all copies.
51 Permission is granted to copy and distribute modified versions of this
52 manual under the conditions for verbatim copying, provided that the
53 entire resulting derived work is distributed under the terms of a
54 permission notice identical to this one.
58 @c ==================================================================
59 @node Top, Introduction, (dir), (dir)
62 * Introduction:: Introduction
63 * Installing tinc - preparations::
64 * Installing tinc - installation::
67 * Technical information::
69 * Concept Index:: All used terms explained
75 @c ==================================================================
76 @node Introduction, Installing tinc - preparations, Top, Top
80 tinc is a Virtual Private Network (VPN) daemon that uses tunneling and
81 encryption to create a secure private network between hosts on the
84 Because the tunnel appears to the IP level network code as a normal
85 network device, there is no need to adapt any existing software.
87 This tunneling allows VPN sites to share information with each other
88 over the Internet without exposing any information to others.
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.
95 * VPNs:: Virtual Private Networks in general
97 * Supported platforms::
100 @c ==================================================================
101 @node VPNs, tinc, Introduction, Introduction
102 @section Virtual Private Networks
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.
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,
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.
120 This problem can be solved by using @emph{virtual} networks. Virtual
121 networks can live on top of other networks, but do not interfere with
122 each other. Mostly, virtual networks appear like a singe LAN, even though
123 they can span the entire world. But virtual networks can't be secured
124 by using firewalls, because the traffic that flows through it has to go
125 through the internet, where other people can look at it.
127 When one introduces encryption, we can form a true VPN. Other people may
128 see encrypted traffic, but if they don't know how to decipher it (they
129 need to know the key for that), they cannot read the information that flows
130 through the VPN. This is what tinc was made for.
133 tinc uses normal IP datagrams to encapsulate data that goes over the VPN
134 network link. In this case it's also clear that the network is
135 @emph{virtual}, because no direct network link has to exist between to
138 As is the case with either type of VPN, anybody could eavesdrop. Or
139 worse, alter data. Hence it's probably advisable to encrypt the data
140 that flows over the network.
143 @c ==================================================================
144 @node tinc, Supported platforms, VPNs, Introduction
149 I really don't quite remember what got us started, but it must have been
150 Guus' idea. He wrote a simple implementation (about 50 lines of C) that
151 used the @emph{ethertap} device that Linux knows of since somewhere
152 about kernel 2.1.60. It didn't work immediately and he improved it a
153 bit. At this stage, the project was still simply called @samp{vpnd}.
155 Since then, a lot has changed---to say the least.
158 tinc now supports encryption, it consists of a single daemon (tincd) for
159 both the receiving and sending end, it has become largely
160 runtime-configurable---in short, it has become a full-fledged
161 professional package.
163 A lot can---and will be---changed. I have a few things that I'd like to
164 see in the future releases of tinc. Not everything will be available in
165 the near future. Our first objective is to make tinc work perfectly as
166 it stands, and then add more advanced features.
168 Meanwhile, we're always open-minded towards new ideas. And we're
172 @c ==================================================================
173 @node Supported platforms, , tinc, Introduction
174 @section Supported platforms
176 tinc works on Linux, FreeBSD and Solaris. These are the three platforms
177 that are supported by the universial TUN/TAP device driver, so if
178 support for other operating systems is added to this driver, perhaps
179 tinc will run on them as well. Without this driver, tinc will most
180 likely compile and run, but it will not be able to send or receive data
183 For a more up to date list, please check the list on our website:
184 @uref{http://tinc.nl.linux.org/platforms.html}.
187 @c ==================================================================
190 tinc was first written for Linux running on an intel x86 processor, so
191 this is the best supported platform. The protocol however, and actually
192 anything about tinc, has been rewritten to support random byte ordering
193 and arbitrary word length. So in theory it should run on other
194 processors that Linux runs on. Take care however, we haven't been able
195 to really test it yet. If you want to run tinc on another platform than
196 x86, and want to tell us how it went, please do so.
198 tinc uses the ethertap device that is provided in the standard kernel
199 since version 2.1.60, so anything above that (2.2.x, 2.3.x, and the
200 2.4.0-testx (which is current at the time of this writing) kernel
201 versions) is able to support tinc.
204 @c ==================================================================
207 tinc on FreeBSD relies on the universial TUN/TAP driver for its data
208 acquisition from the kernel. Therefore, tinc suports the same platforms
209 as this driver. These are: FreeBSD 3.x, 4.x, 5.x.
212 @c ==================================================================
215 tinc on Solaris relies on the universial TUN/TAP driver for its data
216 acquisition from the kernel. Therefore, tinc suports the same platforms
217 as this driver. These are: Solaris, 2.1.x.
226 @c Preparing your system
233 @c ==================================================================
234 @node Installing tinc - preparations, Installing tinc - installation, Introduction, Top
235 @chapter Installing tinc: preparations
237 This chapter contains information on how to prepare your system to
241 * Configuring the kernel::
246 @c ==================================================================
247 @node Configuring the kernel, Libraries, Installing tinc - preparations, Installing tinc - preparations
248 @section Configuring the kernel
250 If you are running Linux, chances are good that your kernel already
251 supports all the devices that tinc needs for proper operation. For
252 example, the standard kernel from Redhat Linux already has support for
253 ethertap and netlink compiled in. Debian users can use the modconf
254 utility to select the modules. If your Linux distribution supports this
255 method of selecting devices, look out for something called `ethertap',
256 and `netlink_dev'. You need both these devices.
258 If you can install these devices in a similar manner, you may skip this
262 * Configuration of the Linux kernel::
263 * Configuration of the FreeBSD kernel::
264 * Configuration of the Solaris kernel::
268 @c ==================================================================
269 @node Configuration of the Linux kernel, Configuration of the FreeBSD kernel, Configuring the kernel, Configuring the kernel
270 @subsection Configuring the Linux kernel
272 Since this particular implementation only runs on 2.1 or higher Linux
273 kernels, you should grab one (2.2 is current at this time). A 2.0 port
274 is not really possible, unless someone tells me someone ported the
275 ethertap and netlink devices back to 2.0.
277 If you are unfamiliar with the process of configuring and compiling a
278 new kernel, you should read the
279 @uref{http://howto.linuxberg.com/LDP/HOWTO/Kernel-HOWTO.html, Kernel
280 HOWTO} first. Do that now!
282 Here are the options you have to turn on when configuring a new
288 Code maturity level options
289 [*] Prompt for development and/or incomplete code/drivers
291 [*] Kernel/User netlink socket
292 <*> Netlink device emulation
293 Network device support
294 <*> Ethertap network tap
297 For kernel 2.3.x and 2.4.x:
300 Code maturity level options
301 [*] Prompt for development and/or incomplete code/drivers
303 [*] Kernel/User netlink socket
304 <*> Netlink device emulation
305 Network device support
306 <*> Universal TUN/TAP device driver support
310 Any other options not mentioned here are not relevant to tinc. If you
311 decide to build any of these as dynamic kernel modules, it's a good idea
312 to add these lines to @file{/etc/modules.conf}.
316 alias char-major-36 netlink_dev
319 If you have a 2.4 kernel, you can also choose to use the `Ethertap
320 network tap' device. This is marked obsolete, because the universal
321 TUN/TAP driver is a newer implementation that is supposed to be used in
322 favor of ethertap. For tinc, it doesn't really matter which one you
323 choose; based on the device file name, tinc will make the right choice
324 about what protocol to use.
326 Finally, after having set up other options, build the kernel and boot
327 it. Unfortunately it's not possible to insert these modules in a
331 @c ==================================================================
332 @node Configuration of the FreeBSD kernel, Configuration of the Solaris kernel, Configuration of the Linux kernel, Configuring the kernel
333 @subsection Configuring the FreeBSD kernel
335 This section will contain information on how to configure your FreeBSD
336 kernel to support the universal TUN/TAP device. For 5.0 and 4.1
337 systems, this is included in the kernel configuration, for earlier
338 systems (4.0 and 3.x), you need to install the universal TUN/TAP driver
341 Unfortunately somebody still has to write the text.
344 @c ==================================================================
345 @node Configuration of the Solaris kernel, , Configuration of the FreeBSD kernel, Configuring the kernel
346 @subsection Configuring the Solaris kernel
348 This section will contain information on how to configure your Solaris
349 kernel to support the universal TUN/TAP device. You need to install
350 this driver yourself.
352 Unfortunately somebody still has to write the text.
355 @c ==================================================================
356 @node Libraries, , Configuring the kernel, Installing tinc - preparations
360 Before you can configure or build tinc, you need to have the OpenSSL
361 library installed on your system. If you try to configure tinc without
362 having installed it, configure will give you an error message, and stop.
369 @c ==================================================================
370 @node OpenSSL, , Libraries, Libraries
374 For all cryptography-related functions, tinc uses the functions provided
375 by the OpenSSL library. We recommend using version 0.9.5 or 0.9.6 of
376 this library. Other versions may also work, but we can guarantee
379 If this library is not installed, you wil get an error when configuring
380 tinc for build. Support for running tinc without having OpenSSL
381 installed @emph{may} be added in the future.
383 You can use your operating system's package manager to install this if
384 available. Make sure you install the development AND runtime versions
387 If you have to install OpenSSL manually, you can get the source code
388 from @url{http://www.openssl.org/}. Instructions on how to configure,
389 build and install this package are included within the package. Please
390 make sure you build development and runtime libraries (which is the
393 If you installed the OpenSSL libraries from source, it may be necessary
394 to let configure know where they are, by passing configure one of the
395 --with-openssl-* parameters.
398 --with-openssl=DIR OpenSSL library and headers prefix
399 --with-openssl-include=DIR OpenSSL headers directory
400 (Default is OPENSSL_DIR/include)
401 --with-openssl-lib=DIR OpenSSL library directory
402 (Default is OPENSSL_DIR/lib)
406 @subsubheading License
408 Since the license under which OpenSSL is distributed is not directly
409 compatible with the terms of the GNU GPL
410 @uref{http://www.openssl.org/support/faq.html#LEGAL2}, therefore we
411 include an addition to the GPL (see also the file COPYING.README):
414 This program is released under the GPL with the additional exemption
415 that compiling, linking, and/or using OpenSSL is allowed. You may
416 provide binary packages linked to the OpenSSL libraries, provided that
417 all other requirements of the GPL are met.
430 @c ==================================================================
431 @node Installing tinc - installation, Configuring tinc, Installing tinc - preparations, Top
432 @chapter Installing tinc: installation
434 If you use Redhat or Debian, you may want to install one of the
435 precompiled packages for your system. These packages are equipped with
436 system startup scripts and sample configurations.
438 If you don't run either of these systems, or you want to compile tinc
439 for yourself, you can use the source. The source is distributed under
440 the GNU General Public License (GPL). Download the source from the
441 @uref{http://tinc.nl.linux.org/download.html, download page}, which has
442 the checksums of these files listed; you may wish to check these with
443 md5sum before continuing.
445 tinc comes in a convenient autoconf/automake package, which you can just
446 treat the same as any other package. Which is just untar it, type
447 `configure' and then `make'.
449 More detailed instructions are in the file @file{INSTALL}, which is
450 included in the source distribution.
459 @c ==================================================================
460 @node Building tinc, System files, Installing tinc - installation, Installing tinc - installation
461 @section Building tinc
463 Detailed instructions on configuring the source and building tinc can be
464 found in the file called @file{INSTALL}.
467 @c ==================================================================
468 @node System files, Interfaces, Building tinc, Installing tinc - installation
469 @section System files
471 Before you can run tinc, you must make sure you have all the needed
472 files on your system.
480 @c ==================================================================
481 @node Device files, Other files, System files, System files
482 @subsection Device files
484 First, you'll need the special device file(s) that form the interface
485 between the kernel and the daemon.
487 The permissions for these files have to be such that only the super user
488 may read/write to this file. You'd want this, because otherwise
489 eavesdropping would become a bit too easy. This does, however, imply
490 that you'd have to run tincd as root.
492 If you use the universal TUN/TAP driver, you have to create the
493 following device files (unless they already exist):
496 mknod -m 600 /dev/... c .. ..
500 If you want to have more devices, the device numbers will be .. .. ...
502 If you use Linux, and you run the new 2.4 kernel using the devfs
503 filesystem, then the tap device will be automatically generated as
504 @file{/dev/netlink/tap0}.
506 If you use Linux and have kernel 2.2.x, you have to make the ethertap
510 mknod -m 600 /dev/tap0 c 36 16
514 Any further ethertap devices have minor device number 16 through 31.
517 @c ==================================================================
518 @node Other files, , Device files, System files
519 @subsection Other files
521 @subsubheading @file{/etc/networks}
523 You may add a line to @file{/etc/networks} so that your VPN will get a
524 symbolic name. For example:
530 This has nothing to do with the MyVPNIP configuration variable that will be
531 discussed later, it is only to make the output of the route command more
534 @subsubheading @file{/etc/services}
536 You may add this line to @file{/etc/services}. The effect is that you
537 may supply a @samp{tinc} as a valid port number to some programs. The
538 number 655 is registered with the IANA.
543 # Ivo Timmermans <itimmermans@@bigfoot.com>
547 @c ==================================================================
548 @node Interfaces, , System files, Installing tinc - installation
551 Before you can start transmitting data over the tinc tunnel, you must
552 set up the ethertap network devices.
554 First, decide which IP addresses you want to have associated with these
555 devices, and what network mask they must have. You also need these
556 numbers when you are going to configure tinc itself. @xref{Configuring
559 It doesn't matter much which part you do first, setting up the network
560 devices or configure tinc. But they both have to be done before you try
563 The actual setup of the ethertap device is quite simple, just repeat
567 ifconfig tap@emph{n} hw ether fe:fd:00:00:00:00
571 @cindex hardware address
572 @strong{Note:} Since version 1.0pre3, all interface addresses are set to
573 this address, whereas previous versions required the MAC to match the
577 To activate the device, you have to assign an IP address to it. To set
578 an IP address @emph{IP} with network mask @emph{mask}, do the following:
581 ifconfig tap@emph{n} @emph{xx}.@emph{xx}.@emph{xx}.@emph{xx} netmask @emph{mask}
585 The netmask is the mask of the @emph{entire} VPN network, not just your
586 own subnet. It is the same netmask you will have to specify with the
587 VpnMask configuration variable.
601 @c ==================================================================
602 @node Configuring tinc, Running tinc, Installing tinc - installation, Top
603 @chapter Configuring tinc
606 * Multiple networks::
607 * How connections work::
608 * Configuration file::
612 @c ==================================================================
613 @node Multiple networks, How connections work, Configuring tinc, Configuring tinc
614 @section Multiple networks
618 It is perfectly OK for you to run more than one tinc daemon.
619 However, in its default form, you will soon notice that you can't use
620 two different configuration files without the -c option.
622 We have thought of another way of dealing with this: network names. This
623 means that you call tincd with the -n argument, which will assign a name
626 The effect of this is that the daemon will set its configuration
627 ``root'' to /etc/tinc/nn/, where nn is your argument to the -n
628 option. You'll notice that it appears in syslog as ``tinc.nn''.
630 However, it is not strictly necessary that you call tinc with the -n
631 option. In this case, the network name would just be empty, and it will
632 be used as such. tinc now looks for files in /etc/tinc/, instead of
633 /etc/tinc/nn/; the configuration file should be /etc/tinc/tinc.conf,
634 and the passphrases are now expected to be in /etc/tinc/passphrases/.
636 But it is highly recommended that you use this feature of tinc, because
637 it will be so much clearer whom your daemon talks to. Hence, we will
638 assume that you use it.
641 @c ==================================================================
642 @node How connections work, Configuration file, Multiple networks, Configuring tinc
643 @section How connections work
645 Before going on, first a bit on how tinc sees connections.
647 When tinc starts up, it reads in the configuration file and parses the
648 command-line options. If it sees a `ConnectTo' value in the file, it
649 will try to connect to it, on the given port. If this fails, tinc exits.
652 @c ==================================================================
653 @node Configuration file, Example, How connections work, Configuring tinc
654 @section Configuration file
656 The actual configuration of the daemon is done in the file
657 @file{/etc/tinc/nn/tinc.conf}.
659 This file consists of comments (lines started with a #) or assignments
666 The variable names are case insensitive, and any spaces, tabs, newlines
667 and carriage returns are ignored. Note: it is not required that you put
668 in the `=' sign, but doing so improves readability. If you leave it
669 out, remember to replace it with at least one space character.
671 In this section all valid variables are listed in alphabetical order.
672 The default value is given between parentheses; required directives are
673 given in @strong{bold}.
676 * Main configuration variables::
677 * Host configuration variables::
682 @c ==================================================================
683 @node Main configuration variables, Host configuration variables, Configuration file, Configuration file
684 @subsection Main configuration variables
687 @item @strong{ConnectTo = <name>}
688 Specifies which host to connect to on startup. Multiple ConnectTo
689 variables may be specified, if connecting to the first one fails then
690 tinc will try the next one, and so on. It is possible to specify
691 hostnames for dynamic IP addresses (like those given on dyndns.org),
692 tinc will not cache the resolved IP address.
694 If you don't specify a host with ConnectTo, regardless of whether a
695 value for ConnectPort is given, tinc won't connect at all, and will
696 instead just listen for incoming connections.
698 @item Hostnames = <yes|no> (no)
699 This option selects whether IP addresses (both real and on the VPN)
700 should be resolved. Since DNS lookups are blocking, it might affect
701 tinc's efficiency, even stopping the daemon for a few seconds everytime
702 it does a lookup if your DNS server is not responding.
704 This does not affect resolving hostnames to IP addresses from the
707 @item Interface = <device>
708 If you have more than one network interface in your computer, tinc will
709 by default listen on all of them for incoming connections. It is
710 possible to bind tinc to a single interface like eth0 or ppp0 with this
713 @item InterfaceIP = <local address>
714 If your computer has more than one IP address on a single interface (for
715 example if you are running virtual hosts), tinc will by default listen
716 on all of them for incoming connections. It is possible to bind tinc to
717 a single IP address with this variable. It is still possible to listen
718 on several interfaces at the same time though, if they share the same IP
721 @item KeyExpire = <seconds> (3600)
722 This option controls the time the encryption keys used to encrypt the
723 data are valid. It is common practice to change keys at regular
724 intervals to make it even harder for crackers, even though it is thought
725 to be nearly impossible to crack a single key.
727 @item @strong{Name = <name>}
728 This is a symbolic name for this connection. It can be anything
730 @item PingTimeout = <seconds> (5)
731 The number of seconds of inactivity that tinc will wait before sending a
732 probe to the other end. If that other end doesn't answer within that
733 same amount of seconds, the connection is terminated, and the others
734 will be notified of this.
736 @item @strong{PrivateKey = <path>}
737 This is the full path name of the RSA private key file that was
738 generated by ``tincd --generate-keys''. It must be a full path, not a
739 relative directory. (NOTE: In version 1.0pre3, this variable was used
740 to give the key inline. This is no longer supported.)
742 @item TapDevice = <device> (/dev/tap0)
743 The ethertap device to use. Note that you can only use one device per
744 daemon. The info pages of the tinc package contain more information
745 about configuring an ethertap device for Linux.
747 @item VpnMask = <mask>
748 The mask that defines the scope of the entire VPN. This option is not
749 used by the tinc daemon itself, but can be used by startup scripts to
750 configure the ethertap devices correctly.
754 @c ==================================================================
755 @node Host configuration variables, How to configure, Main configuration variables, Configuration file
756 @subsection Host configuration variables
759 @item @strong{Address = <IP address|hostname>}
760 This variable is only required if you want to connect to this host. It
761 must resolve to the external IP address where the host can be reached,
762 not the one that is internal to the VPN.
764 @item IndirectData = <yes|no> (no)
765 This option specifies whether other tinc daemons besides the one you
766 specified with ConnectTo can make a direct connection to you. This is
767 especially useful if you are behind a firewall and it is impossible to
768 make a connection from the outside to your tinc daemon. Otherwise, it
769 is best to leave this option out or set it to no.
771 @item Port = <port> (655)
772 Connect to the upstream host (given with the ConnectTo directive) on
773 port port. port may be given in decimal (default), octal (when preceded
774 by a single zero) o hexadecimal (prefixed with 0x). port is the port
775 number for both the UDP and the TCP (meta) connections.
777 @item PublicKey = <path>
778 This is the full path name of the RSA public key file that was generated
779 by ``tincd --generate-keys''. It must be a full path, not a relative
780 directory. (NOTE: In version 1.0pre3, this variable was used to give
781 the key inline. This is no longer supported.)
783 @item Subnet = <IP address/maskbits>
784 This is the subnet range of all IP addresses that will be accepted by
785 the host that defines it. Please be careful that no two subnets
786 overlap. Every host @strong{must} have a different range of IP
787 addresses that it can handle, otherwise you will see messages like
788 `packet comes back to us'.
790 The range must contain the IP address of the tap device, not the real IP
791 address of the host running tincd.
793 maskbits is the number of bits set to 1 in the netmask part; for
794 example: netmask 255.255.255.0 would become /24, 255.255.252.0 becomes
797 @item TCPonly = <yes|no> (no)
798 If this variable is set to yes, then the packets are tunnelled over a
799 TCP connection instead of a UDP connection. This is especially useful
800 for those who want to run a tinc daemon from behind a masquerading
801 firewall, or if UDP packet routing is disabled somehow. @emph{This is
802 experimental code, try this at your own risk.}
806 @c ==================================================================
807 @node How to configure, , Host configuration variables, Configuration file
808 @subsection How to configure
810 @subsubheading Step 1. Creating the key files
812 For each host, you have to create a pair of RSA keys. One key is your
813 private key, which is only known to you. The other one is the public
814 key, which you should copy to all hosts wanting to authenticate to you.
817 @subsubheading Step 2. Configuring each host
819 For every host in the VPN, you have to create two files. First there is
820 the main configuration file, @file{/etc/tinc/vpn-name/tinc.conf}. In
821 this file there should at least be three directives:
825 You should fill in the name of this host (or rather, the name of this
826 leaf of the VPN). It can be called after the hostname, the physical
827 location, the department, or the name of one of your boss' pets. It can
828 be anything, as long as all these names are unique across the entire
832 Fill in the full pathname to the file that contains the private RSA key.
835 This is the name of the host that you want to connect to (not a DNS
836 name, rather the name that is given with the Name parameter in that
837 hosts tinc.conf). This is the upstream connection. If your computer is
838 a central node, you might want to leave this out to make it stay idle
839 until someone connects to it.
842 @cindex host configuration file
843 Then you should create a file with the name you gave yourself in
844 tinc.conf (the `Name' parameter), located in
845 @file{/etc/tinc/vpn-name/hosts/}. In this file, which we call the
846 `@emph{host configuration file}', only one variable is required:
850 The IP range that this host accepts as being `local'. All packets with
851 a destination address that is within this subnet will be sent to us.
855 @subsubheading Step 3. Bringing it all together
857 Now for all hosts that you want to create a direct connection to, -- you
858 connect to them or they connect to you -- you get a copy of their host
859 configuration file and their public RSA key.
861 For each host configuration file, you add two variables:
865 Enter the IP address or DNS hostname for this host. This is only needed
866 if you connect to this host.
869 Put the full pathname to this hosts public RSA key here.
872 When you did this, you should be ready to create your first connection.
873 Pay attention to the system log, most errors will only be visible
874 there. If you get an error, you can check @ref{Error messages}.
877 @c ==================================================================
878 @node Example, , Configuration file, Configuring tinc
883 Imagine the following situation. An A-based company wants to connect
884 three branch offices in B, C and D using the internet. All four offices
885 have a 24/7 connection to the internet.
887 A is going to serve as the center of the network. B and C will connect
888 to A, and D will connect to C. Each office will be assigned their own IP
892 A: net 10.1.0.0 mask 255.255.0.0 gateway 10.1.54.1 internet IP 1.2.3.4
893 B: net 10.2.0.0 mask 255.255.0.0 gateway 10.2.1.12 internet IP 2.3.4.5
894 C: net 10.3.0.0 mask 255.255.0.0 gateway 10.3.69.254 internet IP 3.4.5.6
895 D: net 10.4.0.0 mask 255.255.0.0 gateway 10.4.3.32 internet IP 4.5.6.7
898 ``gateway'' is the VPN IP address of the machine that is running the
899 tincd. ``internet IP'' is the IP address of the firewall, which does not
900 need to run tincd, but it must do a port forwarding of TCP&UDP on port
901 655 (unless otherwise configured).
903 In this example, it is assumed that eth0 is the interface that points to
904 the inner (physical) LAN of the office, although this could also be the
905 same as the interface that leads to the internet. The configuration of
906 the real interface is also shown as a comment, to give you an idea of
907 how these example host is set up.
911 @emph{A} would be configured like this:
914 #ifconfig eth0 10.1.54.1 netmask 255.255.0.0 broadcast 10.1.255.255
915 ifconfig tap0 hw ether fe:fd:00:00:00:00
916 ifconfig tap0 10.1.54.1 netmask 255.0.0.0
919 and in /etc/tinc/tinc.conf:
923 PrivateKey = /etc/tinc/A.priv
927 On all hosts, /etc/tinc/hosts/A contains:
932 PublicKey = /etc/tinc/hosts/A.pub
939 #ifconfig eth0 10.2.43.8 netmask 255.255.0.0 broadcast 10.2.255.255
940 ifconfig tap0 hw ether fe:fd:00:00:00:00
941 ifconfig tap0 10.2.1.12 netmask 255.0.0.0
944 and in /etc/tinc/tinc.conf:
949 PrivateKey = /etc/tinc/B.priv
953 Note here that the internal address (on eth0) doesn't have to be the
954 same as on the tap0 device. Also, ConnectTo is given so that no-one can
955 connect to this node.
957 On all hosts, /etc/tinc/hosts/B:
962 PublicKey = /etc/tinc/hosts/B.pub
969 #ifconfig eth0 10.3.69.254 netmask 255.255.0.0 broadcast 10.3.255.255
970 ifconfig tap0 hw ether fe:fd:00:00:00:00
971 ifconfig tap0 10.3.69.254 netmask 255.0.0.0
974 and in /etc/tinc/A/tinc.conf:
979 TapDevice = /dev/tap1
983 C already has another daemon that runs on port 655, so they have to
984 reserve another port for tinc. It can connect to other tinc daemons on
985 the regular port though, so no ConnectPort variable is needed. They
986 also use the netname to distinguish between the two. tinc is started
989 On all hosts, /etc/tinc/hosts/C:
994 PublicKey = /etc/tinc/hosts/C.pub
1001 #ifconfig tap0 10.4.3.32 netmask 255.255.0.0 broadcast 10.4.255.255
1002 ifconfig tap0 hw ether fe:fd:0a:04:03:20
1003 ifconfig tap0 10.4.3.32 netmask 255.0.0.0
1006 and in /etc/tinc/tinc.conf:
1009 MyVirtualIP = 10.4.3.32/16
1015 D will be connecting to C, which has a tincd running for this network on
1016 port 2000. Hence they need to put in a ConnectPort, but it doesn't need
1017 to have a different ListenPort.
1019 @subsubheading Key files
1021 A, B, C and D all generate a passphrase with genauth 2048, the output is
1022 stored in /etc/tinc/passphrases/local, except for C, where it should be
1023 /etc/tinc/A/passphrases/local.
1025 A stores a copy of B's passphrase in /etc/tinc/passphrases/10.2.1.12
1027 A stores a copy of C's passphrase in /etc/tinc/passphrases/10.3.69.254
1029 B stores a copy of A's passphrase in /etc/tinc/passphrases/10.1.54.1
1031 C stores a copy of A's passphrase in /etc/tinc/A/passphrases/10.1.54.1
1033 C stores a copy of D's passphrase in /etc/tinc/A/passphrases/10.4.3.32
1035 D stores a copy of C's passphrase in /etc/tinc/passphrases/10.3.69.254
1037 @subsubheading Starting
1039 A has to start their tincd first. Then come B and C, where C has to
1040 provide the option `-n A', because they have more than one tinc
1041 network. Finally, D's tincd is started.
1045 @c ==================================================================
1046 @node Running tinc, Technical information, Configuring tinc, Top
1047 @chapter Running tinc
1049 Running tinc isn't just as easy as typing `tincd' and hoping everything
1050 will just work out the way you wanted. Instead, the use of tinc is a
1051 project that involves trust relations and more than one computer.
1060 @c ==================================================================
1061 @node Managing keys, Runtime options, Running tinc, Running tinc
1062 @section Managing keys
1064 Before attempting to start tinc, you have to create passphrases. When
1065 tinc tries to make a connection, it exchanges some sensitive
1066 data. Before doing so, it likes to know if the other end is
1069 To do this, both ends must have some knowledge about the other. In the
1070 case of tinc this is the authentication passphrase.
1072 This passphrase is a number, which is chosen at random. This number is
1073 then sent to the other computers which want to talk to us directly. To
1074 avoid breaking security, this should be done over a known secure channel
1075 (such as ssh or similar).
1077 All passphrases are stored in the passphrases directory, which is
1078 normally /etc/tinc/nn/passphrases/, but it may be changed using the
1079 `Passphrases' option in the config file.
1081 To generate a passphrase, run `genauth'. genauth takes one argument,
1082 which is the length of the passphrase in bits. The length of the
1083 passphrase should be in the range 1024--2048 for a key length of 128
1084 bits. genauth creates a random number of the specified length, and puts
1087 Every computer that wants to participate in the VPN should do this, and
1088 store the output in the passphrases directory, in the file @file{local}.
1090 When every computer has his own local key, it should copy it to the
1091 computer that it wants to talk to directly. (i.e. the one it connects to
1092 during startup.) This should be done via a secure channel, because it is
1093 sensitive information. If this is not done securely, someone might break
1096 Those non-local passphrase files must have the name of the VPN IP
1097 address that they will advertise to you. For instance, if a computer
1098 tells us it likes to be 10.1.1.3 with netmask 255.255.0.0, the file
1099 should still be called 10.1.1.3, and not 10.1.0.0.
1102 @c ==================================================================
1103 @node Runtime options, Error messages, Managing keys, Running tinc
1104 @section Runtime options
1106 Besides the settings in the configuration file, tinc also accepts some
1107 command line options.
1109 This list is a longer version of that in the manpage. The latter is
1110 generated automatically, so may be more up-to-date.
1112 @cindex command line
1113 @cindex runtime options
1117 @item -c, --config=FILE
1118 Read configuration options from FILE. The default is
1119 @file{/etc/tinc/nn/tinc.conf}.
1122 Increase debug level. The higher it gets, the more gets
1123 logged. Everything goes via syslog.
1125 0 is the default, only some basic information connection attempts get
1126 logged. Setting it to 1 will log a bit more, still not very
1127 disturbing. With two -d's tincd will log protocol information, which can
1128 get pretty noisy. Three or more -d's will output every single packet
1129 that goes out or comes in, which probably generates more data than the
1133 Attempt to kill a running tincd and exit. A TERM signal (15) gets sent
1134 to the daemon that his its PID in /var/run/tinc.pid.
1136 Because it kills only one tinc daemon, you should use -n here if you
1137 started it that way. It will then read the PID from
1138 @file{/var/run/tinc.NETNAME.pid}.
1140 @item -n, --net=NETNAME
1141 Connect to net NETNAME. @xref{Multiple networks}.
1143 @item -t, --timeout=TIMEOUT
1144 Seconds to wait before giving a timeout. Should not be set too low,
1145 because every time tincd senses a timeout, it disconnects and reconnects
1146 again, which will cause unnecessary network traffic and log messages.
1149 Display a short reminder of these runtime options and terminate.
1152 Output version information and exit.
1157 @c ==================================================================
1158 @node Error messages, , Runtime options, Running tinc
1159 @section Error messages
1161 What follows is a list of the most common error messages you can see
1162 when configuring tinc. Most of these messages are visible in the syslog
1163 only, so keep an eye on it!
1166 @item Could not open /dev/tap0: No such device
1168 @item You forgot to insmod netlink_dev.o
1169 @item You forgot to compile `Netlink device emulation' in the kernel
1172 @item Can't write to tun/tap device: No such device
1174 @item You forgot to insmod tun.o
1175 @item You forgot to compile `Universal TUN/TAP driver' in the kernel
1178 @item Packet with destination 1.2.3.4 is looping back to us!
1180 @item Some host has an IP address range that overlaps with yours
1181 Different hosts must have different IP ranges (as given with Subnet in
1182 the host configuration files). tinc relies on this information to route
1183 its data, so each IP address range must have exactly one host
1184 associated. You will only see this message if you specified a debug
1185 level of 5 or higher!
1188 @item Network address and subnet mask do not match!
1190 @item The Subnet field must contain a network address
1191 If you only want to use one IP address, set the netmask to /32.
1194 @item This is a bug: net.c:253: 24: Some error
1196 @item This is something that should not have happened
1197 Please report this, and tell us exactly what went wrong before you got
1198 this message. In normal operation, these errors should not occur.
1201 @item Error reading RSA key file `rsa_key.priv': No such file or directory
1203 @item You must specify the complete pathname
1204 Specifying a relative path does not make sense here. tinc changes its
1205 directory to / when starting (to avoid keeping a mount point busy); and
1206 even if we built in a default directory to look for these files, the key
1207 files are bound to be in a different directory.
1210 @item Error reading RSA key file `fd47...8ceb': No such file or directory
1212 @item You specified the key here, not a pathname
1213 In version 1.0pre3, you had to put your key here. This has changed, the
1214 keys are now stored in separate files. This means you have to
1215 regenerate these keys.
1222 @c ==================================================================
1223 @node Technical information, About us, Running tinc, Top
1224 @chapter Technical information
1232 @c ==================================================================
1233 @node The Connection, Security, Technical information, Technical information
1234 @section The basic philosophy of the way tinc works
1237 tinc is a daemon that takes VPN data and transmit that to another host
1238 computer over the existing Internet infrastructure.
1241 * Protocol Preview::
1242 * The Meta-connection::
1246 @c ==================================================================
1247 @node Protocol Preview, The Meta-connection, The Connection, The Connection
1248 @subsection A preview of the way the tinc works
1252 The data itself is read from a character device file, the so-called
1253 @emph{ethertap} device. This device is associated with a network
1254 interface. Any data sent to this interface can be read from the device,
1255 and any data written to the device gets sent from the interface. Data to
1256 and from the device is formatted as if it were a normal ethernet card,
1257 so a frame is preceded by two MAC addresses and a @emph{frame type}
1260 So when tinc reads an ethernet frame from the device, it determines its
1261 type. Right now, tinc can only handle Internet Protocol version 4 (IPv4)
1262 frames. Plans to support other protocols are being made. When tinc knows
1263 which type of frame it has read, it can also read the source and
1264 destination address from it.
1266 Now it is time that the frame gets encrypted. Currently the only
1267 encryption algorithm available is blowfish.
1269 @cindex encapsulating
1270 When the encryption is ready, time has come to actually transport the
1271 packet to the destination computer. We do this by sending the packet
1272 over an UDP connection to the destination host. This is called
1273 @emph{encapsulating}, the VPN packet (though now encrypted) is
1274 encapsulated in another IP datagram.
1276 When the destination receives this packet, the same thing happens, only
1277 in reverse. So it does a decrypt on the contents of the UDP datagram,
1278 and it writes the decrypted information to its own ethertap device.
1281 @c ==================================================================
1282 @node The Meta-connection, , Protocol Preview, The Connection
1283 @subsection The meta-connection
1285 Having only an UDP connection available is not enough. Though suitable
1286 for transmitting data, we want to be able to reliably send other
1287 information, such as routing and encryption information to somebody.
1289 TCP is a better alternative, because it already contains protection
1290 against information being lost, unlike UDP.
1292 So we establish two connections. One for the encrypted VPN data, and one
1293 for other information, the meta-data. Hence, we call the second
1294 connection the meta-connection. We can now be sure that the
1295 meta-information doesn't get lost on the way to another computer.
1297 @cindex data-protocol
1298 @cindex meta-protocol
1299 Like with any communication, we must have a protocol, so that everybody
1300 knows what everything stands for, and how she should react. Because we
1301 have two connections, we also have two protocols. The protocol used for
1302 the UDP data is the ``data-protocol,'' the other one is the
1305 The reason we don't use TCP for both protocols is that UDP is much
1306 better for encapsulation, even while it is less reliable. The real
1307 problem is that when TCP would be used to encapsulate a TCP stream
1308 that's on the private network, for every packet sent there would be
1309 three ACK's sent instead of just one. Furthermore, if there would be
1310 a timeout, both TCP streams would sense the timeout, and both would
1311 start resending packets.
1313 @c ==================================================================
1314 @node Security, , The Connection, Technical information
1315 @section About tinc's encryption and other security-related issues.
1319 tinc got its name from ``TINC,'' short for @emph{There Is No Cabal}; the
1320 alleged Cabal was/is an organization that was said to keep an eye on the
1321 entire Internet. As this is exactly what you @emph{don't} want, we named
1322 the tinc project after TINC.
1325 But in order to be ``immune'' to eavesdropping, you'll have to encrypt
1326 your data. Because tinc is a @emph{Secure} VPN (SVPN) daemon, it does
1327 exactly that: encrypt.
1329 This chapter is a mixture of ideas, reasoning and explanation, please
1330 don't take it too serious.
1338 @c ==================================================================
1339 @node Key Types, Key Management, Security, Security
1340 @subsection Key Types
1341 @c FIXME: check if I'm not talking nonsense
1343 There are several types of encryption keys. Tinc uses two of them,
1344 symmetric private keypairs and public/private keypairs.
1346 Public/private keypairs are used in public key cryptography. It enables
1347 someone to send out a public key with which other people can encrypt their
1348 data. The encrypted data now can only be decrypted by the person who has
1349 the private key that matches the public key. So, a public key only allows
1350 @emph{other} people to send encrypted messages to you. This is very useful
1351 in setting up private communications channels. Just send out your public key
1352 and other people can talk to you in a secure way. But how can you know
1353 the other person is who she says she is?
1355 For authentication itself tinc uses symmetric private keypairs, referred
1356 to as a passphrase. The identity of each tinc daemon is defined by it's
1357 passphrase (like you can be identified by your social security number).
1358 Every tinc daemon that is allowed to connect to you has a copy of your
1359 passphrase (hence symmetrical).
1361 It would also be possible to use public/private keypairs for authentication,
1362 so that you could shout out your public key and don't need to keep it
1363 secret (like the passphrase you would have to send to someone else). Also,
1364 no one else has to know a private key from you.
1365 Both forms have their pros and cons, and at the moment tinc just uses passphrases
1366 (which are computationaly more efficient and perhaps in some way more
1369 @c ==================================================================
1370 @node Key Management, Authentication, Key Types, Security
1371 @subsection Key Management
1372 @c FIXME change for the current protocol
1374 @cindex Diffie-Hellman
1375 You can't just send a private encryption key to your peer, because
1376 somebody else might already be listening to you. So you'll have to
1377 negotiate over a shared but secret key. One way to do this is by using
1378 the ``Diffie-Hellman key exchange'' protocol
1379 (@uref{http://www.rsa.com/rsalabs/faq/html/3-6-1.html}). The idea is as
1382 You have two participants A and B that want to agree over a shared
1383 secret encryption key. Both parties have some large prime number p and a
1384 generator g. These numbers may be known to the outside world, and hence
1385 may be included in the source distribution.
1388 Both parties then generate a secret key. A generates a, and computes g^a
1389 mod p. This is then sent to B; while B computes g^b mod p, and transmits
1390 this to A, b being generated by B. Both a and b must be smaller than
1393 Both parties then calculate g^ab mod p = k. k is the new, shared, but
1396 To obtain a key k of a sufficient length (128 bits in our vpnd), p
1397 should be 2^129-1 or more.
1400 @c ==================================================================
1401 @node Authentication, , Key Management, Security
1402 @subsection Authentication
1405 @cindex man-in-the-middle attack
1406 Because the Diffie-Hellman protocol is in itself vulnerable to the
1407 ``man-in-the-middle attack,'' we should introduce an authentication
1410 We will let A transmit a passphrase that is also known to B encrypted
1411 with g^a, before A sends this to B. This way, B can check whether A is
1412 really A or just someone else.
1413 B will never receive the real passphrase though, because it was
1414 encrypted using public/private keypairs. This way there is no way an
1415 imposter could steal A's passphrase.
1418 @c ehrmz... but we only use 1024 bits passphrases ourselves? [guus]
1419 This passphrase should be 2304 bits for a symmetric encryption
1420 system. But since an asymmetric system is more secure, we could do with
1421 2048 bits. This only holds if the passphrase is very random.
1423 These passphrases could be stored in a file that is non-readable by
1424 anyone else but root; e.g. @file{/etc/tinc/passphrases} with UID 0
1425 and permissions mode 700.
1427 The only thing that needs to be taken care of is how A can securely send
1428 a copy of it's passphrase to B if B doesn't have it yet. This could be
1429 done via mail with PGP, but you should be really convinced of the
1430 identity of the person who owns the email address you are sending this to.
1431 Swapping floppy disks in real life might be the best way to do this!
1434 @c ==================================================================
1435 @node About us, Concept Index, Technical information, Top
1440 * Contact Information::
1445 @c ==================================================================
1446 @node Contact Information, Authors, About us, About us
1447 @section Contact information
1449 tinc's main page is at @url{http://tinc.nl.linux.org/},
1450 this server is located in the Netherlands.
1452 We have an IRC channel on the Open Projects IRC network. Connect to
1453 @uref{http://openprojects.nu/services/irc.html, irc.openprojects.net},
1454 and join channel #tinc.
1457 @c ==================================================================
1458 @node Authors, , Contact Information, About us
1462 @item Ivo Timmermans (zarq) (@email{itimmermans@@bigfoot.com})
1463 Main coder/hacker and maintainer of the package.
1465 @item Guus Sliepen (guus)
1466 Originator of it all, co-author.
1468 @item Wessel Dankers (Ubiq)
1469 General obfuscater of the code.
1473 We have received a lot of valuable input from users. With their help,
1474 tinc has become the flexible and robust tool that it is today. We have
1475 composed a list of contributions, in the file called @file{THANKS} in
1476 the source distribution.
1479 @c ==================================================================
1480 @node Concept Index, , About us, Top
1481 @c node-name, next, previous, up
1482 @unnumbered Concept Index
1484 @c ==================================================================
1488 @c ==================================================================