Network Configuration for LXC Containers

mattlach

Member
Mar 23, 2016
154
12
18
Boston, MA
Hey all,

So, I know you configure the network interfaces for new containers in the web interface (or by editing the corresponding config file in /etc/pve/lxc) but how does it work when you actually power up the container?

The reason I ask is, I have a bunch of Ubuntu 14.04 based containers that are going EOL. I am considering in-place upgrading them to 18.04, but will the fact that 18.04 uses netplan instead of ifupdown cause problems?

I'd imagine that when you create a new container, something, somewhere is configured such that LXC knows how to tell the OS in the container what IP to to configure itself with, by - for instance - populating /etc/network/interfaces, if on ifupdown.

If I then do an in-place upgrade using ubuntu's "do-release-upgrade" tool, it will use the information in /etc/network/interfaces to create an /etc/netplan file, so it should continue to work after th eupgrade. The question is, what happens if I ever try to change IP settings from the web interface (or by editing LXC config files)? I foresee an issue where the container OS has now moved on, and is happily using /etc/netplan, but LXC is making changes to its /etc/network/interfaces file having no effect.

Is this what happens? Or does LXC work in a completely different way making the distinctions between the container OS's ifupdown or netplan configuration moot?

Much obliged

--Matt
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
760
80
28
So, I know you configure the network interfaces for new containers in the web interface (or by editing the corresponding config file in /etc/pve/lxc) but how does it work when you actually power up the container?

The reason I ask is, I have a bunch of Ubuntu 14.04 based containers that are going EOL. I am considering in-place upgrading them to 18.04, but will the fact that 18.04 uses netplan instead of ifupdown cause problems?

I'd imagine that when you create a new container, something, somewhere is configured such that LXC knows how to tell the OS in the container what IP to to configure itself with, by - for instance - populating /etc/network/interfaces, if on ifupdown.
The OS type and release are checked during the start of an LXC container, and the network configurations are defined according to that. After your upgrade, the new ubuntu version should be recognized and the corresponding changed should be automatically made by our code.

Although after a quick look in the code, it looks like we use systemd-networkd instead of netplan on Ubuntu >= 17.10

Code is here: https://git.proxmox.com/?p=pve-container.git;a=blob;f=src/PVE/LXC/Setup/Ubuntu.pm;h=e18d396b6d9bf901dccb06053615a42b586a63d1;hb=refs/heads/master
 

mattlach

Member
Mar 23, 2016
154
12
18
Boston, MA
The OS type and release are checked during the start of an LXC container, and the network configurations are defined according to that. After your upgrade, the new ubuntu version should be recognized and the corresponding changed should be automatically made by our code.

Although after a quick look in the code, it looks like we use systemd-networkd instead of netplan on Ubuntu >= 17.10

Code is here: https://git.proxmox.com/?p=pve-container.git;a=blob;f=src/PVE/LXC/Setup/Ubuntu.pm;h=e18d396b6d9bf901dccb06053615a42b586a63d1;hb=refs/heads/master
Good to know, thank you.

Maybe I am confused. Is it only the desktop version of 18.04 that defaults to netplan?

I am curious. How does it determine the OS version? Does it parse the containers /etc/lsb-release?
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
760
80
28
Maybe I am confused. Is it only the desktop version of 18.04 that defaults to netplan?
We don't have any desktop version for containers. All our Ubuntu containers >= 17.10 use netplan by default.


I am curious. How does it determine the OS version? Does it parse the containers /etc/lsb-release?
Yes.
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
760
80
28
should there be any config.yaml in /etc/netplan on a bionic guest?
i don't have it in a freshly installed bionic container.

edit:


hm.

All our Ubuntu containers >= 17.10 use netplan by default.
i am sorry, i meant they use systemd-networkd. we unlink the default lxc netplan configuration during setup.

you can find the network config in /etc/systemd/network/
 
Last edited:
  • Like
Reactions: Gaia

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!