# though it would do so after a little delay
# so it's better to set a low MTU when possible.
"net/ipv4/tcp_mtu_probing" = 1;
+
+ # Use TCP BBR to significantly increase throughput
+ # and reduce latency for connections.
+ "net/ipv4/tcp_congestion_control" = mkDefault "bbr";
+
+ # BBR must be used with the fq or fq_codel qdisc with pacing enabled,
+ # since pacing is integral to the BBR design and implementation.
+ # BBR without pacing would not function properly,
+ # and may incur unnecessary high packet loss rates.
+ #
+ # See https://github.com/systemd/systemd/issues/9725#issuecomment-412287161
+ # See https://github.com/systemd/systemd/issues/9725#issuecomment-413796842
+ # > The best all-round general purpose default for linux remains fq_codel.
+ "net/core/default_qdisc" = mkDefault "fq_codel";
+
+ # Request Explicit Congestion Notification (ECN)
+ # only for incoming connections (not outgoing).
+ # See https://github.com/systemd/systemd/issues/9748#issuecomment-1261352478
+ # > My answer to the ECN situation remains - turn it on
+ # > - see if it works - don't inflict your decision on others.
+ # > $ sysctl -w net.ipv4.tcp_ecn=1
+ # > $ flent -H flent-newark.bufferbloat.net -t 'now tv hub ecn' \
+ # > --te=download_streams=1 --socket-stats tcp_ndown # try 1,4,16
+ # > $ sysctl -w net.ipv4.tcp_ecn=2
+ # > $ flent -H flent-newark.bufferbloat.net -t 'now tv hub noecn' \
+ # > --te=download_streams=1 --socket-stats tcp_ndown # try 1,4,16
+ # > you can then use flent-gui *.flent.gz to generate a variety of plots,
+ # > especially comparison plots.
+ "net/ipv4/tcp_ecn" = mkDefault 2;
};
networking = {
allowPing = mkDefault true;
};
networkmanager = {
- enable = mkDefault config.services.xserver.enable;
#dhcp = "dhcpcd";
logLevel = mkDefault "INFO";
wifi = {
esac
'';
};
+
+ # The notion of "online" is a broken concept
+ #systemd.services.NetworkManager-wait-online.enable = false;
+ #systemd.network.wait-online.enable = false;
+
+ # Do not take down the network for too long when upgrading,
+ # This also prevents failures of services that are restarted instead of stopped.
+ # It will use `systemctl restart` rather than stopping it with `systemctl stop`
+ # followed by a delayed `systemctl start`.
+ systemd.services.systemd-networkd.stopIfChanged = false;
+
+ # Services that are only restarted might be not able
+ # to resolve when resolved is stopped before.
+ systemd.services.systemd-resolved.stopIfChanged = false;
}