Lxd container didn't receive ip address?

Hai All,
I have question but this is only happen in my ubuntu server lastest version, in the other distro there is no problem, I can set up ip static in lxd container from bridge interface host os. I always setup bridge networking in host OS so my lxd/ lxc can have the same network address with host os and all computer in my lan.
I’ve installed ubuntu server lastest version in KVM, the host is Debian Bullseye with bridge network connected to guest VM(ubuntu server). in ubuntu server I’ve installed bridge network so I can use this bridge interface in lxd container profile. The quesion is why if i created profile example eksternal that contains bridged br0 or br1, the container didm’t received ip address, but when i remove profile eksternal from my container lxd, using default profile lxd, my container received ip addr? and this happen only in ubuntu server, I also use the same prosedur in Arch linux, redhat base and debian base is working normally, my container always received ip address and now I set my container in that machine with static Ip address.

I am new in this container, I don’t know how to solve this problem and maybe this information is useful for problem solving.
This my lxd version
$ lxd --version
4.20

this is my interface network in host os(Ubuntu Server):

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
link/ether 52:54:00:fa:f2:aa brd ff:ff:ff:ff:ff:ff
3: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br1 state UP group default qlen 1000
link/ether 52:54:00:e3:11:84 brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:fa:f2:aa brd ff:ff:ff:ff:ff:ff
inet 192.168.1.30/24 brd 192.168.1.255 scope global br0
valid_lft forever preferred_lft forever
inet6 fe80::1c55:4bff:fed7:9bd0/64 scope link
valid_lft forever preferred_lft forever
5: br1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:e3:11:84 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.35/24 brd 192.168.1.255 scope global br1
valid_lft forever preferred_lft forever
inet6 fe80::cf3:b2ff:fe31:9abc/64 scope link
valid_lft forever preferred_lft forever
6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:64:f5:6e:ef brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
7: lxdbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 00:16:3e:eb:82:5b brd ff:ff:ff:ff:ff:ff
inet 10.196.73.1/24 scope global lxdbr0
valid_lft forever preferred_lft forever
inet6 fd42:74af:80a9:ad97::1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:feeb:825b/64 scope link
valid_lft forever preferred_lft forever
15: veth9eef6c85@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br1 state UP group default qlen 1000
link/ether d6:f0:b8:ca:bd:be brd ff:ff:ff:ff:ff:ff link-netnsid 0

This is my profile eksternal lxd container

config: {}

description: Ekternal Access Profile
devices:
eth0:
name: eth0
nictype: bridged
parent: br1
type: nic
name: eksternal
used_by:

  • /1.0/instances/almalinux-cloud

This info from lxc info my container

$ lxc info almalinux-cloud
Name: almalinux-cloud
Status: RUNNING
Type: container
Architecture: x86_64
PID: 9182
Created: 2021/12/04 13:07 UTC
Last Used: 2021/12/04 13:12 UTC

Resources:
Processes: 14
Disk usage:
root: 782.96MiB
CPU usage:
CPU usage (in seconds): 18
Memory usage:
Memory (current): 88.23MiB
Memory (peak): 118.63MiB
Network usage:
eth0:
Type: broadcast
State: UP
Host interface: veth9eef6c85
MAC address: 00:16:3e:e0:39:d1
MTU: 1500
Bytes received: 23.89kB
Bytes sent: 6.82kB
Packets received: 366
Packets sent: 41
IP addresses:
inet6: fe80::216:3eff:fee0:39d1/64 (link)
lo:
Type: loopback
State: UP
MTU: 65536
Bytes received: 0B
Bytes sent: 0B
Packets received: 0
Packets sent: 0
IP addresses:
inet: 127.0.0.1/8 (local)
inet6: ::1/128 (local)

This SS my container got ip address after I remove eksternal profile from my container and use default profile. but with this profile my container cannot access directly from other computer or vm.

How to solve this problem? I’m sorry for my bad English, if you need furhter information, I’m ready to provide that for you.

Thanks You in Advance
Afiadi

So if you exec into the container… what does it say about the inferfaces?

e.g. lxc exec almalinux-cloud ip a

On my box I get…
[sbanks@centos8]~/git/shard% lxc exec atshard-0-0312210900 ip a ~/git/shard
256: eth0@if257: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:c9:2a:bc brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.130.141.233/24 brd 10.130.141.255 scope global dynamic eth0
valid_lft 2353sec preferred_lft 2353sec
inet6 fd42:777:fc6e:be15:216:3eff:fec9:2abc/64 scope global dynamic mngtmpaddr
valid_lft 3400sec preferred_lft 3400sec
inet6 fe80::216:3eff:fec9:2abc/64 scope link
valid_lft forever preferred_lft forever
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever

1 Like

Excactly alma linux is the same as centos8 so I know the answer to this. The problem is the cloud image is glitched… The network manager isn’t playing is observing the ethernet devices as unmanaged so it never comes up…

Interestingly if you install the none cloud version it works fine for network. Its irritating by cause I want to use cloud-init. So I’m kludged my install by removing NetworkManager and using network-scripts instead.

lxc exec into the container and run dhclient and that should give you a network address…

1 Like

I’m sorry for late reply, I think this is not gliched, I try this in fedora, Debian Bullseye, Arch Linux base, Rocky linux there is no problem with cloud image container. This is so weird my container didn’t receive ip address with bridge interface in host os only in Ubuntu server. I’ve installed ubuntu server in KVM with Debian Bullseye as a Host.
This is in Fedora 35 there is no problem, even i set this opensuse-cloud with static ip address.

How to solve this problem, as far as I know ubuntu is made LXD container.

Thank You in Advance