]> Cypherpunks.ru repositories - govpn.git/blob - doc/example.texi
Merge branch 'develop'
[govpn.git] / doc / example.texi
1 @node Example
2 @section Example usage
3
4 Let's assume that there is some insecure link between your computer and
5 WiFi-reachable gateway.
6
7 @itemize @bullet
8 @item You have got @code{wlan0} NIC with 192.168.0/24 network on it.
9 @item You want to create virtual encrypted and authenticated 172.16.0/24
10 network and use it as a default transport.
11 @item @code{wlan0} MTU is 1500, 20 bytes overhead per IPv4. So MTU for
12 GoVPN is 1500 - 20 - 8 = 1472.
13 @item During startup client and server will say that TAP interface MTU
14 is 1432.
15 @end itemize
16
17 @strong{Install}. At first you must @ref{Installation, install} this
18 software: download, @ref{Integrity, check the signature}, compile.
19
20 @strong{Prepare the client}. Generate client's identity and verifier for
21 Alice as an example:
22 @verbatim
23 client% ./utils/newclient.sh Alice
24 Enter passphrase:
25 Your id is: 7012df29deee2170594119df5091d4a2
26
27 Place the following JSON configuration entry on the server's side:
28
29     "7012df29deee2170594119df5091d4a2": {
30         "name": "Alice",
31         "up": "/path/to/up.sh",
32         "verifier": "fb43255ca3fe5bd884e364e5eae0cd37ad14774930a027fd38d8938fd0b57425"
33     }
34
35 Verifier was generated with:
36
37     ./utils/storekey.sh /tmp/passphrase
38     govpn-verifier -id 7012df29deee2170594119df5091d4a2 -key /tmp/passphrase
39 @end verbatim
40
41 @strong{Prepare the server}. Add this entry to @code{peers.json}
42 configuration file.
43
44 @strong{Prepare network on GNU/Linux IPv4 server}:
45
46 @example
47 server% umask 077
48 server% echo "#!/bin/sh" > /path/to/up.sh
49 server% echo "echo tap10" >> /path/to/up.sh
50 server% ip addr add 192.168.0.1/24 dev wlan0
51 server% tunctl -t tap10
52 server% ip link set mtu 1432 dev tap10
53 server% ip addr add 172.16.0.1/24 dev tap10
54 server% ip link set up dev tap10
55 @end example
56
57 @strong{Run server daemon itself}:
58
59 @example
60 server% govpn-server -bind 192.168.0.1:1194 -mtu 1472
61 @end example
62
63 @strong{Prepare network on GNU/Linux IPv4 client}:
64
65 @example
66 client% umask 066
67 client% utils/storekey.sh key.txt
68 client% ip addr add 192.168.0.2/24 dev wlan0
69 client% tunctl -t tap10
70 client% ip link set mtu 1432 dev tap10
71 client% ip addr add 172.16.0.2/24 dev tap10
72 client% ip link set up dev tap10
73 client% ip route add default via 172.16.0.1
74 @end example
75
76 @strong{Run client daemon itself}:
77 @example
78 client% govpn-client \
79     -key key.txt \
80     -id 906e34b98750c4f686d6c5489508763c \
81     -iface tap10 \
82     -remote 192.168.0.1:1194 \
83     -mtu 1472
84 @end example
85
86 @strong{FreeBSD IPv6 similar client-server example}:
87
88 @example
89 server% ifconfig em0 inet6 fe80::1/64
90 server% govpn-server -bind "fe80::1%em0"
91 @end example
92
93 @example
94 client% ifconfig me0 inet6 -ifdisabled auto_linklocal
95 client% ifconfig tap10
96 client% ifconfig tap10 inet6 fc00::2/96 mtu 1412 up
97 client% route -6 add default fc00::1
98 client% govpn-client \
99     -key key.txt \
100     -id 906e34b98750c4f686d6c5489508763c \
101     -iface tap10 \
102     -remote "[fe80::1%me0]":1194
103 @end example