推荐使用官方镜像(版本会更新,按路径寻找对应rootfs.tar.gz包即可)

https://downloads.openwrt.org/releases/23.05.2/targets/x86/64/openwrt-23.05.2-x86-64-rootfs.tar.gz

将openwrt-23.05.2-x86-64-rootfs.tar.gz上传至PVE存储,将下方local-btrfs:vztmpl改为自己的存储目录

在PVE终端运行如下命令创建Openwrt LXC

pct create 101 \
local-btrfs:vztmpl/openwrt-23.05.2-x86-64-rootfs.tar.gz \
--rootfs local-btrfs:1 \
--ostype unmanaged \
--hostname OpenWrt \
--arch amd64 \
--cores 1 \
--memory 512 \
--onboot 1 \
--swap 0 \
--features nesting=1 \
--net0 bridge=vmbr0,name=eth0,ip=dhcp,ip6=dhcp \
--net1 bridge=vmbr1,name=eth1,ip=dhcp,ip6=dhcp \
--mp10 /mnt/sda1/share/cert,mp=/etc/acme,size=1

--net0 建议接入PVE的LAN网络如 我的vmbr0
--net1 建议接入PVE的WAN网络如 我的vmbr1
--mp10 需要让openwrt访问的PVE目录,/mnt/sda1/share/cert为PVE目录,/etc/acme为openwrt内目录,示例用来实现openwrt的ACME获取到的证书共享给PVE实现PVE下所有系统都使用这个证书。

编辑openwrt LXC的配置文件

nano /etc/pve/lxc/101.conf

文件最后添加如下内容

lxc.cgroup2.devices.allow: c 108:0 rwm
lxc.mount.entry: /dev/ppp dev/ppp none bind,create=file
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file

启动LXC进入终端后进行设置设置
以下都是openwrt内运行的命令
改密码

passwd

网络设置,按照自己的网络规划设置openwrt的IP等网络配置

vi /etc/config/network

替换国内openwrt源(北外)

sed -i 's_downloads.openwrt.org_mirrors.bfsu.edu.cn/openwrt_' /etc/opkg/distfeeds.conf

刷新更新列表

opkg update

更新所有可更新包

opkg list-upgradable | awk -F ' - ' '{print $1}' | xargs opkg upgrade

升级版本
cd /tmp

找到要升级版本的链接替换掉下面的

wget https://downloads.openwrt.org/releases/目标版本/targets/x86/64/packages/kernel_目标版本_x86_64.ipk

opkg install kernel_目标版本_x86_64.ipk

变更/etc/opkg/distfeeds.conf 将配置内版本替换为目标版本号

nano /etc/opkg/distfeeds.conf

自己常用软件包安装
opkg install nano wget bind-host ca-certificates luci-i18n-wol-zh-cn \
luci-i18n-base-zh-cn luci-i18n-firewall-zh-cn luci-i18n-opkg-zh-cn \
luci-i18n-wireguard-zh-cn qrencode \
luci-i18n-acme-zh-cn acme-dnsapi \
luci-i18n-ddns-zh-cn ddns-scripts-gandi \
luci-i18n-ttyd-zh-cn luci-i18n-uhttpd-zh-cn

标签: none

添加新评论