Container network gets overwritten

falves1

Well-Known Member
Jan 11, 2009
99
3
48
I have a container which needs two interfaces and certain features, like this
auto lo eth0 eth1
iface lo inet loopback
allow-hotplug eth0 eth1
iface eth0 inet static
address 192.168.11.38
netmask 255.255.255.0
gateway 192.168.88.1
mtu 1458
post-up ip route replace default via 192.168.11.1 dev eth0 table eth0
post-up ip rule add iif eth0 table eth0
post-up ip rule add from 192.168.11.38 table eth0
post-up ip route show table eth0
iface eth1 inet static
address XXXXXXXX
netmask 255.255.255.0
post-up ip route replace default via XXXXXX.1 dev eth1 table eth1
post-up ip rule add iif eth1 table eth1
post-up ip rule add from XXXXXXXX table eth1
post-up ip route show table eth1
post-up ip route replace default via 192.168.11.1 dev eth0

This is called "policy based routing" and it solves certain application issues. The issue here is that every time the container gets booted, my "interfaces" file gets overwritten. How do I get around that? This is a Debian 7 container.

By the way, Proxmox must find a way to integrate common LXC containers, on disk, not on mounted devices. I still have not figured out how to import my existing containers. And nobody seems to now how to do this.
 
The issue here is that every time the container gets booted, my "interfaces" file gets overwritten. How do I get around that? This is a Debian 7 container.

Remove IP configuration from lxc configuration (leave the related fields empty in WEB-GUI)
By the way, Proxmox must find a way to integrate common LXC containers, on disk, not on mounted devices. I still have not figured out how to import my existing containers. And nobody seems to now how to do this.
[/QUOTE]


AFAIU you mean "container filesystem in host filesystem". Try the following:

- create an empty file via dd with enough space got the container's files

- assign it to a loop device with losetup

- create an ext4 filesystem in it and mount it temporarily (e.g. as /mnt/tmploop)

- copy all files in rootfs from the original container into /mnt/tmploop

- create a proper lxc configurationfile manually and assign the previously created file to it
 
Is it possible that you may somehow automate migrating of foreign LXC containers via a Bash script? The customer would supply only IP address and root password of existing host and the name of a stopped container.
 
Is it possible that you may somehow automate migrating of foreign LXC containers via a Bash script? The customer would supply only IP address and root password of existing host and the name of a stopped container.

A "nice to have" - I understand; but currently not available. Please not that a generally working automatism has to take care about a lot of conditions depending on the environment you use as well as on how the original container is "delivered" (e.g. somewhere in a directory, as archive etc.) even the principle is simple - to write a script specifically for your situation is possibly not a big deal and you can try it by your own.
 

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!