WireGuardを設定していざ疎通をチェックしようとした場合、
以下のようにエラーになることがある。
[root@myhost ~]# ping 10.244.0.4
PING 10.244.0.4 (10.244.0.4) 56(84) bytes of data.
From 192.168.210.253 icmp_seq=1 Destination Host Unreachable
ping: sendmsg: Required key not available
From 192.168.210.253 icmp_seq=2 Destination Host Unreachable
ping: sendmsg: Required key not available
^C
--- 10.244.0.4 ping statistics ---
2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 1001ms
これはWireGuardのAllowed IPsに送り先のアドレスがないために起こっている。
AllowedIPsに必要なアドレス空間を追加して対処する。
wg0.conf
[Peer]
PublicKey = XXXXXXXXXXX...
- AllowedIPs = 192.168.192.0/18
+ AllowedIPs = 192.168.192.0/18,10.244.0.0/16
これによって、相手側から送り返されるpongパケットが正常にWireGuardによって処理される。
[root@myhost ~]# ping 10.244.0.4
PING 10.244.0.4 (10.244.0.4) 56(84) bytes of data.
64 bytes from 10.244.0.4: icmp_seq=1 ttl=63 time=7.43 ms
64 bytes from 10.244.0.4: icmp_seq=2 ttl=63 time=7.21 ms