Skip to content

Instantly share code, notes, and snippets.

@subrezon
Created February 15, 2023 14:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subrezon/b9aa2014343f934fbf69e579ecfc8da8 to your computer and use it in GitHub Desktop.
Save subrezon/b9aa2014343f934fbf69e579ecfc8da8 to your computer and use it in GitHub Desktop.
How to set up an OpenWRT VM in Proxmox
  1. Go to OpenWRT release page, select the latest release stable release, then targets -> x86 -> 64. Right-click generic-ext4-combined.img.gz (not the "efi"!) and copy the link.

  2. On the Proxmox host, download the archive and unpack it:

wget *paste link here*
gunzip openwrt-*.img.gz
  1. Resize the image to be the size you want your VM's disk to be (example with 8 GiB):
qemu-img resize -f raw openwrt-*.img 8G
  1. Create a new VM in Proxmox. Make sure to use:
  • No installation media
  • SeaBIOS
  • No drives

Do not start the VM yet.

  1. Import the resized OpenWRT image into the new VM:
qm importdisk *VMID* openwrt-*.img *STORAGEID*
  1. Go to the VM -> Hardware, select the newly imported disk named "Unused Disk 0", press "Edit", set it to VirtIO with "Discard" and "IO Thread" enabled, then press OK.

  2. Add whatever networking or other devices you need.

  3. You're done! Start the VM and enjoy all the routing.

@ryuheechul
Copy link

Thanks for this gist and I made a similar guide for UEFI case.

@subrezon
Copy link
Author

Thanks for this gist and I made a similar guide for UEFI case.

Cool, glad I was of help. You mention needing Q35 + OVMF to pass through hardware. Just FYI - it works on i440fx + SeaBIOS as well, my OpenWrt has NICs passed through to it and they work just fine.

The major difference between them is that Q35 + OVMF virtualizes an actual PCIe stack, i440fx + SeaBIOS does PCI "overclocked" to PCIe speed. The only situation in which this matters that I know of is when passing through GPUs. Never seen it matter for network interfaces.

@ryuheechul
Copy link

@subrezon that is good to know, thanks!

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