Internet access from nixos-container

Using the container given here or the one given here how can I get access to the internet from that created / started container ?

Original question: I tried the settings described in the manual with no success.

ping -c1

with no luck.

Edit: Disabling firewall is the workaround to get external access:

containers.postfix =
      config =
        { config, pkgs, lib, ... }:

          environment.systemPackages = [ pkgs.mailutils ];

          services.postfix.enable = true;

          users.users.tisu.isNormalUser = true;

          networking.firewall.enable = false;

Stumbled upon Minimal working nextcloud config - #12 by nixinator, linked ticket says that when wifi interface is used, there are issues with NAT.

Thus when I put networking.firewall.enable = false; in configuration.nix or mycontainer.nix I can sudo nixos-container run postfix -- ping -c1 getting 0% packet loss which is a workaround.

Updating the op to reflect workaround.

1 Like

to be more precise , I’ve seen ‘weirdness’ when using layer 2 bridging, as wifi isn’t exactly Ethernet,

and sometime drivers don’t play well with this ‘bridging’. so your Mileage will vary.

All i can say if your having trouble, try Ethernet, and see if you get better results, which is a workaround at best.

1 Like