1 \input texinfo @c -*-texinfo-*-
2 @c $Id: tinc.texi,v 1.8.4.16 2001/05/24 20:24:12 guus Exp $
11 * tinc: (tinc). The tinc Manual.
14 This is the info manual for tinc, a Virtual Private Network daemon.
16 Copyright @copyright{} 1998-2001 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.16 2001/05/24 20:24:12 guus 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-2001 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.16 2001/05/24 20:24:12 guus 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
67 * Technical information::
69 * Concept Index:: All used terms explained
75 @c ==================================================================
76 @node Introduction, 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.
86 The encrypted tunnels allows VPN sites to share information with each other
87 over the Internet without exposing any information to others.
89 This document is the manual for tinc. Included are chapters on how to
90 configure your computer to use tinc, as well as the configuration
91 process of tinc itself.
94 * VPNs:: Virtual Private Networks in general
96 * Supported platforms::
99 @c ==================================================================
100 @node VPNs, tinc, Introduction, Introduction
101 @section Virtual Private Networks
104 A Virtual Private Network or VPN is a network that can only be accessed
105 by a few elected computers that participate. This goal is achievable in
106 more than just one way.
109 Private networks can consist of a single stand-alone Ethernet LAN. Or
110 even two computers hooked up using a null-modem cable. In these cases,
112 obvious that the network is @emph{private}, no one can access it from the
113 outside. But if your computers are linked to the Internet, the network
114 is not private anymore, unless one uses firewalls to block all private
115 traffic. But then, there is no way to send private data to trusted
116 computers on the other end of the Internet.
119 This problem can be solved by using @emph{virtual} networks. Virtual
120 networks can live on top of other networks, but they use encapsulation to
121 keep using their private address space so they do not interfere with
122 the Internet. 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 As is the case with either type of VPN, anybody could eavesdrop. Or
128 worse, alter data. Hence it's probably advisable to encrypt the data
129 that flows over the network.
131 When one introduces encryption, we can form a true VPN. Other people may
132 see encrypted traffic, but if they don't know how to decipher it (they
133 need to know the key for that), they cannot read the information that flows
134 through the VPN. This is what tinc was made for.
137 @c ==================================================================
138 @node tinc, Supported platforms, VPNs, Introduction
142 I really don't quite remember what got us started, but it must have been
143 Guus' idea. He wrote a simple implementation (about 50 lines of C) that
144 used the ethertap device that Linux knows of since somewhere
145 about kernel 2.1.60. It didn't work immediately and he improved it a
146 bit. At this stage, the project was still simply called @samp{vpnd}.
148 Since then, a lot has changed---to say the least.
151 tinc now supports encryption, it consists of a single daemon (tincd) for
152 both the receiving and sending end, it has become largely
153 runtime-configurable---in short, it has become a full-fledged
154 professional package.
156 @cindex Traditional VPNs
158 tinc also allows more than two sites to connect to eachother and form a single VPN.
159 Traditionally VPNs are created by making tunnels, which only have two endpoints.
160 Larger VPNs with more sites are created by adding more tunnels.
161 tinc takes another approach: only endpoints are specified,
162 the software itself will take care of creating the tunnels.
163 This allows for easier configuration and improved scalability.
165 A lot can---and will be---changed. We have a number of things that we would like to
166 see in the future releases of tinc. Not everything will be available in
167 the near future. Our first objective is to make tinc work perfectly as
168 it stands, and then add more advanced features.
170 Meanwhile, we're always open-minded towards new ideas. And we're
174 @c ==================================================================
175 @node Supported platforms, , tinc, Introduction
176 @section Supported platforms
179 tinc has been verified to work under Linux, FreeBSD and Solaris, with
180 various hardware architectures. These are the three platforms
181 that are supported by the universial TUN/TAP device driver, so if
182 support for other operating systems is added to this driver, perhaps
183 tinc will run on them as well. Without this driver, tinc will most
184 likely compile and run, but it will not be able to send or receive data
188 The official release only truly supports Linux.
189 For an up to date list of supported platforms, please check the list on
191 @uref{http://tinc.nl.linux.org/platforms.html}.
194 @c ==================================================================
198 tinc was first written for Linux running on an intel x86 processor, so
199 this is the best supported platform. The protocol however, and actually
200 anything about tinc, has been rewritten to support random byte ordering
201 and arbitrary word length. So in theory it should run on other
202 processors that Linux runs on. It has already been verified to run on
203 alpha and sparc processors as well.
205 tinc uses the ethertap device or the universal TUN/TAP driver. The former is provided in the standard kernel
206 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.
209 @c ==================================================================
213 tinc on FreeBSD relies on the universial TUN/TAP driver for its data
214 acquisition from the kernel. Therefore, tinc will work on the same platforms
215 as this driver. These are: FreeBSD 3.x, 4.x, 5.x.
218 @c ==================================================================
222 tinc on Solaris relies on the universial TUN/TAP driver for its data
223 acquisition from the kernel. Therefore, tinc will work on the same platforms
224 as this driver. These are: Solaris, 2.1.x.
233 @c Preparing your system
240 @c ==================================================================
241 @node Preparations, Installation, Introduction, Top
242 @chapter Preparations
244 This chapter contains information on how to prepare your system to
248 * Configuring the kernel::
253 @c ==================================================================
254 @node Configuring the kernel, Libraries, Preparations, Preparations
255 @section Configuring the kernel
262 If you are running Linux, chances are good that your kernel already supports
263 all the devices that tinc needs for proper operation. For example, the
264 standard kernel from Redhat Linux already has support for ethertap and netlink
265 compiled in. Debian users can use the modconf utility to select the modules.
266 If your Linux distribution supports this method of selecting devices, look out
267 for something called `ethertap', and `netlink_dev' if it is using a kernel
268 version prior to 2.4.0. In that case you will need both these devices. If you
269 are using kernel 2.4.0 or later, you need to select `tun'.
272 If you can install these devices in a similar manner, you may skip this section.
273 Otherwise, you will have to recompile the kernel in order to turn on the required features.
274 If you are unfamiliar with the process of configuring and compiling a new kernel,
275 you should read the @uref{http://howto.linuxberg.com/LDP/HOWTO/Kernel-HOWTO.html, Kernel HOWTO} first.
278 * Configuration of Linux kernels 2.1.60 up to 2.4.0::
279 * Configuration of Linux kernels 2.4.0 and higher::
280 * Configuration of FreeBSD kernels::
281 * Configuration of Solaris kernels::
285 @c ==================================================================
286 @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
287 @subsection Configuration of Linux kernels 2.1.60 up to 2.4.0
289 Here are the options you have to turn on when configuring a new kernel:
292 Code maturity level options
293 [*] Prompt for development and/or incomplete code/drivers
295 [*] Kernel/User netlink socket
296 <M> Netlink device emulation
297 Network device support
298 <M> Ethertap network tap
301 If you want to run more than one instance of tinc or other programs that use
302 the ethertap, you have to compile the ethertap driver as a module, otherwise
303 you can also choose to compile it directly into the kernel.
305 If you decide to build any of these as dynamic kernel modules, it's a good idea
306 to add these lines to @file{/etc/modules.conf}:
309 alias char-major-36 netlink_dev
311 options tap0 -o tap0 unit=0
313 options tap1 -o tap1 unit=1
315 alias tap@emph{N} ethertap
316 options tap@emph{N} -o tap@emph{N} unit=@emph{N}
319 Add as much alias/options lines as necessary.
322 @c ==================================================================
323 @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
324 @subsection Configuration of Linux kernels 2.4.0 and higher
326 Here are the options you have to turn on when configuring a new kernel:
329 Code maturity level options
330 [*] Prompt for development and/or incomplete code/drivers
331 Network device support
332 <M> Universal TUN/TAP device driver support
335 It's not necessary to compile this driver as a module, even if you are going to
336 run more than one instance of tinc.
338 If you have an early 2.4 kernel, you can choose both the TUN/TAP driver and the
339 `Ethertap network tap' device. This latter is marked obsolete, and chances are
340 that it won't even function correctly anymore. Make sure you select the
341 universal TUN/TAP driver.
343 If you decide to build the TUN/TAP driver as a kernel module, add these lines
344 to @file{/etc/modules.conf}:
347 alias char-major-10-200 tun
351 @c ==================================================================
352 @node Configuration of FreeBSD kernels, Configuration of Solaris kernels, Configuration of Linux kernels 2.4.0 and higher, Configuring the kernel
353 @subsection Configuration of FreeBSD kernels
355 This section will contain information on how to configure your FreeBSD
356 kernel to support the universal TUN/TAP device. For 5.0 and 4.1
357 systems, this is included in the kernel configuration, for earlier
358 systems (4.0 and 3.x), you need to install the universal TUN/TAP driver
361 Unfortunately somebody still has to write the text.
364 @c ==================================================================
365 @node Configuration of Solaris kernels, , Configuration of FreeBSD kernels, Configuring the kernel
366 @subsection Configuration of Solaris kernels
368 This section will contain information on how to configure your Solaris
369 kernel to support the universal TUN/TAP device. You need to install
370 this driver yourself.
372 Unfortunately somebody still has to write the text.
375 @c ==================================================================
376 @node Libraries, , Configuring the kernel, Preparations
381 Before you can configure or build tinc, you need to have the OpenSSL
382 library installed on your system. If you try to configure tinc without
383 having installed it, configure will give you an error message, and stop.
390 @c ==================================================================
391 @node OpenSSL, , Libraries, Libraries
395 For all cryptography-related functions, tinc uses the functions provided
396 by the OpenSSL library.
398 If this library is not installed, you wil get an error when configuring
399 tinc for build. Support for running tinc without having OpenSSL
400 installed @emph{may} be added in the future.
402 You can use your operating system's package manager to install this if
403 available. Make sure you install the development AND runtime versions
406 If you have to install OpenSSL manually, you can get the source code
407 from @url{http://www.openssl.org/}. Instructions on how to configure,
408 build and install this package are included within the package. Please
409 make sure you build development and runtime libraries (which is the
412 If you installed the OpenSSL libraries from source, it may be necessary
413 to let configure know where they are, by passing configure one of the
414 --with-openssl-* parameters.
417 --with-openssl=DIR OpenSSL library and headers prefix
418 --with-openssl-include=DIR OpenSSL headers directory
419 (Default is OPENSSL_DIR/include)
420 --with-openssl-lib=DIR OpenSSL library directory
421 (Default is OPENSSL_DIR/lib)
425 @subsubheading License
428 Since the license under which OpenSSL is distributed is not directly
429 compatible with the terms of the GNU GPL
430 @uref{http://www.openssl.org/support/faq.html#LEGAL2}, therefore we
431 include an addition to the GPL (see also the file COPYING.README):
434 This program is released under the GPL with the additional exemption
435 that compiling, linking, and/or using OpenSSL is allowed. You may
436 provide binary packages linked to the OpenSSL libraries, provided that
437 all other requirements of the GPL are met.
450 @c ==================================================================
451 @node Installation, Configuration, Preparations, Top
452 @chapter Installation
454 If you use Redhat or Debian, you may want to install one of the
455 precompiled packages for your system. These packages are equipped with
456 system startup scripts and sample configurations.
458 If you don't run either of these systems, or you want to compile tinc
459 for yourself, you can use the source. The source is distributed under
460 the GNU General Public License (GPL). Download the source from the
461 @uref{http://tinc.nl.linux.org/download.html, download page}, which has
462 the checksums of these files listed; you may wish to check these with
463 md5sum before continuing.
465 tinc comes in a convenient autoconf/automake package, which you can just
466 treat the same as any other package. Which is just untar it, type
467 `configure' and then `make'.
468 More detailed instructions are in the file @file{INSTALL}, which is
469 included in the source distribution.
472 * Building and installing tinc::
477 @c ==================================================================
478 @node Building and installing tinc, System files, Installation, Installation
479 @section Building and installing tinc
481 Detailed instructions on configuring the source, building tinc and installing tinc
482 can be found in the file called @file{INSTALL}.
484 @cindex binary package
485 If you happen to have a binary package for tinc for your distribution,
486 you can use the package management tools of that distribution to install tinc.
487 The documentation that comes along with your distribution will tell you how to do that.
490 @c ==================================================================
491 @node System files, , Building and installing tinc, Installation
492 @section System files
494 Before you can run tinc, you must make sure you have all the needed
495 files on your system.
503 @c ==================================================================
504 @node Device files, Other files, System files, System files
505 @subsection Device files
508 First, you'll need the special device file(s) that form the interface
509 between the kernel and the daemon.
511 The permissions for these files have to be such that only the super user
512 may read/write to this file. You'd want this, because otherwise
513 eavesdropping would become a bit too easy. This does, however, imply
514 that you'd have to run tincd as root.
516 If you use Linux and have a kernel version prior to 2.4.0, you have to make the
520 mknod -m 600 /dev/tap0 c 36 16
524 Any further ethertap devices have minor device number 16 through 31.
526 If you use the universal TUN/TAP driver, you have to create the
527 following device files (unless they already exist):
530 mknod -m 600 /dev/tun c 10 200
534 If you use Linux, and you run the new 2.4 kernel using the devfs filesystem,
535 then the TUN/TAP device will probably be automatically generated as
539 @c ==================================================================
540 @node Other files, , Device files, System files
541 @subsection Other files
543 @subsubheading @file{/etc/networks}
545 You may add a line to @file{/etc/networks} so that your VPN will get a
546 symbolic name. For example:
552 @subsubheading @file{/etc/services}
555 You may add this line to @file{/etc/services}. The effect is that you
556 may supply a @samp{tinc} as a valid port number to some programs. The
557 number 655 is registered with the IANA.
562 # Ivo Timmermans <itimmermans@@bigfoot.com>
577 @c ==================================================================
578 @node Configuration, Running tinc, Installation, Top
579 @chapter Configuration
582 * Configuration introduction::
583 * Multiple networks::
584 * How connections work::
585 * Configuration files::
586 * Generating keypairs::
587 * Network interfaces::
588 * Example configuration::
591 @c ==================================================================
592 @node Configuration introduction, Multiple networks, Configuration, Configuration
593 @section Configuration introduction
595 @cindex Network Administrators Guide
596 Before actually starting to configure tinc and editing files,
597 make sure you have read this entire section so you know what to expect.
598 Then, make it clear to yourself how you want to organize your VPN:
599 What are the nodes (computers running tinc)?
600 What IP addresses/subnets do they have?
601 What is the network mask of the entire VPN?
602 Do you need special firewall rules?
603 Do you have to set up masquerading or forwarding rules?
604 These questions can only be answered by yourself,
605 you will not find the answers in this documentation.
606 Make sure you have an adequate understanding of networks in general.
607 A good resource on networking is the
608 @uref{http://www.linuxdoc.org/LDP/nag2/, Linux Network Administrators Guide}.
610 If you have everything clearly pictured in your mind,
611 proceed in the following order:
612 First, generate the configuration files (tinc.conf, your host configuration file, tinc-up and perhaps tinc-down).
613 Then generate the keypairs.
614 Finally, distribute the host configuration files.
615 These steps are described in the subsections below.
618 @c ==================================================================
619 @node Multiple networks, How connections work, Configuration introduction, Configuration
620 @section Multiple networks
622 @cindex multiple networks
624 In order to allow you to run more than one tinc daemon on one computer,
625 for instance if your computer is part of more than one VPN,
626 you can assign a ``netname'' to your VPN.
627 It is not required if you only run one tinc daemon,
628 it doesn't even have to be the same on all the sites of your VPN,
629 but it is recommended that you choose one anyway.
631 We will asume you use a netname throughout this document.
632 This means that you call tincd with the -n argument,
633 which will assign a netname to this daemon.
635 The effect of this is that the daemon will set its configuration
636 ``root'' to /etc/tinc/netname/, where netname is your argument to the -n
637 option. You'll notice that it appears in syslog as ``tinc.netname''.
639 However, it is not strictly necessary that you call tinc with the -n
640 option. In this case, the network name would just be empty, and it will
641 be used as such. tinc now looks for files in /etc/tinc/, instead of
642 /etc/tinc/netname/; the configuration file should be /etc/tinc/tinc.conf,
643 and the host configuration files are now expected to be in /etc/tinc/hosts/.
645 But it is highly recommended that you use this feature of tinc, because
646 it will be so much clearer whom your daemon talks to. Hence, we will
647 assume that you use it.
650 @c ==================================================================
651 @node How connections work, Configuration files, Multiple networks, Configuration
652 @section How connections work
654 When tinc starts up, it parses the command-line options and then
655 reads in the configuration file.
656 If it sees a `ConnectTo' value pointing to another tinc daemon in the file,
657 it will try to connect to that other one.
658 Whether this succeeds or not and whether `ConnectTo' is specified or not,
659 tinc will listen for incoming connection from other deamons.
660 If you did specify a `ConnectTo' value and the other side is not responding,
661 tinc will keep retrying.
662 This means that once started, tinc will stay running until you tell it to stop,
663 and failures to connect to other tinc daemons will not stop your tinc daemon
664 for trying again later.
665 This means you don't have to intervene if there are any network problems.
669 There is no real distinction between a server and a client in tinc.
670 If you wish, you can view a tinc daemon without a `ConnectTo' value as a server,
671 and one which does specify such a value as a client.
672 It does not matter if two tinc daemons have a `ConnectTo' value pointing to eachother however.
675 @c ==================================================================
676 @node Configuration files, Generating keypairs, How connections work, Configuration
677 @section Configuration files
679 The actual configuration of the daemon is done in the file
680 @file{/etc/tinc/netname/tinc.conf} and at least one other file in the directory
681 @file{/etc/tinc/netname/hosts/}.
683 These file consists of comments (lines started with a #) or assignments
690 The variable names are case insensitive, and any spaces, tabs, newlines
691 and carriage returns are ignored. Note: it is not required that you put
692 in the `=' sign, but doing so improves readability. If you leave it
693 out, remember to replace it with at least one space character.
695 In this section all valid variables are listed in alphabetical order.
696 The default value is given between parentheses; required directives are
697 given in @strong{bold}.
700 * Main configuration variables::
701 * Host configuration variables::
706 @c ==================================================================
707 @node Main configuration variables, Host configuration variables, Configuration files, Configuration files
708 @subsection Main configuration variables
711 @item @strong{ConnectTo = <name>}
713 Specifies which host to connect to on startup. Multiple ConnectTo
714 variables may be specified, if connecting to the first one fails then
715 tinc will try the next one, and so on. It is possible to specify
716 hostnames for dynamic IP addresses (like those given on dyndns.org),
717 tinc will not cache the resolved IP address.
719 If you don't specify a host with ConnectTo, regardless of whether a
720 value for ConnectPort is given, tinc won't connect at all, and will
721 instead just listen for incoming connections.
723 @item Hostnames = <yes|no> (no)
725 This option selects whether IP addresses (both real and on the VPN)
726 should be resolved. Since DNS lookups are blocking, it might affect
727 tinc's efficiency, even stopping the daemon for a few seconds everytime
728 it does a lookup if your DNS server is not responding.
730 This does not affect resolving hostnames to IP addresses from the
733 @item Interface = <device>
735 If you have more than one network interface in your computer, tinc will
736 by default listen on all of them for incoming connections. It is
737 possible to bind tinc to a single interface like eth0 or ppp0 with this
740 @item InterfaceIP = <local address>
742 If your computer has more than one IP address on a single interface (for
743 example if you are running virtual hosts), tinc will by default listen
744 on all of them for incoming connections. It is possible to bind tinc to
745 a single IP address with this variable. It is still possible to listen
746 on several interfaces at the same time though, if they share the same IP
749 @item KeyExpire = <seconds> (3600)
751 This option controls the time the encryption keys used to encrypt the data
752 are valid. It is common practice to change keys at regular intervals to
753 make it even harder for crackers, even though it is thought to be nearly
754 impossible to crack a single key.
756 @item ListenPort = <port> (655)
758 Listen on local port port. The computer connecting to this daemon should
759 use this number as the argument for his ConnectPort.
761 @item @strong{Name = <name>}
763 This is a symbolic name for this connection. It can be anything
765 @item PingTimeout = <seconds> (5)
767 The number of seconds of inactivity that tinc will wait before sending a
768 probe to the other end. If that other end doesn't answer within that
769 same amount of seconds, the connection is terminated, and the others
770 will be notified of this.
772 @item PrivateKey = <key> (obsolete)
774 This is the RSA private key for tinc. However, for safety reasons it is
775 advised to store private keys of any kind in separate files. This prevents
776 accidental eavesdropping if you are editting the configuration file.
778 @item @strong{PrivateKeyFile = <path>} (recommended)
779 @cindex PrivateKeyFile
780 This is the full path name of the RSA private key file that was
781 generated by ``tincd --generate-keys''. It must be a full path, not a
784 @item @strong{TapDevice = <device>} (/dev/tap0)
786 The ethertap device to use. Note that you can only use one device per
787 daemon. The info pages of the tinc package contain more information
788 about configuring an ethertap device for Linux.
790 @item TCPonly = <yes|no> (no, experimental)
792 If this variable is set to yes, then the packets are tunnelled over a TCP
793 connection instead of a UDP connection. This is especially useful for those
794 who want to run a tinc daemon from behind a masquerading firewall, or if
795 UDP packet routing is disabled somehow. This is experimental code,
796 try this at your own risk.
800 @c ==================================================================
801 @node Host configuration variables, How to configure, Main configuration variables, Configuration files
802 @subsection Host configuration variables
805 @item @strong{Address = <IP address|hostname>}
807 This variable is only required if you want to connect to this host. It
808 must resolve to the external IP address where the host can be reached,
809 not the one that is internal to the VPN.
811 @item IndirectData = <yes|no> (no, experimental)
813 This option specifies whether other tinc daemons besides the one you
814 specified with ConnectTo can make a direct connection to you. This is
815 especially useful if you are behind a firewall and it is impossible to
816 make a connection from the outside to your tinc daemon. Otherwise, it
817 is best to leave this option out or set it to no.
819 @item Port = <port> (655)
821 Connect to the upstream host (given with the ConnectTo directive) on
822 port port. port may be given in decimal (default), octal (when preceded
823 by a single zero) o hexadecimal (prefixed with 0x). port is the port
824 number for both the UDP and the TCP (meta) connections.
826 @item PublicKey = <key> (obsolete)
828 This is the RSA public key for this host.
830 @item PublicKeyFile = <path> (obsolete)
831 @cindex PublicKeyFile
832 This is the full path name of the RSA public key file that was generated
833 by ``tincd --generate-keys''. It must be a full path, not a relative
837 From version 1.0pre4 on tinc will store the public key directly into the
838 host configuration file in PEM format, the above two options then are not
839 necessary. Either the PEM format is used, or exactly
840 @strong{one of the above two options} must be specified
841 in each host configuration file, if you want to be able to establish a
842 connection with that host.
844 @item Subnet = <IP address/maskbits>
846 This is the subnet range of all IP addresses that will be accepted by
847 the host that defines it.
849 The range must be contained in the IP address range of the tap device,
850 not the real IP address of the host running tincd.
852 @cindex CIDR notation
853 maskbits is the number of bits set to 1 in the netmask part; for
854 example: netmask 255.255.255.0 would become /24, 255.255.252.0 becomes
855 /22. This conforms to standard CIDR notation as described in
856 @uref{ftp://ftp.isi.edu/in-notes/rfc1519.txt, RFC1519}
858 @item TCPonly = <yes|no> (no, experimental)
860 If this variable is set to yes, then the packets are tunnelled over a
861 TCP connection instead of a UDP connection. This is especially useful
862 for those who want to run a tinc daemon from behind a masquerading
863 firewall, or if UDP packet routing is disabled somehow. This is
864 experimental code, try this at your own risk. It may not work at all.
868 @c ==================================================================
869 @node How to configure, , Host configuration variables, Configuration files
870 @subsection How to configure
872 @subsubheading Step 1. Creating the main configuration file
874 The main configuration file will be called @file{/etc/tinc/netname/tinc.conf}.
875 Adapt the following example to create a basic configuration file:
878 Name = @emph{yourname}
879 TapDevice = @emph{/dev/tap0}
880 PrivateKeyFile = /etc/tinc/@emph{netname}/rsa_key.priv
883 Then, if you know to which other tinc daemon(s) yours is going to connect,
884 add `ConnectTo' values.
886 @subsubheading Step 2. Creating your host configuration file
888 If you added a line containing `Name = yourname' in the main configuarion file,
889 you will need to create a host configuration file @file{/etc/tinc/netname/hosts/yourname}.
890 Adapt the following example to create a host configuration file:
893 Address = @emph{your.real.hostname.org}
894 Subnet = @emph{192.168.1.0/24}
897 You can also use an IP address instead of a hostname.
898 The `Subnet' specifies the address range that is local for @emph{your part of the VPN only}.
899 If you have multiple address ranges you can specify more than one `Subnet'.
900 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).
903 @c ==================================================================
904 @node Generating keypairs, Network interfaces, Configuration files, Configuration
905 @section Generating keypairs
907 @cindex key generation
908 Now that you have already created the main configuration file and your host configuration file,
909 you can easily create a public/private keypair by entering the following command:
912 tincd -n @emph{netname} -K
915 tinc will generate a public and a private key and ask you where to put them.
916 Just press enter to accept the defaults.
919 @c ==================================================================
920 @node Network interfaces, Example configuration, Generating keypairs, Configuration
921 @section Network interfaces
923 Before tinc can start transmitting data over the tunnel, it must
924 set up the ethertap network devices.
926 First, decide which IP addresses you want to have associated with these
927 devices, and what network mask they must have.
929 tinc will open an ethertap device or TUN/TAP device, which will also
930 create a network interface called `tap0', or `tap1', and so on if you are using
931 the ethertap driver, or a network interface with the same name as netname
932 if you are using the universal TUN/TAP driver.
935 You can configure that device by putting ordinary ifconfig, route, and other commands
936 to a script named @file{/etc/tinc/netname/tinc-up}. When tinc starts, this script
937 will be executed. When tinc exits, it will execute the script named
938 @file{/etc/tinc/netname/tinc-down}, but normally you don't need to create that script.
940 An example @file{tinc-up} script when using the TUN/TAP driver:
944 ifconfig $NETNAME hw ether fe:fd:00:00:00:00
945 ifconfig $NETNAME @emph{xx}.@emph{xx}.@emph{xx}.@emph{xx} netmask @emph{mask}
946 ifconfig $NETNAME -arp
950 @cindex hardware address
951 The first line sets up the MAC address of the network interface.
952 Due to the nature of how Ethernet and tinc work, it has to be set to fe:fd:00:00:00:00.
953 (tinc versions prior to 1.0pre3 required that the MAC address matched the IP address.)
954 You can use the environment variable $NETNAME to get the name of the interface.
955 If you are using the ethertap driver however, you need to replace it with tap@emph{N},
956 corresponding to the device file name.
959 The next line gives the interface an IP address and a netmask.
960 The kernel will also automatically add a route to this interface, so normally you don't need
961 to add route commands to the @file{tinc-up} script.
962 The kernel will also bring the interface up after this command.
964 The netmask is the mask of the @emph{entire} VPN network, not just your
968 The last line tells the kernel not to use ARP on that interface.
969 Again this has to do with how Ethernet and tinc work. Don't forget to add this line.
972 @c ==================================================================
973 @node Example configuration, , Network interfaces, Configuration
974 @section Example configuration
978 Imagine the following situation. Branch A of our example `company' wants to connect
979 three branch offices in B, C and D using the Internet. All four offices
980 have a 24/7 connection to the Internet.
982 A is going to serve as the center of the network. B and C will connect
983 to A, and D will connect to C. Each office will be assigned their own IP
987 A: net 10.1.0.0 mask 255.255.0.0 gateway 10.1.54.1 internet IP 1.2.3.4
988 B: net 10.2.0.0 mask 255.255.0.0 gateway 10.2.1.12 internet IP 2.3.4.5
989 C: net 10.3.0.0 mask 255.255.0.0 gateway 10.3.69.254 internet IP 3.4.5.6
990 D: net 10.4.0.0 mask 255.255.0.0 gateway 10.4.3.32 internet IP 4.5.6.7
993 ``gateway'' is the VPN IP address of the machine that is running the
994 tincd. ``internet IP'' is the IP address of the firewall, which does not
995 need to run tincd, but it must do a port forwarding of TCP&UDP on port
996 655 (unless otherwise configured).
998 In this example, it is assumed that eth0 is the interface that points to
999 the inner (physical) LAN of the office, although this could also be the
1000 same as the interface that leads to the Internet. The configuration of
1001 the real interface is also shown as a comment, to give you an idea of
1002 how these example host is set up. All branches use the netname `company'
1003 for this particular VPN.
1005 @subsubheading For Branch A
1007 @emph{BranchA} would be configured like this:
1009 In @file{/etc/tinc/company/tinc-up}:
1012 # Real interface of internal network:
1013 # ifconfig eth0 10.1.54.1 netmask 255.255.0.0 broadcast 10.1.255.255
1015 ifconfig tap0 hw ether fe:fd:00:00:00:00
1016 ifconfig tap0 10.1.54.1 netmask 255.0.0.0
1020 and in @file{/etc/tinc/company/tinc.conf}:
1024 PrivateKey = /etc/tinc/company/rsa_key.priv
1025 TapDevice = /dev/tap0
1028 On all hosts, /etc/tinc/company/hosts/BranchA contains:
1031 Subnet = 10.1.0.0/16
1034 Note that the IP addresses of eth0 and tap0 are the same.
1035 This is quite possible, if you make sure that the netmasks of the interfaces are different.
1036 It is in fact recommended to give give both real internal network interfaces and tap interfaces the same IP address,
1037 since that will make things a lot easier to remember and set up.
1039 -----BEGIN RSA PUBLIC KEY-----
1041 -----END RSA PUBLIC KEY-----
1045 @subsubheading For Branch B
1047 In @file{/etc/tinc/company/tinc-up}:
1050 # Real interface of internal network:
1051 # ifconfig eth0 10.2.43.8 netmask 255.255.0.0 broadcast 10.2.255.255
1053 ifconfig tap0 hw ether fe:fd:00:00:00:00
1054 ifconfig tap0 10.2.1.12 netmask 255.0.0.0
1058 and in @file{/etc/tinc/company/tinc.conf}:
1063 PrivateKey = /etc/tinc/company/rsa_key.priv
1066 Note here that the internal address (on eth0) doesn't have to be the
1067 same as on the tap0 device. Also, ConnectTo is given so that no-one can
1068 connect to this node.
1070 On all hosts, in @file{/etc/tinc/company/hosts/BranchB}:
1073 Subnet = 10.2.0.0/16
1076 -----BEGIN RSA PUBLIC KEY-----
1078 -----END RSA PUBLIC KEY-----
1082 @subsubheading For Branch C
1084 In @file{/etc/tinc/company/tinc-up}:
1087 # Real interface of internal network:
1088 # ifconfig eth0 10.3.69.254 netmask 255.255.0.0 broadcast 10.3.255.255
1090 ifconfig tap1 hw ether fe:fd:00:00:00:00
1091 ifconfig tap1 10.3.69.254 netmask 255.0.0.0
1095 and in @file{/etc/tinc/company/tinc.conf}:
1100 TapDevice = /dev/tap1
1103 C already has another daemon that runs on port 655, so they have to
1104 reserve another port for tinc. It knows the portnumber it has to listen on
1105 from it's own host configuration file.
1107 On all hosts, in @file{/etc/tinc/company/hosts/BranchC}:
1111 Subnet = 10.3.0.0/16
1114 -----BEGIN RSA PUBLIC KEY-----
1116 -----END RSA PUBLIC KEY-----
1120 @subsubheading For Branch D
1122 In @file{/etc/tinc/company/tinc-up}:
1125 # Real interface of internal network:
1126 # ifconfig eth0 10.4.3.32 netmask 255.255.0.0 broadcast 10.4.255.255
1128 ifconfig company hw ether fe:fd:0a:04:03:20
1129 ifconfig company 10.4.3.32 netmask 255.0.0.0
1130 ifconfig company -arp
1133 and in @file{/etc/tinc/company/tinc.conf}:
1138 TapDevice = /dev/net/tun
1139 PrivateKeyFile = /etc/tinc/company/rsa_key.priv
1142 D will be connecting to C, which has a tincd running for this network on
1143 port 2000. It knows the port number from the host configuration file.
1144 Also note that since D uses the TUN/TAP driver, the network interface
1145 will not be called `tun' or `tap0' or something like that, but will
1146 have the same name as netname.
1148 On all hosts, in @file{/etc/tinc/company/hosts/BranchD}:
1151 Subnet = 10.4.0.0/16
1154 -----BEGIN RSA PUBLIC KEY-----
1156 -----END RSA PUBLIC KEY-----
1159 @subsubheading Key files
1161 A, B, C and D all have generated a public/private keypair with the following command:
1167 The private key is stored in @file{/etc/tinc/company/rsa_key.priv},
1168 the public key is put into the host configuration file in the @file{/etc/tinc/company/hosts/} directory.
1169 During key generation, tinc automatically guesses the right filenames based on the -n option and
1170 the Name directive in the @file{tinc.conf} file (if it is available).
1172 @subsubheading Starting
1174 After each branch has finished configuration and they have distributed
1175 the host configuration files amongst them, they can start their tinc daemons.
1176 They don't necessarily have to wait for the other branches to have started
1177 their daemons, tinc will try connecting until they are available.
1180 @c ==================================================================
1181 @node Running tinc, Technical information, Configuration, Top
1182 @chapter Running tinc
1184 If everything else is done, you can start tinc by typing the following command:
1187 tincd -n @emph{netname}
1191 tinc will detach from the terminal and continue to run in the background like a good daemon.
1192 If there are any problems however you can try to increase the debug level
1193 and look in the syslog to find out what the problems are.
1201 @c ==================================================================
1202 @node Runtime options, Error messages, , Running tinc
1203 @section Runtime options
1205 Besides the settings in the configuration file, tinc also accepts some
1206 command line options.
1208 This list is a longer version of that in the manpage. The latter is
1209 generated automatically, so may be more up-to-date.
1211 @cindex command line
1212 @cindex runtime options
1216 @item -c, --config=PATH
1217 Read configuration options from the directory PATH. The default is
1218 @file{/etc/tinc/netname/}.
1222 Increase debug level. The higher it gets, the more gets
1223 logged. Everything goes via syslog.
1225 0 is the default, only some basic information connection attempts get
1226 logged. Setting it to 1 will log a bit more, still not very
1227 disturbing. With two -d's tincd will log protocol information, which can
1228 get pretty noisy. Three or more -d's will output every single packet
1229 that goes out or comes in, which probably generates more data than the
1233 Attempt to kill a running tincd and exit. A TERM signal (15) gets sent
1234 to the daemon that his its PID in /var/run/tinc.pid.
1236 Because it kills only one tinc daemon, you should use -n here if you
1237 started it that way. It will then read the PID from
1238 @file{/var/run/tinc.NETNAME.pid}.
1240 @item -n, --net=NETNAME
1241 Connect to net NETNAME. @xref{Multiple networks}.
1243 @item -K, --generate-keys[=BITS]
1244 Generate public/private keypair of BITS length. If BITS is not specified,
1245 1024 is the default. tinc will ask where you want to store the files,
1246 but will default to the configuration directory (you can use the -c or -n option
1247 in combination with -K). After that, tinc will quit.
1250 Display a short reminder of these runtime options and terminate.
1253 Output version information and exit.
1258 @c ==================================================================
1259 @node Error messages, , Runtime options, Running tinc
1260 @section Error messages
1262 What follows is a list of the most common error messages you can see
1263 when configuring tinc. Most of these messages are visible in the syslog
1264 only, so keep an eye on it!
1267 @item Could not open /dev/tap0: No such device
1270 @item You forgot to `modprobe netlink_dev' or `modprobe ethertap'.
1271 @item You forgot to compile `Netlink device emulation' in the kernel.
1274 @item Can't write to /dev/net/tun: No such device
1277 @item You forgot to `modprobe tun'.
1278 @item You forgot to compile `Universal TUN/TAP driver' in the kernel.
1281 @item Packet with destination 1.2.3.4 is looping back to us!
1284 @item Something is not configured right. Packets are being sent out to the
1285 tap device, but according to the Subnet directives in your host configuration
1286 file, those packets should go to your own host. Most common mistake is that
1287 you have a Subnet line in your host configuration file with a netmask which is
1288 just as large as the netmask of the tap device. The latter should in almost all
1289 cases be larger. Rethink your configuration.
1290 Note that you will only see this message if you specified a debug
1291 level of 5 or higher!
1292 @item Chances are that a `Subnet = ...' line in the host configuration file of this tinc daemon is wrong.
1293 Change it to a subnet that is accepted locally by another interface,
1294 or if that is not the case, try changing the prefix length into /32.
1297 @item Network doesn't work, syslog shows only packets of length 46
1301 Jan 1 12:00:00 host tinc.net[1234]: Read packet of length 46 from tap device
1302 Jan 1 12:00:00 host tinc.net[1234]: Trying to look up 0.0.192.168 in connection list failed!
1305 @item Add the `ifconfig $NETNAME -arp' to tinc-up.
1308 @item Network address and subnet mask do not match!
1311 @item The Subnet field must contain a @emph{network} address.
1312 @item If you only want to use one IP address, set the netmask to /32.
1315 @item This is a bug: net.c:253: 24: Some error
1318 @item This is something that should not have happened.
1319 Please report this, and tell us exactly what went wrong before you got
1320 this message. In normal operation, these errors should not occur.
1323 @item Error reading RSA key file `rsa_key.priv': No such file or directory
1326 @item You must specify the complete pathname.
1327 Specifying a relative path does not make sense here. tinc changes its
1328 directory to / when starting (to avoid keeping a mount point busy); and
1329 even if we built in a default directory to look for these files, the key
1330 files are bound to be in a different directory.
1335 @c ==================================================================
1336 @node Technical information, About us, Running tinc, Top
1337 @chapter Technical information
1346 @c ==================================================================
1347 @node The Connection, Security, Technical information, Technical information
1348 @section The basic philosophy of the way tinc works
1351 tinc is a daemon that takes VPN data and transmit that to another host
1352 computer over the existing Internet infrastructure.
1355 * Protocol Preview::
1356 * The Meta-connection::
1360 @c ==================================================================
1361 @node Protocol Preview, The Meta-connection, The Connection, The Connection
1362 @subsection A preview of the way the tinc works
1366 The data itself is read from a character device file, the so-called
1367 @emph{ethertap} device. This device is associated with a network
1368 interface. Any data sent to this interface can be read from the device,
1369 and any data written to the device gets sent from the interface. Data to
1370 and from the device is formatted as if it were a normal Ethernet card,
1371 so a frame is preceded by two MAC addresses and a @emph{frame type}
1374 So when tinc reads an Ethernet frame from the device, it determines its
1375 type. Right now, tinc can only handle Internet Protocol version 4 (IPv4)
1376 frames, because it needs IP headers for routing.
1377 Plans to support other protocols and switching instead of routing are being made.
1378 (Some code for IPv6 routing and switching is already present but nonfunctional.)
1380 which type of frame it has read, it can also read the source and
1381 destination address from it.
1383 Now it is time that the frame gets encrypted. Currently the only
1384 encryption algorithm available is blowfish.
1386 @cindex encapsulating
1388 When the encryption is ready, time has come to actually transport the
1389 packet to the destination computer. We do this by sending the packet
1390 over an UDP connection to the destination host. This is called
1391 @emph{encapsulating}, the VPN packet (though now encrypted) is
1392 encapsulated in another IP datagram.
1394 When the destination receives this packet, the same thing happens, only
1395 in reverse. So it does a decrypt on the contents of the UDP datagram,
1396 and it writes the decrypted information to its own ethertap device.
1398 To let the kernel on the receiving end accept the packet, the destination MAC
1399 address must match that of the tap interface. Because of the routing nature
1400 of tinc, ARP is not possible. tinc solves this by always overwriting the
1401 destination MAC address with fe:fd:0:0:0:0. That is also the reason why you must
1402 set the MAC address of your tap interface to that address.
1405 @c ==================================================================
1406 @node The Meta-connection, , Protocol Preview, The Connection
1407 @subsection The meta-connection
1409 Having only an UDP connection available is not enough. Though suitable
1410 for transmitting data, we want to be able to reliably send other
1411 information, such as routing and session key information to somebody.
1414 TCP is a better alternative, because it already contains protection
1415 against information being lost, unlike UDP.
1417 So we establish two connections. One for the encrypted VPN data, and one
1418 for other information, the meta-data. Hence, we call the second
1419 connection the meta-connection. We can now be sure that the
1420 meta-information doesn't get lost on the way to another computer.
1422 @cindex data-protocol
1423 @cindex meta-protocol
1424 Like with any communication, we must have a protocol, so that everybody
1425 knows what everything stands for, and how she should react. Because we
1426 have two connections, we also have two protocols. The protocol used for
1427 the UDP data is the ``data-protocol,'' the other one is the
1430 The reason we don't use TCP for both protocols is that UDP is much
1431 better for encapsulation, even while it is less reliable. The real
1432 problem is that when TCP would be used to encapsulate a TCP stream
1433 that's on the private network, for every packet sent there would be
1434 three ACKs sent instead of just one. Furthermore, if there would be
1435 a timeout, both TCP streams would sense the timeout, and both would
1436 start re-sending packets.
1438 @c ==================================================================
1439 @node Security, , The Connection, Technical information
1440 @section About tinc's encryption and other security-related issues.
1444 tinc got its name from ``TINC,'' short for @emph{There Is No Cabal}; the
1445 alleged Cabal was/is an organisation that was said to keep an eye on the
1446 entire Internet. As this is exactly what you @emph{don't} want, we named
1447 the tinc project after TINC.
1450 But in order to be ``immune'' to eavesdropping, you'll have to encrypt
1451 your data. Because tinc is a @emph{Secure} VPN (SVPN) daemon, it does
1452 exactly that: encrypt.
1453 tinc uses blowfish encryption in CBC mode and a small amount of salt
1454 at the beginning of each packet to make sure eavesdroppers cannot get
1455 any information at all from the packets they can intercept.
1457 @cindex authentication
1458 Another important part is the authentication done prior to allowing other
1459 tinc daemons to connect. This is done by a challenge/response handshake
1460 involving RSA encryption.
1461 The details of the authentication can be found in a file called @file{doc/SECURITY2}
1462 in the source of tinc.
1465 @c ==================================================================
1466 @node About us, Concept Index, Technical information, Top
1471 * Contact Information::
1476 @c ==================================================================
1477 @node Contact Information, Authors, About us, About us
1478 @section Contact information
1481 tinc's website is at @url{http://tinc.nl.linux.org/},
1482 this server is located in the Netherlands.
1485 We have an IRC channel on the Open Projects IRC network. Connect to
1486 @uref{http://openprojects.nu/services/irc.html, irc.openprojects.net},
1487 and join channel #tinc.
1490 @c ==================================================================
1491 @node Authors, , Contact Information, About us
1495 @item Ivo Timmermans (zarq) (@email{itimmermans@@bigfoot.com})
1496 Main coder/hacker and maintainer of the package.
1498 @item Guus Sliepen (guus) (@email{guus@@sliepen.warande.net})
1499 Originator of it all, co-author.
1501 @item Wessel Dankers (Ubiq) (@email{wsl@@nl.linux.org})
1502 For the name `tinc' and various suggestions.
1506 We have received a lot of valuable input from users. With their help,
1507 tinc has become the flexible and robust tool that it is today. We have
1508 composed a list of contributions, in the file called @file{THANKS} in
1509 the source distribution.
1512 @c ==================================================================
1513 @node Concept Index, , About us, Top
1514 @c node-name, next, previous, up
1515 @unnumbered Concept Index
1517 @c ==================================================================
1521 @c ==================================================================