NetworkManager: Difference between revisions

No edit summary
Axka (talk | contribs)
m Link to link aggregation in Network article
 
(15 intermediate revisions by 6 users not shown)
Line 1: Line 1:
NetworkManager is a suite of programs for configuring network devices on a system. It is widely used by several Linux distributions and can be optionally enabled on [[NixOS]] for non-declarative network configuration. Additionally, it is used by several desktop environments.
NetworkManager is a program for configuring network devices on Linux. It is widely used by several Linux distributions and recommended for new [[NixOS]] installs. It provides non-declarative, interactive network configuration and tends to be the default for many desktop environments, such as [[GNOME]] or [[KDE|KDE Plasma]].


== Installation ==
== Installation ==
NetworkManager can be enabled with the following line:
NetworkManager can be enabled in the NixOS configuration file with the following line:<syntaxhighlight lang="nix">
networking.networkmanager.enable = true;
</syntaxhighlight>In order to allow access to the NetworkManager daemon and be able to configure and add new networks, the user must be added to the <code>networkmanager</code> group. This can be done through the <code>extraGroups</code> option for a defined user:<syntaxhighlight lang="nix">
users.users.<name>.extraGroups = [ "networkmanager" ];
</syntaxhighlight>By default, NetworkManager comes with <code>nmcli</code> and <code>nmtui</code> as user interfaces, however, a GTK interface called <code>nm-connection-editor</code> can be found in the <code>networkmanagerapplet</code> package.


<code> {
== Usage ==
  networking.networkmanager.enable = true;
} </code>


By default, NetworkManager comes with <code>nmcli</code> and <code>nmtui</code> as user interfaces, however, a GTK interface called <code>nm-connection-editor</code> can be found in the <code>nm-applet</code> package.
NetworkManager can be used with several front ends, such as <code>nmcli</code>, <code>nmtui</code>, or <code>nm-applet</code> and <code>nm-connection-editor</code>.
 
== Configuration ==
The NixOS modules offer additional configurations that can be setup very easily. For a full list of module options, refer to {{nixos:option|networking.networkmanager}}.
 
=== DNS Management ===
To allow custom DNS management, you must disable NetworkManager's built-in DNS resolution, as well as some NixOS <code>dhcp</code> related options. Refer to the configuration below as an example of what to do:<syntaxhighlight lang="nix">
networking.networkmanager.enable = true;
 
# Disable NetworkManager's internal DNS resolution
networking.networkmanager.dns = "none";
 
# These options are unnecessary when managing DNS ourselves
networking.useDHCP = false;
networking.dhcpcd.enable = false;
 
# Configure DNS servers manually (this example uses Cloudflare and Google DNS)
# IPv6 DNS servers can be used here as well.
networking.nameservers = [
  "1.1.1.1"
  "1.0.0.1"
  "8.8.8.8"
  "8.8.4.4"
];
</syntaxhighlight>
 
=== Power Saving ===
On laptops, where extra power savings may be desired, you can enable NetworkManager specific power saving options as follows:<syntaxhighlight lang="nix">
networking.networkmanager.wifi.powersave = true;
</syntaxhighlight>Please see [[Power Management]] for more tips relating to power-saving tips and tricks for NixOS.
 
=== Link aggregation ===
 
See [[Networking#Link aggregation]].
 
[[Category:Networking]]
[[Category:Desktop]]
[[Category:GNOME]]
[[Category:KDE]]
[[Category:DNS]]