]> Cypherpunks.ru repositories - govpn.git/blob - doc/example.texi
[DOC] Update user examples, making it more understandable
[govpn.git] / doc / example.texi
1 @node Example usage
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, check the signature, compile.
19
20 Do not forget about setting @code{GOMAXPROC} environment variable for
21 using more than one CPU on both sides:
22
23 @example
24 % export GOMAXPROC=4
25 @end example
26
27 @strong{Prepare the server}. Create the new client, named (for example)
28 "Alice":
29
30 @example
31 % ./utils/newclient.sh Alice
32 Place verifier to peers/6d4ac605ce8dc37c2f0bf21cb542a713/verifier
33 @end example
34
35 "6d4ac605ce8dc37c2f0bf21cb542a713" -- is the new client's identity.
36
37 @strong{Prepare the client}. Generate @ref{Verifier} for known client
38 identity:
39
40 @example
41 % ./utils/storekey.sh /tmp/passphrase
42 Enter passphrase:[my secure passphrase is here]
43 % govpn-verifier -id 6d4ac605ce8dc37c2f0bf21cb542a713 -key /tmp/passphrase
44 562556cc9ecf0019b4cf45bcdf42706944ae9b3ac7c73ad299d83f2d5a169c55
45 % rm /tmp/passphrase
46 @end example
47
48 "562556cc9ecf0019b4cf45bcdf42706944ae9b3ac7c73ad299d83f2d5a169c55" --
49 this is verifier itself.
50
51 @strong{Save verifier on server}.
52
53 @example
54 % cat > peers/6d4ac605ce8dc37c2f0bf21cb542a713/verifier <<EOF
55 562556cc9ecf0019b4cf45bcdf42706944ae9b3ac7c73ad299d83f2d5a169c55
56 EOF
57 @end example
58
59 @strong{Prepare network on GNU/Linux IPv4 server}:
60
61 @example
62 server% echo "echo tap10" >> peers/6d4ac605ce8dc37c2f0bf21cb542a713/up.sh
63 server% ip addr add 192.168.0.1/24 dev wlan0
64 server% tunctl -t tap10
65 server% ip link set mtu 1432 dev tap10
66 server% ip addr add 172.16.0.1/24 dev tap10
67 server% ip link set up dev tap10
68 @end example
69
70 @strong{Run server daemon itself}:
71
72 @example
73 server% govpn-server -bind 192.168.0.1:1194 -mtu 1472
74 @end example
75
76 @strong{Prepare network on GNU/Linux IPv4 client}:
77
78 @example
79 client% umask 066
80 client% utils/storekey.sh key.txt
81 client% ip addr add 192.168.0.2/24 dev wlan0
82 client% tunctl -t tap10
83 client% ip link set mtu 1432 dev tap10
84 client% ip addr add 172.16.0.2/24 dev tap10
85 client% ip link set up dev tap10
86 client% ip route add default via 172.16.0.1
87 @end example
88
89 @strong{Run client daemon itself}:
90 @example
91 client% govpn-client \
92     -key key.txt \
93     -id 6d4ac605ce8dc37c2f0bf21cb542a713 \
94     -iface tap10 \
95     -remote 192.168.0.1:1194 \
96     -mtu 1472
97 @end example
98
99 @strong{FreeBSD IPv6 similar client-server example}:
100
101 @example
102 server% ifconfig em0 inet6 fe80::1/64
103 server% govpn-server -bind "fe80::1%em0"
104 @end example
105
106 @example
107 client% ifconfig me0 inet6 -ifdisabled auto_linklocal
108 client% ifconfig tap10
109 client% ifconfig tap10 inet6 fc00::2/96 mtu 1412 up
110 client% route -6 add default fc00::1
111 client% govpn-client \
112     -key key.txt \
113     -id 6d4ac605ce8dc37c2f0bf21cb542a713 \
114     -iface tap10 \
115     -remote "[fe80::1%me0]":1194
116 @end example