Install OpenWRT on PVE
I had built a 6-port router running OpenWRT.
A few days ago, after a reboot, it did not load OpenWRT. Taken out the SSD and checked on another computer, the SSD could not be identified. I am not sure if its the SSD quality issue, or the high heat killed the SSD.
I have purchased Kingston NV2 250GB SSD for replacement.
Preparation
Download PVE 8.1 ISO
Download OpenWRT 23.05.2 x86_64 generic-squashfs-combined.img.gz
I have found a good tool which you can place many ISO image files onto a single USB thumb drive as boot disk, without needing to flash them one by one.
Flash Ventoy with Etcher
Put PVE and OpenWRT ISO files onto Ventoy.
Install PVE
Plugin the USB thumb drive into the router computer. Using the router computer, install PVE and reboot. I used these info:
- Management Interface: (Choose the port connecting the router with your PC)
- Hostname: dev.thematrix (Anything you like)
- IP Address: 192.168.50.2/24 (The static IP address of PVE)
- Gateway: 192.168.50.1 (The static IP address of the OpenWRT to be installed)
- DNS Server: 192.168.50.1
Configure PVE
Using your PC.
Manually assign an IP address. Example on Ubuntu:
SSH access PVE on the router computer:
ssh [email protected]
Remove enterprise sources, since we are using free unpaid version:
rm /etc/apt/sources.list.d/ceph.list
rm /etc/apt/sources.list.d/pve-enterprise.list
The router seller had provided me these to "prevent the router from dying" when using PVE:
nano /etc/default/grub
Replace:
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
To:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on pcie_port_pm=off quiet splash intel_idle.max_cstate=2"
Apply changes:
update-grub
update-initramfs -u -k all
reboot
After reboot, access the router from browser. Go to http://192.168.50.2. Login with username root
and your configured password.
I am going to use bridged
network instead of passthrough
, since I don't want to sacrifice one port for PVE management use. Bridged
network speed is good enough to handle my 2.5gbps network.
All those enp*s0
are physical network interface.
Click on pve
on the left, choose Create
> Linux Bridge
.
Add all the physical network interface to be bridged
interface.
Beware of the numbers (order) and the management port. Click Apply Configuration
.
Install OpenWRT
On PVE, click Create VM
on the top right corner.
- General: Enter a name (e.g.
openwrt
). CheckStart at boot
. - OS: Choose
Do not use any media
. - System: Use default.
- Disk: Enter
1
for disk size. It will be deleted afterwards. - CPU: Adjust
sockets
andcores
accordingly. Choosehost
astype
. - Memory: Adjust accordingly.
- Network: Use default.
- Confirm: Uncheck
Start after created
.Finish
.
Choose the newly created instance. Choose Hardware
- Remove
CD/DVD Drive
- Detach
Hard Disk
- Remove
Unused Disk 0
Choose local (pve)
on the left. Choose ISO Images
. Click Upload
Upload the OpenWRT image file.
Copy the uploaded path.
Choose pve
on the left. Choose Shell
Replace 100
(your instance ID) and path
(uploaded OpenWRT image file) and run in Shell
:
qm importdisk 101 /var/lib/vz/template/iso/openwrt-23.05.2-x86-64-generic-squashfs-combined.img local-lvm
Wait until it shows:
transferred 120.5 MiB of 120.5 MiB (100.00%)
Successfully imported disk as 'unused1:local-lvm:vm-101-disk-1'
Choose your instance on the left. Choose Hardware
. There is a new Unused Disk
.
Click Edit
. Add
.
Click Add
> Network Device
. Add all the bridged
network interfaces.
Choose Options
. Make SCSI0
to be the only option in Boot Order
.
Click Start
on the top right corner.
Click Console
you will see the boot up progress.
Initialize OpenWRT
On the Console
, run:
vi /etc/config/network
Modify the ipaddr
on interface 'lan'
. In my case, eth5
is my management interface.
Restart the network. Run:
/etc/init.d/network restart
Open http://192.168.50.1 on a web browser to continue OpenWRT configuration.
Bonus
OpenWRT and PVE died periodically. It occurred very frequently, once within an hour.
OpenWRT showed something like "read only system" and "IO error".
On PVE shell it also showed an error and I can no longer control PVE. I have to power cycle the router computer.
dmesg
gave me some hints.
It seems to be a recent issue on PVE:
I suspect it is a compatibility issue, rather than a hardware one.
Swapping to an old spared used Kingston A2000 250GB, PVE and OpenWRT has been working well.