« Wireguard » : différence entre les versions

Aucun résumé des modifications
Aucun résumé des modifications
 
(12 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
=== 🟢 Générer paire de clés pour un client ===
<syntaxhighlight lang="bash" line copy>
wg genkey | tee client1.key | wg pubkey > client1.pub
</syntaxhighlight>
=== 🟢 Ajouter une PresharedKey (PSK) à un peer ===
<syntaxhighlight lang="bash" line>
mkdir -p /etc/wireguard/keys
chmod 700 /etc/wireguard/keys
</syntaxhighlight>
<syntaxhighlight lang="bash" line>
wg genpsk | tee /etc/wireguard/keys/client1.psk
chmod 600 /etc/wireguard/keys/client1.psk
</syntaxhighlight>
👉 récupère la clé :
<syntaxhighlight lang="bash" copy>
cat /etc/wireguard/keys/client1.psk
</syntaxhighlight>
1. Modifier ton `wg0.conf` (serveur)
<syntaxhighlight lang="bash" copy>
nano /etc/wireguard/wg0.conf
</syntaxhighlight>
Ajoute dans le peer concerné :
<syntaxhighlight lang="bash" line>
[Peer]
PublicKey = CLIENT_PUBLIC_KEY
PresharedKey = TA_PSK_ICI
</syntaxhighlight>
2. Ajouter la PSK côté client
<syntaxhighlight lang="bash" copy>
nano /etc/wireguard/client1.conf
</syntaxhighlight>
<syntaxhighlight lang="bash" line>
[Peer]
PublicKey = SERVER_PUBLIC_KEY
PresharedKey = TA_PSK_ICI
</syntaxhighlight>
=== 🟢 Commandes ===
Démarrer l'interface :
<syntaxhighlight lang="bash" line copy>
sudo wg-quick up wg0
</syntaxhighlight>
Arrêter l'interface :
<syntaxhighlight lang="bash" line copy>
sudo wg-quick down wg0
</syntaxhighlight>
Redémarrer l'interface
<syntaxhighlight lang="bash" line copy>
systemctl restart wg-quick@wg0
</syntaxhighlight>
Les logs de WireGuard sont également enregistrés dans le journal système
<syntaxhighlight lang="bash" line copy>
sudo journalctl -u wg-quick@wg0
</syntaxhighlight>
<syntaxhighlight lang="bash" line copy>
sudo journalctl -u wg-quick@wg0 -p err
</syntaxhighlight>
1. Afficher des informations sur l'état des interfaces WireGuard, y compris les adresses IP des pairs, les données transférées, etc.
<syntaxhighlight lang="bash" line copy>
sudo wg show wg0
</syntaxhighlight>
2. Pour voir les connexions actives sur le port WireGuard
<syntaxhighlight lang="bash" line copy>
sudo ss -anu | grep 51820
</syntaxhighlight>
ou
<syntaxhighlight lang="bash" line copy>
sudo netstat -anu | grep 51820
</syntaxhighlight>
3. Capturer le trafic WireGuard
<syntaxhighlight lang="bash" line copy>
sudo tcpdump -i wg0 udp port 51820
</syntaxhighlight>
4. Vérifier les connexions actives
<syntaxhighlight lang="bash" line copy>
sudo wg show wg0 | grep -A 2 "peer:"
</syntaxhighlight>
5. Surveiller les connexions en temps réel
<syntaxhighlight lang="bash" line copy>
sudo watch -n 1 wg show wg0
</syntaxhighlight>
=== 🟢 QR‑code WireGuard ===
*[[ Wireguard_qrcode | Wireguard qrcode ]]
== Sources ==
  [https://blog.flozz.fr/2020/03/15/wireguard-decouverte-dun-vpn-moderne-simple-et-multiplateforme/ blog.flozz.fr exemple installation manuelle]
  [https://blog.flozz.fr/2020/03/15/wireguard-decouverte-dun-vpn-moderne-simple-et-multiplateforme/ blog.flozz.fr exemple installation manuelle]
  [https://blog.flozz.fr/2020/03/22/wireguard-outils-et-fichiers-de-configuration/ blog.flozz.fr Fichiers de configuration]
  [https://blog.flozz.fr/2020/03/22/wireguard-outils-et-fichiers-de-configuration/ blog.flozz.fr Fichiers de configuration]
[[category:VPN]]
[[category:VPN]] [[Catégorie:Linux]] [[Catégorie:Debian]]