FreeBSD-based router, built using poudriere.
Largely inspired by NanoBSD, ZFS Magic Upgrades, and the BSD Router Project.
-
Create a poudriere jail (with a kernel)
poudriere jail -c -j router -v 14.1-RELEASE -K GENERIC
-
Create a ports tree
QUARTERLY_BRANCH=$(date +%YQ)$((($(date +%-m)-1)/3+1)) poudriere ports -c -U https://git.freebsd.org/ports.git -B $QUARTERLY_BRANCH \ -p quarterly
-
Create/modify the list of ports to be included
cat > pkglist <<EOF net/bird2@netlink sysutils/tmux security/strongswan ... EOF
-
Build the ports
poudriere bulk -j router -b quarterly -p quarterly -f pkglist
-
Create the router image
poudriere image -t zfs -j router -s 4g -p quarterly -n router \ -f pkglist -c overlaydir -B pre-script.sh -X excludefile
-
Test the image
sh /usr/share/examples/bhyve/vmrun.sh -uE -m 4G -n e1000 -t tap0 -t tap1 \ -d /usr/local/poudriere/data/images/router.img router
-
Update the poudriere jail
poudriere jail -u -j router
-
Update the ports tree
poudriere ports -u -p quarterly
or create an updated ports tree
QUARTERLY_BRANCH=$(date +%YQ)$((($(date +%-m)-1)/3+1)) poudriere ports -c -U https://git.freebsd.org/ports.git -B $QUARTERLY_BRANCH \ -p quarterly
-
Build the ports
poudriere bulk -j router -b quarterly -p quarterly -f pkglist
-
Create a router boot environment (BE)
poudriere image -t zfs+send+be -j router -s 4g -p quarterly -n router \ -f pkglist -c overlaydir -B pre-script.sh -X excludefile
-
Test the BE image:
-
Optionally, compress the BE image created in the previous step
xz -9 --keep /usr/local/poudriere/data/images/router.be.zfs
-
Start a VM with the old image
sh /usr/share/examples/bhyve/vmrun.sh -uE -m 4G -n e1000 -t tap0 -t tap1 \ -d /usr/local/poudriere/data/images/router.img router
-
From the router, import the new BE
fetch -o - https://srv/router.be.zfs.xz | unxz | bectl import newbe
-
Boot once
bectl activate -t newbe
-
Reboot
shutdown -r now "Rebooting for a firmware upgrade"
-
The router uses ZFS as the underlying file system, but mounts /etc
and /var
as memory disks (like NanoBSD).
In order to save configuration changes, issue the following command:
# save_cfg
Configuration changes are then saved to /cfg
, to overlay the base /etc
template (NanoBSD-style).
- Add a
VARIANT
and aVARIANT_ID
to /var/run/os-release - No-priv build
- /boot/efi capsule upgrades
- Document incremental snapshots (BE)
- Adapt some scripts from BSDRP