How to install OpenWrt in Proxmox VE as a VM
Since OpenWrt only offer IMG file for installation, and Proxmox VE only take ISO file. So we have to use the command line to import IMG file into the virtual machine in order to use OpenWrt as a VM in PVE.
Step 1. Preparation
Proxmox VE: you can download from here.
OpenWrt 19.07: Download the x86_64 firmware from here. Download combined-squashfs.img.gz then unzip it to IMG file.
Step 2. Creating the virtual machine
Login to your PVE web interface then click “Create VM” on the top right corner.
Giving your OpenWrt VM a VM ID and the Name you like, click “Advanced” to check “Start at boot”. Then Next.
Check “Do not use any media”, then Next.
Use the default setting for this page, and just click Next.
For hard disk settings, just give it a random size or just leave it alone, because we will delete this virtual disk later. Then Next.
For CPU cores, set it based on your usage, normally 2 or 4 cores are good enough. Remember to change the CPU type to host for the best performance!
For memory, 1024 MB should be good enough, if you like, you can give as much as ram you want.
For Network, just leave it alone and click Next.
Just click “Finish” to finish it up.
Step 3. Import IMG file and edit the VM hardware
First, find the VM you just created and click “Hardware”
Select the “Hard Disk” then click “Detach”, then click Yes on the confirmation window.
Select the “Unused Disk 0” and click “Remove” to remove this disk.
Now, let’s go the Shell of Proxmox and run the following command to download the OpenWrt firmware.
wget https://downloads.openwrt.org/releases/19.07.0-rc2/targets/x86/64/openwrt-19.07.0-rc2-x86-64-combined-squashfs.img.gz
After download finished, use the following command to unzip it to IMG file.
gunzip openwrt-19.07.0-rc2-x86-64-combined-squashfs.img.gz
Then rename it to a shorter name to make it easier to type in.
mv openwrt-19.07.0-rc2-x86-64-combined-squashfs.img openwrt.img
You can also download the OpenWrt file locally, then unzip it to IMG file, rename and upload it to the Proxmox server by using WinSCP or MobaXterm.
Here is the most important step, which is import IMG file into the VM. Type in the following command to shell. 200 is the VM ID, and openwrt.img is the file we just downloaded.
qm importdisk 200 openwrt.img local-lvm
Go back to the OpenWrt VM hardware page, you will see there is an “Unused Disk 0”, check it and click “Edit”
Change the Bus/Device to SCSI, then click “Add”
Now, you are ready to start your OpenWrt VM!
If you click the Console, and you are able to access the OpenWrt console.
Congratulations! You successfully created a OpenWrt VM in Proxmox VE and the IP address should be 192.168.1.1, if you want to change the LAN IP address, use the following command. x.x.x.x is the IP address you want to access the web interface.
uci set network.lan.ipaddr='x.x.x.x'
uci commit network
/etc/init.d/network restart
Welcome to the world of OpenWrt!
16 thoughts on “How to install OpenWrt in Proxmox VE as a VM”
Hello, thank you for this How To. It was really helpfull. But there was a problem to boot the imported image. It wasn’t recognized to be bootable. I needed to make sure there is the …
boot: order=scsi0
bootdisk: scsi0
… entry in the [VM ID].conf file of my virtual machine.
Best regards
Seraphin
Hi,
Thanks for the great tutorial!
Just one highlight: When you detach the generic disk and later attach the new one, the boot order in Options changes from disk-network to network-disk. In my case (PVE 6.3, OWRT 19.07.5) the disk was not even ticked as a boot device. I think it’s worth mentioning in your HowTo so that others will save 10 minutes trying to figure out what’s wrong :).
Also, would it not be better to use the ext4 image instead of squashfs? PVE is most likely running off a big enough HDD anyway so not much point having squashfs around here.
Hi, thanks for the comment. For squashfs image, the biggest benefit is the ability to reset OpenWrt to factory setting. If you don’t need that, ext4 image maybe is the better option for you.
Hi, for reset the OpenWrt VM you can use Proxmox snapshot instead of that.
Thanks for the doc.
i cant get openwrt to finish loading.
https://imgur.com/wAytNXT
it just hangs there. i cant figure out what to do.
I have same issues, can you solve this?
You need to press enter
Switching machine from “i440fx” to “q35” did significantly reduce CPU usage on my proxmox. I recommend you have a try.
Great work.
Thank you.
Best regards.
thanks a lot
it worked for me when i changed SCSI in SATA
thanks a lot
it worked for me when i changed SCSI in SATA
Thanks!
One thing, after this just go the VM -> Options -> Boot Order and Add (scsi0) as default boot device!
I just want to add for anyone being too creative like me, it needs to be on local-lvm! I added it to another drive that wasn’t lvm and it cannot grow the space as needed.
Porxmox 7.2 – the directions fail to boot the device without following the comment from Leroy van Logchem
“One thing, after this just go the VM -> Options -> Boot Order and Add (scsi0) as default boot device!”
I had to click “enable” and move to top of boot order list.
By default it’s not enabled to boot from.
Hello Guys,
I am new here, I just have a question, I see that you are using the vmbr0 (bridge) but where does the second Nic come in, I mean are you using vmbr0 as the lan or wan? I would think it would have to be wan as you would want your IP (Internet) to come from there correct?
Sorry I am not very good at the network side of things.
Thanks for your time;
Michael
Hello. What I have been faced is internet connection is not working with default bridge over ethernet. So, I created another bridge at the pve tab -> network. It contains CIDR 192.168.1.0/24 and no gateway. And then on my Openwrt VM -> Hardware tab I have added one more bridge with bridge that I have just created. Then it workeed