LoginSignup
2
2

More than 3 years have passed since last update.

WireGuardで「ping: sendmsg: Required key not available」と出たときの対処法

Posted at

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
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2