WireGuard should switch between Wifi and Mob1s1a1 - new QR settings and Server IP field unclear

Hello!

WireGuard should switch between Wifi1 and Mob1s1a1. However, since some firmware update, I suddenly see a new tab “QR settings” under “Peers” and there is “Server IP”, where I need to select either Wifi1 or Mob1s1a1.

Now how do I set this up, so my RUTX11 can switch its WireGuard connection to my Fritzbox at home, irrespective if the RUTX11 is connected to the Internet via Wifi (e.g. public campsite), via mobile network (SIM card), or via Wifi directly to my Fritzbox if the car is parked in its Wifi reach?

I am still very puzzled that there is no good tutorial or even better a “one-button-solution” that creates a ready to use file that can be imported to an AVM Fritzbox, one of the most common routers across Europe.

MS Copilot even suggested that I shall create a script and use a cron job to dynamically switch:

#!/bin/bash

# Aktuelle IP-Adresse des WiFi-Interfaces abrufen
wifi_ip=$(ip addr show wifi1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)

# Aktuelle IP-Adresse des Mobilfunk-Interfaces abrufen
mob_ip=$(ip addr show mob1s1a1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)

# WireGuard-Konfigurationsdatei
wg_config="/etc/wireguard/wg0.conf"

# Endpunkt basierend auf der verfügbaren Verbindung ändern
if [ -n "$wifi_ip" ]; then
    # WiFi ist verbunden
    sed -i 's/Endpoint = .*/Endpoint = <Fritzbox_IP>:51820/' $wg_config
elif [ -n "$mob_ip" ]; then
    # Mobilfunk ist verbunden
    sed -i 's/Endpoint = .*/Endpoint = <Fritzbox_IP>:51820/' $wg_config
fi

# WireGuard neu starten
wg-quick down wg0
wg-quick up wg0

While I understand almost nothing about this, I really hope that it is less complicated.

Should I instead create 2 peers (one with Wifi1 Server IP, the other with Mob1s1a1 Server IP and then of course with different key pairs (as one public key cannot be shared across peers)?

Thanks everybody for sharing your thoughts! :+1: