2026-11-03 (Stevie): the OPNsense and IPFire VM definitions, their import scripts, the
unheaded-firewallprofile and the WAN bridge were removed. The lab's firewall is the host nftables ruleset (ADR-098 step 6) and Heimdall; FRR runs natively on west and east (routing/). Only the FRR and BIRD container notes below remain.
This directory contains configurations for deploying OPNsense and IPFire as LXD VMs, along with FRR and BIRD routing daemons as containers.
LXD VMs are the best platform for enterprise-grade firewalls like OPNsense and IPFire because:
- Full Kernel Isolation: VMs run their own complete kernel (FreeBSD for OPNsense, Linux for IPFire), providing true OS-level isolation from the host and other containers.
- Native Driver Support: Access to real NIC drivers, not just virtio pass-through. OPNsense and IPFire expect full hardware control.
- Serial Console Access: LXD VMs support serial consoles, which is essential for initial setup and troubleshooting of headless firewalls.
- Memory and CPU Isolation: True resource isolation, not cgroups-based limits.
- QEMU/KVM Performance: Hardware virtualization ensures firewall packet processing isn't limited by container overhead.
- Stateful Firewall Rules: Both OPNsense and IPFire maintain complex stateful firewall tables that require full kernel support.
The OPNsense image is a serial-optimized FreeBSD disk image (520MB bz2):
bash lxd/firewall/import-opnsense.sh
This script:
- Decompresses the bz2 image to raw format
- Creates LXD metadata.yaml with FreeBSD properties
- Imports into LXD as a VM image with alias
opnsense-26.1.2 - Verifies the import succeeded
The IPFire image is a Linux disk image (497MB xz):
bash lxd/firewall/import-ipfire.sh
This script:
- Decompresses the xz image to raw format
- Creates LXD metadata.yaml with Linux properties
- Imports into LXD as a VM image with alias
ipfire-2.29-core199 - Verifies the import succeeded
| Feature | VM | Container |
|---|---|---|
| Kernel | Own kernel instance | Shared host kernel |
| Isolation | Hardware-level | cgroup/namespace |
| Boot time | 30-90 seconds | <1 second |
| Overhead | ~2-4% CPU/mem | <1% |
| Use case | Firewalls, legacy OS | Microservices, stateless |
| File system | Full ext4/UFS | Overlayfs |
| Network driver | Real virtio NIC | Virtual bridge |
OPNsense and IPFire MUST run as VMs — they need full OS control and can't share the host kernel.
Both firewall VMs have two network interfaces:
- Type: macvlan (direct physical NIC pass-through)
- Parent:
eno1(your physical WAN NIC) - Role: Connects to upstream router / external network
- Configuration: DHCP (or static, depending on upstream)
- NO host IP: The firewall VM owns this interface entirely
- Type: bridged
- Parent:
unheaded(the service container bridge) - Role: Connects to internal service containers
- IP: 10.20.0.1/16 (configured inside firewall)
- Purpose: Provides DHCP/routing to internal containers
OPNsense and IPFire both support serial console, which is essential for initial setup:
# Connect to OPNsense serial console lxc console unheaded-opnsense # Connect to IPFire serial console lxc console unheaded-ipfire # Type Ctrl+A then Q to exit
The serial console allows:
- Initial firewall setup wizard
- Network interface configuration
- Root password setup
- Debugging boot issues
- Emergency access if web UI fails
The boot.autostart.priority configuration ensures services start in the correct order:
-
Priority 200 (OPNsense/IPFire): Firewall VMs start FIRST
- Wait 30 seconds for OPNsense/IPFire to fully initialize
- These provide the critical egress/ingress path
-
Priority 190 (FRR/BIRD): Routing daemons start SECOND
- Wait 10 seconds for routing engines to initialize
- They announce routes via BGP to the firewall
-
Priority 100-150 (Services): All other containers start LAST
- Depend on firewall for egress and routing for traffic optimization
- Safe to start once firewall is operational
- Firewall first: Packet egress/ingress must be controlled from the start
- Routing second: BGP speakers need to advertise routes immediately after firewall is up
- Services last: Depend on both firewall and routing being ready
After launching:
lxc console unheaded-opnsense
You'll see the FreeBSD boot messages and eventually the OPNsense setup wizard:
Choose an option from the menu:
1) Configure LAN interface
2) Configure WAN interface
3) Configure OPT interfaces
4) Set up encryption
5) Shell
6) Reboot
7) Halt
8) Reset factory defaults
Critical steps:
- Set WAN interface to
vtnet0→ DHCP (or static IP depending on upstream) - Set LAN interface to
vtnet1→ Static IP 10.20.0.1/16 - Configure root password
- Enable sshd (for remote configuration)
- Set hostname to
opnsense-host-a
After initial setup, you can configure firewall rules via:
- Web UI:
https://10.20.0.1(from a container on theunheadedbridge) - SSH:
ssh [email protected](once firewall rules allow it) - OPNsense REST API:
https://10.20.0.1/api(with API key)
After launching:
lxc console unheaded-ipfire
IPFire will boot to a login prompt. Default credentials:
Username: root
Password: (set during installation, or 'password' if factory reset)
Critical setup:
- Run
setupto configure networking - Assign
eth0to RED (WAN) → DHCP - Assign
eth1to GREEN (LAN) → Static 10.20.0.1/255.255.0.0 - Set hostname to
ipfire-host-b - Change root password
- Enable web UI (on port 10443 by default)
Access web UI:
- URL:
https://10.20.0.1:10443 - User: admin
- Password: (your chosen password)
FRR runs in a container on host-a:
lxc launch ubuntu:24.04 unheaded-frr --profile unheaded-base --profile unheaded-ebpf
The container's cloud-init automatically:
- Installs build dependencies
- Creates frr user/group
- Sets up directories
To build and install FRR from source:
lxc exec unheaded-frr -- bash cd /tmp git clone https://github.com/FRRouting/frr.git cd frr ./configure --prefix=/usr --sysconfdir=/etc/frr make make install
Then configure BGP in /etc/frr/bgpd.conf:
router bgp 65001
bgp router-id 10.20.255.1
neighbor 10.20.0.1 remote-as external
neighbor 10.20.0.1 description "OPNsense WAN"
address-family ipv4 unicast
neighbor 10.20.0.1 activate
exit-address-family
Start FRR:
systemctl start frr
systemctl enable frrBIRD runs in a container on host-b:
lxc launch ubuntu:24.04 unheaded-bird --profile unheaded-base --profile unheaded-ebpf
Cloud-init installs build dependencies and creates bird user/group.
Build BIRD from source:
lxc exec unheaded-bird -- bash cd /tmp git clone https://github.com/BIRD/bird.git bird cd bird ./configure make make install
Configure BGP in /etc/bird/bird.conf:
router id 10.20.255.2;
protocol bgp {
local as 65002;
neighbor 10.20.0.1 as external;
export all;
import all;
}
protocol device {
scan time 10;
}
Start BIRD:
systemctl restart bird
systemctl enable birdAfter initial OPNsense setup, you can install the FRR plugin for native BGP support:
- Log into OPNsense web UI:
https://10.20.0.1 - Navigate to System → Firmware → Plugins
- Install os-frr plugin
- Configure BGP in Routing → BGP
- Reload FRR daemon
This allows OPNsense to speak BGP natively without a separate container.
- Check serial console:
lxc console unheaded-opnsense - Verify image import:
lxc image list | grep opnsense - Check QEMU errors:
lxc info unheaded-opnsense | grep -A5 Error
- Verify LAN bridge is connected:
lxc network list - Check firewall rules inside VM (may be blocking access initially)
- Verify container is on
unheadedbridge:lxc config show unheaded-SERVICE | grep parent
- Verify firewall has routing enabled (not just filtering)
- Check BGP session status:
vtysh -c "show ip bgp summary" - Verify ASN/router-id configuration
- Check firewall's BGP config (if using native BGP, not FRR plugin)
- Try
lxc console --type=vgafor alternative console - Reboot VM:
lxc restart unheaded-opnsense --force - Check if SSH is available instead
- Image import scripts:
lxd/firewall/import-*.sh - Network config:
lxd/networks/wan-bridge.yaml - Firewall profile:
lxd/profiles/unheaded-firewall.yaml - Launch scripts:
lxd/hosts/host-a/launch-all.sh,host-b/launch-minimal.sh
- OPNsense: BSD 2-Clause
- IPFire: GPL 2.0
- FRR: GPL 2.0+
- BIRD: GPL 2.0+