I bought this computer to serve as both for a router and a server running lxd, but it'll take a while to arrive.
The main issue is still the planning and I see two options for it.
The first option is to run OpenWRT on the system and run lxd inside it. This would probably be the easiest approach if lxd runs inside OpenWRT. I didn't find anyone doing this, so I wanted to know if this is possible. Does anyone know?
The second option is to run Ubuntu Server on the system, OpenWRT as an lxd container and manage the rj45 ports from inside the container. This has its advantages as well, but seems more complicated to manage. How can I let the OpenWRT container manager the port connections and still have the host Ubuntu server have access to the network to provide access to the other containers?
I guess there's also a third option which is to get some recommendation on any alternative I have not thought about. Can someone recommend a better alternative in which I can run lxd and also administer the router through an easy web interface?
i guess proxmox? Since it's x86/64 bit, you can run proxmox and Run those 2 system you need in 2 vm, having access natively to the hardware.you can also give the server vm internet access through internal bridge, always with proxmox.
If OpenWRT doesn't run LXD, what would be the best options to run OpenWRT as a container? Do I pass all network devices over to the OpenWRT container and then try to open a connection from the server to the container afterwards? Or does the server connect to the internet and pass that connection to the OpenWRT container? What would be my options? I'm quite a noob on this and I'm trying to learn.
I recommend running OpenWRT inside LXD. I have this setup on Arch Linux server on a HP T620+ with additional 4nic Intel card. Works beautifully.
I only pass through WAN NIC to OpenWRT. The rest is connected into a br0 software bridge on host and this bridge is connected to OpenWRT. This way, I still retain LAN network connecticity when OpenWRT container is down - very useful for a headless router.
I'm currently doing the same, except for running on Ubuntu Server. The only issue I still have with this solution is for managing the host bridge, which is not made through OpenWRT. The host bridge is currently not vlan aware, so adding vlans through OpenWRT would not work. My solution is just to not use vlans. Have you considered this issue?
I thought about it but turned out I didn't need VLANs, so stopped thinking about it. I am sure I have seen something about a VLAN-aware bridge somewhere.
A quick and dirty solution is to pass all ethernet ports to the LXD container and leave the bridge only for host communication/net access. However, when the container goes down, it takes LAN with it, so you have to connect keyboard/screen to the host machine in such case.
Be aware that running OpenWrt inside a containerization (like lxc/ lxd) is not a supported configuration (contrary to full system virtualization, like qemu, virtualbox, vmware, hyper-v, etc.). OpenWrt depends on the modified/ patched behaviour of several kernel modules (netfilter in particular), certain sysctl (pre-)configurations, and expects to be able to unload/ load kernel modules according to its needs. Neither of these are possible in a container, using the host's kernel. While it might appear to run, there will be bugs and security issues caused by this.