NoIpClientVPN
A Raspberry Pi script that keeps a No-IP DDNS hostname pointed at the current public IP, with Telegram alerts on change — so the home VPN stays reachable even when the IP changes.
The problem
My home connection runs through a router on a mobile/LTE network, with a public IP that changes and that the router doesn’t reliably push to the DDNS service. Without a stable address to point at, the home WireGuard server becomes unreachable from outside exactly when you need it.
What it does
Every 5 minutes, run by cron, the script:
- Fetches the current public IP from an external service.
- Compares it with the last known value (kept in a cache).
- If it changed → updates the No-IP DDNS via their API and sends a Telegram message.
- If it’s unchanged → exits silently, doing nothing.
That way the hostname always points at the right IP, and the WireGuard client can use it as its endpoint without touching the router configuration.
Details
- Last-IP cache to avoid pointless updates (and to respect No-IP’s rules).
- Optional Telegram notifications, only when the IP actually changes.
- Credentials kept out of the code, in a
.envfile. - File logging with explicit handling of No-IP’s responses (
good/nochg/badauth/nohost) so it’s obvious at a glance what happened.
Stack
Python · Raspberry Pi · cron · No-IP API · WireGuard · Telegram