source: trunk/docs/servers.rst

Last change on this file was 02ba2a0, checked in by Brian Warner <warner@…>, at 2016-09-14T23:12:32Z

implement --listen=none, use it for create-client

Improve docs on server configuration to explain --listen options.

  • Property mode set to 100644
File size: 8.4 KB
Line 
1=========================
2How To Configure A Server
3=========================
4
5Many Tahoe-LAFS nodes run as "servers", meaning they provide services for
6other machines (i.e. "clients"). The two most important kinds are the
7Introducer, and Storage Servers.
8
9To be useful, servers must be reachable by clients. Tahoe servers can listen
10on TCP ports, and advertise their "location" (hostname and TCP port number)
11so clients can connect to them. They can also listen on Tor "onion services"
12and I2P ports.
13
14Storage servers advertise their location by announcing it to the Introducer,
15which then broadcasts the location to all clients. So once the location is
16determined, you don't need to do anything special to deliver it.
17
18The Introducer itself has a location, which must be manually delivered to all
19storage servers and clients. You might email it to the new members of your
20grid. This location (along with other important cryptographic identifiers) is
21written into a file named ``private/introducer.furl`` in the Introducer's
22base directory, and should be provided as the ``--introducer=`` argument to
23``tahoe create-client`` or ``tahoe create-node``.
24
25The first step when setting up a server is to figure out how clients will
26reach it. Then you need to configure the server to listen on some ports, and
27then configure the location properly.
28
29Manual Configuration
30====================
31
32Each server has two settings in their ``tahoe.cfg`` file: ``tub.port``, and
33``tub.location``. The "port" controls what the server node listens to: this
34is generally a TCP port.
35
36The "location" controls what is advertised to the outside world. This is a
37"foolscap connection hint", and it includes both the type of the connection
38(tcp, tor, or i2p) and the connection details (hostname/address, port
39number). Various proxies, port-forwardings, and privacy networks might be
40involved, so it's not uncommon for ``tub.port`` and ``tub.location`` to look
41different.
42
43You can directly control the ``tub.port`` and ``tub.location`` configuration
44settings by providing ``--port=`` and ``--location=`` when running ``tahoe
45create-node``.
46
47Automatic Configuration
48=======================
49
50Instead of providing ``--port=/--location=``, you can use ``--listen=``.
51Servers can listen on TCP, Tor, I2P, a combination of those, or none at all.
52The ``--listen=`` argument controls which kinds of listeners the new server
53will use.
54
55``--listen=none`` means the server should not listen at all. This doesn't
56make sense for a server, but is appropriate for a client-only node. The
57``tahoe create-client`` command automatically includes ``--listen=none``.
58
59``--listen=tcp`` is the default, and turns on a standard TCP listening port.
60Using ``--listen=tcp`` requires a ``--hostname=`` argument too, which will be
61incorporated into the node's advertised location. We've found that computers
62cannot reliably determine their externally-reachable hostname, so rather than
63having the server make a guess (or scanning its interfaces for IP addresses
64that might or might not be appropriate), node creation requires the user to
65provide the hostname.
66
67``--listen=tor`` will talk to a local Tor daemon and create a new "onion
68server" address (which look like ``alzrgrdvxct6c63z.onion``). Likewise
69``--listen=i2p`` will talk to a local I2P daemon and create a new server
70address. See :doc:`anonymity-configuration` for details.
71
72You could listen on all three by using ``--listen=tcp,tor,i2p``.
73
74Deployment Scenarios
75====================
76
77The following are some suggested scenarios for configuring servers using
78various network transports. These examples do not include specifying an
79introducer FURL which normally you would want when provisioning storage
80nodes. For these and other configuration details please refer to
81:doc:`configuration`.
82
83#.  `Server has a public DNS name`_
84#.  `Server has a public IPv4/IPv6 address`_
85#.  `Server is behind a firewall with port forwarding`_
86#.  `Using I2P/Tor to Avoid Port-Forwarding`_
87
88
89Server has a public DNS name
90----------------------------
91
92The simplest case is where your server host is directly connected to the
93internet, without a firewall or NAT box in the way. Most VPS (Virtual Private
94Server) and colocated servers are like this, although some providers block
95many inbound ports by default.
96
97For these servers, all you need to know is the external hostname. The system
98administrator will tell you this. The main requirement is that this hostname
99can be looked up in DNS, and it will map to an IPv4 or IPv6 address which
100will reach the machine.
101
102If your hostname is ``example.net``, then you'll create the introducer like
103this::
104
105  tahoe create-introducer --hostname example.com ~/introducer
106
107or a storage server like::
108
109  tahoe create-node --hostname=example.net
110
111These will allocate a TCP port (e.g. 12345), assign ``tub.port`` to be
112``tcp:12345``, and ``tub.location`` will be ``tcp:example.com:12345``.
113
114Ideally this should work for IPv6-capable hosts too (where the DNS name
115provides an "AAAA" record, or both "A" and "AAAA"). However Tahoe-LAFS
116support for IPv6 is new, and may still have problems. Please see ticket
117`#867`_ for details.
118
119.. _#867: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/867
120
121
122Server has a public IPv4/IPv6 address
123-------------------------------------
124
125If the host has a routeable (public) IPv4 address (e.g. ``203.0.113.1``), but
126no DNS name, you will need to choose a TCP port (e.g. ``3457``), and use the
127following::
128
129  tahoe create-node --port=tcp:3457 --location=tcp:203.0.113.1:3457
130
131``--port`` is an "endpoint specification string" that controls which local
132port the node listens on. ``--location`` is the "connection hint" that it
133advertises to others, and describes the outbound connections that those
134clients will make, so it needs to work from their location on the network.
135
136Tahoe-LAFS nodes listen on all interfaces by default. When the host is
137multi-homed, you might want to make the listening port bind to just one
138specific interface by adding a ``interface=`` option to the ``--port=``
139argument::
140
141  tahoe create-node --port=tcp:3457:interface=203.0.113.1 --location=tcp:203.0.113.1:3457
142
143If the host's public address is IPv6 instead of IPv4, use square brackets to
144wrap the address, and change the endpoint type to ``tcp6``::
145
146  tahoe create-node --port=tcp6:3457 --location=tcp:[2001:db8::1]:3457
147
148You can use ``interface=`` to bind to a specific IPv6 interface too, however
149you must backslash-escape the colons, because otherwise they are interpreted
150as delimiters by the Twisted "endpoint" specification language. The
151``--location=`` argument does not need colons to be escaped, because they are
152wrapped by the square brackets::
153
154  tahoe create-node --port=tcp6:3457:interface=2001\:db8\:\:1 --location=tcp:[2001:db8::1]:3457
155
156For IPv6-only hosts with AAAA DNS records, if the simple ``--hostname=``
157configuration does not work, they can be told to listen specifically on an
158IPv6-enabled port with this::
159
160  tahoe create-node --port=tcp6:3457 --location=tcp:example.net:3457
161
162
163Server is behind a firewall with port forwarding
164------------------------------------------------
165
166To configure a storage node behind a firewall with port forwarding you will
167need to know:
168
169* public IPv4 address of the router
170* the TCP port that is available from outside your network
171* the TCP port that is the forwarding destination
172* internal IPv4 address of the storage node (the storage node itself is
173  unaware of this address, and it is not used during ``tahoe create-node``,
174  but the firewall must be configured to send connections to this)
175
176The internal and external TCP port numbers could be the same or different
177depending on how the port forwarding is configured. If it is mapping ports
1781-to-1, and the public IPv4 address of the firewall is 203.0.113.1 (and
179perhaps the internal IPv4 address of the storage node is 192.168.1.5), then
180use a CLI command like this::
181
182  tahoe create-node --port=tcp:3457 --location=tcp:203.0.113.1:3457
183
184If however the firewall/NAT-box forwards external port *6656* to internal
185port 3457, then do this::
186
187  tahoe create-node --port=tcp:3457 --location=tcp:203.0.113.1:6656
188
189
190Using I2P/Tor to Avoid Port-Forwarding
191--------------------------------------
192
193I2P and Tor onion services, among other great properties, also provide NAT
194penetration without port-forwarding, hostnames, or IP addresses. So setting
195up a server that listens only on Tor is simple::
196
197  tahoe create-node --listen=tor
198
199For more information about using Tahoe-LAFS with I2p and Tor see
200:doc:`anonymity-configuration`
Note: See TracBrowser for help on using the repository browser.