Kill switch WireGuard : protéger votre connexion
Sur cette page
Le kill switch coupe automatiquement votre trafic internet si le tunnel VPN se déconnecte, empêchant ainsi toute fuite de votre vraie adresse IP.
Pourquoi activer le kill switch ?
Sans kill switch, si la connexion WireGuard s'interrompt (réseau instable, redémarrage d'interface), votre trafic bascule sur votre connexion directe, exposant votre IP réelle. Le kill switch évite cela.
Kill switch sur Linux (via iptables)
Ajoutez ces règles dans votre configuration WireGuard (/etc/wireguard/wg0.conf) :
[Interface]
Address = 10.8.0.2/32
PrivateKey = <votre_clé_privée>
DNS = 1.1.1.1
# Kill switch
PostUp = iptables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
[Peer]
PublicKey = <clé_publique_serveur>
Endpoint = vpn.flowhardware.ch:51820
AllowedIPs = 0.0.0.0/0, ::/0
Kill switch sur Windows
Le client WireGuard officiel pour Windows inclut un kill switch natif :
- Ouvrez le client WireGuard
- Modifiez votre tunnel
- Cochez Block untunneled traffic (kill-switch)
- Sauvegardez
Kill switch sur iOS
L'application WireGuard iOS inclut une option On-Demand qui maintient le tunnel actif en permanence, ce qui agit comme un kill switch :
- Dans l'app WireGuard, appuyez sur votre tunnel
- Activez On-Demand → Wi-Fi et Cellulaire
Kill switch sur macOS
Similaire à Linux, vous pouvez ajouter des règles via pf (packet filter) :
# Créer /etc/pf.anchors/wireguard
block all
pass on utun0 all
pass on lo0 all
Vérifier que le kill switch fonctionne
- Activez le VPN et vérifiez votre IP sur whatismyip.com
- Simulez une déconnexion VPN :
wg-quick down wg0 - Tentez d'accéder à internet — l'accès doit être bloqué
- Relancez le VPN :
wg-quick up wg0
Ce guide n'a pas suffi ? Une personne du support vous répond en français.








