On Thu, May 20, 2021 at 9:23 PM Max Schulze <max.schu...@online.de> wrote: > On 20.05.21 18:20, Roman Mamedov wrote: > > On Thu, 20 May 2021 11:15:30 +0500 > > Roman Mamedov <r...@romanrm.net> wrote: > > > >>> So, what do you mean is that wireguard does a single DNS resolution at > >>> the beginning and further DNS resolutions need to be done elsewere. Is > >>> that correct? > >> Yes. > Just to point out what 'others are doing' - openwrt has a watchdog > script [1] that might be run with cron every 15 mins > > */15 * * * * /usr/bin/wireguard_watchdog > > which will update the new endpoint if the last handshake is too old: > > wg set ${iface} peer ${public_key} endpoint > "${endpoint_host}:${endpoint_port}" > > It needs PersistenKeepalive also, if i understand correctly. > > [1] > https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/network/utils/wireguard-tools/files/wireguard_watchdog;hb=HEAD > > -- > > Max
Hello, i've been running this script on a setup with a wg interface with a single peer: while true ; do sleep 300 curr=$(date +%s) prev=$(wg show wg0 latest-handshakes | cut -f2) elapsed=$(( ${curr} - ${prev} )) [ ${elapsed} -ge 300 ] && wg syncconf wg0 /etc/wireguard/wg0.conf done on the client side for 3 days and the issue occurred once again. This time the connection was restablished automatically and no manual intervention was required. Thank you Max and Roman. Regards, Vicenç.