hello
I am trying to use a bridge so my containers can be accessed from other computers.
I am using Ubuntu 24.04 on the host and containers. I created this netplan config on the host:
network:
ethernets:
eno1:
dhcp4: no
bridges:
br0:
dhcp4: yes
interfaces: [eno1]
version: 2
This bridge seems to work on the host. It gets IP address from DHCP.
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.224 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::583b:56ff:feba:914e prefixlen 64 scopeid 0x20<link>
ether 5a:3b:56:ba:91:4e txqueuelen 1000 (Ethernet)
RX packets 69950 bytes 5451247 (5.4 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 19904 bytes 2267768 (2.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:23:24:b4:d2:f9 txqueuelen 1000 (Ethernet)
RX packets 84713 bytes 11508797 (11.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 20039 bytes 2393210 (2.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xdf100000-df120000
I created this profile and I attached it to container.
config: {}
description: Bridged networking LXD profile
devices:
eno1:
name: eno1
nictype: bridged
parent: br0
type: nic
name: bridgeprofile
used_by:
- /1.0/instances/git
My networks:
+----------+----------+---------+-----------------+---------------------------+-------------+---------+---------+
| NAME | TYPE | MANAGED | IPV4 | IPV6 | DESCRIPTION | USED BY | STATE |
+----------+----------+---------+-----------------+---------------------------+-------------+---------+---------+
| br0 | bridge | NO | | | | 2 | |
+----------+----------+---------+-----------------+---------------------------+-------------+---------+---------+
| docker0 | bridge | NO | | | | 0 | |
+----------+----------+---------+-----------------+---------------------------+-------------+---------+---------+
| eno1 | physical | NO | | | | 0 | |
+----------+----------+---------+-----------------+---------------------------+-------------+---------+---------+
| incusbr0 | bridge | YES | 10.220.171.1/24 | fd42:2bba:ec6d:fc07::1/64 | | 2 | CREATED |
+----------+----------+---------+-----------------+---------------------------+-------------+---------+---------+
But when I start the container it gets IP address from incus bridge incusbr0.
+------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------+---------+----------------------+-----------------------------------------------+-----------+-----------+
| git | RUNNING | 10.220.171.24 (eth0) | fd42:2bba:ec6d:fc07:216:3eff:fee2:7175 (eth0) | CONTAINER | 0 |
+------+---------+----------------------+-----------------------------------------------+-----------+-----------+
Am I doing something wrong here? I also tried using eth0 device in the bridge profile.
It didn’t work either. The container couldnt get IP address and it couldnt connect to network.
Relevant bits from container config:
volatile.eno1.host_name: veth9f4c86d5
volatile.eno1.hwaddr: 00:16:3e:fd:76:18
volatile.eth0.host_name: veth63c3713d
volatile.eth0.hwaddr: 00:16:3e:e2:71:75
...
profiles:
- default
- bridgeprofile
Those virtual interfaces appear in ifconfig output (on host), like this:
veth63c3713d: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether c6:cf:98:35:e3:f0 txqueuelen 1000 (Ethernet)
RX packets 40 bytes 3866 (3.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 28 bytes 3707 (3.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
veth9f4c86d5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether aa:b8:ec:f7:1d:91 txqueuelen 1000 (Ethernet)
RX packets 15 bytes 1146 (1.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2366 bytes 163318 (163.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Can someone help me, please?