← ClaudeAtlas

lxd-docker-firewall-conflictlisted

Diagnose and fix the well-known Docker/LXD firewall conflict on a host running both. Docker sets the iptables FORWARD chain policy to DROP and accepts only its own bridges, so forwarded traffic from the LXD bridge (lxdbr0) is silently dropped and LXD containers/VMs get no outbound internet (the host itself is fine). Fix: accept the LXD bridge in the DOCKER-USER chain, then persist it with a systemd unit ordered after docker.service. Use when an LXD container has no internet or cannot reach archive.ubuntu.com, when "apt update"/"apt-get"/"curl" inside an LXD container times out or reports "Network is unreachable" / "connection timed out" / "Failed to fetch" (but the same works on the host), when a packer-lxd image build fails during "apt update", when LXD container networking breaks right after installing Docker, or when iptables shows "policy DROP" on FORWARD with an empty DOCKER-USER chain. The LXD bridge already has ipv4.nat=true and net.ipv4.ip_forward=1 — it is purely a FORWARD-chain drop, not a NAT or DN
soulmachine/skills · ★ 2 · AI & Automation · score 75
Install: claude install-skill soulmachine/skills
# LXD ↔ Docker firewall conflict (FORWARD DROP) When Docker and LXD share a host, **Docker sets the iptables `FORWARD` chain policy to `DROP`** and only ACCEPTs traffic for its own bridges. Forwarded packets from the LXD bridge (`lxdbr0`) match nothing and fall through to the DROP policy, so **LXD containers/VMs lose all outbound internet** — even though the host itself is fine and the LXD bridge has `ipv4.nat=true`. The fix is to ACCEPT the LXD bridge in Docker's `DOCKER-USER` chain and persist it. ⚠️ This is **not** a NAT, DNS, or LXD-config problem. The bridge's `ipv4.nat=true` and `net.ipv4.ip_forward=1` are already correct — packets are dropped at the `FORWARD` hook before NAT ever applies. Don't waste time reconfiguring the bridge, DNS, or `lxd init`. ## Quick start ```bash # Detects managed LXD bridges, adds DOCKER-USER ACCEPT rules, and installs a # systemd unit so they survive reboots + docker restarts. Idempotent; re-runnable. bash scripts/fix-lxd-docker-forward.sh ``` ## Symptoms - Inside an LXD container, `apt update` / `apt-get` / `curl` **times out** on IPv4 (`connection timed out`, `Failed to fetch`) and/or instantly says `Network is unreachable` on IPv6. - The **exact same request works on the host.** - A `packer-lxd` image build errors in its first shell provisioner at `apt update` → `Failed to fetch ... Could not connect ... connection timed out`. - It began right after **Docker was installed** on the LXD host (or after a Docker upgrade re-applied