全球主机交流论坛

标题: 在 arm 版的 pve 中建了一个 alpine lxc 容器,发现每次重启容... [打印本页]

作者: moisfool    时间: 2023-7-21 17:59
标题: 在 arm 版的 pve 中建了一个 alpine lxc 容器,发现每次重启容...
在一台 arm vps ( 6c16g200G ) 上装了 pve ,因为只有单 ip ,网络按照文档中的基于 iptables 的网络地址转换配置进行配置
  1. # The loopback network interface
  2. auto lo
  3. iface lo inet loopback

  4. # The primary network interface
  5. allow-hotplug enp1s0
  6. iface enp1s0 inet static
  7.         address xxx.xxx..xxx..xxx./24
  8.         gateway xxx..xxx..xxx..xxx.
  9.         # dns-* options are implemented by the resolvconf package, if installed
  10.         dns-nameservers 1.0.0.1 8.8.4.4
  11. iface enp1s0 inet6 dhcp


  12. auto vmbr0
  13. iface vmbr0 inet static
  14. address  10.10.10.1/24
  15. bridge-ports none
  16. bridge-stp off
  17. bridge-fd 0
  18. post-up   echo 1 > /proc/sys/net/ipv4/ip_forward
  19. post-up   iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o enp1s0 -j MASQUERADE
  20. post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o enp1s0 -j MASQUERADE
复制代码


然后在 pve webui 中新建一个 alpine 非特权容器,网络设置中也手动设置了 ip 和网关

进入容器后,发现容器没网络,进一步排查发现 /etc/network/interfaces 中的配置为 iface vmbr0 inet dhcp,于是手动修改了 /etc/network/interfaces

  1. auto lo
  2. iface lo inet loopback

  3. auto eth0
  4. iface eth0 inet static
  5. address 10.10.10.100/24
  6. gateway 10.10.10.1
复制代码


重启网络,连网正常,但。。一单容器重启,/etc/network/interfaces 文件被还原为

  1. auto lo
  2. iface lo inet loopback

  3. auto eth0
  4. iface eth0 inet dhcp
复制代码


试过把容器删除重新建一个,也一样。。

arm vps 安装的是 debian 11 ,pve 用的是佛西版 https://github.com/jiangcuo/Proxmox-Arm64





欢迎光临 全球主机交流论坛 (https://lilynana.eu.org/) Powered by Discuz! X3.4