I am using LXD v3.17
Host is Ubuntu 18.04
I have 2 Ubuntu Bionic containers wg1 and wg2 I created.
I decided to follow this threads advice to change the IP address of wg1:
stgraber
Stéphane GraberMaintainer
Feb '18If running a modern LXD with a LXD managed bridge, then you can just set the
ipv4.address
property on the network interface of the container.$ lxc stop wg1
$ lxc network attach lxdbr0 wg1 eth0 eth0
$ lxc config device set wg1 eth0 ipv4.address 10.99.10.42
$ lxc start wg1
So I do that and verify that it supposedly changed by assigning 10.30.180.1:
$ lxc stop wg1
$ lxc network attach lxdbr0 wg1 eth0 eth0
$ lxc config device set wg1 eth0 ipv4.address 10.30.180.1
$ lxc config device get wg1 eth0 ipv4.address10.30.180.1
And the wg1 container “supposedly” has the IP address I set
Then I restart wg1:
$ lxc start wg1
Then…
$ lxc list
and it shows “wg1” with its old IP address not the new one…
wg1 | RUNNING | 10.30.175.11 (eth0)
BUT… lxc config still shows wg1 assigned the NEW IPv4 address ??
$ lxc config device get wg1 eth0 ipv4.address
10.30.180.1
Is this happening because Netplan was introduced between the time Stephane’s above information was posted and today?
If I go into the wg1 container and look at:
root@wg1:~# nano /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init’s network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
version: 2
ethernets:
eth0:
dhcp4: true
In “wg1” container I created the file:
/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
containing…
network {config: disabled}:
version: 2
ethernets:
eth0:
dhcp4: true
saved it and the exited back to Host and reran commands to change IP of WG1 and
restart the container “wg1” again!
but same thing occurred.
$ lxc config device get wg1 eth0 ipv4.address
10.30.180.1
and…
“lxc list” shows OLD IP still assigned to WG1 ???
$ lxc list
wg1 | RUNNING | 10.30.175.11 (eth0)