aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-26 15:20:38 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-26 15:20:38 +0000
commit0545cda24a18d5120c2e3af9710410f1b65edc90 (patch)
tree841dd04a77bdfd0d4f935ea38d41523cb50618ba /src/vpn
parent56622cd03cd5fca9c1c437e84bf8301cee935a87 (diff)
downloadgnunet-0545cda24a18d5120c2e3af9710410f1b65edc90.tar.gz
gnunet-0545cda24a18d5120c2e3af9710410f1b65edc90.zip
-removing outdated docs, some has also been added to the website instead
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/README149
1 files changed, 0 insertions, 149 deletions
diff --git a/src/vpn/README b/src/vpn/README
deleted file mode 100644
index 50fb9b119..000000000
--- a/src/vpn/README
+++ /dev/null
@@ -1,149 +0,0 @@
1For Users
2=========
3
4To use the gnunet-vpn you have to have at least added "vpn" to the
5"DEFAULTSERVICES" option of arm.
6
7If you start gnunet now, you will get a new network-interface called gnunet-vpn
8(you can rename it by adding the option "IFNAME" to a section called "vpn" in
9your ~/.gnunet/gnunet.conf) with the IP addresses 1234::1/32 and 10.11.10.1/16
10(Theese can be changed with "IPV6ADDR", "IPV6PREFIX", "IPV4ADDR" and
11"IPV4MASK"). You "normal" internet-usage should not be impaired (check that!)
12but you should be able to point your web browser to something like
13http://gnunet.gnunet/ and get the gnunet webpage! That's it, you are set to use
14gnunet to access legacy services!
15
16
17Offering Services
18-----------------
19
20If you want to offer services such as your webpage via gnunet you have to have
21add "exit" to the DEFAULTSERVICES and an entry like the following to
22~/.gnunet/gnunet.conf:
23
24#v+
25[example.gnunet.]
26ALTERNATIVE_NAMES = www
27TCP_REDIRECTS = 80:example.com:80 22:localhost4:22
28UDP_REDIRECTS = 69:tftp.example.com:69
29TTL = 3600000
30#v-
31
32This entry creates the hostnames example.gnunet and www.example.gnunet and
33send traffic to port 80 of this virtual host to the real host, sends traffic
34on port 22 to your local machine (the machine running GnuNET) and traffic on
35port 69 to tftp.example.com.
36
37Note: The exit-daemon will also create a virtual network-interface with its
38own set of IPv4 and IPv6 addresses. These addresses can be accessed by
39localhost4 and localhost6 in the domain-configuration.
40
41Now point you computer (or any other computer in the gnunet) to
42http://example.gnunet/ and you will get your website.
43
44Offering Internet Access
45------------------------
46
47Add "PROVIDE_EXIT = YES" to the section "dns" of your configuration if you
48want to allow other peers to use your computer to resolve DNS-Queries.
49
50If you want to allow other users to send traffic over your
51internet-connection, add the options "ENABLE_UDP = YES" and "ENABLE_TCP = YES"
52to the section "exit" of the configuration.
53
54Be aware, that this enables people to use your internet connection for
55nefarious things which might make you liable!
56
57For Developers
58==============
59
60The gnunet-vpn is a combination of three programs:
61
62- gnunet-daemon-vpn opens a tun-interface, configures it and controls the
63 network
64- gnunet-service-dns configures a hijack for outgoing DNS-requests, so that
65 they get sent to gnunet-daemon-vpn, which sends them on to
66 gnunet-service-dns which sends them on, either to their original destination
67 or to gnunet. It also publishes names from dns.conf to the dht.
68- gnunet-daemon-exit takes connections from the gnunet and sends them on to
69 the legacy internet.
70
71The gnunet-service-dns decides where to send the query with an easy check:
72
73- it is a query for something.gnunet: it gets sent to the dht
74- it is a query sent to the configured VIRT_DNS: it gets sent on to some other
75 gnunet-service-dns somewhere in the gnunet (anyone having configured
76 DNS_EXIT)
77- else: it gets sent to the original destination
78
79These programs exchange whole TCP- or UDP-packets, they only strip of the
80IP-header. This way gnunet achieves translation between IPv6-services and
81IPv4-clients and vice versa!
82
83The gnunet-daemon-vpn receives packets on the tun-interface and routes them:
84- everything to port 53 (dns) will be sent to the gnunet-service-dns
85 replies to these queries will be sent from the gnunet-service-dns back to
86 gnunet-daemon-vpn which will then fill in a newly generated IP-Adress, save
87 it and a descriptor of what kind of address it is (for a .gnunet-service or for
88 a "real" service) to a hashmap and send the reply back through the interface
89- for every non-dns packet the hashmap is queried if the destination-adress is known
90 if it is, the packet gets sent to either the peer advertising the service or
91 (via the mesh by-type mechanism) to any peer that allows exit-functionality
92- everything else is dropped
93
94Hijacking the DNS-Traffic
95-------------------------
96
97For access to services provided via GNUNet we need to make sure that we can
98inspect every DNS-Query made from the local machine. We briefly considered
99replacing the configured nameserver (i.e. saving and then changing
100\texttt{/etc/resolv.conf}) but rejected it out of practical considerations: A
101plethora of tools change this file, \textit{resolvconf} and the
102\textit{Network-Manager} being just the most prominent of them. We would have
103to monitor this file for changes. This scheme would also run into problems if
104some application would use its own nameserver without referring to
105\texttt{/etc/resolv.conf}.
106
107A solution based on \textit{destination NAT} was also rejected: Since the
108captured packets would have no record of their original destination our
109application would not know where to send the query if it should not be
110answered internally.
111
112We finally settled on a solution using \textit{policy based routing}. We would
113\textit{MARK} every outgoing DNS-packet if it was not sent by our application.
114Using a second routing table in the linux kernel these marked packets would be
115routed through our virtual network interface and could thus be captured
116unchanged.
117
118Our application then reads the query and decides how to handle it: A query to
119an address ending in \texttt{.gnunet} would be resolved internally using a
120DHT. A reverse query for an address of the configured virtual network could be
121answered with records kept about previous forward queries. A query sent
122originally to our virtual address is resolved using the nearest peer that
123provides name resolution. Every other query will be sent to the original
124recipient. The answer to the query will always be sent back through the
125virtual interface with the original nameserver as source address.
126
127iptables -t mangle -I OUTPUT 1 -p udp --sport $LOCALPORT --dport 53 -j ACCEPT
128iptables -t mangle -I OUTPUT 2 -p udp --dport 53 -j MARK --set-mark 3
129ip rule add fwmark 3 table2
130ip route add default via $VIRTUALDNS table2
131
132Line 1 makes sure that all packets coming from a port our application opened
133beforehand (\texttt{\$LOCALPORT}) will be routed normally. Line 2 marks every
134other packet to a DNS-Server with mark $3$ (chosen arbitrarily). The third
135line adds a routing policy based on this mark $3$ via the routing table
136"table2" which is populated with just the default route.
137
138
139Performance Measurements
140========================
141
142These tests were done between hosts (i7 with 2.67GHz and Core 2 with 2GHz)
143connected by a switched Gigabit Ethernet.
144
145scp direct (100MiB file): 33.3MiB/s (as shown by scp)
146udp echo direct (6 Bytes of data): 0.000333 (measured by tcpdump)
147
148scp over gnunet (100MiB file, stopped after 5 minutes): 20KiB/s (as shown by scp)
149udp echo over gnunet (6 Bytes of data): 0.078410s (measured by tcpdump)