Ce que je fait :
[Interface]
PrivateKey = <clé_privée_client>
Address = 192.168.27.65/32
DNS = 212.27.38.253
MTU = 1360
[Peer]
PublicKey = <clé_publique_freebox>
Endpoint = 82.xx:xx:xx:660
AllowedIPs = 192.168.27.64/27, 192.168.1.0/24
PersistentKeepalive = 25
chmod 600 /etc/wireguard/wg0.conf
chown root:root /etc/wireguard/wg0.conf
Je créer une table de routage:
200 wgroute
Ensuite je fait du routage sélectif:
sudo ip rule add from 10.0.0.83 table 200
sudo ip route add default dev wg0 table 200
La partit nat :
sudo iptables -t nat -A POSTROUTING -s 10.0.0.83 -o wg0 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o enp1s0f0 -j MASQUERADE
sudo iptables -I INPUT 1 -i wg0 -j ACCEPT
sudo iptables -I FORWARD 1 -i enp1s0f0 -o wg0 -j ACCEPT
sudo iptables -I FORWARD 1 -i wg0 -o enp1s0f0 -j ACCEPT
Il y a des choses a amélioré ou des chose que je fait mal.
interface: wg0
public key: fbQix73xxxxxxxxxxx
private key: (hidden)
listening port: 57520
peer:xxxxxxxxxxxxxxx
endpoint: 82.xx:xx:xx:660
allowed ips: 192.168.27.64/27, 192.168.0.0/24
latest handshake: 1 minute, 32 seconds ago
transfer: 400 B received, 1.27 KiB sent
persistent keepalive: every 25 seconds