Dear Nix users,
I want to declare nixos-containers and I would like to expose them to
the local network as if they were “normal” machines. The services
should be reachable from other machines by separate IP
addresses. Ideally, they would be configured through DHCP.
I’m a bit stuck trying multiple settings from man configuration.nix
. The closest is this:
containers.fileserver = {
config = …
hostAddress = "192.168.2.20";
localAddress = "192.168.100.2";
}
That creates a virtual interface on the host with IP
192.168.2.20
. This ip is in my network (currently 192.168.0.0/20). I
can ping this address from other machines. But it seems that incoming
traffic is not routed to the container. Do I need to declare each port
forward or can I say “all traffic from this interface to the
container, please”? It would also be nice, if the DHCP would configure
the hostAddress
, but not so important….
Is this possible? I’m sorry if I miss something obvious; As you see, I
really lack some understanding of this container networking/routing
stuff.
Any help is much appreciated! Thanks