Open davidak opened 5 years ago
It works when i set the IP on the bridge!
networking = {
...
bridges = {
br0 = {
interfaces = [ "enp0s25" ];
};
};
interfaces = {
br0.ipv4.addresses = [
{ address = "192.168.10.214"; prefixLength = 24; }
];
};
nameservers = [ "192.168.50.253" "192.168.10.254" ];
defaultGateway = { address = "192.168.10.254"; interface = "br0"; };
};
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
@davidak Could you show your full configuration (host & guest) that made it work?
I don't have access to the machine and i think i used another approach in the end.
But the code in the other posts should be enough. What is unclear specifically?
Issue description
I want to spawn a nixos-container that gets an IP via DHCP in the same network as my notebook (as it was connected to the same switch).
This works with VMs in VirtualBox using the "Bridged Adapter" setting.
How can i achieve that using nixos-container?
A documentation would be great!
https://nixos.org/nixos/manual/index.html#ch-containers
It currently only explains NAT, but i want to access the container from the network using it's own IP.
Steps to reproduce
I tried
Inside container config:
With this config, my notebooks network stops working and the container has a link local address.
Technical details
"x86_64-linux"
Linux 4.19.44, NixOS, 19.03.172657.cdec6217d98 (Koi)
no
yes
nix-env (Nix) 2.2.2
"nixos-19.03.172657.cdec6217d98, nixos-hardware, nixos-unstable-19.09pre180241.971b731fc18"
/nix/var/nix/profiles/per-user/root/channels/nixos