Post

Cloudflare Mesh on Proxmox

A tale of two firewalls

We’ve been looking into migrating from Tailscale to Cloudflare Mesh at work. I’ll put my first impressions of Cloudflare Mesh in a later blog post, but I wanted to share how I got Cloudflare Mesh working on Proxmox since it does not work out of the box.

Cloudflare Mesh is a VPN solution that puts all connected hosts on the same LAN regardless of where the are physically or logically. Go check out their docs or Tailscale which is very similar.

I deployed the warp-cli agent on a server running Proxmox 9 and my laptop and configured all of the policies to allow them to talk to no avail. My laptop could not ping or ssh into the server. The server similarly could not communicate with my laptop with nc reporting “no route to host”. This led me to think that the server somehow did not have a route back to my laptop.

After a bit of debugging and snooping with tcpdump I could see that the server was in fact reaching the laptop but the laptop was rejecting with a tcp reset. Nothing ever showed up on the server’s tcpdump output. Weird! Proxmox has a firewall so I looked at it. There’s nothing immediately obvious about allowing SSH and web admin traffic in the cluster’s firewall settings but there are “IPSets” and one is labeled “management” which has the management subnet defined to allow SSH and web traffic.

But the Cloudflare client adds its own firewall rules to allow incoming traffic on its interface - why isn’t that working? According to AI it’s because Cloudflare uses nftables while Proxmox uses iptables which is seemingly applied before nftable rules. Adding the mesh IP range to Proxmox’s iptables firewall rules solves the problem.

The Easy Fix

Adding the Cloudflare Mesh IP range to the management IPSet allows Cloudflare Mesh nodes to access SSH, the web admin page, and a few other ports. This is the easiest solution and is scoped to a few ports.

1
2
3
pvesh create /cluster/firewall/ipset/management \
  --cidr 100.96.0.0/12 \
  --comment "Cloudflare Mesh"

Note that this does not match against the Cloudflare network interface so it might be easier to spoof and gain access.

The Nuanced Fix

Rather than adding the mesh IP range to the management network you can create a firewall rule that allows all ports, specific ports or other granular policies while scoping it to the Cloudflare network interface.

Here’s an example that allows access to all ports:

1
2
3
4
5
6
7
pvesh create /cluster/firewall/rules \
  --type in \
  --action ACCEPT \
  --iface CloudflareWARP \
  --source 100.96.0.0/12 \
  --enable 1 \
  --comment "Cloudflare Mesh"

You could create rules that match specific IPs and ports or protocols.

Migrating from Tailscale

We are migrating from Tailscale which worked without a hitch! According to AI Tailscale puts its rules in iptables which is true in our setup.

Conclusion

VPN deployments are complicated especially when using host agents and dealing with multiple firewall backends. Proxmox’s lack of visibility combined with nc’s “no route to host” error took me down the wrong path initially. Allowing the Cloudflare Mesh IP range in Proxmox’s Firewall is the best solution and should prove to be future-proof.

I plan on writing another post about my overall experience with Cloudflare Mesh soon.

This post is licensed under CC BY 4.0 by the author.