Installing OpenWRT on top of LXC in Proxmox
I recently realized that I don't get the full speed promised by my ISP, and the reason behind it is that I run my OpenWRT router in KVM. I do not have a Ryzen to run my Proxmox and instead of shelling some cash to get one, I decided to try to run OpenWRT on LXC instead.
I am documenting here what works for me as they differ from what was being documented. Maybe this would encourage providers here to offer an OpenWRT template on their Proxmox host
If you decide to follow what I wrote here, remember YMMV.
The combination that works: Proxmox VE 6.3-3, privileged container, OpenWRT Snapshot (20201216).
# pveversion pve-manager/6.3-3/eee5f901 (running kernel: 5.4.78-2-pve)
I couldn't make it work with unprivileged containers nor the latest stable.
First download the rootfs.tar.gz from https://downloads.openwrt.org/snapshots/targets/x86/64/.
opct.sh from https://github.com/DazzyWalkman/oplxc4pve. This will make container creation and update much, much easier.
Open EDITOR (vi, nano, emacs,...) and change parameters to fit your Proxmox install. You'll also define how much memory, swap, cpu cores you'll allocate to this container here. Remember to change
unprivileged to '0' or it may not work.
Pay attention to the bind mount settings. It came biting me when I restarted my Proxmox machine and found that the OpenWRT container refused to start, since I do not have the host directory set up. I am not sure if commenting it out would work, but it is worth a try.
Once you're done editing, give
opct.sh executable privileges and copy to
opct.sh new <VMID> <LOCATION OF OPENWRT ROOTFS>
An OpenWRT container will appear on Proxmox's CP. All you need to do now is rename the container (in DNS), add network interfaces, and start the container to configure OpenWRT to your needs.
The all seeing eye sees everything...