- Made Makefile.am stub for doc/es/
[tinc] / doc / tinc.texi
1 \input texinfo   @c -*-texinfo-*-
2 @c $Id: tinc.texi,v 1.8.4.5 2000/10/14 22:22:06 zarq Exp $
3 @c %**start of header
4 @setfilename tinc.info
5 @settitle tinc Manual
6 @setchapternewpage odd
7 @c %**end of header
8
9 @ifinfo
10 @direntry
11 * tinc: (tinc).              The tinc Manual.
12 @end direntry
13
14 This is the info manual for tinc, a Virtual Private Network daemon.
15
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>.
19
20 $Id: tinc.texi,v 1.8.4.5 2000/10/14 22:22:06 zarq Exp $
21
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.
25
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.
30
31 @end ifinfo
32
33 @titlepage
34 @title tinc Manual
35 @subtitle Setting up a Virtual Private Network with tinc
36 @author Ivo Timmermans and Guus Sliepen
37
38 @page
39 @vskip 0pt plus 1filll
40 @cindex copyright
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>.
44
45 $Id: tinc.texi,v 1.8.4.5 2000/10/14 22:22:06 zarq Exp $
46
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.
50
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.
55
56 @end titlepage
57
58 @c ==================================================================
59 @node Top, Introduction, (dir), (dir)
60
61 @menu
62 * Introduction::                Introduction
63 * Installing tinc - preparations::  
64 * Installing tinc - installation::  
65 * Configuring tinc::            
66 * Running tinc::                
67 * Technical information::       
68 * About us::                    
69 * Concept Index::               All used terms explained
70 @end menu
71
72
73 @contents
74
75 @c ==================================================================
76 @node    Introduction, Installing tinc - preparations, Top, Top
77 @chapter Introduction
78
79 @cindex tinc
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
82 Internet.
83
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
87 This tunneling allows VPN sites to share information with each other
88 over the Internet without exposing any information to others.
89
90 This document is the manual for tinc. Included are chapters on how to
91 configure your computer to use tinc, as well as the configuration
92 process of tinc itself.
93
94 @menu
95 * VPNs::                        Virtual Private Networks in general
96 * tinc::                        about tinc
97 * Supported platforms::         
98 @end menu
99
100 @c ==================================================================
101 @node    VPNs, tinc, Introduction, Introduction
102 @section Virtual Private Networks
103
104 @cindex VPN
105 A Virtual Private Network or VPN is a network that can only be accessed
106 by a few elected computers that participate. This goal is achievable in
107 more than just one way.
108
109 @cindex private
110 Private networks can consist of a single stand-alone ethernet LAN. Or
111 even two computers hooked up using a null-modem cable. In these cases,
112 it is
113 obvious that the network is @emph{private}, no one can access it from the
114 outside. But if your computers are linked to the internet, the network
115 is not private anymore, unless one uses firewalls to block all private
116 traffic. But then, there is no way to send private data to trusted
117 computers on the other end of the internet.
118
119 @cindex virtual
120 This problem can be solved by using @emph{virtual} networks. Virtual
121 networks can live on top of other networks, but 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.
126
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.
131
132 @cindex virtual
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
136 participants.
137
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.
141
142
143 @c ==================================================================
144 @node    tinc, Supported platforms, VPNs, Introduction
145 @section tinc
146
147 @cindex vpnd
148 @cindex ethertap
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}.
154
155 Since then, a lot has changed---to say the least.
156
157 @cindex tincd
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.
162
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.
167
168 Meanwhile, we're always open-minded towards new ideas. And we're
169 available too.
170
171
172 @c ==================================================================
173 @node    Supported platforms,  , tinc, Introduction
174 @section Supported platforms
175
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
181 packets.
182
183 @c ==================================================================
184 @subsection Linux
185
186 tinc was first written for Linux running on an intel x86 processor, so
187 this is the best supported platform.  The protocol however, and actually
188 anything about tinc, has been rewritten to support random byte ordering
189 and arbitrary word length.  So in theory it should run on other
190 processors that Linux runs on.  Take care however, we haven't been able
191 to really test it yet.  If you want to run tinc on another platform than
192 x86, and want to tell us how it went, please do so.
193
194 tinc uses the ethertap device that is provided in the standard kernel
195 since version 2.1.60, so anything above that (2.2.x, 2.3.x, and the
196 2.4.0-testx (which is current at the time of this writing) kernel
197 versions) is able to support tinc.
198
199
200 @c ==================================================================
201 @subsection FreeBSD
202
203 tinc on FreeBSD relies on the universial TUN/TAP driver for its data
204 acquisition from the kernel.  Therefore, tinc suports the same platforms
205 as this driver.  These are: FreeBSD 3.x, 4.x, 5.x.
206
207
208 @c ==================================================================
209 @subsection Solaris
210
211 tinc on Solaris relies on the universial TUN/TAP driver for its data
212 acquisition from the kernel.  Therefore, tinc suports the same platforms
213 as this driver.  These are: Solaris, 2.1.x.
214
215
216 @c
217 @c
218 @c
219 @c
220 @c
221 @c
222 @c       Preparing your system
223 @c
224 @c
225 @c
226 @c
227 @c
228
229 @c ==================================================================
230 @node    Installing tinc - preparations, Installing tinc - installation, Introduction, Top
231 @chapter Installing tinc: preparations
232
233 This chapter contains information on how to prepare your system to
234 support tinc.
235
236 @menu
237 * Configuring the kernel::      
238 * Libraries::                   
239 @end menu
240
241
242 @c ==================================================================
243 @node    Configuring the kernel, Libraries, Installing tinc - preparations, Installing tinc - preparations
244 @section Configuring the kernel
245
246 If you are running Linux, chances are good that your kernel already
247 supports all the devices that tinc needs for proper operation.  For
248 example, the standard kernel from Redhat Linux already has support for
249 ethertap and netlink compiled in.  Debian users can use the modconf
250 utility to select the modules.  If your Linux distribution supports this
251 method of selecting devices, look out for something called `ethertap',
252 and `netlink_dev'.  You need both these devices.
253
254 If you can install these devices in a similar manner, you may skip this
255 section.
256
257 @menu
258 * Configuration of the Linux kernel::  
259 * Configuration of the FreeBSD kernel::  
260 * Configuration of the Solaris kernel::  
261 @end menu
262
263
264 @c ==================================================================
265 @node       Configuration of the Linux kernel, Configuration of the FreeBSD kernel, Configuring the kernel, Configuring the kernel
266 @subsection Configuring the Linux kernel
267
268 Since this particular implementation only runs on 2.1 or higher Linux
269 kernels, you should grab one (2.2 is current at this time). A 2.0 port
270 is not really possible, unless someone tells me someone ported the
271 ethertap and netlink devices back to 2.0.
272
273 If you are unfamiliar with the process of configuring and compiling a
274 new kernel, you should read the
275 @uref{http://howto.linuxberg.com/LDP/HOWTO/Kernel-HOWTO.html, Kernel
276 HOWTO} first. Do that now!
277
278 Here are the options you have to turn on when configuring a new
279 kernel.
280
281 For kernel 2.2.x:
282
283 @example
284 Code maturity level options
285 [*] Prompt for development and/or incomplete code/drivers
286 Networking options
287 [*] Kernel/User netlink socket
288 <*> Netlink device emulation
289 Network device support
290 <*> Ethertap network tap
291 @end example
292
293 For kernel 2.3.x and 2.4.x:
294
295 @example
296 Code maturity level options
297 [*] Prompt for development and/or incomplete code/drivers
298 Networking options
299 [*] Kernel/User netlink socket
300 <*> Netlink device emulation
301 Network device support
302 <*> Universal TUN/TAP device driver support
303 @end example
304
305
306 Any other options not mentioned here are not relevant to tinc. If you
307 decide to build any of these as dynamic kernel modules, it's a good idea
308 to add these lines to @file{/etc/modules.conf}.
309
310 @example
311 alias tap0 ethertap
312 alias char-major-36 netlink_dev
313 @end example
314
315 If you have a 2.4 kernel, you can also choose to use the `Ethertap
316 network tap' device.  This is marked obsolete, because the universal
317 TUN/TAP driver is a newer implementation that is supposed to be used in
318 favor of ethertap.  For tinc, it doesn't really matter which one you
319 choose; based on the device file name, tinc will make the right choice
320 about what protocol to use.
321
322 Finally, after having set up other options, build the kernel and boot
323 it.  Unfortunately it's not possible to insert these modules in a
324 running kernel.
325
326
327 @c ==================================================================
328 @node       Configuration of the FreeBSD kernel, Configuration of the Solaris kernel, Configuration of the Linux kernel, Configuring the kernel
329 @subsection Configuring the FreeBSD kernel
330
331 This section will contain information on how to configure your FreeBSD
332 kernel to support the universal TUN/TAP device.  For 5.0 and 4.1
333 systems, this is included in the kernel configuration, for earlier
334 systems (4.0 and 3.x), you need to install the universal TUN/TAP driver
335 yourself.
336
337 Unfortunately somebody still has to write the text.
338
339
340 @c ==================================================================
341 @node       Configuration of the Solaris kernel,  , Configuration of the FreeBSD kernel, Configuring the kernel
342 @subsection Configuring the Solaris kernel
343
344 This section will contain information on how to configure your Solaris
345 kernel to support the universal TUN/TAP device.  You need to install
346 this driver yourself.
347
348 Unfortunately somebody still has to write the text.
349
350
351 @c ==================================================================
352 @node    Libraries,  , Configuring the kernel, Installing tinc - preparations
353 @section Libraries
354
355 @cindex requirements
356 Before you can configure or build tinc, you need to have the OpenSSL
357 library installed on your system.  If you try to configure tinc without
358 having installed it, configure will give you an error message, and stop.
359
360 @menu
361 * OpenSSL::                     
362 @end menu
363
364
365 @c ==================================================================
366 @node       OpenSSL,  , Libraries, Libraries
367 @subsection OpenSSL
368
369 @cindex OpenSSL
370 For all cryptography-related functions, tinc uses the functions provided
371 by the OpenSSL library.  We recommend using version 0.9.5 or 0.9.6 of
372 this library.  Other versions may also work, but we can guarantee
373 nothing.
374
375 If this library is not installed, you wil get an error when configuring
376 tinc for build.  Support for running tinc without having OpenSSL
377 installed @emph{may} be added in the future.
378
379 You can use your operating system's package manager to install this if
380 available.  Make sure you install the development AND runtime versions
381 of this package.
382
383 If you have to install OpenSSL manually, you can get the source code
384 from @url{http://www.openssl.org/}.  Instructions on how to configure,
385 build and install this package are included within the package.  Please
386 make sure you build development and runtime libraries (which is the
387 default).
388
389
390 @c
391 @c
392 @c
393 @c      Installing tinc
394 @c
395 @c
396 @c
397 @c
398
399 @c ==================================================================
400 @node    Installing tinc - installation, Configuring tinc, Installing tinc - preparations, Top
401 @chapter Installing tinc: installation
402
403 If you use Redhat or Debian, you may want to install one of the
404 precompiled packages for your system.  These packages are equipped with
405 system startup scripts and sample configurations.
406
407 If you don't run either of these systems, or you want to compile tinc
408 for yourself, you can use the source.  The source is distributed under
409 the GNU General Public License (GPL).  Download the source from the
410 @uref{http://tinc.nl.linux.org/download.html, download page}, which has
411 the checksums of these files listed; you may wish to check these with
412 md5sum before continuing.
413
414 tinc comes in a handy autoconf/automake package, which you can just
415 treat the same as any other package. Which is just untar it, type
416 `configure' and then `make'.
417
418 More detailed instructions are in the file @file{INSTALL}, which is
419 included in the source distribution.
420
421 @menu
422 * Building tinc::               
423 * System files::                
424 * Interfaces::                  
425 @end menu
426
427
428 @c ==================================================================
429 @node    Building tinc, System files, Installing tinc - installation, Installing tinc - installation
430 @section Building tinc
431
432 Detailed instructions on configuring the source and building tinc can be
433 found in the file called @file{INSTALL}.
434
435
436 @c ==================================================================
437 @node    System files, Interfaces, Building tinc, Installing tinc - installation
438 @section System files
439
440 Before you can run tinc, you 
441
442 @menu
443 * Device files::                
444 * Other files::                 
445 @end menu
446
447
448 @c ==================================================================
449 @node       Device files, Other files, System files, System files
450 @subsection Device files
451
452 First, you'll need the special device file(s) that form the interface
453 between the kernel and the daemon.
454
455 The permissions for these files have to be such that only the super user
456 may read/write to this file.  You'd want this, because otherwise
457 eavesdropping would become a bit too easy.  This does, however, imply
458 that you'd have to run tincd as root.
459
460 If you use the universal TUN/TAP driver, you have to create the
461 following device files (unless they already exist):
462
463 @example
464 mknod -m 600 /dev/... c .. ..
465 chown 0.0 /dev/...
466 @end example
467
468 If you want to have more devices, the device numbers will be .. .. ...
469
470 If you use Linux, and you run the new 2.4 kernel using the devfs
471 filesystem, then the tap device will be automatically generated as
472 @file{/dev/netlink/tap0}.
473
474 If you use Linux and have kernel 2.2.x, you have to make the ethertap
475 devices:
476
477 @example
478 mknod -m 600 /dev/tap0 c 36 16
479 chown 0.0 /dev/tap0
480 @end example
481
482 Any further ethertap devices have minor device number 16 through 31.
483
484
485 @c ==================================================================
486 @node       Other files,  , Device files, System files
487 @subsection Other files
488
489 @subsubheading @file{/etc/networks}
490
491 You may add a line to @file{/etc/networks} so that your VPN will get a
492 symbolic name. For example:
493
494 @example
495 myvpn 10.0.0.0
496 @end example
497
498 This has nothing to do with the MyVPNIP configuration variable that will be
499 discussed later, it is only to make the output of the route command more
500 legible.
501
502 @subsubheading @file{/etc/services}
503
504 You may add this line to @file{/etc/services}. The effect is that you
505 may supply a @samp{tinc} as a valid port number to some programs. The
506 number 655 is registered with the IANA.
507
508 @example
509 tinc            655/tcp    TINC
510 tinc            655/udp    TINC
511 #                          Ivo Timmermans <itimmermans@@bigfoot.com>
512 @end example
513
514
515 @c ==================================================================
516 @node    Interfaces,  , System files, Installing tinc - installation
517 @section Interfaces
518
519 Before you can start transmitting data over the tinc tunnel, you must
520 set up the ethertap network devices.
521
522 First, decide which IP addresses you want to have associated with these
523 devices, and what network mask they must have.  You also need these
524 numbers when you are going to configure tinc itself.  @xref{Configuring
525 tinc}.
526
527 It doesn't matter much which part you do first, setting up the network
528 devices or configure tinc. But they both have to be done before you try
529 to start a tincd.
530
531 The actual setup of the ethertap device is quite simple, just repeat
532 after me:
533
534 @example
535 ifconfig tap@emph{n} hw ether fe:fd:@emph{xx}:@emph{xx}:@emph{xx}:@emph{xx}
536 @end example
537
538 The @emph{n} here is the number of the ethertap device you want to use.
539 It should be the same @emph{n} as the one you use for
540 @file{/dev/tap@emph{n}}.  The @emph{xx}s are four hexadecimal numbers
541 (0--ff). With previous versions of tincd, it didn't matter what they
542 were.  But newer kernels require properly set up ethernet addresses.  In
543 fact, the old behavior was wrong.  It is required that the @emph{xx}s
544 match the numbers of the IP address you will give to the tap device and
545 to the MyOwnVPNIP configuration (which will be discussed later).
546
547 @cindex MAC address
548 @cindex hardware address
549 @strong{Tip}: for finding out what the MAC address of the tap interface
550 should be, you can use the following command:
551
552 @example
553 $ printf 'fe:fd:%02x:%02x:%02x:%02x' 10 1 54 1
554 fe:fd:0a:01:36:01
555 @end example
556
557 @cindex ifconfig
558 To activate the device, you have to assign an IP address to it.  To set
559 an IP address @emph{IP} with network mask @emph{mask}, do the following:
560
561 @example
562 ifconfig tap@emph{n} @emph{xx}.@emph{xx}.@emph{xx}.@emph{xx} netmask @emph{mask}
563 @end example
564
565 @cindex netmask
566 The netmask is the mask of the @emph{entire} VPN network, not just your
567 own subnet.  It is the same netmask you will have to specify with the
568 VpnMask configuration variable.
569
570
571 @c
572 @c
573 @c
574 @c
575 @c         Configuring tinc
576 @c
577 @c
578 @c
579 @c
580
581
582 @c ==================================================================
583 @node    Configuring tinc, Running tinc, Installing tinc - installation, Top
584 @chapter Configuring tinc
585
586 @menu
587 * Multiple networks::           
588 * How connections work::        
589 * Configuration file::          
590 * Example::                     
591 @end menu
592
593 @c ==================================================================
594 @node    Multiple networks, How connections work, Configuring tinc, Configuring tinc
595 @section Multiple networks
596
597 @c from the manpage
598
599 It is perfectly OK for you to run more than one tinc daemon.
600 However, in its default form, you will soon notice that you can't use
601 two different configuration files without the -c option.
602
603 We have thought of another way of dealing with this: network names. This
604 means that you call tincd with the -n argument, which will assign a name
605 to this daemon.
606
607 The effect of this is that the daemon will set its configuration
608 ``root'' to /etc/tinc/nn/, where nn is your argument to the -n
609 option. You'll notice that it appears in syslog as ``tinc.nn''.
610
611 However, it is not strictly necessary that you call tinc with the -n
612 option. In this case, the network name would just be empty, and it will
613 be used as such. tinc now looks for files in /etc/tinc/, instead of
614 /etc/tinc/nn/; the configuration file should be /etc/tinc/tinc.conf,
615 and the passphrases are now expected to be in /etc/tinc/passphrases/.
616
617 But it is highly recommended that you use this feature of tinc, because
618 it will be so much clearer whom your daemon talks to. Hence, we will
619 assume that you use it.
620
621
622 @c ==================================================================
623 @node    How connections work, Configuration file, Multiple networks, Configuring tinc
624 @section How connections work
625
626 Before going on, first a bit on how tinc sees connections.
627
628 When tinc starts up, it reads in the configuration file and parses the
629 command-line options. If it sees a `ConnectTo' value in the file, it
630 will try to connect to it, on the given port. If this fails, tinc exits.
631
632
633 @c ==================================================================
634 @node    Configuration file, Example, How connections work, Configuring tinc
635 @section Configuration file
636
637 The actual configuration of the daemon is done in the file
638 @file{/etc/tinc/nn/tinc.conf}.
639
640 This file consists of comments (lines started with a #) or assignments
641 in the form of
642
643 @example
644 Variable = Value.
645 @end example
646
647 The variable names are case insensitive, and any spaces, tabs, newlines
648 and carriage returns are ignored. Note: it is not required that you put
649 in the `=' sign, but doing so improves readability.  If you leave it
650 out, remember to replace it with at least one space character.
651
652 @menu
653 * Variables::                   
654 @end menu
655
656 @c ==================================================================
657 @node    Variables,  , Configuration file, Configuration file
658 @subsection Variables
659
660 Here are all valid variables, listed in alphabetical order. The default
661 value, required or optional is given between parentheses.
662
663 @c straight from the manpage
664 @table @asis
665 @item ConnectPort = <port> (655)
666 Connect to the upstream host (given with the ConnectTo directive) on
667 port port. port may be given in decimal (default), octal (when preceded
668 by a single zero) or hexadecimal (prefixed with 0x).  port is the port
669 number for both the UDP and the TCP (meta) connections.
670
671 @item ConnectTo = <IP address|hostname> (optional)
672 Specifies which host to connect to on startup. Multiple ConnectTo variables
673 may be specified, if connecting to the first one fails then tinc will try
674 the next one, and so on. It is possible to specify hostnames for dynamic IP
675 addresses (like those given on dyndns.org), tinc will not cache the resolved
676 IP address.
677
678 If you don't specify a host with ConnectTo, regardless of whether a
679 value for ConnectPort is given, tinc won't connect at all, and will
680 instead just listen for incoming connections.
681
682 @item Hostnames = <yes|no> (no)
683 This option selects whether IP addresses (both real and on the VPN) should
684 be resolved. Since DNS lookups are blocking, it might affect tinc's
685 efficiency, even stopping the daemon for a few seconds everytime it does
686 a lookup if your DNS server is not responding.
687
688 This does not affect resolving hostnames to IP addresses from the configuration
689 file.
690
691 @item IndirectData = <yes|no> (no)
692 This option specifies whether other tinc daemons besides the one you
693 specified with ConnectTo can make a direct connection to you. This is
694 especially useful if you are behind a firewall and it is impossible
695 to make a connection from the outside to your tinc daemon. Otherwise,
696 it is best to leave this option out or set it to no.
697
698 @item Interface = <device> (optional)
699 If you have more than one network interface in your computer, tinc will by
700 default listen on all of them for incoming connections. It is possible to
701 bind tinc to a single interface like eth0 or ppp0 with this variable.
702
703 @item InterfaceIP = <local address> (optional)
704 If your computer has more than one IP address on a single interface (for example
705 if you are running virtual hosts), tinc will by default listen on all of them for
706 incoming connections. It is possible to bind tinc to a single IP address with
707 this variable. It is still possible to listen on several interfaces at the same
708 time though, if they share the same IP address.
709
710 @item KeyExpire = <seconds> (3600)
711 This option controls the time the encryption keys used to encrypt the data
712 are valid. It is common practice to change keys at regular intervals to
713 make it even harder for crackers, even though it is thought to be nearly
714 impossible to crack a single key.
715
716 @item ListenPort = <port> (655)
717 Listen on local port port. The computer connecting to this daemon should
718 use this number as the argument for his ConnectPort.
719
720 @item MyOwnVPNIP = <local address[/maskbits]> (required)
721 The local address is the number that the daemon will propagate to
722 other daemons on the network when it is identifying itself. Hence this
723 will be the file name of the passphrase file that the other end expects
724 to find the passphrase in.
725
726 The local address is the IP address of the tap device, not the real IP
727 address of the host running tincd. Due to changes in recent kernels, it
728 is also necessary that you make the ethernet (also known as MAC) address
729 equal to the IP address (see the example).
730
731 maskbits is the number of bits set to 1 in the netmask part.
732
733 @item MyVirtualIP = <local address[/maskbits]>
734 This is an alias for MyOwnVPNIP.
735
736 @item Passphrases = <directory> (/etc/tinc/NETNAME/passphrases)
737 The directory where tinc will look for passphrases when someone tries to
738 connect. Please see the manpage for genauth(8) for more information
739 about passphrases as used by tinc.
740
741 @item PingTimeout = <seconds> (5)
742 The number of seconds of inactivity that tinc will wait before sending a
743 probe to the other end. If that other end doesn't answer within that
744 same amount of seconds, the connection is terminated, and the others
745 will be notified of this.
746
747 @item TapDevice = <device> (/dev/tap0)
748 The ethertap device to use. Note that you can only use one device per
749 daemon. The info pages of the tinc package contain more information
750 about configuring an ethertap device for Linux.
751
752 @item TCPonly = <yes|no> (no, experimental)
753 If this variable is set to yes, then the packets are tunnelled over a TCP
754 connection instead of a UDP connection. This is especially useful for those
755 who want to run a tinc daemon from behind a masquerading firewall, or if
756 UDP packet routing is disabled somehow. This is experimental code,
757 try this at your own risk.
758
759 @item VpnMask = <mask> (optional)
760 The mask that defines the scope of the entire VPN. This option is not used
761 by the tinc daemon itself, but can be used by startup scripts to configure
762 the ethertap devices correctly.
763 @end table
764
765
766
767 @c ==================================================================
768 @node    Example,  , Configuration file, Configuring tinc
769 @section Example
770
771
772 Imagine the following situation. An A-based company wants to connect
773 three branch offices in B, C and D using the internet. All four offices
774 have a 24/7 connection to the internet.
775
776 A is going to serve as the center of the network. B and C will connect
777 to A, and D will connect to C. Each office will be assigned their own IP
778 network, 10.x.0.0.
779
780 @example
781 A: net 10.1.0.0 mask 255.255.0.0 gateway 10.1.54.1 internet IP 1.2.3.4
782 B: net 10.2.0.0 mask 255.255.0.0 gateway 10.2.1.12 internet IP 2.3.4.5
783 C: net 10.3.0.0 mask 255.255.0.0 gateway 10.3.69.254 internet IP 3.4.5.6
784 D: net 10.4.0.0 mask 255.255.0.0 gateway 10.4.3.32 internet IP 4.5.6.7
785 @end example
786
787 ``gateway'' is the VPN IP address of the machine that is running the
788 tincd. ``internet IP'' is the IP address of the firewall, which does not
789 need to run tincd, but it must do a port forwarding of TCP&UDP on port
790 655 (unless otherwise configured).
791
792 In this example, it is assumed that eth0 is the interface that points to
793 the inner LAN of the office, although this could also be the same as the
794 interface that leads to the internet. The configuration of the real
795 interface is also shown as a comment, to give you an idea of how these
796 example host is set up.
797
798 @subsubheading For A
799
800 @emph{A} would be configured like this:
801
802 @example
803 #ifconfig eth0 10.1.54.1 netmask 255.255.0.0 broadcast 10.1.255.255
804 ifconfig tap0 hw ether fe:fd:0a:01:36:01
805 ifconfig tap0 10.1.54.1 netmask 255.0.0.0
806 @end example
807
808 and in /etc/tinc/tinc.conf:
809
810 @example
811 TapDevice = /dev/tap0
812 MyVirtualIP = 10.1.54.1/16
813 VpnMask = 255.0.0.0
814 @end example
815
816 @subsubheading For B
817
818 @example
819 #ifconfig eth0 10.2.43.8 netmask 255.255.0.0 broadcast 10.2.255.255
820 ifconfig tap0 hw ether fe:fd:0a:02:01:0c
821 ifconfig tap0 10.2.1.12 netmask 255.0.0.0
822 @end example
823
824 and in /etc/tinc/tinc.conf:
825
826 @example
827 TapDevice = /dev/tap0
828 MyVirtualIP = 10.2.1.12/16
829 ConnectTo = 1.2.3.4
830 VpnMask = 255.0.0.0
831 @end example
832
833 Note here that the internal address (on eth0) doesn't have to be the
834 same as on the tap0 device. Also, ConnectTo is given so that no-one can
835 connect to this node.
836
837 @subsubheading For C
838
839 @example
840 #ifconfig eth0 10.3.69.254 netmask 255.255.0.0 broadcast 10.3.255.255
841 ifconfig tap0 hw ether fe:fd:0a:03:45:fe
842 ifconfig tap0 10.3.69.254 netmask 255.0.0.0
843 @end example
844
845 and in /etc/tinc/A/tinc.conf:
846
847 @example
848 MyVirtualIP = 10.3.69.254/16
849 TapDevice = /dev/tap1
850 ConnectTo = 1.2.3.4
851 ListenPort = 2000
852 VpnMask = 255.0.0.0
853 @end example
854
855 C already has another daemon that runs on port 655, so they have to
856 reserve another port for tinc. It can connect to other tinc daemons on
857 the regular port though, so no ConnectPort variable is needed.
858 They also use the netname to distinguish
859 between the two. tinc is started with `tincd -n A'.
860
861 @subsubheading For D
862
863 @example
864 #ifconfig tap0 10.4.3.32 netmask 255.255.0.0 broadcast 10.4.255.255
865 ifconfig tap0 hw ether fe:fd:0a:04:03:20
866 ifconfig tap0 10.4.3.32 netmask 255.0.0.0
867 @end example
868
869 and in /etc/tinc/tinc.conf:
870
871 @example
872 MyVirtualIP = 10.4.3.32/16
873 ConnectTo = 3.4.5.6
874 ConnectPort = 2000
875 VpnMask=255.0.0.0
876 @end example
877
878 D will be connecting to C, which has a tincd running for this network on
879 port 2000. Hence they need to put in a ConnectPort, but it doesn't need
880 to have a different ListenPort.
881
882 @subsubheading Authentication
883
884 A, B, C and D all generate a passphrase with genauth 2048, the output is
885 stored in /etc/tinc/passphrases/local, except for C, where it should be
886 /etc/tinc/A/passphrases/local.
887
888 A stores a copy of B's passphrase in /etc/tinc/passphrases/10.2.1.12
889
890 A stores a copy of C's passphrase in /etc/tinc/passphrases/10.3.69.254
891
892 B stores a copy of A's passphrase in /etc/tinc/passphrases/10.1.54.1
893
894 C stores a copy of A's passphrase in /etc/tinc/A/passphrases/10.1.54.1
895
896 C stores a copy of D's passphrase in /etc/tinc/A/passphrases/10.4.3.32
897
898 D stores a copy of C's passphrase in /etc/tinc/passphrases/10.3.69.254
899
900 @subsubheading Starting
901
902 A has to start their tincd first. Then come B and C, where C has to
903 provide the option `-n A', because they have more than one tinc
904 network. Finally, D's tincd is started.
905
906
907
908 @c ==================================================================
909 @node    Running tinc, Technical information, Configuring tinc, Top
910 @chapter Running tinc
911
912 Running tinc isn't just as easy as typing `tincd' and hoping everything
913 will just work out the way you wanted. Instead, the use of tinc is a
914 project that involves trust relations and more than one computer.
915
916 @menu
917 * Managing keys::               
918 * Runtime options::             
919 @end menu
920
921
922 @c ==================================================================
923 @node    Managing keys, Runtime options, Running tinc, Running tinc
924 @section Managing keys
925
926 Before attempting to start tinc, you have to create passphrases. When
927 tinc tries to make a connection, it exchanges some sensitive
928 data. Before doing so, it likes to know if the other end is
929 trustworthy.
930
931 To do this, both ends must have some knowledge about the other. In the
932 case of tinc this is the authentication passphrase.
933
934 This passphrase is a number, which is chosen at random. This number is
935 then sent to the other computers which want to talk to us directly. To
936 avoid breaking security, this should be done over a known secure channel
937 (such as ssh or similar).
938
939 All passphrases are stored in the passphrases directory, which is
940 normally /etc/tinc/nn/passphrases/, but it may be changed using the
941 `Passphrases' option in the config file.
942
943 To generate a passphrase, run `genauth'. genauth takes one argument,
944 which is the length of the passphrase in bits. The length of the
945 passphrase should be in the range 1024--2048 for a key length of 128
946 bits. genauth creates a random number of the specified length, and puts
947 it to stdout.
948
949 Every computer that wants to participate in the VPN should do this, and
950 store the output in the passphrases directory, in the file @file{local}.
951
952 When every computer has his own local key, it should copy it to the
953 computer that it wants to talk to directly. (i.e. the one it connects to
954 during startup.) This should be done via a secure channel, because it is
955 sensitive information. If this is not done securely, someone might break
956 in on you later on.
957
958 Those non-local passphrase files must have the name of the VPN IP
959 address that they will advertise to you. For instance, if a computer
960 tells us it likes to be 10.1.1.3 with netmask 255.255.0.0, the file
961 should still be called 10.1.1.3, and not 10.1.0.0.
962
963
964 @c ==================================================================
965 @node    Runtime options,  , Managing keys, Running tinc
966 @section Runtime options
967
968 Besides the settings in the configuration file, tinc also accepts some
969 command line options.
970
971 This list is a longer version of that in the manpage. The latter is
972 generated automatically, so may be more up-to-date.
973
974 @c from the manpage
975 @table @asis
976 @item -c, --config=FILE
977 Read configuration options from FILE. The default is
978 @file{/etc/tinc/nn/tinc.conf}.
979
980 @item -d
981 Increase debug level. The higher it gets, the more gets
982 logged. Everything goes via syslog.
983
984 0 is the default, only some basic information connection attempts get
985 logged. Setting it to 1 will log a bit more, still not very
986 disturbing. With two -d's tincd will log protocol information, which can
987 get pretty noisy. Three or more -d's will output every single packet
988 that goes out or comes in, which probably generates more data than the
989 packets themselves.
990
991 @item -k, --kill
992 Attempt to kill a running tincd and exit. A TERM signal (15) gets sent
993 to the daemon that his its PID in /var/run/tinc.nn.pid.
994
995 Because it kills only one tincd, you should use -n here if you use it
996 normally.
997
998 @item -n, --net=NETNAME
999 Connect to net NETNAME. @xref{Multiple networks}.
1000
1001 @item -t, --timeout=TIMEOUT
1002 Seconds to wait before giving a timeout. Should not be set too low,
1003 because every time tincd senses a timeout, it disconnects and reconnects
1004 again, which will cause unnecessary network traffic and log messages.
1005
1006 @item --help
1007 Display a short reminder of these runtime options and terminate.
1008
1009 @item --version
1010 Output version information and exit.
1011
1012 @end table
1013
1014
1015 @c ==================================================================
1016 @node    Technical information, About us, Running tinc, Top
1017 @chapter Technical information
1018
1019
1020 @c ==================================================================
1021 @menu
1022 * The Connection::              
1023 * Security::                    
1024 @end menu
1025
1026 @node    The Connection, Security, Technical information, Technical information
1027 @section The basic philosophy of the way tinc works
1028 @cindex Connection
1029
1030 tinc is a daemon that takes VPN data and transmit that to another host
1031 computer over the existing Internet infrastructure.
1032
1033 @menu
1034 * Protocol Preview::            
1035 * The Meta-connection::         
1036 @end menu
1037
1038
1039 @c ==================================================================
1040 @node    Protocol Preview, The Meta-connection, The Connection, The Connection
1041 @subsection A preview of the way the tinc works
1042
1043 @cindex ethertap
1044 @cindex frame type
1045 The data itself is read from a character device file, the so-called
1046 @emph{ethertap} device. This device is associated with a network
1047 interface. Any data sent to this interface can be read from the device,
1048 and any data written to the device gets sent from the interface. Data to
1049 and from the device is formatted as if it were a normal ethernet card,
1050 so a frame is preceded by two MAC addresses and a @emph{frame type}
1051 field.
1052
1053 So when tinc reads an ethernet frame from the device, it determines its
1054 type. Right now, tinc can only handle Internet Protocol version 4 (IPv4)
1055 frames. Plans to support other protocols are being made. When tinc knows
1056 which type of frame it has read, it can also read the source and
1057 destination address from it.
1058
1059 Now it is time that the frame gets encrypted. Currently the only
1060 encryption algorithm available is blowfish.
1061
1062 @cindex encapsulating
1063 When the encryption is ready, time has come to actually transport the
1064 packet to the destination computer. We do this by sending the packet
1065 over an UDP connection to the destination host. This is called
1066 @emph{encapsulating}, the VPN packet (though now encrypted) is
1067 encapsulated in another IP datagram.
1068
1069 When the destination receives this packet, the same thing happens, only
1070 in reverse. So it does a decrypt on the contents of the UDP datagram,
1071 and it writes the decrypted information to its own ethertap device.
1072
1073
1074 @c ==================================================================
1075 @node    The Meta-connection,  , Protocol Preview, The Connection
1076 @subsection The meta-connection
1077
1078 Having only an UDP connection available is not enough. Though suitable
1079 for transmitting data, we want to be able to reliably send other
1080 information, such as routing and encryption information to somebody.
1081
1082 TCP is a better alternative, because it already contains protection
1083 against information being lost, unlike UDP.
1084
1085 So we establish two connections. One for the encrypted VPN data, and one
1086 for other information, the meta-data. Hence, we call the second
1087 connection the meta-connection. We can now be sure that the
1088 meta-information doesn't get lost on the way to another computer.
1089
1090 @cindex data-protocol
1091 @cindex meta-protocol
1092 Like with any communication, we must have a protocol, so that everybody
1093 knows what everything stands for, an how he should react. Because we
1094 have two connections, we also have two protocols. The protocol used for
1095 the UDP data is the ``data-protocol,'' the other one is the
1096 ``meta-protocol.''
1097
1098 The reason we don't use TCP for both protocols is that UDP is much
1099 better for encapsulation, even while it is less reliable. The real
1100 problem is that when TCP would be used to encapsulate a TCP stream
1101 that's on the private network, for every packet sent there would be
1102 three ACK's sent instead of just one. Furthermore, if there would be
1103 a timeout, both TCP streams would sense the timeout, and both would
1104 start resending packets.
1105
1106 @c ==================================================================
1107 @node    Security,  , The Connection, Technical information
1108 @section About tinc's encryption and other security-related issues.
1109
1110 @cindex tinc
1111 @cindex Cabal
1112 tinc got its name from ``TINC,'' short for @emph{There Is No Cabal}; the
1113 alleged Cabal was/is an organization that was said to keep an eye on the
1114 entire Internet. As this is exactly what you @emph{don't} want, we named
1115 the tinc project after TINC.
1116
1117 @cindex SVPN
1118 But in order to be ``immune'' to eavesdropping, you'll have to encrypt
1119 your data. Because tinc is a @emph{Secure} VPN (SVPN) daemon, it does
1120 exactly that: encrypt.
1121
1122 This chapter is a mixture of ideas, reasoning and explanation, please
1123 don't take it too serious.
1124
1125 @menu
1126 * Key Types::                   
1127 * Key Management::              
1128 * Authentication::              
1129 * Protection::                  
1130 @end menu
1131
1132 @c ==================================================================
1133 @node    Key Types, Key Management, Security, Security
1134 @subsection Key Types
1135 @c FIXME: check if I'm not talking nonsense
1136
1137 There are several types of encryption keys. Tinc uses two of them,
1138 symmetric private keypairs and public/private keypairs.
1139
1140 Public/private keypairs are used in public key cryptography. It enables
1141 someone to send out a public key with which other people can encrypt their
1142 data. The encrypted data now can only be decrypted by the person who has
1143 the private key that matches the public key. So, a public key only allows
1144 @emph{other} people to send encrypted messages to you. This is very useful
1145 in setting up private communications channels. Just send out your public key
1146 and other people can talk to you in a secure way. But how can you know
1147 the other person is who he says he is?
1148
1149 For authentication itself tinc uses symmetric private keypairs, referred
1150 to as a passphrase. The identity of each tinc daemon is defined by it's
1151 passphrase (like you can be identified by your social security number).
1152 Every tinc daemon that is allowed to connect to you has a copy of your
1153 passphrase (hence symmetrical).
1154
1155 It would also be possible to use public/private keypairs for authentication,
1156 so that you could shout out your public key and don't need to keep it
1157 secret (like the passphrase you would have to send to someone else). Also,
1158 no one else has to know a private key from you.
1159 Both forms have their pros and cons, and at the moment tinc just uses passphrases
1160 (which are computationaly more efficient and perhaps in some way more
1161 secure).
1162
1163 @c ==================================================================
1164 @node    Key Management, Authentication, Key Types, Security
1165 @subsection Key Management
1166 @c FIXME change for the current protocol
1167
1168 @cindex Diffie-Hellman
1169 You can't just send a private encryption key to your peer, because
1170 somebody else might already be listening to you. So you'll have to
1171 negotiate over a shared but secret key. One way to do this is by using
1172 the ``Diffie-Hellman key exchange'' protocol
1173 (@uref{http://www.rsa.com/rsalabs/faq/html/3-6-1.html}). The idea is as
1174 follows.
1175
1176 You have two participants A and B that want to agree over a shared
1177 secret encryption key. Both parties have some large prime number p and a
1178 generator g. These numbers may be known to the outside world, and hence
1179 may be included in the source distribution.
1180
1181 @cindex secret key
1182 Both parties then generate a secret key. A generates a, and computes g^a
1183 mod p. This is then sent to B; while B computes g^b mod p, and transmits
1184 this to A, b being generated by B. Both a and b must be smaller than
1185 p-1.
1186
1187 Both parties then calculate g^ab mod p = k. k is the new, shared, but
1188 still secret key.
1189
1190 To obtain a key k of a sufficient length (128 bits in our vpnd), p
1191 should be 2^129-1 or more.
1192
1193
1194 @c ==================================================================
1195 @node    Authentication, Protection, Key Management, Security
1196 @subsection Authentication
1197 @c FIXME: recheck
1198
1199 @cindex man-in-the-middle attack
1200 Because the Diffie-Hellman protocol is in itself vulnerable to the
1201 ``man-in-the-middle attack,'' we should introduce an authentication
1202 system.
1203
1204 We will let A transmit a passphrase that is also known to B encrypted
1205 with g^a, before A sends this to B. This way, B can check whether A is
1206 really A or just someone else.
1207 B will never receive the real passphrase though, because it was
1208 encrypted using public/private keypairs. This way there is no way an
1209 imposter could steal A's passphrase.
1210
1211 @cindex passphrase
1212 @c ehrmz... but we only use 1024 bits passphrases ourselves? [guus]
1213 This passphrase should be 2304 bits for a symmetric encryption
1214 system. But since an asymmetric system is more secure, we could do with
1215 2048 bits. This only holds if the passphrase is very random. 
1216
1217 These passphrases could be stored in a file that is non-readable by
1218 anyone else but root; e.g. @file{/etc/tinc/passphrases} with UID 0
1219 and permissions mode 700.
1220
1221 The only thing that needs to be taken care of is how A can securely send
1222 a copy of it's passphrase to B if B doesn't have it yet. This could be
1223 done via mail with PGP, but you should be really convinced of the
1224 identity of the person who owns the email address you are sending this to.
1225 Swapping floppy disks in real life might be the best way to do this!
1226
1227
1228 @c ==================================================================
1229 @node    Protection,  , Authentication, Security
1230 @subsection Protecting your data
1231
1232 Now we have securely hidden our data. But a malicious cracker may still
1233 bother you by randomly altering the encrypted data he intercepts.
1234
1235 @c FIXME what the hell is this all about? remove? IT
1236
1237 @c ==================================================================
1238 @node    About us, Concept Index, Technical information, Top
1239 @chapter About us
1240
1241
1242 @menu
1243 * Contact Information::         
1244 * Authors::                     
1245 @end menu
1246
1247
1248 @c ==================================================================
1249 @node    Contact Information, Authors, About us, About us
1250 @section Contact information
1251
1252 tinc's main page is at @url{http://tinc.nl.linux.org/},
1253 this server is located in the Netherlands.
1254
1255 We have an IRC channel on the Open Projects IRC network. Connect to
1256 @uref{http://openprojects.nu/services/irc.html, irc.openprojects.net},
1257 and join channel #tinc.
1258
1259
1260 @c ==================================================================
1261 @node    Authors,  , Contact Information, About us
1262 @section Authors
1263
1264 @table @asis
1265 @item Ivo Timmermans (zarq) (@email{itimmermans@@bigfoot.com})
1266 Main coder/hacker and maintainer of the package.
1267
1268 @item Guus Sliepen (guus)
1269 Originator of it all, co-author.
1270
1271 @item Wessel Dankers (Ubiq)
1272 General obfuscater of the code.
1273
1274 @end table
1275
1276 Thank you's to: Dekan, Emphyrio, vDong
1277
1278 Greetings to: braque, Fluor, giggles, macro, smoke, tribbel
1279
1280
1281 @c ==================================================================
1282 @node    Concept Index,  , About us, Top
1283 @c        node-name,    next, previous,        up
1284 @unnumbered Concept Index
1285
1286 @c ==================================================================
1287 @printindex cp
1288
1289
1290 @c ==================================================================
1291 @contents
1292 @bye
1293