How to prevent network config in lxc from being overwritten

alitvak69

Renowned Member
Oct 2, 2015
105
3
83
Dear all,

I am trying to add multiple IP addresses inside the lxc container. I know that there are multiple methods, but the one I am looking for is to add extra IP address from within the container using standard network settings of guest OS.

PCT seems to overwrite ifcfg-eth0 static IP config in my centos7 container no matter what I use. I know that running lxc on ubuntu server with centos containers doesn't cause the issue. I can add several IP addresses to a single interface within the container and even if lxc container config has network settings it doesn't rewrite my cfg file.

Any way to achieve the same with containers in proxmox ?
 
There are several ways to do this, yet the only that will work with your way is to set the configuration file immutable.
 
you can "touch /etc/network/.pve-ignore.interfaces" to tell PVE to not change that file.
 
  • Like
Reactions: elBradford
There are several ways to do this, yet the only that will work with your way is to set the configuration file immutable.

Making the file immutable did not fix the issue - in fact, it made it worse. The container refused to boot when that file is immutable.
 
As a sidenote, let me add that after a reboot, networking is lost and the container's external IP is the Promox server's IP. But if I do "ifdown eth0 && ifup eth0" right after the reboot, the container will then pick up the correct networking configuration.
 
Is there any equivalent trick for Red Hat based OSs (CentOS 7 in particular) where the path to the interfaces is "/etc/sysconfig/network-scripts"?

Thank you.

PVE should not touch any file in the container for which a .pve-ignore. file exists, see PVE Admin Guide
 
Dear all,

apologies for bringing this thread up again.

I'm setting up a container (ubuntu-20.04) with a specific network setup, therefore I would like to use .pve-ignore on the network config of the container. Unfortunately /etc/network/.pve-ignore.interfaces does not seem to work with ubuntu-20.04 container. Could anyone please help me where to put .pve-ignore.interfaces in the container, so that the network config is not set up by the host?

Thank you for your help.
 
Dear all,

apologies for bringing this thread up again.

I'm setting up a container (ubuntu-20.04) with a specific network setup, therefore I would like to use .pve-ignore on the network config of the container. Unfortunately /etc/network/.pve-ignore.interfaces does not seem to work with ubuntu-20.04 container. Could anyone please help me where to put .pve-ignore.interfaces in the container, so that the network config is not set up by the host?

Thank you for your help.

ubuntu uses netplan not network, /etc/netplan/.pve-ignore.config.yaml
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!