Bonjour,
J'ai du lire à peu près tous les tutos français et anglais sur wireguard et je n'arrive pas à faire fonctionner ma configuration sur mon serveur ubuntu 20.04.
wg0.conf sur le serveur :
[Interface]
Address = 10.66.66.1/24
ListenPort = 51820
PrivateKey = ACFylod...
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o enp2s0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o enp2s0 -j MASQUERADE
#ipad
[Peer]
PublicKey = N6sYQZ...
AllowedIPs = 10.66.66.2/32
Le port 51820 est bien rerouté en udp vers mon serveur sur la freebox
conf client (ipad)
[Interface]
PrivateKey = ONwwWC...
Address = 10.66.66.2/24
DNS = 8.8.8.8,208.67.222.222
[Peer]
PublicKey = Glzl88V...
Endpoint = mon_ip:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
NB: J'ai aussi essayé en mettant AllowedIPs = 10.66.66.1/32
La connection VPN sur iPad semble bien être activée, mais :
Résultat ping 10.66.66.1 sur iPad :
Request timeout for icmp...
Résultat ping 10.6.66.2 sur Serveur
PING 10.66.66.2 (10.66.66.2) 56(84) bytes of data.
From 10.66.66.1 icmp_seq=1 Destination Host Unreachable
ping: sendmsg: Adresse de destination requise
From 10.66.66.1 icmp_seq=2 Destination Host Unreachable
Commande wg sur serveur :
root@Lenovo:/etc/wireguard# wg
interface: wg0
public key: <serv_public_key>
private key: (hidden)
listening port: 51820
peer: <ipad_public_key>
allowed ips: 10.66.66.2/32
Donc pas de "latest handshake" bien que l'ipad me dise qu'il est connecté...
ifconfig sur serveur
root@Lenovo:/etc/wireguard# ifconfig
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.50 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::49fa:1b41:e79a:7a8b prefixlen 64 scopeid 0x20<link>
ether c0:3f:d5:0a:0d:10 txqueuelen 1000 (Ethernet)
RX packets 9887 bytes 2403712 (2.4 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5947 bytes 1152258 (1.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Boucle locale)
RX packets 545 bytes 45012 (45.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 545 bytes 45012 (45.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.8.0.1 netmask 255.255.255.0 destination 10.8.0.1
inet6 fe80::e4b0:9277:37bc:d99a prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 438 bytes 37678 (37.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 341 bytes 114843 (114.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wg0: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1420
inet 10.66.66.1 netmask 255.255.255.0 destination 10.66.66.1
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 12 dropped 0 overruns 0 carrier 0 collisions 0
iptables -t nat -v -n -L
root@Lenovo:/etc/wireguard# iptables -t nat -v -n -L
Chain PREROUTING (policy ACCEPT 505 packets, 47301 bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 505 packets, 47301 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 64 packets, 5162 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 23 packets, 1796 bytes)
pkts bytes target prot opt in out source destination
68 4440 SNAT all -- * * 10.8.0.0/24 !10.8.0.0/24 to:192.168.0.50
41 3366 MASQUERADE all -- * enp2s0 0.0.0.0/0 0.0.0.0/0
Dans /etc/sysctl.conf, la ligne
net.ipv4.ip_forward=1
est bien décommentée...
ufw n'est pas actif
Ca doit être évident pour un spécialiste réseau vu que tous les tutos wireguard sont à peu près identiques, mais je sèche ...