Hi! I’m running Incus on an Ubuntu 24.04 server, with kernel 6.8.0, and I have configured a physical nic on one of my containers using the following commands:
$ incus launch images:ubuntu/24.04 caddy-container
$ incus config device add caddy-container lan nic \\
nictype=physical parent=enp4s0 name=enp4s0
And then DCHPv4, with netplan, on the container:
$ incus exec caddy-container -- su --login ubuntu
$ sudo cat /etc/netplan/10-lxc.yaml
network:
version: 2
ethernets:
eth0:
dhcp4: true
dhcp-identifier: mac
enp4s0:
dhcp4: true
And after a restart of the container, I can see that it gets the IP:
$ incus ls
+------------------------------------------+---------+----------------------------+------------------------------------------------+-----------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------------------------------------------+---------+----------------------------+------------------------------------------------+-----------------+-----------+
| caddy-container | RUNNING | 10.177.116.10 (eth0) | fd42:771d:9b36:84ca:216:3eff:feb1:e6c2 (eth0) | CONTAINER | 0 |
| | | 10.1.1.237 (enp4s0) | fd06:3f72:6d6a::4ec (enp4s0) | | |
| | | | fd06:3f72:6d6a:0:1ac0:4dff:febb:5e6b (enp4s0) | | |
...
And that the host does not see the interface:
$ ip a s
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 noprefixroute
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 18:c0:4d:bb:5e:6a brd ff:ff:ff:ff:ff:ff
inet 10.1.1.235/24 metric 100 brd 10.1.1.255 scope global dynamic enp3s0
valid_lft 31205sec preferred_lft 31205sec
inet6 fd06:3f72:6d6a::849/128 scope global dynamic noprefixroute
valid_lft 27982sec preferred_lft 27982sec
inet6 fd06:3f72:6d6a:0:1ac0:4dff:febb:5e6a/64 scope global mngtmpaddr noprefixroute
valid_lft forever preferred_lft 604542sec
inet6 fe80::1ac0:4dff:febb:5e6a/64 scope link
valid_lft forever preferred_lft forever
4: incusbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 10:66:6a:54:71:10 brd ff:ff:ff:ff:ff:ff
inet 10.177.116.1/24 brd 10.177.116.255 scope global incusbr0
valid_lft forever preferred_lft forever
inet6 fd42:771d:9b36:84ca::1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::1266:6aff:fe54:7110/64 scope link
valid_lft forever preferred_lft forever
6: veth309cf0fc@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master incusbr0 state UP group default qlen 1000
link/ether 22:38:7b:79:3d:8d brd ff:ff:ff:ff:ff:ff link-netnsid 0
8: veth0ff22abf@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master incusbr0 state UP group default qlen 1000
link/ether ba:c3:ed:27:8d:fd brd ff:ff:ff:ff:ff:ff link-netnsid 1
10: vethdbe78812@if9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master incusbr0 state UP group default qlen 1000
link/ether 9a:b3:85:0a:41:ce brd ff:ff:ff:ff:ff:ff link-netnsid 2
12: veth85f7f7ad@if11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master incusbr0 state UP group default qlen 1000
link/ether be:34:b5:b9:c5:6c brd ff:ff:ff:ff:ff:ff link-netnsid 3
14: vethd9e274d0@if13: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master incusbr0 state UP group default qlen 1000
link/ether ea:e8:dc:1f:e2:77 brd ff:ff:ff:ff:ff:ff link-netnsid 4
16: veth7b237818@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master incusbr0 state UP group default qlen 1000
link/ether 16:d6:95:24:d2:c5 brd ff:ff:ff:ff:ff:ff link-netnsid 5
18: vethd621de92@if17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master incusbr0 state UP group default qlen 1000
link/ether c6:cf:91:92:b2:96 brd ff:ff:ff:ff:ff:ff link-netnsid 6
Everything seems to work fine, but, from time to time, I lose connectivity with the container using the dedicated NIC.
I’ve tried restarting the container itself, and the incus service but then, the interface does not come up:
$ incus ls
+------------------------------------------+---------+----------------------------+------------------------------------------------+-----------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------------------------------------------+---------+----------------------------+------------------------------------------------+-----------------+-----------+
| caddy-container | RUNNING | 10.177.116.10 (eth0) | fd42:771d:9b36:84ca:216:3eff:feb1:e6c2 (eth0) | CONTAINER | 0 |
| | | | | | |
| | | | | | |
...
The only thing that works is restarting the host; then everything works again.
So, how can I debug what’s going wrong?
Thanks!