说明
系统环境为 debian,提前完成 qemu 组件的配置
apt install qemu-system apt install qemu-user-static # RHEL/CentOS: yum install qemu-kvm
- 组件版本 http://147.8.92.207/opnsense/FreeBSD%3A13%3Aaarch64/24.1/latest/
- 组件升级说明 https://yrzr.github.io/opnsense-23-for-aarch64/#32-qemu
- 虚拟机版本 https://github.com/yrzr/opnsense-tools/releases https://github.com/maurice-w/opnsense-vm-images/releases
- aarch64 repo https://opnsense-update.walker.earth/
下载对应版本
wget https://github.com/yrzr/opnsense-tools/releases/download/24.1.5/OPNsense-24.1.5-vm-aarch64.vmdk.xz xz -d OPNsense-*-aarch64*.*.xz qemu-img convert -f vmdk -O raw OPNsense-*-vm-aarch64.vmdk OPNsense-out.raw wget https://retrage.github.io/edk2-nightly/bin/RELEASEAARCH64_QEMU_EFI.fd mv RELEASEAARCH64_QEMU_EFI.fd edk2-aarch64-code.fd cp edk2-aarch64-code.fd /usr/share/qemu/
配置网络
apt install brctl-utils ip a brctl delbr br0 brctl addbr br0 ip address add 192.168.192.78/24 dev br0 ip link set dev br0 up brctl addif br0 eth0 ip address del 192.168.192.78/24 dev eth0 ip route add defaul via 192.168.192.1 qemu-system-aarch64 -bios /usr/share/qemu/edk2-aarch64-code.fd -M virt,gic-version=max \ -cpu cortex-a57 -smp 4 -m 2048M -nographic -drive format=raw,file=OPNsense-out.raw,cache=none,if=virtio \ -netdev bridge,id=nic0,br=br0 -device virtio-net,netdev=nic0,mac=da:65:2e:22:da:8c -netdev bridge,id=nic1,br=br0 \ -device virtio-net,netdev=nic1,mac=da:65:2e:22:da:8d
启动主机后关闭虚拟机
按 ctrl+a 后输入 c 进入命令行界面
常见问题
failed to parse default acl file `/etc/qemu/bridge.conf'
mkdir /etc/qemu echo 'allow br0' > /etc/qemu/bridge.conf echo 'allow all' >> /etc/qemu/bridge.conf
failed to parse default acl file `/usr/local/libexec/../etc/qemu/bridge.conf'
qemu-system-arm: -netdev bridge,id=net0: bridge helper failed
cd /usr/local/etc mkdir qemu echo 'allow br0' > /usr/local/etc/qemu/bridge.conf echo 'allow all' >> /usr/local/etc/qemu/bridge.conf