Maintenant que ça fonctionne à peu près, occupons nous du routage qui est aussi capricieux :
Site A :
root@wgvpnlpa:~# route -n
Table de routage IP du noyau
Destination Passerelle Genmask Indic Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp0s3
172.16.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wg0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 wg0
Site B :
root@wgvpnlhst:~# route -n
Table de routage IP du noyau
Destination Passerelle Genmask Indic Metric Ref Use Iface
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 ens18
172.16.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wg0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wg0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 ens18
-le ping 192.168.2.0/24 > 192.168.1.0/24 fonctionne mais bizarrement pas avec tous les devices. Par exemple mon raspberry pi qui est en 192.168.1.10 est injoignable. Par contre ça fonctionne pour le NAS (192.168.1.2), mon PC (192.168.1.11) ou le routeur (192.168.1.1).
root@wgvpnlhst:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=63 time=212 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=63 time=107 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=63 time=107 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=63 time=105 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=63 time=107 ms
^C
--- 192.168.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 105.701/128.361/212.623/42.141 ms
root@wgvpnlhst:~# ping 192.168.1.11
PING 192.168.1.11 (192.168.1.11) 56(84) bytes of data.
64 bytes from 192.168.1.11: icmp_seq=1 ttl=63 time=105 ms
64 bytes from 192.168.1.11: icmp_seq=2 ttl=63 time=105 ms
64 bytes from 192.168.1.11: icmp_seq=3 ttl=63 time=104 ms
64 bytes from 192.168.1.11: icmp_seq=4 ttl=63 time=104 ms
64 bytes from 192.168.1.11: icmp_seq=5 ttl=63 time=104 ms
^C
--- 192.168.1.11 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 104.012/104.679/105.256/0.508 ms
root@wgvpnlhst:~# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
64 bytes from 192.168.1.2: icmp_seq=1 ttl=62 time=111 ms
64 bytes from 192.168.1.2: icmp_seq=2 ttl=63 time=107 ms
64 bytes from 192.168.1.2: icmp_seq=3 ttl=63 time=106 ms
64 bytes from 192.168.1.2: icmp_seq=4 ttl=63 time=104 ms
64 bytes from 192.168.1.2: icmp_seq=5 ttl=63 time=105 ms
^C
--- 192.168.1.2 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 104.520/106.868/111.129/2.373 ms
root@wgvpnlhst:~# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
^C
--- 192.168.1.10 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2036ms
-le ping 192.168.1.0/24 > 192.168.2.0/24 fonctionne uniquement vers le serveur WG (192.168.2.2) tout le reste est KO :
root@wgvpnlpa:~# ping 192.168.2.2
PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data.
64 bytes from 192.168.2.2: icmp_seq=1 ttl=64 time=106 ms
64 bytes from 192.168.2.2: icmp_seq=2 ttl=64 time=103 ms
64 bytes from 192.168.2.2: icmp_seq=3 ttl=64 time=104 ms
64 bytes from 192.168.2.2: icmp_seq=4 ttl=64 time=104 ms
^C
--- 192.168.2.2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 103.939/105.013/106.538/1.029 ms
root@wgvpnlpa:~# ping 192.168.2.3
PING 192.168.2.3 (192.168.2.3) 56(84) bytes of data.
^C
--- 192.168.2.3 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4083ms
root@wgvpnlpa:~# ping 192.168.2.1
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.
^C
--- 192.168.2.1 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3057ms
Une idée ?
Pour ce qui est est d'ouvrir une session SSH par exemple ça ne fonctionne pas non plus... même sur ceux répondant au ping.