1

I have a server running with multiple services running inside each of their own LXD container. All containers uses a bridged network. For now I am routing everything through the servers main ip address and forwarding the required ports to each container, but this is annoying. For an example I have multiple web GUI's running and using this setup they all need a different port like 8080, 8081 and so on, instead of just using the standard port 80 or 433. What I would like is to setup Pi-Hole with internal URL's pointing at each containers IP, but I need to somehow have traffic automatically routed through the server.

I am able to manually add a route for the LXD "10.x.x.x" network to the server and have it connect directly to a container. But I would have to do this to every single device that is being connected to the network. Is there a way to have the server tell the router to route traffic for this network through the server?

I know that I can setup LXD containers to use macvlan, but this introduces other issues and is also not a real solution either, but more a work-around.

4
  • Why not let each container get its own IP address in your LAN from the router via DHCP? Sep 5, 2022 at 23:27
  • It requires containers to be set up using macvlan which provides additional issues. Firstly the host will not be able to reach the containers via IP, also it seams to create more overhead on the network of the host, at least enough to feel it on the Raspberry Pi running LXD. Lastly, it bypasses all of the network configurations for outbound connections that is setup on the host. But most of all I don't like virtual systems on my main network, as it's just not a pretty way of doing it. Routing traffic to the bridged network is not impossible. It's just how to have it done automatically.
    – dbergloev
    Sep 6, 2022 at 1:36
  • You don't need macvlan. A virtual Ethernet cable (veth) connecting the container to the bridge is sufficient. The host, or any device in the LAN, can reach the containers by IP. It doesn't add any overhead. I have a RPi with ~25 network namespaces set up this way, and there's absolutely no performance impact. Now, I am not familiar with LXD, but I imagine its containers are probably built on top of net namespaces. You seem to have strong opinions against having VMs in your LAN, although you want them reachable from your LAN, which doesn't make sense to me. But, hey, your home, your rules. Sep 6, 2022 at 12:25
  • I have a lot of devices and I don't like mixing virtual and psychical devices on the same network. But mostly I don't like to settle just because I hit a wall. However if possible without macvlan, I could add a vlan on my network for all containers. That is something my gateway would know about and could direct traffic towards.
    – dbergloev
    Sep 6, 2022 at 15:53

1 Answer 1

0

I decided to just switch the crappy Mesh routers with an AP and a dedicated router that support static routing. Seams to be the best option. Also a great reason to get some proper networking hardware.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .