Page 1 of 1

Using Automate on Android for Wireguard on dynamic IP

Posted: Wed Feb 14, 2024 3:38 pm
by inteq
Valid for people connecting to a Wireguard server that is hosted on a dynamic IP/DNS connection.

When using Wireguard client on Android and the IP of the Wireguard server changes, the tunnel will be stuck active but no traffic will pass.
The user needs to deactivate and activate the tunnel to fix it.

To automate this, I am using Automate for Android: https://play.google.com/store/apps/deta ... e&hl=en_US
As I could not find a flow to fix my specific issue, I have wrote a small one that does.

How to get it.
Install Automate, go to Community and search for "Wireguard check. DynDNS & SSID"
Direct link to file: https://llamalab.com/automate/community ... 6+SSID.flo

Features
1. Checks if wireguard tunnel is actually working and retries if not. Useful with wireguard servers behind dynamic IP using dynamic DNS. If the IP changes, the tunnel will get stuck, requiring manual deactivate/activate.
2. Disables the tunnel if on specific SSID.
3. Enables the tunnel if not on specific SSID.

Setup
1. Edit block 1 and set your SSID. Leave empty if you don't need feature 2.
2. Edit blocks 2 and 3 and set your tunnel name.
3. Edit block 5 and input an IP that is only reachable through the tunnel, like the router's private IP. Wireguard must be able to get an icmp reply from the IP.
4. Edit delays in blocks 9, 10 and 13 to suit your needs. In my testing, 60 seconds is fine. Lower it for faster reaction time, but higher battery usage.
5. Disable logging when done testing.
6. In Wireguard client settings, check "Allow remote control apps".
7. Disable app battery usage for Wireguard as well as for Automate.
8. Disable "Pause app activity if unused" for Wireguard and Automate.
9. Make sure to set the permission for Automate app "control WireGuard tunnels" to on, or else it won't be able to activate/deactivate the tunnel.
perm.png


How the flow looks
flow.jpg
As this is my first ever flow in Automate, I am sure there is room for improvement.
Please share your ideas if you have some.

Re: Using Automate on Android for Wireguard on dynamic IP

Posted: Thu Feb 22, 2024 1:30 pm
by Mesquite
What does this have to do with Mikrotik?