# On PVE Host
Create a Linux VM without disk, in my PVE, the new VM id is 115.
wget https://openwrt.proxy.ustclug.org/snapshots/targets/x86/64/openwrt-x86-64-generic-ext4-combined.img.gz
gunzip openwrt-x86-64-generic-ext4-combined.img.gz
qemu-img resize -f raw openwrt-x86-64-generic-ext4-combined.img 20G
qm importdisk 115 openwrt-x86-64-generic-ext4-combined.img local-lvm
rm -f openwrt-x86-64-generic-ext4-combined.img
From VM Hardware, click the newly imported disk, open the dialog and save.
Then Change boot order, add the disk.
Start OpenWRT VM
# On OpenWRT
uci set network.lan.ipaddr='192.168.11.243'
uci commit
sed -i -e 's/downloads.openwrt.org/openwrt.proxy.ustclug.org/g' /etc/opkg/distfeeds.conf
reboot
# Now you should be able to access VM from other machines.
# temporary internet access
ip route add default via 192.168.11.1
echo 'nameserver 192.168.11.1' > /etc/resolv.conf
opkg update
# install web ui
opkg install luci bash mtr
# change default shell to bash
sed -i -e 's/bin\/ash/bin\/bash/g' /etc/passwd
# install wwan module (NCM mode) support
opkg install kmod-usb-net-rndis kmod-usb-acm luci-proto-ncm picocom
# Resize disk
# https://openwrt.org/docs/guide-user/advanced/expand_root
opkg install parted losetup resize2fs
wget -U "" -O expand-root.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/expand_root?codeblock=0"
. ./expand-root.sh
reboot
# On PVE Console
Load Quectel Module by Adding USB Hardware
# On OpenWRT Console
Network > Interfaces > Add New Interface
Name: wwan
Protocol: DHCP client
Device: usb0
You should be able to find usb0 by `ip a`
Firewall, set Zone to WAN
.
Save & Apply
# Note
DO NOT ATTACH Quectel WWAN module before OpenWRT fully booted.
Leave a Reply