· 2 min read

How I Fixed My Homelab Cloudflare Tunnel After a Power Outage Broke Everything

Funny meme

So yesterday, something fun happened: my apartment’s utility got cut off for a few hours (thanks, landlord 🙃), which meant my homelab — including all my self-hosted VMs — went down hard.

Now, the whole point of my setup is to self-host things like a GitHub Actions runner that helps build my little Jisho-powered server. Super cool and convenient — when it works. But after the power came back, my server didn’t. Well… not fully.

🔍 The Problem: Dynamic IPs and Cloudflare Tunnel Don’t Mix

After everything rebooted, I noticed some of my apps weren’t accessible from the internet anymore. Specifically, my Cloudflare Tunnel setups started failing.

I checked the tunnel config, and sure enough: they were still pointing to internal IPs like 192.168.68.99 — but those VMs had new IPs now. One of them got 192.168.68.77, another was 192.168.68.88, etc. Basically: my router handed out fresh IPs and broke everything.

✅ The Fix: Make Those VM IPs Stick

Here’s how I fixed it:

1. Set a Static IP Inside Each VM

On each Linux VM, I updated the Netplan config to disable DHCP and assign a fixed IP.

Example for Ubuntu (/etc/netplan/01-netcfg.yaml):

network:
  version: 2
  ethernets:
    ens18:  # ⚠️ This name matters! Check your actual network interface.
      dhcp4: no
      addresses:
        - 192.168.68.99/24
      nameservers:
        addresses: [1.1.1.1, 8.8.8.8]
      routes:
        - to: 0.0.0.0/0
          via: 192.168.68.1

Then apply the changes:

sudo netplan apply

💡 Tip: You can check the network interface name using ip link. It might be ens18, eth0, or something else depending on your setup.

2. (Optional) Set a DHCP Reservation on the Router

If you don’t want to change VM configs, another option is to reserve an IP via your router:

  • Get your VM’s MAC address.
  • Log into your router’s DHCP or LAN settings.
  • Assign a reserved IP to that MAC address.

This way, the VM still uses DHCP but always gets the same IP — your Cloudflare Tunnel will be happy.

🎉 The Result: Cloudflare Tunnel Back in Action

With static IPs in place, my VMs now boot with consistent addresses. Cloudflare Tunnel started working immediately — no need to reconfigure anything again.

🧠 Takeaway

If you’re self-hosting anything behind Cloudflare Tunnel, avoid relying on dynamic IPs for your internal services.

Use either:

  • Static IPs (with Netplan or /etc/network/interfaces)
  • Or DHCP reservations from your router

That way, you don’t need to manually fix your tunnels every time your power blinks.

Trust me — future you will thank you 😄

Back to Blog