Skip to content

Instantly share code, notes, and snippets.

@parzival-space
Last active January 29, 2025 21:11
Show Gist options
  • Save parzival-space/b4c967dbc15ab452d392d051bc719e53 to your computer and use it in GitHub Desktop.
Save parzival-space/b4c967dbc15ab452d392d051bc719e53 to your computer and use it in GitHub Desktop.

pfSense WifiPine Setup

I want my pfSense box to be able to provide a Wireless AP, but since FreeBSD apparently sucks, when it comes to WiFi-Card support, I have to workaround the problem using a Linux VM. In this case its a Alpine Linux VM, hence the name WifiPine.

Below are some notes I wrote down during the process.

1. Create ZFS

zfs create pfSense/bhyve

2. Install Bhyve

pkg install vm-bhyve
pkg add https://pkg.freebsd.org/FreeBSD:14:amd64/latest/All/edk2-bhyve-g202308_5.pkg

sysrc vm_enable="YES"
sysrc vm_dir="zfs:pfSense/bhyve"

vm init

3. Find PCI id

pciconf -v -l

3.1 Mask device from host and load kernel modules

/boot/loader.conf
vmm_load="YES"
nmdm_load="YES"
if_bridge_load="YES"
if_tap_load="YES"
pptdevs="6/0/0"

3.1.1 Add System Tunable [System -> Advanced -> System Tunables]

Tunable: net.link.tap.up_on_open Value: 1 Description: Open TAP on boot for vm-bhyve

3.2 Reboot

reboot

4. Configure VM

4.1 Create Switch

vm switch create -t manual -b bridge0 wifipine

4.2 Create Template

/pfSense/bhyve/.templates/wifipine.conf
loader="uefi"
cpu=1
memory=512M
passthru0="6/0/0"
network0_type="virtio-net"
network0_switch="wifipine"
disk0_type="nvme"
disk0_name="wifipine.img"

4.3 Download ISO

vm iso https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/x86_64/alpine-standard-3.21.2-x86_64.iso

4.4 Create VM

vm create -t wifipine -s 16G wifipine

4.4.1 DHCP Lease

Write down mac in wifipine.conf

4.4.2 Install ISO

vm install -f wifipine alpine-standard-3.21.2-x86_64.iso

4.4.2.1 Start VM (TEST)

vm start wifipine

4.4.3 Autostart VM

sudo sysrc vm_list="wifipine"
sudo sysrc vm_delay="5"

4.4.4 pfSense rc.d Workaround

See Persistent VMs on pfSense with vm-bhyve

ln -s /usr/local/etc/rc.d/vm /usr/local/etc/rc.d/vm.sh

5. Configure AP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment