收起左侧

有爱快主路由和openwrt旁路由需求,飞牛OS虚拟机能hold住吗

3
回复
60
查看
[ 复制链接 ]

13

主题

10

回帖

0

牛值

江湖小虾

有爱快主路由和openwrt旁路由需求,飞牛OS虚拟机能hold住吗,还是最好刷个PVE打底?

收藏
送赞
分享

1

主题

28

回帖

0

牛值

江湖小虾

能hold住,pve可以自己编译个ct模板,资源占用再少。

网址:

https://downloads.immortalwrt.org/

镜像名称:

generic-squashfs-combined-efi.img.gz
固件版本 ImmortalWrt 24.10.2 r33247-467867283bb9 / LuCI openwrt-24.10 branch 25.175.22647~dbf5de0

PVE中CT模板目录

/var/lib/vz/template/cache/

1、使用wget 将指定镜像拉取到pve目录内

2、使用mv命令重命名为一个短名称

mv 原名称 新名称

3、解压缩

gzip -d 名称.img.gz

4、创建一个挂载目录并加载nbd模块

mkdir /mnt/openwrt
modprobe nbd
qemu-nbd -c /dev/nbd0 -f raw 镜像名.img
lsblk -f /dev/nbd0
mount /dev/nbd0p2 /mnt/openwrt
cd /mnt/openwrt

5、打包镜像

tar --numeric-owner --anchored --exclude='./dev/*' -czf /var/lib/vz/template/cache/wrt.rootfs.tar.gz .

6、卸载挂载目录

cd 
umount /mnt/openwrt/
qemu-nbd -d /dev/nbd0

7、安装这个CT

pct create 123 local:vztmpl/wrt.rootfs.tar.gz \
  --rootfs local:2 \
  --features nesting=1,keyctl=1 \
  --hostname openwrt \
  --memory 256 \
  --net0 name=eth0,bridge=vmbr0,ip=dhcp \
  --ostype unmanaged
  • local:vztmpl/wrt.rootfs.tar.gz → 你打包好的 OpenWrt rootfs
  • --rootfs local:2 → 给 rootfs 分配 2G 存储(你可以改成 1G、4G 等)local修改为自己的
  • --features nesting=1,keyctl=1 → 打开 LXC 的额外功能(OpenWrt 需要)
  • --net0 name=eth0,bridge=vmbr0,ip=dhcp → 把 eth0 接到 PVE 的 vmbr0 网桥,并用 DHCP 拿 IP
  • --ostype unmanaged → 不检查 /etc/os-release,直接创建

之后可以到窗口修改IP等信息。

8、内部修改IP和添加tun网卡

vi /etc/config/network

在PVE主机

nano /etc/pve/lxc/虚拟机编号.conf
lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file

9、更新

无法进行固件更新,只有重新打包

完成

感谢,我以前也是用PVE打底...这次想尝试下飞牛OS打底,飞牛也需要设置直通这些吗  详情 回复
1 小时前

13

主题

10

回帖

0

牛值

江湖小虾

1 小时前 楼主 显示全部楼层
朝闻道🇨? 发表于 2025-12-19 16:57
能hold住,pve可以自己编译个ct模板,资源占用再少。
网址:
https://downloads.immortalwrt.org/

感谢,我以前也是用PVE打底...这次想尝试下飞牛OS打底,飞牛也需要设置直通这些吗
直接用桥接就行了,有wifi需求可以直通无线网卡。  详情 回复
1 小时前

1

主题

28

回帖

0

牛值

江湖小虾

浮生若水 发表于 2025-12-19 17:43
感谢,我以前也是用PVE打底...这次想尝试下飞牛OS打底,飞牛也需要设置直通这些吗 ...

直接用桥接就行了,有wifi需求可以直通无线网卡。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则