4G modem over VPN

Hi everyone,

I’ve set up a custom router for my mobile home using a Raspberry Pi 4B. It’s configured with internal WiFi as an access point, a 4G modem, a USB WiFi AX dongle, and the option to use phone tethering for connectivity. Everything works flawlessly, including a VPN that automatically connects to my home network before routing to the internet. I followed this OpenVPN guide, and overall, the setup works great—except for one issue.

When I connect my 4G modem, all connectivity is lost. If I disable the VPN kill-switch and restart, the 4G modem works fine again. The configuration appears consistent, as the same WAN interface and OpenWRT firewall rules are applied across the setup.

I suspect it might have something to do with the virtual Ethernet interface created when using the 4G modem, but I’m unsure how to address or configure this properly. Does anyone have insights or suggestions?

Additionally, I’d like to know if it’s possible to prioritize network connections in OpenWRT (e.g., setting a preference order for 4G, WiFi, or tethering).

Thanks in advance for any advice or assistance!

Does anyone have an idea what could be wrong here and how to solve this?

I've been running some tests and encountered the following issues:

  1. Modem Disconnects and Restarts: When I disable my VPN (and kill switch) and rely solely on my modem for the connection, the modem disconnects and restarts after approximately 30 seconds. I can confirm this because my provider assigns a new IP address each time. I'm not sure what might be causing this, but is there a specific setting I can adjust to prevent the modem from disconnecting and restarting?
  2. DNS Issue When Restarting the Router: With my VPN and kill switch enabled, if I restart the router, I can ping both LAN IPs and other IPs, but I can't resolve any URLs. This seems to point to a DNS-related problem.

Notably, I don't experience these issues when connecting via WiFi or tethering through my phone.

Does this spark any ideas for a solution?

I found one of the 2 problems:

I followed this tutorial for USB tethering on open wrt for Restart tethering on connection failure:

https://openwrt.org/docs/guide-user/network/wan/smartphone.usb.tethering#restart_tethering_on_connection_failure

After putting this in scheduled task using * * * * * /root/wan-watchdog.sh then every minute my connection goes down, signal is lost and modem restarts.

After disabling this scheduled task everything stays connected and works without problems.

Why does this script not work as it should and do I need this script?

The problem with DNS is still not solved and tried multiple things. When connected to my modem I have a VPN connection to my VPN server and it is active. I can ping my internal LAN and IP addresses on the WAN but I cannot resolve hosts and I don't know howto solve this. When connected via USB Tethering or WiFi I don't have this problem.

Hope someone can help.