LXC networking between two containers in different hosts

How can I make two containers be able to ping each other, if they are on different hosts?

I have devised different methods for doing this, first one being: one host on macvlan mode, and the other in routed mode, (macvlan mode container is on a laptop with ethernet, while the routed node is on a RPI4, with wifi)

Is there anyway these two hosts can communicate over their lxbrd bridges?

When initializing LXD on a hosts it asks:

Would you like LXD to be available over the network? (yes/no) [default=no]:

Does this have anything to do with lxdbr0 being exposed to network, or is it for other things?

Best Regards,
C.

Hi,

No that setting just controls whether LXD’s API port will listen on an external HTTPS port.

You can setup a separate (unmanaged) bridge on the non-wifi host and have it join to the machine’s external network port, then you can connect containers to that bridge then they will use the DHCP server from the external network and will be pingable from other nodes.

Or you could continue using a private managed bridge and setup a static route for the private subnet on your external network’s router such that packets destined for that subnet are routed to the LXD node’s IP.

1 Like