]> Cypherpunks.ru repositories - govpn.git/blob - doc/example.texi
Ability to explicitly specify TAP interface, without up-script using
[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
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 verifier for Alice as an
21 example:
22
23 @verbatim
24 client% ./utils/newclient.sh Alice
25 Enter passphrase:
26 Your client verifier is: $argon2d$m=4096,t=128,p=1$bwR5VjeCYIQaa8SeaI3rqg
27
28 Place the following JSON configuration entry on the server's side:
29
30     "Alice": {
31         "up": "/path/to/up.sh",
32         "iface": "or TAP interface name",
33         "verifier": "$argon2d$m=4096,t=128,p=1$bwR5VjeCYIQaa8SeaI3rqg$KCNIqfS4DGsBTtVytamAzcISgrlEWvNxan1UfBrFu10"
34     }
35
36 Verifier was generated with:
37
38     ./utils/storekey.sh /tmp/passphrase
39     govpn-verifier -key /tmp/passphrase
40 @end verbatim
41
42 @strong{Prepare the server}. Add this entry to @code{peers.json}
43 configuration file:
44
45 @verbatim
46 {
47     "Alice": {
48         "iface": "tap10",
49         "verifier": "$argon2d$m=4096,t=128,p=1$bwR5VjeCYIQaa8SeaI3rqg$KCNIqfS4DGsBTtVytamAzcISgrlEWvNxan1UfBrFu10"
50     }
51 }
52 @end verbatim
53
54 @strong{Prepare network on GNU/Linux IPv4 server}:
55
56 @example
57 server% umask 077
58 server% ip addr add 192.168.0.1/24 dev wlan0
59 server% tunctl -t tap10
60 server% ip link set mtu 1432 dev tap10
61 server% ip addr add 172.16.0.1/24 dev tap10
62 server% ip link set up dev tap10
63 @end example
64
65 @strong{Run server daemon itself}:
66
67 @example
68 server% govpn-server -bind 192.168.0.1:1194 -mtu 1472
69 @end example
70
71 @strong{Prepare network on GNU/Linux IPv4 client}:
72
73 @example
74 client% umask 066
75 client% utils/storekey.sh key.txt
76 client% ip addr add 192.168.0.2/24 dev wlan0
77 client% tunctl -t tap10
78 client% ip link set mtu 1432 dev tap10
79 client% ip addr add 172.16.0.2/24 dev tap10
80 client% ip link set up dev tap10
81 client% ip route add default via 172.16.0.1
82 @end example
83
84 @strong{Run client daemon itself}:
85 @example
86 client% govpn-client \
87     -key key.txt \
88     -verifier '$argon2d$m=4096,t=128,p=1$bwR5VjeCYIQaa8SeaI3rqg' \
89     -iface tap10 \
90     -remote 192.168.0.1:1194 \
91     -mtu 1472
92 @end example
93
94 @strong{FreeBSD IPv6 similar client-server example}:
95
96 @example
97 server% ifconfig em0 inet6 fe80::1/64
98 server% govpn-server -bind "fe80::1%em0"
99 @end example
100
101 @example
102 client% ifconfig me0 inet6 -ifdisabled auto_linklocal
103 client% ifconfig tap10
104 client% ifconfig tap10 inet6 fc00::2/96 mtu 1412 up
105 client% route -6 add default fc00::1
106 client% govpn-client \
107     -key key.txt \
108     -verifier '$argon2d$m=4096,t=128,p=1$bwR5VjeCYIQaa8SeaI3rqg' \
109     -iface tap10 \
110     -remote "[fe80::1%me0]":1194
111 @end example