Notes on running OpenWRT in QEMU on MacOS.
- Install QEMU with homebrew
$ brew install qemu
- Download a OpenWRT image. We want a armvirt/64 image.
# Snapshot dir does not have armvirt images, need to pick a release.
# https://downloads.openwrt.org/releases/22.03.5/targets/armvirt/64/
# -rw-r--r--@ 1 adam staff 21157896 Jul 31 21:49 openwrt-22.03.5-armvirt-64-Image-initramfs
- Bash script to start the VM
#!/bin/bash
qemu-system-aarch64 -m 1024 -smp 2 -cpu host -M virt,highmem=off \
-nographic \
-accel hvf \
-kernel openwrt-22.03.5-armvirt-64-Image-initramfs \
-device virtio-net,netdev=net0 -netdev user,id=net0,net=192.168.1.0/24,hostfwd=tcp:127.0.0.1:1122-192.168.1.1:22 \
-device virtio-net,netdev=net1 -netdev user,id=net1,net=192.0.2.0/24
- Login into the OpenWRT VM & setup port forwarding
$ ssh -p1122 -L :8080:127.0.0.1:80 root@127.0.0.1
- To install Luci on the running image
# opkg update
# opkg install luci
More info on installing Luci is here
- Open Safari & visit http://127.0.0.1 to use the luci interface