Let’s start with an actual reproducer please. If I try this:
incus init images:debian/13/cloud ezra
incus config set ezra cloud-init.network-config=- <<EOF
version: 2
ethernets:
eth0:
addresses:
- 69.41.138.110/27
gateway4: 69.41.138.97
nameservers:
addresses:
- 69.41.138.98
- 8.8.4.4
EOF
incus start ezra
incus exec ezra -- cloud-init status --wait
# status: done
incus list ezra
# +------+---------+----------------------+--------------------------------------------+-----------+-----------+
# | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
# +------+---------+----------------------+--------------------------------------------+-----------+-----------+
# | ezra | RUNNING | 69.41.138.110 (eth0) | XXXXXXXXXXXXXXXXXXXX:6aff:fed6:c2ec (eth0) | CONTAINER | 0 |
# +------+---------+----------------------+--------------------------------------------+-----------+-----------+
incus exec ezra -- cloud-init clean --seed --logs --configs all
incus stop ezra
incus config set ezra cloud-init.network-config=- <<EOF
version: 2
ethernets:
eth0:
addresses:
- 69.41.138.102/27
gateway4: 69.41.138.97
nameservers:
addresses:
- 69.41.138.98
- 8.8.4.4
EOF
incus config set ezra volatile.apply_template=create
incus start ezra
incus exec ezra -- cloud-init status --wait
# status: done
incus list ezra
# +------+---------+----------------------+---------------------------------------------+-----------+-----------+
# | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
# +------+---------+----------------------+---------------------------------------------+-----------+-----------+
# | ezra | RUNNING | 69.41.138.102 (eth0) | XXXXXXXXXXXXXXXXXXXXX:6aff:fed6:c2ec (eth0) | CONTAINER | 0 |
# +------+---------+----------------------+---------------------------------------------+-----------+-----------+
This all looks fine to me. (incus 7.0.1 on Ubuntu 22.04.5)
Maybe you needed cloud-init clean ... --configs all which deletes network config, as well as ssh_config and some other things.
EDIT: use --configs network if you only want to reconfigure the network, and don’t want to regenerate your ssh host keys.