1
|
<!DOCTYPE html>
|
2
|
<html>
|
3
|
|
4
|
<head>
|
5
|
<meta charset="utf-8">
|
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
<title>Welcome file</title>
|
8
|
<link rel="stylesheet" href="https://stackedit.io/style.css" />
|
9
|
</head>
|
10
|
|
11
|
<body class="stackedit">
|
12
|
<div class="stackedit__html"><h1 id="test-de-wireguard">Test de wireguard</h1>
|
13
|
<h2 id="installation">Installation</h2>
|
14
|
<h3 id="debian">Debian</h3>
|
15
|
<p>Disponible en unstable, package <strong>wireguard</strong><br>
|
16
|
Pour Jessie et Stretch:</p>
|
17
|
<pre><code># echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
|
18
|
# printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-unstable
|
19
|
# apt update
|
20
|
# apt install wireguard
|
21
|
</code></pre>
|
22
|
<p><a href="https://wiki.debian.orgWireguard">wiki debian</a></p>
|
23
|
<h3 id="ubuntu">Ubuntu</h3>
|
24
|
<pre><code>$ add-apt-repository ppa:wireguard/wireguard
|
25
|
$ apt-get update
|
26
|
$ apt-get install wireguard
|
27
|
</code></pre>
|
28
|
<h3 id="fedora">Fedora</h3>
|
29
|
<pre><code>dnf install wireguard
|
30
|
</code></pre>
|
31
|
<p>Les paquets suivant sont installés: wireguard, wireguard-dkms, wireguard-tools</p>
|
32
|
<h2 id="configuration-rapide-en-mode-serveur">Configuration rapide en mode serveur</h2>
|
33
|
<p>On va utiliser la méthode avec <strong>wg-quick</strong>, on choisit <strong>192.168.100.0</strong> comme réseau pour le vpn.</p>
|
34
|
<h3 id="configuration-du-serveur">Configuration du serveur</h3>
|
35
|
<p>Dans le répertoire <strong>/etc/wireguard</strong>, on génère une paire de clefs:</p>
|
36
|
<pre><code>wg genkey | tee wg-private.key | wg pubkey > wg-public.key
|
37
|
</code></pre>
|
38
|
<p>Créer le fichier <strong>/etc/wireguard/wg0.conf</strong>:</p>
|
39
|
<pre><code>[Interface]
|
40
|
#server
|
41
|
Address = 192.168.100.254
|
42
|
PrivateKey = <CONTENU DU FICHIER wg-private.key>
|
43
|
ListenPort = 4820
|
44
|
|
45
|
[Peer]
|
46
|
#client 1
|
47
|
PublicKey = <CLEF PUBLIQUE DU CLIENT 1>
|
48
|
AllowedIPs = 192.168.100.1
|
49
|
</code></pre>
|
50
|
<h3 id="sur-le-client-1">Sur le client 1</h3>
|
51
|
<p>Dans le répertoire <strong>/etc/wireguard</strong>, on génère une paire de clefs:</p>
|
52
|
<pre><code>wg genkey | tee wg-private.key | wg pubkey > wg-public.key
|
53
|
</code></pre>
|
54
|
<p>Créer le fichier <strong>/etc/wireguard/wg0.conf</strong>:</p>
|
55
|
<pre><code>[Interface]
|
56
|
#client 1
|
57
|
Address = 192.168.100.1
|
58
|
PrivateKey = <CONTENU DU FICHIER wg-private.key>
|
59
|
ListenPort = 4820
|
60
|
|
61
|
[Peer]
|
62
|
#client 1
|
63
|
PublicKey = <CLEF PUBLIQUE DU SERVEUR>
|
64
|
AllowedIPs = 192.168.100.0/24 (si 0.0.0.0/0 alors tout le traffic est routé dans le vpn)
|
65
|
</code></pre>
|
66
|
<p>On peut répéter l’opération sur autant de clients qu’on veut. Il suffit d’ajouter un bloc peer correspondant dans le fichier de configuration du serveur.</p>
|
67
|
<h3 id="démarrer-le-vpn">Démarrer le vpn</h3>
|
68
|
<p>Sur le serveur puis sur le client</p>
|
69
|
<pre><code>wg-quick up wg0
|
70
|
</code></pre>
|
71
|
<p>Pour voir l’état du vpn</p>
|
72
|
<pre><code>wg show
|
73
|
</code></pre>
|
74
|
<h3 id="ajouter-un-client-android">Ajouter un client android</h3>
|
75
|
<p><em>On peut utiliser n’importe quelle machine ou wireguard est installé</em><br>
|
76
|
Installer le programme <strong>qrencode</strong> (dispos sous debian fedora)<br>
|
77
|
Créer un configuration comme n’importe quel autre client.</p>
|
78
|
<pre><code>qrencode -t ansiutf8 < client.conf
|
79
|
</code></pre>
|
80
|
<p>Sur android dans f-droid installer wireguard et ajouter un vpn, choisir “create from qrcode”.</p>
|
81
|
<p>J’ai fait les tests avec un serveur debian arm64 et des clients ubuntu bionic, fedora 29, debian arm64, android.<br>
|
82
|
On peut joindre chacun des clients depuis un autre client. J’ai ouvert un serveur nginx sur une machine du vpn et j’ai visisonné une vidéo sur mon téléphone avec vlc :)</p>
|
83
|
</div>
|
84
|
</body>
|
85
|
|
86
|
</html>
|