Skip to content

Instantly share code, notes, and snippets.

@subrezon
Last active September 27, 2025 22:44
Show Gist options
  • 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 (replace VMID and STORAGEID with yours):
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. Go to the VM -> Options -> Boot Order, make sure that virtio0 is at the top and is the only one that is ticked.

  3. Add whatever networking or other devices you need.

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

@kikislater
Copy link

kikislater commented Jul 11, 2025

root@OpenWrt:~# opkg install parted losetup resize2fs blkid
Unknown package 'parted'.
Unknown package 'losetup'.
Unknown package 'resize2fs'.
Unknown package 'blkid'.
Collected errors:
 * pkg_hash_check_unresolved: cannot find dependency libreadline8 for parted
 * pkg_hash_check_unresolved: cannot find dependency libncurses6 for parted
 * pkg_hash_fetch_best_installation_candidate: Packages for parted found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package parted.
 * opkg_install_cmd: Cannot install package losetup.
 * opkg_install_cmd: Cannot install package resize2fs.
 * opkg_install_cmd: Cannot install package blkid.

@viktorezgeta Where to find this libs under OpenWRT 24.10.2 ?

Edit: Strange ... After reboot multiple times I can now install them !

@Nasa1423
Copy link

Hello! I've faced a quite difficult task. I have a x86 machine, I want to setup proxmox and openwrt in it as a vm/ct. Main problem is, I want openwrt to be as gateway router for the network and for the proxmox host (and other virtualised machines). Does anyone know how to correctly setup proxmox and openwrt to work the way I want?

@subrezon
Copy link
Author

@Nasa1423 it is quite simple actually, assuming you have 2 or more NICs.

  • Keep one NIC for the host and use it for a bridge
  • Pass one NIC fully to the VM (this one will be your WAN)
  • Create a virtual interface and attach it to the VM (this will be your LAN)
  • Connect the WAN interface to your modem and the LAN interface to the rest of your network

The LAN port will connect everything attached to the bridge to your network, including the Proxmox host itself, as well as all attached containers and VMs, including OpenWrt.

@Nasa1423
Copy link

Nasa1423 commented Aug 26, 2025

@subrezon And that is the most interesting thing, I want openwrt to be the main gateway router and connect proxmox virtually. If I want proxmox to work in my openwrt network, I should physically connect proxmox NIC to one of the lans. But I want to do it virtually, so all the lan ports would be free to use. Possibly did not completely understand the idea you told me?

@subrezon
Copy link
Author

Let me explain like this: you have two interfaces, let's call them eth0 and eth1.

  • Create a bridge interface, let's call it br0. Attach it to eth0 and assign the Proxmox static IP address to it.
  • Create the OpenWrt VM, pass eth1 through to it fully, and create one virtual interface that is attached to br0.
  • Configure OpenWrt so that the physical interface (eth1) is the WAN and the virtual interface (br0) is the LAN.

Now Proxmox, OpenWrt and the rest of your network that is connected to eth0 are all in the same network and can access each other.

@Nasa1423
Copy link

Yes, that makes much more sense for me! Thank you very much @subrezon!

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