Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| omv8:omv8_plugins:wireguard [2025/12/30 18:34] – [Update DuckDNS IP, receive notifications only when it changes, and restart WireGuard automatically] chente | omv8:omv8_plugins:wireguard [2025/12/31 08:57] (current) – [Update DuckDNS IP, receive notifications only when it changes, and restart the tunnel if needed] chente | ||
|---|---|---|---|
| Line 555: | Line 555: | ||
| - | === Update DuckDNS IP, receive notifications only when it changes, and restart | + | === Update DuckDNS IP, receive notifications only when it changes, and restart |
| - | You can add this script to a scheduled task so that your public | + | This script |
| + | * Update | ||
| + | * Reactivate the tunnel interface if it is down. | ||
| + | * Send an email only when changes | ||
| - | Additionally, | + | Useful for securing persistent connections |
| - | | + | **WireGuard tunnel naming in OMV-extras plugin** |
| - | < | + | * Standard tunnels: |
| + | * Tunnel number 1 → '' | ||
| + | * Tunnel number 2 → '' | ||
| + | * Custom tunnels: | ||
| + | * The plugin automatically prefixes the name with '' | ||
| + | * Example: if you name your custom tunnel '' | ||
| + | * Example: if you name it '' | ||
| - | | + | Summary: |
| - | * Replace | + | |
| - | * For custom tunnels, add an underscore: '' | + | * Custom: |
| - | * Enable OMV notifications to get an alert if the public IP changes. | + | |
| + | Important: The TUNNELS variable in the scheduled task script must use these internal names to correctly check and reactivate the interfaces. | ||
| + | |||
| + | **Script example: | ||
| + | |||
| + | < | ||
| + | DOMAIN=" | ||
| + | TOKEN=" | ||
| + | TUNNELS=" | ||
| + | UPDATED=0 | ||
| + | |||
| + | # Update IP address in DuckDNS | ||
| + | curl -s -k " | ||
| + | echo "IP updated in DuckDNS" | ||
| + | UPDATED=1 | ||
| + | } | ||
| + | |||
| + | # Check tunnel | ||
| + | for TUNNEL in $TUNNELS; do | ||
| + | ip link show " | ||
| + | echo " | ||
| + | systemctl start wg-quick@" | ||
| + | UPDATED=1 | ||
| + | } | ||
| + | done | ||
| + | |||
| + | [ " | ||
| + | </ | ||
| + | |||
| + | **How to use:** | ||
| + | * Replace placeholders with your real values: | ||
| + | * [MY_DOMAIN] = Your DuckDNS domain (without .duckdns.org) | ||
| + | * [MY_TOKEN] = Your DuckDNS token | ||
| + | * [MY_TUNNEL_NUMBER_1], [MY_TUNNEL_NUMBER_2], etc. = Internal tunnel names as described above | ||
| + | * Single-line version for OMV Scheduled Tasks: | ||
| + | * < | ||
| + | * Enable OMV notifications to receive alerts when the public IP changes | ||
| * Add a descriptive label to your scheduled task. | * Add a descriptive label to your scheduled task. | ||
| - | * Once configured, just copy the command into **Scheduled Tasks** and set the execution interval. | + | * Make sure **curl** |
| - | * Remember to have **curl** installed before running the task. | + | |
| ---- | ---- | ||