[ol]# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp1s0
iface enp1s0 inet static
address xxx.xxx..xxx..xxx./24
gateway xxx..xxx..xxx..xxx.
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 1.0.0.1 8.8.4.4
iface enp1s0 inet6 dhcp
auto vmbr0
iface vmbr0 inet static
address 10.10.10.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o enp1s0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o enp1s0 -j MASQUERADE[/ol]复制代码
然后在 pve webui 中新建一个 alpine 非特权容器,网络设置中也手动设置了 ip 和网关
进入容器后,发现容器没网络,进一步排查发现 /etc/network/interfaces 中的配置为 iface vmbr0 inet dhcp,于是手动修改了 /etc/network/interfaces
[ol]auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.10.10.100/24
gateway 10.10.10.1[/ol]复制代码
重启网络,连网正常,但。。一单容器重启,/etc/network/interfaces 文件被还原为
[ol]auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp[/ol]复制代码
试过把容器删除重新建一个,也一样。。
arm vps 安装的是 debian 11 ,pve 用的是佛西版 https://github.com/jiangcuo/Proxmox-Arm64