OpenWRT software appliance on OpenIndiana#

I got myself a ThinkPad T470 and unfortunately the WiFi chip is not supported by illumos. Since my kernel driver porting skills are not so good ;) I decided to do a different thing.

I'm going to run a bhyve VM, pass through the WiFi card to it, and run OpenWRT inside the VM.

Download OpenWRT#

Go to https://downloads.openwrt.org/releases/ pick a version and download the openwrt*x86-64-generic-ext4-combined-efi.img image, I used https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/openwrt-22.03.3-x86-64-generic-ext4-combined-efi.img.gz.

Setup the bhyve zone#

# zonecfg -z router
create -b
set zonepath=/export/zones/router
set brand=bhyve
set autoboot=true
set ip-type=exclusive
add net
set physical="routerint0"
end
add device
set match="/dev/zvol/rdsk/rpool/export/bhyve/routerd0"
end
add device
set match="/dev/ppt0"
end
add attr
set name="bootrom"
set type="string"
set value="BHYVE_RELEASE"
end
add attr
set name="bootdisk"
set type="string"
set value="rpool/export/bhyve/routerd0"
end
add attr
set name="vcpus"
set type="string"
set value="1"
end
add attr
set name="ram"
set type="string"
set value="1G"
end
add attr
set name="vnc"
set type="string"
set value="on"
end
add attr
set name="extra"
set type="string"
set value="-S -s 8:0,passthru,/dev/ppt0"
end

Now we need to create the VNIC, the disk and the passthru device.

The Disk ist easy:

# zfs create -V 1G -o compression=lz4 rpool/export/bhyve/routerd0
# dd if=openwrt-22.03.3-x86-64-generic-ext4-combined-efi.img of=/dev/zvol/rdsk/rpool/export/bhyve/routerd0 bs=1024k

Now, let's set up the networking. We are going to create an Etherstub with two interfaces, one for the laptops global zone and one for the router vm:

  1. dladm create-etherstub dmz0
  2. dladm create-vnic -l dmz0 routerint0
  3. dladm create-vnic -l dmz0 dmzint0