gnunet-handbook

The GNUnet Handbook
Log | Files | Refs

vpn.rst (10270B)


      1 .. _Using-the-Virtual-Public-Network:
      2 
      3 Virtual Public Network
      4 ----------------------
      5 
      6 .. note::
      7 
      8    The VPN is under development; expect bugs and incompatible changes.  See
      9    :doc:`/status`.
     10 
     11 Using the GNUnet Virtual Public Network (VPN) application you can tunnel
     12 IP traffic over GNUnet. Moreover, the VPN comes with built-in protocol
     13 translation and DNS-ALG support, enabling IPv4-to-IPv6 protocol
     14 translation (in both directions). This chapter documents how to use the
     15 GNUnet VPN.
     16 
     17 The first thing to note about the GNUnet VPN is that it is a public
     18 network. All participating peers can participate and there is no secret
     19 key to control access. So unlike common virtual private networks, the
     20 GNUnet VPN is not useful as a means to provide a \"private\" network
     21 abstraction over the Internet. The GNUnet VPN is a virtual network in
     22 the sense that it is an overlay over the Internet, using its own routing
     23 mechanisms and can also use an internal addressing scheme. The GNUnet
     24 VPN is an Internet underlay --- TCP/IP applications run on top of it.
     25 
     26 The VPN is currently only supported on GNU/Linux systems. Support for
     27 operating systems that support TUN (such as FreeBSD) should be easy to
     28 add (or might not even require any coding at all --- we just did not
     29 test this so far). Support for other operating systems would require
     30 re-writing the code to create virtual network interfaces and to
     31 intercept DNS requests.
     32 
     33 The VPN does not provide good anonymity. While requests are routed over
     34 the GNUnet network, other peers can directly see the source and
     35 destination of each (encapsulated) IP packet. Finally, if you use the
     36 VPN to access Internet services, the peer sending the request to the
     37 Internet will be able to observe and even alter the IP traffic. We will
     38 discuss additional security implications of using the VPN later in this
     39 chapter.
     40 
     41 .. _Setting-up-an-Exit-node:
     42 
     43 Setting up an Exit node
     44 ~~~~~~~~~~~~~~~~~~~~~~~
     45 
     46 Any useful operation with the VPN requires the existence of an exit node
     47 in the GNUnet Peer-to-Peer network. Exit functionality can only be
     48 enabled on peers that have regular Internet access. If you want to play
     49 around with the VPN or support the network, we encourage you to setup
     50 exit nodes. This chapter documents how to setup an exit node.
     51 
     52 There are four types of exit functions an exit node can provide, and
     53 using the GNUnet VPN to access the Internet will only work nicely if the
     54 first three types are provided somewhere in the network. The four exit
     55 functions are:
     56 
     57 -  DNS: allow other peers to use your DNS resolver
     58 
     59 -  IPv4: allow other peers to access your IPv4 Internet connection
     60 
     61 -  IPv6: allow other peers to access your IPv6 Internet connection
     62 
     63 -  Local service: allow other peers to access a specific TCP or UDP
     64    service your peer is providing
     65 
     66 By enabling \"exit\" in gnunet-setup and checking the respective boxes
     67 in the \"exit\" tab, you can easily choose which of the above exit
     68 functions you want to support.
     69 
     70 Note, however, that by supporting the first three functions you will
     71 allow arbitrary other GNUnet users to access the Internet via your
     72 system. This is somewhat similar to running a Tor exit node. The
     73 Torproject has a nice article about what to consider if you want to do
     74 this here. We believe that generally running a DNS exit node is
     75 completely harmless.
     76 
     77 The exit node configuration does currently not allow you to restrict the
     78 Internet traffic that leaves your system. In particular, you cannot
     79 exclude SMTP traffic (or block port 25) or limit to HTTP traffic using
     80 the GNUnet configuration. However, you can use your host firewall to
     81 restrict outbound connections from the virtual tunnel interface. This is
     82 highly recommended. In the future, we plan to offer a wider range of
     83 configuration options for exit nodes.
     84 
     85 Note that by running an exit node GNUnet will configure your kernel to
     86 perform IP-forwarding (for IPv6) and NAT (for IPv4) so that the traffic
     87 from the virtual interface can be routed to the Internet. In order to
     88 provide an IPv6-exit, you need to have a subnet routed to your host's
     89 external network interface and assign a subrange of that subnet to the
     90 GNUnet exit's TUN interface.
     91 
     92 When running a local service, you should make sure that the local
     93 service is (also) bound to the IP address of your EXIT interface (e.g.
     94 169.254.86.1). It will NOT work if your local service is just bound to
     95 loopback. You may also want to create a \"VPN\" record in your zone of
     96 the GNU Name System to make it easy for others to access your service
     97 via a name instead of just the full service descriptor. Note that the
     98 identifier you assign the service can serve as a passphrase or shared
     99 secret, clients connecting to the service must somehow learn the
    100 service's name. VPN records in the GNU Name System can make this easier.
    101 
    102 The config file configuration to offer a service `http` on port 80 which
    103 is forwarded to port 8080 on IP `169.254.86.1` is as follows:
    104 
    105 ::
    106 
    107   [http.gnunet.]
    108   TCP_REDIRECTS = 80:169.254.86.1:8080
    109 
    110 You can then add a GNS record to this service:
    111 
    112 ::
    113 
    114   $  gnunet-namestore -z myzone -a -e "1 d" -p -t VPN -n www -V "6 <ZKEY> http"
    115 
    116 Where `myzone` is the name of your GNS zone.
    117 We are adding a record of type `VPN`, and the value is a string containing three values:
    118 The first is a boolean indicating the use of TCP (`6`) or UDP (`17`),
    119 your peer identity and the identifier of the service we used in the configuration section above
    120 before the `.gnunet.`.
    121 
    122 When using the `dns2gns` DNS server it will automatically synthesize `A`/`AAAA` records from
    123 encountered `VPN` records using the `VPN` service.
    124 Otherwise, this must be done by the client that resolved the `VPN` record.
    125 
    126 .. _Fedora-and-the-Firewall:
    127 
    128 Fedora and the Firewall
    129 ~~~~~~~~~~~~~~~~~~~~~~~
    130 
    131 When using an exit node on Fedora 15, the standard firewall can create
    132 trouble even when not really exiting the local system! For IPv4, the
    133 standard rules seem fine. However, for IPv6 the standard rules prohibit
    134 traffic from the network range of the virtual interface created by the
    135 exit daemon to the local IPv6 address of the same interface (which is
    136 essentially loopback traffic, so you might suspect that a standard
    137 firewall would leave this traffic alone). However, as somehow for IPv6
    138 the traffic is not recognized as originating from the local system (and
    139 as the connection is not already \"established\"), the firewall drops
    140 the traffic. You should still get ICMPv6 packets back, but that's
    141 obviously not very useful.
    142 
    143 Possible ways to fix this include disabling the firewall (do you have a
    144 good reason for having it on?) or disabling the firewall at least for
    145 the GNUnet exit interface (or the respective IPv4/IPv6 address range).
    146 The best way to diagnose these kinds of problems in general involves
    147 setting the firewall to REJECT instead of DROP and to watch the traffic
    148 using wireshark (or tcpdump) to see if ICMP messages are generated when
    149 running some tests that should work.
    150 
    151 .. _Setting-up-VPN-node-for-protocol-translation-and-tunneling:
    152 
    153 Setting up VPN node for protocol translation and tunneling
    154 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    155 
    156 The GNUnet VPN/PT subsystem enables you to tunnel IP traffic over the
    157 VPN to an exit node, from where it can then be forwarded to the
    158 Internet. This section documents how to setup VPN/PT on a node. Note
    159 that you can enable both the VPN and an exit on the same peer. In this
    160 case, IP traffic from your system may enter your peer's VPN and leave
    161 your peer's exit. This can be useful as a means to do protocol
    162 translation. For example, you might have an application that supports
    163 only IPv4 but needs to access an IPv6-only site. In this case, GNUnet
    164 would perform 4to6 protocol translation between the VPN (IPv4) and the
    165 Exit (IPv6). Similarly, 6to4 protocol translation is also possible.
    166 However, the primary use for GNUnet would be to access an Internet
    167 service running with an IP version that is not supported by your ISP. In
    168 this case, your IP traffic would be routed via GNUnet to a peer that has
    169 access to the Internet with the desired IP version.
    170 
    171 Setting up an entry node into the GNUnet VPN primarily requires you to
    172 enable the \"VPN/PT\" option in \"gnunet-setup\". This will launch the
    173 \"gnunet-service-vpn\", \"gnunet-service-dns\" and \"gnunet-daemon-pt\"
    174 processes. The \"gnunet-service-vpn\" will create a virtual interface
    175 which will be used as the target for your IP traffic that enters the
    176 VPN. Additionally, a second virtual interface will be created by the
    177 \"gnunet-service-dns\" for your DNS traffic. You will then need to
    178 specify which traffic you want to tunnel over GNUnet. If your ISP only
    179 provides you with IPv4 or IPv6-access, you may choose to tunnel the
    180 other IP protocol over the GNUnet VPN. If you do not have an ISP (and
    181 are connected to other GNUnet peers via WLAN), you can also choose to
    182 tunnel all IP traffic over GNUnet. This might also provide you with some
    183 anonymity. After you enable the respective options and restart your
    184 peer, your Internet traffic should be tunneled over the GNUnet VPN.
    185 
    186 The GNUnet VPN uses DNS-ALG to hijack your IP traffic. Whenever an
    187 application resolves a hostname (like 'gnunet.org'), the
    188 \"gnunet-daemon-pt\" will instruct the \"gnunet-service-dns\" to
    189 intercept the request (possibly route it over GNUnet as well) and
    190 replace the normal answer with an IP in the range of the VPN's
    191 interface. \"gnunet-daemon-pt\" will then tell \"gnunet-service-vpn\" to
    192 forward all traffic it receives on the TUN interface via the VPN to the
    193 original destination.
    194 
    195 For applications that do not use DNS, you can also manually create such
    196 a mapping using the gnunet-vpn command-line tool. Here, you specify the
    197 desired address family of the result (e.g. \"-4\"), and the intended
    198 target IP on the Internet (e.g. \"-i 131.159.74.67\") and \"gnunet-vpn\"
    199 will tell you which IP address in the range of your VPN tunnel was
    200 mapped.
    201 
    202 ``gnunet-vpn`` can also be used to access \"internal\" services offered
    203 by GNUnet nodes. So if you happen to know a peer and a service offered
    204 by that peer, you can create an IP tunnel to that peer by specifying the
    205 peer's identity, service name and protocol (--tcp or --udp) and you will
    206 again receive an IP address that will terminate at the respective peer's
    207 service.
    208