0%

PVE创建lxc的openwrt容器

在PVE中创建lxc的openwrt容器,更节省资源!

下载openwrt的rootfs

不知道哪里有适用自己机器架构的openwrt rootfs文件的可以去openwrt官网下载

op官网的固件很简洁,甚至要自己安装中文语言包,最好找适合自己的rootfs。

命令行创建openwrt lxc

openwrt无法在webui中创建,只能通过命令创建。
修改以下命令的[]参数为自己对应的。

1
2
3
4
5
6
7
8
9
10
11
12
pct create [lxc-id] local:vztmpl/[openwrt的rootfs文件名称] \
--rootfs local-lvm:[分配的空间大小,单位 G] \
--ostype unmanaged \
--hostname [lxc名称] \
--arch [机器架构 amd64/arm64] \
--cores [分配几个核心] \
--memory [分配内存大小] \
--swap [分配swap大小] \
-net0 bridge=vmbr0,name=eth0
-net1 bridge=vmbr0,name=eth1
# 多网口可按需配置,要几个加几个

示例配置

1
2
3
4
5
6
7
8
9
pct create 121 local:vztmpl/immortalwrt-x86-64-generic-rootfs.tar.gz \
--rootfs local-lvm:4 \
--ostype unmanaged \
--hostname immortalwrt \
--arch amd64 \
--cores 4 \
--memory 1024 \
--swap 0 \
-net0 bridge=vmbr0,name=eth0