« Unix::wireguard » : différence entre les versions
De wiki_pcwiki2
Aller à la navigationAller à la recherche
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 16 : | Ligne 16 : | ||
Ensuite, attention, les fichiers de conf sont très sensibles aux /32, /24 ... : | Ensuite, attention, les fichiers de conf sont très sensibles aux /32, /24 ... : | ||
'''Configuration du serveur:''' | '''Configuration du serveur:''' | ||
# OVH2::/etc/wireguard/wg0.conf | # OVH2::/etc/wireguard/wg0.conf | ||
Version du 26 juin 2024 à 12:30
KEYWORDS: WIREGUARD, VPN
Le 25/06/2024: Bouygues a l'air de merdouiller sur les ports forwarding (exemple: 1113 & 1114 ok, ssh pas ok !) J'ai donc prévu de mettre un VPN entre OVH[1,2] et Bois Dery et j'ai choisi wireguard.
apt install -y wireguard Avant tout, il faut modifier /etc/sysctl.conf: #Pour Wireguard (25/06/2024): net.ipv4.ip_forward=1 net.ipv4.conf.all.proxy_arp=1 Puis, sysctl -p pour rendre ces ordres pérennes. Puis installer le paquet resolvonf Ensuite, attention, les fichiers de conf sont très sensibles aux /32, /24 ... :
Configuration du serveur:
# OVH2::/etc/wireguard/wg0.conf
[Interface]
# Le 25/06/2024:
Address = 10.11.12.2/32
ListenPort = 51820
# Private Key du serveur OVH2:
PrivateKey = gBHG/+MoOtoQoMiAtx0IjegwOejtHO4ccIgM3ljweUc=
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eno3 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eno3 -j MASQUERADE
[Peer]
# Clé du client SRV17
Publickey = 7wBupLOQktTuwVecurg9+ZgcgwqIzHbRAfgZVnDMfws=
PersistentKeepalive = 20
Endpoint = 51.68.207.177:51820
AllowedIPs = 10.11.12.3/32
[Peer]
# Clé du client SRV09
Publickey = acVxZhdBXe87kPX4ARmhrKZ4RcZlZFgUcZZo2iEgei8=
PersistentKeepalive = 20
Endpoint = 51.68.207.177:51820
AllowedIPs = 10.11.12.1/32
[Peer]
# Clé du client SRV18
Publickey = BPBurdxfynCJtK6yh4fVlD6zF+rH03ZE7QQuqulQlSs=
PersistentKeepalive = 20
Endpoint = 51.68.207.177:51820
AllowedIPs = 10.11.12.18/32
[Peer]
# Clé du client XPS13
Publickey = IxCXwhfZ5Lf0yYUSZR5g+5aeRkFAmNIKLtHVd9MX0Cc=
PersistentKeepalive = 20
Endpoint = 51.68.207.177:51820
AllowedIPs = 10.11.12.13/32
Configuration d'un client:
# SRV09::/etc/wireguard/wg0.conf
[Interface]
Address = 10.11.12.1/32
ListenPort = 51820
DNS=8.8.8.8
# Private Key du client SRV09:
PrivateKey = WFqHoWYxwQ4rxha4dAXLhJF4Oxq5J3PlVjrqmdvpm3s=
[Peer]
# Clé du serveur (OVH2)
Publickey = cfylLxAtWKBu+5HEoGd3qYjhzCRyAxvkZEt3BIkd+2E=
PersistentKeepalive = 20
Endpoint = 51.68.207.177:51820
AllowedIPs = 10.11.12.0/24