My network goes down/up every couple of minutes

My network seems to go down and then up every once in a while.

The output of dmesg as

[10916.292570] r8169 0000:01:00.0 enp1s0: Link is Down
[10929.912911] r8169 0000:01:00.0 enp1s0: Link is Up - 1Gbps/Full - flow control off
[11164.262614] r8169 0000:01:00.0 enp1s0: Link is Down
[11178.125254] r8169 0000:01:00.0 enp1s0: Link is Up - 1Gbps/Full - flow control off

My configuration.nix is:

  networking = {
    enableIPv6 = false;
    wireless = {
      enable = false;
    };
    hostName = "hostName"; # Define your hostname.
    hostId = "4e98920d";
    firewall = {
      enable = false;
    };
  };

I run linux 5.4.43 and nixos 20.03.2059.05a32d8e771 (Markhor).

journalctl doesn’t output anything network related before the network goes down.

I never had this issue in any old version.

I think this is either a kernel problem (do older generations of your system, with older kernels, work correctly?) or a hardware problem (is the cable inserted properly? Have you tried another cable?).

I don’t have a pre-20.03 generation to revert back to anymore.

You can build a one-off 19.09 system using nixos-rebuild boot -I nixpkgs=channel:nixos-19.09 then reboot to test this. Make sure to do a regular nixos-rebuild boot afterwards to put a boot entry for 20.03 back at the top.