LXC always does the same thing, it preconfigures your network namespace. Now if the OS you're running in the container runs its own network configuration tool, that pre-made configuration will likely get reset or mangled.
If you want to use those config keys, you need to make sure you're not running software in your container which will reset that pre-made configuration. ** Changed in: lxc (Ubuntu) Status: New => Invalid -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to lxc in Ubuntu. https://bugs.launchpad.net/bugs/1876475 Title: lxc can't assign ipv4 address from lxc-container config file Status in lxc package in Ubuntu: Invalid Bug description: I created and ran lxc-container with network config - others lxc-config on host system are the same like that (ipv4. addresses is different): __________________________________________ # Template used to create this container: /usr/share/lxc/templates/lxc-ubuntu # Parameters passed to the template: # For additional config options, please look at lxc.container.conf(5) # Uncomment the following line to support nesting containers: #lxc.include = /usr/share/lxc/config/nesting.conf # (Be aware this has security implications) # Common configuration lxc.include = /usr/share/lxc/config/ubuntu.common.conf lxc.apparmor.profile = unconfined lxc.start.auto = 1 # Container specific configuration lxc.rootfs.path = dir:/var/lib/lxc/video/rootfs lxc.uts.name = video lxc.arch = amd64 # Network configuration lxc.net.0.type = veth lxc.net.0.flags = up lxc.net.0.link = lxcbr0 lxc.net.0.hwaddr = 4a:49:43:49:79:bf lxc.net.0.ipv4.address = 10.0.3.10/24 lxc.net.0.ipv4.gateway = 10.0.3.1 ________________________________________________ When container started - i can't see ip 10.0.3.10, it is not assigned after start: NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED x RUNNING 1 - 10.0.3.2 - false y RUNNING 1 - 10.0.3.3 - false x1 RUNNING 1 - 10.0.3.7 - false x2 RUNNING 1 - 10.0.3.5 - false z3 RUNNING 1 - 10.0.3.4 - false z1 RUNNING 1 - 10.0.3.6 - false video RUNNING 0 - - - false <-----!!! Example (inside container "z1"): root@z1:/# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.3 LTS Release: 18.04 Codename: bionic Example (inside problem container "video"): root@video:/# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal x,y,x1-3,z3,z1 - ubuntu 18 lts video - Ubuntu 20 LTS, host system ubuntu 20 lts. Host system: root@node:/var/lib/lxc/video# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal BUT! When I restarts all host-system, "video" container assigns ipv4 address after it. And if I stop the "video" container again (lxc-stop) and start the "video" container again (lxc-start -d -n video) - it losts ipv4 address and can't assign it again (from cli). root@node:/home/alex# dpkg -l | grep lxc ii liblxc-common 1:4.0.2-0ubuntu1 amd64 Linux Containers userspace tools (common tools) ii liblxc1 1:4.0.2-0ubuntu1 amd64 Linux Containers userspace tools (library) ii lxc 1:4.0.2-0ubuntu1 all Transitional package - lxc -> lxc-utils ii lxc-templates 3.0.4-3ubuntu1 amd64 Linux Containers userspace tools (templates) ii lxc-utils 1:4.0.2-0ubuntu1 amd64 Linux Containers userspace tools rc lxctl 0.3.1+debian-4 all Utility to manage LXC ProblemType: Bug DistroRelease: Ubuntu 20.04 Package: lxc 1:4.0.2-0ubuntu1 ProcVersionSignature: Ubuntu 5.4.0-28.32-generic 5.4.30 Uname: Linux 5.4.0-28-generic x86_64 ApportVersion: 2.20.11-0ubuntu27 Architecture: amd64 CasperMD5CheckResult: skip Date: Sat May 2 18:21:44 2020 PackageArchitecture: all ProcEnviron: SHELL=/bin/bash LANG=en_US.UTF-8 TERM=xterm XDG_RUNTIME_DIR=<set> PATH=(custom, no user) SourcePackage: lxc UpgradeStatus: Upgraded to focal on 2020-05-02 (0 days ago) defaults.conf: lxc.net.0.type = veth lxc.net.0.link = lxcbr0 lxc.net.0.flags = up lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx lxc.conf: lxc.network.link = lxcbr0 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1876475/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp