NetworkManager: Difference between revisions
initial creation |
m Category:DNS added |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
NetworkManager is a | NetworkManager is a program for configuring network devices on Linux. It is widely used by several Linux distributions and can be optionally enabled on [[NixOS]] for non-declarative network configuration. It also tends to be the default for many desktop environments, such as [[GNOME]] or [[KDE|KDE Plasma]]. | ||
== Installation == | |||
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>nm-applet</code> package. | |||
== Usage == | |||
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. | |||
=== 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. | |||
[[Category:Networking]] | |||
[[Category:Desktop]] | |||
[[Category:GNOME]] | |||
[[Category:KDE]] | |||
[[Category:DNS]] |