Im well into week 4 of my exploration of lxd and somehow feel really confident in using it locally (host only networking) but also very confused when it comes to networking with public ips.
I have used a manually created bridge already to have IPs assigned via dhcp to new containers (which works great!) at home for testing purposes.
Now I want to transfer this setup to a root server, which is where I really struggle I cannot get IP addresses of an additional subnet assigned to my containers and all the available information is ether outdated, outright wrong or doesn’t resemble what I am trying to do.
I already read some of simos’ tutorials, found a couple of questions at stackoverflow that were answered by Stéphane… But this just problem just makes me feel like beeing completely out of my league…
I guess my setup is not that far away from Alejandro over here: Give public ip one container with custom bridge but I can’t seem to find and follow the necessary steps
Given are the following restrictions:
- I have a public static IP for the lxd host (say 100.100.100.65)
- I have a subnet available for containers (say 126.96.36.199/29) giving me 6 addresses for containers, or even 8 if I use gateway and broadcasting IP too (which would be bonus points).
- All IPs of the subnet are statical routed to the host IP.
- Virtual Mac Addresses would be available to get dhcp static leases, but I’d rather avoid the additional cost + they are only available for single ips, hence not giving me the freedom of adding another subnet to the host if need be.
I read, that I cannot use the managed lxdbr0 interface for the subnet to automagically assign “ipv4.address” to containers.
So now I wonder how to configure static IP addresses for the containers without
- editing an pushing an interfaces-file to the container
- entering the container and editing said file manually?
Also I wonder about how I would route the ips to the containers (after assigning them to the interface)
I just magine I had 40 hosts, running a plethora of small containers, but with mentioned restrictions (no dhcp for mac adresses, etc…).
What would be a manageable way to configure these to begin with, and maybe even add additional IP adresses to single containers (if need be)?
I read Stéphane mentioning
lxc network set lxdbr0 ipv4.routes which is not available in my version (2.21) of lxd and then
post-up and pre-down ing the ip addresses in the container itself.
But this seems so impractical even if you are just spinning up a few containers every day.
I know this would still be somehow scriptable, but just does not feel right.
Seeing how openVZ seeminigly easily manages to assign an IP to a container this just boggles me.
How would something alike be possible with lxd ?
Happy to give further information if need be.