snap install lxd
lxd init
…
Would you like to create a new local network bridge? (yes/no) [default=yes]: no
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: yes
Name of the existing bridge or host interface: eth0
…
lxc launch images:debian/bullseye debian
(wait 1 minute…)
lxc ls
±-------±--------±-----±--------------------------------------------±----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±-------±--------±-----±--------------------------------------------±----------±----------+
| debian | RUNNING | | 9999::ff:fe88:cd06 (eth0) | CONTAINER | 0 |
±-------±--------±-----±--------------------------------------------±----------±----------+
Working under old /etc/network/interface under last Raspberry OS :
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.163.1
netmask 255.255.255.0
gateway 192.168.163.254
network 192.168.163.0
broadcast 192.168.163.255
dns-nameservers 8.8.8.8 8.8.4.4
I use a local dhcp server which works fine with other clients. It may be the point…
Thanks for any help…
We’ve seen cases where specific NICs badly interact with macvlan unfortunately which can cause this kind of issue. It could also be an issue with the switch your machine is plugged into not letting multiple MAC addresses for the same physical port go through.
root@sos:~# networkctl
WARNING: systemd-networkd is not running, output will be incomplete.
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback n/a unmanaged
2 eth0 ether n/a unmanaged
3 wlan0 wlan n/a unmanaged
3 links listed.
root@sos:~# lxc exec ubuntu bash
root@ubuntu:~# networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
5 eth0 ether routable configuring
2 links listed.
The router is an old freebox, the host is a raspberry pi 4b, I see leases :
root@sos:~# systemctl status isc-dhcp-server.service
● isc-dhcp-server.service - LSB: DHCP server
Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
Active: failed (Result: exit-code) since Wed 2021-09-08 18:56:41 CEST; 5h 18min ago
Docs: man:systemd-sysv-generator(8)
Process: 659 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/isc-dhcp-server.service
└─694 /usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf
Sep 09 00:12:02 sos dhcpd[694]: DHCPOFFER on 192.168.163.62 to 00:16:3e:b8:43:41 (ubuntu) via eth0
Sep 09 00:13:05 sos dhcpd[694]: DHCPDISCOVER from 00:16:3e:b8:43:41 (ubuntu) via eth0
Sep 09 00:13:06 sos dhcpd[694]: DHCPOFFER on 192.168.163.62 to 00:16:3e:b8:43:41 (ubuntu) via eth0
Sep 09 00:13:42 sos dhcpd[694]: DHCPREQUEST for 192.168.163.60 from 94:be:46:11:54:13 via eth0
Sep 09 00:13:42 sos dhcpd[694]: Wrote 0 deleted host decls to leases file.
Sep 09 00:13:42 sos dhcpd[694]: Wrote 0 new dynamic host decls to leases file.
Sep 09 00:13:42 sos dhcpd[694]: Wrote 12 leases to leases file.
Sep 09 00:13:42 sos dhcpd[694]: DHCPACK on 192.168.163.60 to 94:be:46:11:54:13 via eth0
Sep 09 00:14:09 sos dhcpd[694]: DHCPDISCOVER from 00:16:3e:b8:43:41 (ubuntu) via eth0
Sep 09 00:14:10 sos dhcpd[694]: DHCPOFFER on 192.168.163.62 to 00:16:3e:b8:43:41 (ubuntu) via eth0
If it’s not too much trouble, can you reconfigure your LXD host (rpi) to use a bridge instead of macvlan?
You’d effectively want to make sure that bridge-utils is installed and then change /etc/network/interfaces to something like (sorry been a while, not 100% sure it’s correct):
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.163.1
netmask 255.255.255.0
gateway 192.168.163.254
network 192.168.163.0
broadcast 192.168.163.255
dns-nameservers 8.8.8.8 8.8.4.4
bridge-ports eth0
Some question about using bridges : is this a workaround waiting some bug correction of macvlan ? or is it by design that in my case macvlan will “never” be the solution…?
macvlan should work in your case, but there are quite a lot of moving pieces outside of our control which can sometimes interfere. macvlan is dependent on the kernel driver for the physical NIC as well as in some cases the physical NIC itself supporting handling multiple MACs at the hardware level. As mentioned before, some switches also don’t enjoy it so much and may drop packets in one direction or another.
In your case, it looks like outgoing traffic is working fine but the NIC isn’t forwarding incoming traffic for some reason.
Bridges in general are far more reliable and the best option whenever possible.
macvlan is mostly a convenience as it doesn’t require a reconfiguration of the host networking to accommodate a bridge.