My setup is,
At remote end, I have a raspberry pi running wireguard server. Since this ISP changes WAN ip address every 24 hours, I have a ddns update service running on the pi to automatically update the new ip to dns name every 5 minute.
At local, I have an openwrt router configured with wireguard client connected to above wireguard server.
Is there a way to make the VPN interface restart when dns ip is changed?
Presumably, your local side is acting as a client, right? In that case, use watchcat on your local side to detect when things stop working through the tunnel and then restart the Wireguard interface.
Yes. my local side is acting as client.
watchcat should fix my problem I believe.
One question though, after ping fails on dns (at this point remote WAN IP is changed), it takes approximately 10 minutes for the remote raspberry pi to update new WAN ip to dns.
Is there a way, I can set that 10 min delay in watchcat restart interface?
I don't know, actually, as I've never used watchcat myself. But it seems that you should be able to set a period to properly account for this: Restart Interface: the longest interval of time without a successful ping before the rule is activated