Difference between revisions of "NetworkManager"

From ArchWiki
Jump to: navigation, search
(VPN problems in Networkmanager 0.7.999: Networkmanager is ver 0.9.6 now. Git version is not needed.)
(Undo revision 449806 by Z3ntu (talk) - that's implied by the "Go to IPv4 Settings" step, isn't it?)
 
(354 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
[[Category:Networking]]
+
[[Category:Network configuration]]
 
[[cs:NetworkManager]]
 
[[cs:NetworkManager]]
 
[[de:Networkmanager]]
 
[[de:Networkmanager]]
Line 5: Line 5:
 
[[fr:NetworkManager]]
 
[[fr:NetworkManager]]
 
[[it:NetworkManager]]
 
[[it:NetworkManager]]
 +
[[ja:NetworkManager]]
 
[[pt:NetworkManager]]
 
[[pt:NetworkManager]]
 
[[ru:NetworkManager]]
 
[[ru:NetworkManager]]
 
[[tr:NetworkManager]]
 
[[tr:NetworkManager]]
 
[[zh-CN:NetworkManager]]
 
[[zh-CN:NetworkManager]]
{{Article summary start}}
+
{{Related articles start}}
{{Article summary text|Covers installation and configuration of NetworkManager – a set of co-operative tools that make networking simple and straightforward.}}
+
{{Related|Network configuration}}
{{Article summary heading|Overview}}
+
{{Related|Wireless network configuration}}
{{Article summary text|{{Networking overview}}}}
+
{{Related|:Category:Network configuration}}
{{Article summary end}}
+
{{Related articles end}}
 
+
 
[http://projects.gnome.org/NetworkManager/ NetworkManager] is a program for providing detection and configuration for systems to automatically connect to network.  NetworkManager's functionality can be useful for both wireless and wired networks.  For wireless networks, NetworkManager prefers known wireless networks and has the ability to switch to the most reliable network.  NetworkManager-aware applications can switch from online and offline mode.  NetworkManager also prefers wired connections over wireless ones, has support for modem connections and certain types of VPN.  NetworkManager was originally developed by Red Hat and now is hosted by the [[GNOME]] project.
 
[http://projects.gnome.org/NetworkManager/ NetworkManager] is a program for providing detection and configuration for systems to automatically connect to network.  NetworkManager's functionality can be useful for both wireless and wired networks.  For wireless networks, NetworkManager prefers known wireless networks and has the ability to switch to the most reliable network.  NetworkManager-aware applications can switch from online and offline mode.  NetworkManager also prefers wired connections over wireless ones, has support for modem connections and certain types of VPN.  NetworkManager was originally developed by Red Hat and now is hosted by the [[GNOME]] project.
  
== Base install ==
+
{{Warning|By default, Wi-Fi passwords are stored in clear text. See section [[#Encrypted Wi-Fi passwords]]}}
 +
 
 +
== Installation ==
  
NetworkManager can be installed with the package {{Pkg|networkmanager}}, available in the [[official repositories]].
+
NetworkManager can be [[install]]ed with the package {{Pkg|networkmanager}}. The package does not include the tray applet ''nm-applet'' which is part of the {{Pkg|network-manager-applet}}. It has functionality for basic DHCP support. For full featured DHCP and if you require IPv6 support, {{Pkg|dhclient}} integrates it.
 +
 
 +
{{Note|You must ensure that no other service that wants to configure the network is running; in fact, multiple networking services will conflict. You can find a list of the currently running services with {{ic|1=systemctl --type=service}} and then [[stop]] them. See [[#Configuration]] to enable the NetworkManager service.}}
  
 
=== VPN support ===
 
=== VPN support ===
  
Network Manager VPN support is based on a plug-in system. If you need VPN support via network manager you have to install one of the following packages in [[official repositories]]:
+
NetworkManager VPN support is based on a plug-in system. If you need VPN support via NetworkManager, you have to install one of the following packages:
  
    networkmanager-openvpn
+
* {{Pkg|networkmanager-openconnect}}
    networkmanager-pptp
+
* {{Pkg|networkmanager-openvpn}}
    networkmanager-vpnc
+
* {{Pkg|networkmanager-pptp}}
 +
* {{Pkg|networkmanager-vpnc}}
 +
* {{AUR|networkmanager-l2tp}}
  
== Graphical front-ends ==
+
{{Warning|1=VPN support is [https://bugzilla.gnome.org/buglist.cgi?quicksearch=networkmanager%20vpn unstable], check the daemon processes options set via the GUI correctly and double-check with each package release.[https://bugzilla.gnome.org/show_bug.cgi?id=755350] [https://bugzilla.gnome.org/show_bug.cgi?id=758772] {{Bug|47535}}}}
  
To configure and have easy access to NetworkManager most people will want to install an applet. This GUI front-end usually resides in the system tray (or notification area) and allows network selection and configuration of NetworkManager. Various applets exist for different types of desktops.
+
=== PPPoE / DSL support ===
  
=== GNOME ===
+
[[Install]] {{pkg|rp-pppoe}} for PPPoE / DSL connection support.
  
GNOME's {{Pkg|network-manager-applet}} (formerly gnome-network-manager) is lightweight enough and works across all environments.
+
== Front-ends ==
  
If you want to store authentication details (Wireless/DSL) and enable global connection settings, i.e "available to all users" install and configure [[GNOME Keyring]].
+
To configure and have easy access to NetworkManager, most users will want to install an applet. This GUI front-end usually resides in the system tray (or notification area) and allows network selection and configuration of NetworkManager. Various applets exist for different types of desktops.
  
=== KDE4 ===
+
=== GNOME ===
  
The KNetworkManager front-end has been made available since KDE 4.4 as a Plasma widget available in the official repositories:
+
[[GNOME]]'s {{Pkg|network-manager-applet}} works in all environments.
{{Pkg|kdeplasma-applets-networkmanagement}}.
+
  
The GNOME counterpart works just as nicely, or even better (has more features and detects more hardware).
+
To store authentication details for connections (Wireless/DSL) install and configure [[GNOME Keyring]].
  
{{Note|If you are changing from another network managing tool like [[Wicd]], do not forget to set the default 'Network Management Backend' in  
+
Be aware that after enabling the tick-box option {{ic|Make available to other users}} for a connection, NetworkManager stores the password in plain-text, though the respective file is accessible only to root (or other users via {{ic|nm-applet}}). See [[#Encrypted Wi-Fi passwords]].
System Settings -> Hardware -> Information Sources}}
+
  
If you have both the Plasma widget and {{ic|nm-applet}} installed and do not want to start {{ic|nm-applet}} when using KDE, add the following line to {{ic|/etc/xdg/autostart/nm-applet.desktop}}:
+
=== KDE Plasma ===
NotShowIn=KDE
+
  
=== KDE3 ===
+
[[Install]] the {{Pkg|plasma-nm}} applet.
Though no longer supported, {{AUR|kdemod3-knetworkmanager}} can be found in the [[AUR]]. This is a modified version of KNetworkManager for the [[Trinity]] DE and requires NetworkManager 0.8.
+
  
=== XFCE ===
+
=== Xfce ===
{{Pkg|network-manager-applet}} will work fine in XFCE, but in order to see notifications, ''including error messages'', {{ic|nm-applet}} needs an implementation of the Freedesktop desktop notifications specification (see the [http://www.galago-project.org/specs/notification/0.9/index.html Galapago Project]) to display them. To enable notifications install {{Pkg|xfce4-notifyd}}, a package that provides an implementation for the specification.
+
 
 +
While {{Pkg|network-manager-applet}} works in [[Xfce]], in order to see notifications, including error messages, {{ic|nm-applet}} needs an implementation of the Freedesktop desktop notifications specification (see the [http://www.galago-project.org/specs/notification/0.9/index.html Galapago Project]) to display them. To enable notifications install {{Pkg|xfce4-notifyd}}, a package that provides an implementation for the specification.
  
 
Without such a notification daemon, {{ic|nm-applet}} outputs the following errors to stdout/stderr:
 
Without such a notification daemon, {{ic|nm-applet}} outputs the following errors to stdout/stderr:
  
 
  (nm-applet:24209): libnotify-WARNING **: Failed to connect to proxy
 
  (nm-applet:24209): libnotify-WARNING **: Failed to connect to proxy
 
 
  ** (nm-applet:24209): WARNING **: get_all_cb: couldn't retrieve
 
  ** (nm-applet:24209): WARNING **: get_all_cb: couldn't retrieve
 
  system settings properties: (25) Launch helper exited with unknown
 
  system settings properties: (25) Launch helper exited with unknown
 
  return code 1.
 
  return code 1.
 
 
  ** (nm-applet:24209): WARNING **: fetch_connections_done: error
 
  ** (nm-applet:24209): WARNING **: fetch_connections_done: error
 
  fetching connections: (25) Launch helper exited with unknown return
 
  fetching connections: (25) Launch helper exited with unknown return
 
  code 1.
 
  code 1.
 
 
  ** (nm-applet:24209): WARNING **: Failed to register as an agent:
 
  ** (nm-applet:24209): WARNING **: Failed to register as an agent:
 
  (25) Launch helper exited with unknown return code 1
 
  (25) Launch helper exited with unknown return code 1
  
 
{{ic|nm-applet}} will still work fine, though, but without notifications.
 
{{ic|nm-applet}} will still work fine, though, but without notifications.
 +
 +
If {{ic|nm-applet}} is not prompting for a password when connecting to new wifi networks, and is just disconnecting immediately, you may need to install {{Pkg|gnome-keyring}}.
 +
 +
Should the applet not appear, install the {{AUR|xfce4-indicator-plugin}} package. [http://askubuntu.com/questions/449658/networkmanager-tray-nm-applet-is-gone-after-upgrade-to-14-04-trusty]
  
 
=== Openbox ===
 
=== Openbox ===
  
To function properly in Openbox, the GNOME applet requires the {{Pkg|xfce4-notifyd}} notification daemon for the same reason as in XFCE and the {{Pkg|gnome-icon-theme}} package to be able to display the applet in the systray.
+
To work properly in [[Openbox]], the GNOME applet requires the {{Pkg|xfce4-notifyd}} notification daemon for the same reason as in XFCE and the {{Pkg|gnome-icon-theme}} package to be able to display the applet in the systray.
  
 
If you want to store authentication details (Wireless/DSL) install and configure [[gnome-keyring]].
 
If you want to store authentication details (Wireless/DSL) install and configure [[gnome-keyring]].
  
{{Note|If the ''networkmanager'' daemon is in {{ic|rc.conf}}, the following settings are obsolete or the applet will be started twice.}}
+
{{ic|nm-applet}} installs the autostart file at {{ic|/etc/xdg/autostart/nm-applet.desktop}}. If you have issues with it (e.g. {{ic|nm-applet}} is started twice or is not started at all), see [[Openbox#autostart]] or [https://bbs.archlinux.org/viewtopic.php?pid=993738] for solution.
 
+
To have Openbox's autostart start {{ic|nm-applet}} properly, you may need to delete the file {{ic|/etc/xdg/autostart/nm-applet.desktop}} (You may need to delete this file again after every update to {{Pkg|network-manager-applet}}).
+
 
+
Then in {{ic|autostart}}, start {{ic|nm-applet}} with this line:
+
 
+
(sleep 3 && /usr/bin/nm-applet --sm-disable) &
+
 
+
If you experience errors connecting, make sure you have your [[D-Bus]] user session started.
+
  
 
=== Other desktops and window managers ===
 
=== Other desktops and window managers ===
Line 95: Line 91:
 
In all other scenarios it is recommended to use the GNOME applet. You will also need to be sure that the {{Pkg|gnome-icon-theme}} package is installed to be able to display the applet.
 
In all other scenarios it is recommended to use the GNOME applet. You will also need to be sure that the {{Pkg|gnome-icon-theme}} package is installed to be able to display the applet.
  
To store connection secrets install and configure [[gnome-keyring]].
+
To store connection secrets install and configure [[GNOME Keyring]].
  
 
In order to run {{ic|nm-applet}} without a systray, you can use {{Pkg|trayer}} or {{Pkg|stalonetray}}. For example, you can add a script like this one in your path:
 
In order to run {{ic|nm-applet}} without a systray, you can use {{Pkg|trayer}} or {{Pkg|stalonetray}}. For example, you can add a script like this one in your path:
 +
 
{{hc|nmgui|<nowiki>
 
{{hc|nmgui|<nowiki>
#!/bin/sh
+
#!/bin/sh
nm-applet    > /dev/null 2>/dev/null &
+
nm-applet    2>&1 > /dev/null &
stalonetray  > /dev/null 2>/dev/null
+
stalonetray  2>&1 > /dev/null
killall nm-applet
+
killall nm-applet
 
</nowiki>}}
 
</nowiki>}}
  
When you close the stalonetray window, it closes {{ic|nm-applet}} too, so no extra memory is used once you are done with network settings.
+
When you close the ''stalonetray'' window, it closes {{ic|nm-applet}} too, so no extra memory is used once you are done with network settings.
  
 
=== Command line ===
 
=== Command line ===
  
The {{Pkg|networkmanager}} package contains [http://manpages.ubuntu.com/manpages/maverick/man1/nmcli.1.html nmcli] since version 0.8.1.
+
The following applications can be useful for configuring and managing networks without X.
  
== Configuration ==
+
==== nmcli ====
  
NetworkManager will require some additional steps to be able run properly.
+
A command line frontend, ''nmcli'', is included with {{Pkg|networkmanager}}.
  
Verify that your {{ic|/etc/hosts}} is correct before continuing. If you previously tried to connect before doing this step, NetworkManager may have altered it. An example hostname line in {{ic|/etc/hosts}}:
+
For usage information, see {{man|1|nmcli|url=https://www.mankier.com/1/nmcli}}. Examples:
  
{{bc|
+
* To connect to a wifi network: {{bc|nmcli dev wifi connect <name> password <password>}}
#<ip-address> <hostname.domain.org>           <hostname>                      
+
* To connect to a wifi on the {{ic|wlan1}} wifi interface: {{bc|nmcli dev wifi connect <name> password <password> iface wlan1 [profile name]}}
127.0.0.1    localhost.localdomain localhost dell-latitude
+
* To disconnect an interface: {{bc|nmcli dev disconnect iface eth0}}
}}
+
* To reconnect an interface marked as disconnected: {{bc|nmcli con up uuid <uuid>}}
 +
* To get a list of UUIDs: {{bc|nmcli con show}}
 +
* To see a list of network devices and their state: {{bc|nmcli dev}}
 +
* To turn off wifi: {{bc|nmcli r wifi off}}
  
=== Disable current network setup ===
+
==== nmtui ====
  
You will want to disable your current network setup to be able to properly test NetworkManager:
+
A curses based graphical frontend, ''nmtui'', is included with {{Pkg|networkmanager}}.
# If using the Arch Linux network scripts, [[Daemon|stop]] the network daemon.
+
# Bring down your NIC's (Network Interface Controllers, i.e. network cards).  For example (using the {{Pkg|iproute2}} package):
+
  
ip link set down eth0
+
For usage information, see {{man|1|nmtui|url=https://www.mankier.com/1/nmtui}}.
ip link set down wlan0
+
  
# Edit {{ic|/etc/rc.conf}} where DHCP or a static IP address are defined by commenting them out:
+
==== nmcli-dmenu ====
{{Note|Following settings are obsolete in the most recent rc.conf.}}
+
{{bc|<nowiki>
+
#eth0="dhcp"                                                                   
+
#wlan0="dhcp"                                                                 
+
INTERFACES=(!eth0 !wlan0)
+
</nowiki>}}
+
  
# Finally, edit {{ic|/etc/rc.conf}} to '''remove''' the default ''network'' daemon or any other network management daemons you may be using.
+
Alternatively there is {{AUR|networkmanager-dmenu-git}} which is a small script to manage NetworkManager connections with ''dmenu'' instead of {{ic|nm-applet}}. It provides all essential features such as connect to existing NetworkManager wifi or wired connections, connect to new wifi connections, requests passphrase if required, connect to existing VPN connections, enable/disable networking, launch ''nm-connection-editor'' GUI.
  
=== Enable NetworkManager ===
+
== Configuration ==
  
How you enable NetworkManager depends on how your system is configured. New installations now use [[systemd]] by default. Many users have transitioned to systemd, which will become the default in the future.
+
NetworkManager will require some additional steps to be able run properly. Make sure you have configured {{ic|/etc/hosts}} as described in [[Network configuration#Set the hostname]] section.
  
Once the NetworkManager daemon is started, it will automatically connect to any available "system connections" that have already been configured. Any "user connections" or unconfigured connections will need {{ic|nmcli}} or an applet to configure and connect.
+
=== Enable NetworkManager ===
  
==== Enable NetworkManager with systemd ====
+
NetworkManager is [[systemd#Using units|controlled]] via {{ic|NetworkManager.service}}. Once the NetworkManager daemon is started, it will automatically connect to any available "system connections" that have already been configured. Any "user connections" or unconfigured connections will need ''nmcli'' or an applet to configure and connect.
  
You can enable NetworkManager at startup with the following command:
+
NetworkManager has a global configuration file at {{ic|/etc/NetworkManager/NetworkManager.conf}}. Usually no configuration needs to be done to the global defaults.
  
{{bc|# systemctl enable NetworkManager.service}}
+
=== Enable NetworkManager Wait Online ===
  
You can start the NetworkManager daemon immediately with the following command:
+
If you have services which fail if they are started before the network is up, you may use {{ic|NetworkManager-wait-online.service}} in addition to {{ic|NetworkManager.service}}. This is, however, rarely necessary because most networked daemons start up okay, even if the network has not been configured yet.
  
{{bc|# systemctl start NetworkManager.service}}
+
In some cases, the service will still fail to start successfully on boot due to the timeout setting in {{ic|/usr/lib/systemd/system/NetworkManager-wait-online.service}} being too short. Change the default timeout from 30 to a higher value.
  
{{Note|If you have services which fail if they are started before the network is up, you have to use {{ic|NetworkManager-wait-online.service}} instead. This is however hardly ever necessary since most network daemons start up fine, even if the network has not been configured yet.}}
+
=== Set up PolicyKit permissions ===
  
==== Enable NetworkManager with legacy initscripts ====
+
See [[General troubleshooting#Session permissions]] for setting up a working session.
  
To enable NetworkManager at startup, edit the ''DAEMONS'' line in {{ic|/etc/rc.conf}} by '''adding''' the ''networkmanager'' daemon, after the dbus daemon:
+
With a working session, you have several options for granting the necessary privileges to NetworkManager:
  
DAEMONS=( ...'''dbus networkmanager'''... )
+
* ''Option 1.'' Run a [[Polkit]] authentication agent when you log in, such as {{ic|/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1}} (part of {{Pkg|polkit-gnome}}). You will be prompted for your password whenever you add or remove a network connection.
 +
* ''Option 2.'' [[Users and groups#Group management|Add]] yourself to the {{ic|wheel}} group.  You will not have to enter your password, but your user account may be granted other permissions as well, such as the ability to use [[sudo]] without entering the root password.
 +
* ''Option 3.'' [[Users and groups#Group management|Add]] yourself to the {{ic|network}} group and create the following file:
  
Be sure that the package {{Pkg|dbus}} is installed as NetworkManager will require it. To start other services (daemons) that require a network connection see the next section on how to set them up.
+
{{hc|/etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules|<nowiki>
 +
polkit.addRule(function(action, subject) {
 +
  if (action.id.indexOf("org.freedesktop.NetworkManager.") == 0 && subject.isInGroup("network")) {
 +
    return polkit.Result.YES;
 +
  }
 +
});
 +
</nowiki>}}
  
You can start the NetworkManager daemon immediately with the following commands:
+
: All users in the {{ic|network}} group will be able to add and remove networks without a password. This will not work under [[systemd]] if you do not have an active session with ''systemd-logind''.
  
{{bc|# rc.d start dbus}}
+
=== Network services with NetworkManager dispatcher ===
{{bc|# rc.d start networkmanager}}
+
  
=== Set up PolicyKit permissions ===
+
There are quite a few network services that you will not want running until NetworkManager brings up an interface. Good examples are [[NTPd]] and network filesystem mounts of various types (e.g. '''netfs'''). NetworkManager has the ability to start these services when you connect to a network and stop them when you disconnect. To activate the feature you need to [[start]] the {{ic|NetworkManager-dispatcher.service}}.
  
See [[General Troubleshooting#Session permissions]] for setting up a working session.
+
Once the feature is active, scripts can be added to the {{ic|/etc/NetworkManager/dispatcher.d}} directory.  These scripts must be '''owned by root''', otherwise the dispatcher will not execute them. For added security, set group ownership to root as well:
  
With a working session, you have several options for granting the necessary privileges to NetworkManager:
+
# chown root:root ''scriptname''
  
''Option 1.'' Run a [[PolicyKit]] authentication agent when you log in, such as {{ic|/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1}} (part of {{Pkg|polkit-gnome}}).  You will be prompted for your password whenever you add or remove a network connection.
+
Also, the script must have '''write permission for owner only''', otherwise the dispatcher will not execute them:
  
''Option 2.'' Add yourself to the {{ic|wheel}} group.  You will not have to enter your password, but your user account may be granted other permissions as well, such as the ability to use [[sudo]] without entering the root password.
+
# chmod 755 ''scriptname''
  
''Option 3.'' Add yourself to the {{ic|network}} group and create the following file:
+
The scripts will be run in alphabetical order at connection time, and in reverse alphabetical order at disconnect time. They receive two arguments: the name of the interface (e.g. {{ic|eth0}}) and the status (''up'' or ''down'' for interfaces and ''vpn-up'' or ''vpn-down'' for vpn connections). To ensure what order they come up in, it is common to use numerical characters prior to the name of the script (e.g. {{ic|10_portmap}} or {{ic|30_netfs}} (which ensures that the ''portmapper'' is up before NFS mounts are attempted).
{{hc|/etc/polkit-1/localauthority/50-local.d/org.freedesktop.NetworkManager.pkla|<nowiki>
+
[nm-applet]
+
Identity=unix-group:network
+
Action=org.freedesktop.NetworkManager.*
+
ResultAny=yes
+
ResultInactive=no
+
ResultActive=yes</nowiki>}}
+
All users in the {{ic|network}} group will be able to add and remove networks without a password. This will not work under systemd if you do not have an active session with [[Systemd#Using_systemd-logind|systemd-logind]].
+
  
=== Network services with NetworkManager dispatcher===
+
{{Warning|If you connect to foreign or public networks, be aware of what services you are starting and what servers you expect to be available for them to connect to. You could make a security hole by starting the wrong services while connected to a public network}}
  
There are quite a few network services that you will not want running until NetworkManager brings up an interface. Good examples are [[OpenNTPD]] and network filesystem mounts of various types (e.g. '''netfs'''). NetworkManager has the ability to start these services when you connect to a network and stop them when you disconnect.
+
==== Avoiding the dispatcher timeout ====
  
To use this feature, scripts can be added to the {{ic|/etc/NetworkManager/dispatcher.d}} directory.  These scripts will need to have executable, user permissions.  For security, it is good practice to make them owned by '''root:root''' and writable only by the owner.
+
If the above is working, then this section is not relevant. However, there is a general problem related to running dispatcher scripts which take longer to be executed. Initially an internal timeout of three seconds only was used. If the called script did not complete in time, it was killed. Later the timeout was extended to about 20 seconds (see the [https://bugzilla.redhat.com/show_bug.cgi?id=982734 Bugtracker] for more information). If the timeout still creates the problem, a work around may be to modify the dispatcher service file {{ic|/usr/lib/systemd/system/NetworkManager-dispatcher.service}} to remain active after exit:  
  
The scripts will be run in alphabetical order at connection time, and in reverse alphabetical order at disconnect time. They receive two arguments: the name of the interface (e.g. ''eth0'') and the status (''up'' or ''down''). To ensure what order they come up in, it is common to use numerical characters prior to the name of the script (e.g. {{ic|10_portmap}} or {{ic|30_netfs}} (which ensures that the portmapper is up before NFS mounts are attempted).
+
{{hc|/etc/systemd/system/NetworkManager-dispatcher.service|2=
 +
.include /usr/lib/systemd/system/NetworkManager-dispatcher.service
 +
[Service]
 +
RemainAfterExit=yes}}
  
{{Warning|For security reason. You should disable write access for group and other. For example use 755 mask.
+
Now start and enable the modified {{ic|NetworkManager-dispatcher}} service.
In other case it can refuse to execute script, with error message "nm-dispatcher.action: Script could not be executed: writable by group or other, or set-UID." in {{ic|/var/log/messages.log}} }}
+
 
{{Warning|if you connect to foreign or public networks, be aware of what services you are starting and what servers you expect to be available for them to connect to. You could make a security hole by starting the wrong services while connected to a public network.}}
+
{{Warning|Adding the {{ic|RemainAfterExit}} line to it will prevent the dispatcher from closing. Unfortunately, the dispatcher '''has''' to close before it can run your scripts again. With it the dispatcher will not time out but it also will not close, which means that the scripts will only run once per boot. Therefore, do not add the line unless the timeout is definitely causing a problem.}}
  
 
==== Start OpenNTPD ====
 
==== Start OpenNTPD ====
  
The following example starts the OpenNTPD daemon when an interface is brought up. Save the file as {{ic|/etc/NetworkManager/dispatcher.d/20_openntpd}} and make it executable.
+
Install the {{Pkg|networkmanager-dispatcher-openntpd}} package.
{{bc|<nowiki>
+
#!/bin/sh
+
 
+
INTERFACE=$1 # The interface which is brought up or down
+
STATUS=$2 # The new state of the interface
+
 
+
case "$STATUS" in
+
    'up') # $INTERFACE is up
+
exec rc.d start openntpd
+
;;
+
    'down') # $INTERFACE is down
+
# Check for active interface and down if no one active
+
if [ ! `nm-tool|grep State|cut -f2 -d' '` = "connected" ]; then
+
exec rc.d stop openntpd
+
fi
+
;;
+
esac
+
</nowiki>}}
+
  
 
==== Mount remote folder with sshfs ====
 
==== Mount remote folder with sshfs ====
  
As the script is run in a very restrictive environment, you have to export {{ic|SSH_AUTH_SOCK}} in order to connect to your SSH agent. There are different ways to accomplish this, see [https://bbs.archlinux.org/viewtopic.php?pid=1042030#p1042030 this link] for more information. The example below works with [[gnome-keyring]], and will ask you for the password if not unlocked already. In case NetworkManager connects automatically on login, it is likely gnome-keyring has not yet started and the export will fail (hence the sleep). The {{ic|UUID}} to match can be found in {{ic|/etc/NetworkManager/system-connections/}}).     
+
As the script is run in a very restrictive environment, you have to export {{ic|SSH_AUTH_SOCK}} in order to connect to your SSH agent. There are different ways to accomplish this, see [https://bbs.archlinux.org/viewtopic.php?pid=1042030#p1042030 this message] for more information. The example below works with [[GNOME Keyring]], and will ask you for the password if not unlocked already. In case NetworkManager connects automatically on login, it is likely ''gnome-keyring'' has not yet started and the export will fail (hence the sleep). The {{ic|UUID}} to match can be found with the command {{ic|nmcli con status}} or {{ic|nmcli con list}}.     
  
#!/bin/bash
+
{{bc|<nowiki>
USER=<your sshfs user>
+
#!/bin/sh
if [ $CONNECTION_UUID == <connection UUID> ]; then
+
USER='username'
        case "$2" in
+
REMOTE='user@host:/remote/path'
+
LOCAL='/local/path'
                up)
+
                    #sleep 10
+
                    export SSH_AUTH_SOCK=$(find /tmp/keyring-*/ -type s -user $USER -group users -name ssh)
+
                    su $USER -c "/usr/bin/sshfs user@host:/remote/folder /local/folder/"
+
                  ;;
+
+
                down)
+
                    fusermount -u /local/folder
+
                  ;;
+
        esac
+
  fi
+
  
==== Use dispatcher to connect to a VPN after a network-connection is established ====
+
interface=$1 status=$2
 +
if [ "$CONNECTION_UUID" = "</nowiki>''uuid''<nowiki>" ]; then
 +
  case $status in
 +
    up)
 +
      export SSH_AUTH_SOCK=$(find /tmp -maxdepth 1 -type s -user "$USER" -name 'ssh')
 +
      su "$USER" -c "sshfs $REMOTE $LOCAL"
 +
      ;;
 +
    down)
 +
      fusermount -u "$LOCAL"
 +
      ;;
 +
  esac
 +
fi
 +
</nowiki>}}
  
In this example we want to connect automatically to a previously defined VPN connection after connecting to a specific WiFi network. First thing to do is to create the dispatcher script that defines what to do after we are connected to the network.  
+
==== Use dispatcher to connect to a VPN after a network connection is established ====
 +
 
 +
In this example we want to connect automatically to a previously defined VPN connection after connecting to a specific Wi-Fi network. First thing to do is to create the dispatcher script that defines what to do after we are connected to the network.
  
 
:1. Create the dispatcher script:
 
:1. Create the dispatcher script:
 +
 
{{hc|/etc/NetworkManager/dispatcher.d/vpn-up|<nowiki>
 
{{hc|/etc/NetworkManager/dispatcher.d/vpn-up|<nowiki>
  VPN_NAME=<name of VPN connection defined in NetworkManager>
+
#!/bin/sh
  ESSID=<wifi network ESSID (not connection name)>
+
VPN_NAME="name of VPN connection defined in NetworkManager"
  if [ "$2" = "up" -o "$2" = "vpn-down" ]; then          # -o "$2" = "vpn-down" makes VPN reconnect after VPN connection interrupt
+
ESSID="Wi-Fi network ESSID (not connection name)"
     if [ "$(iwgetid | grep ':"'$ESSID'"')" ]; then       # check for ESSID match
+
 
       nmcli con up id "$VPN_NAME";                      # parentheses needed for VPN connection names with spaces
+
interface=$1 status=$2
 +
case $status in
 +
  up|vpn-down)
 +
     if iwgetid | grep -qs ":\"$ESSID\""; then
 +
       nmcli con up id "$VPN_NAME"
 
     fi
 
     fi
   elif [ "$2" = "down" ]; then                          # disconnect VPN prior to disconnecting from the network
+
    ;;
     if [ "$(iwgetid | grep ':"'$ESSID'"')" ]; then       # check for ESSID match and that VPN is actually connected
+
   down)
       if [ $(nmcli con status id "$VPN_NAME" | grep -c activated) ]; then
+
     if iwgetid | grep -qs ":\"$ESSID\""; then
         nmcli con down id "$VPN_NAME";
+
       if nmcli con show --active | grep "$VPN_NAME"; then
 +
         nmcli con down id "$VPN_NAME"
 
       fi
 
       fi
 
     fi
 
     fi
  fi
+
    ;;
 +
esac
 
</nowiki>}}
 
</nowiki>}}
Remember to make it executable with {{ic|chmod +x}} and to make the VPN connection available to all users.
 
  
Trying to connect using this setup will fail and NetworkManager will complain about 'no valid VPN secrets', because of [http://projects.gnome.org/NetworkManager/developers/migrating-to-09/secrets-flags.html the way VPN secrets are stored] which brings us to step 2:
+
If you would like to attempt to automatically connect to VPN for all Wi-Fi networks, you can use the following definition of the ESSID: {{ic|1=ESSID=$(iwgetid -r)}}. Remember to set the script's permissions [[#Network services with NetworkManager dispatcher|accordingly]].
  
:2. Edit your VPN connection configuration file to make NetworkManager store the secrets by itself rather than inside a keyring [https://bugzilla.redhat.com/show_bug.cgi?id=710552 that will be inaccessible for root]: open up {{ic|/etc/NetworkManager/system-connections/<name of your VPN connection>}} and change the {{ic|password-flags}} and {{ic|secret-flags}} form {{ic|1}} to {{ic|0}}.
+
If you require and tick the {{ic|nm-applet}} option to ''Make the VPN connection available to all users'', trying to connect may still fail and NetworkManager will complain about 'no valid VPN secrets', because of [http://developer.gnome.org/NetworkManager/0.9/secrets-flags.html the way VPN secrets are stored], which brings us to step 2:
  
{{Note|It may now be necessary to re-open the NetworkManager connection editor and re-enter the VPN passwords/secrets.}}
+
:2. Either edit the VPN connection configuration file to make NetworkManager store the secrets by itself rather than inside a keyring [https://bugzilla.redhat.com/show_bug.cgi?id=710552 that will be inaccessible for root]: open up {{ic|/etc/NetworkManager/system-connections/''name of your VPN connection''}} and change the {{ic|password-flags}} and {{ic|secret-flags}} from {{ic|1}} to {{ic|0}}.
  
==== Use /etc/rc.conf to control services started by networkmanager ====
+
Alternatively put the password directly in the configuration file adding the section {{ic|vpn-secrets}}:
  
Some Arch users may dislike having two places where the launching of daemons is configured. Using this method, network services started by NetworkManager are controlled from {{ic|rc.conf}} by the use of a {{ic|NET_DAEMONS}} array in the same fashion as the typical {{ic|DAEMONS}} array
+
  [vpn]
 +
  ....
 +
  password-flags=0
 +
 
 +
  [vpn-secrets]
 +
  password=''your_password''
  
# Install {{AUR|networkmanager-dispatcher-net_daemons}} from the [[AUR]].
+
{{Note|It may now be necessary to re-open the NetworkManager connection editor and save the VPN passwords/secrets again.}}
# Ensure ''dbus'' and ''networkmanager'' are both in the {{ic|DAEMONS}} line in {{ic|rc.conf}}.
+
# Add a {{ic|NET_DAEMONS}} line to rc.conf which includes all services you do not want started until after the network connection is established.
+
  
Example {{ic|DAEMONS}} and {{ic|NET_DAEMONS}} in {{ic|rc.conf}} are shown below:
+
==== Use dispatcher to handle mounting of CIFS shares ====
  
{{bc|<nowiki>
+
Some CIFS shares are only available on certain networks or locations (e.g. at home). You can use the dispatcher to only mount CIFS shares that are present at your current location.
# DAEMONS
+
 
# -------
+
The following script will check if we connected to a specific network and mount shares accordingly:
#
+
{{hc|/etc/NetworkManager/dispatcher.d/mount_cifs|<nowiki>
DAEMONS=(syslog-ng crond dbus networkmanager)
+
#!/bin/bash
NET_DAEMONS=(iptables nscd sshd samba avahi-daemon avahi-dnsconfd openntpd)
+
if [ "$2" = "up" ]
 +
  if [ "$CONNECTION_UUID" = "uuid" ]
 +
    mount /your/mount/point &
 +
    # add more shares as needed
 +
  fi
 +
fi
 
</nowiki>}}
 
</nowiki>}}
 +
{{Note|You can get a list of uuids using [[#nmcli|nmcli]].}}
 +
 +
The following script will unmount all CIFS before a disconnect from a specific network:
 +
{{hc|/etc/NetworkManager/dispatcher.d/pre-down.d/mount_cifs|<nowiki>
 +
#!/bin/bash
 +
umount -a -l -t cifs
 +
</nowiki>}}
 +
{{Note|Make sure this script is located in the pre-down.d subdirectory as shown above, otherwise it will unmount all shares on any connection state change.}}
 +
{{Note|Ever since NetworkManager 0.9.8, the 'pre-down' and 'down' actions are not executed on shutdown or restart, so the above script will only work if you manually disconnect from the network. See [https://bugzilla.gnome.org/show_bug.cgi?id&#61;701242 this bug report] for more info.}}
 +
 +
As before, do not forget to set the script permissions [[#Network services with NetworkManager dispatcher|accordingly]].
 +
 +
See also [[NFS#NetworkManager dispatcher]] for another example script that parses {{ic|/etc/fstab}} mounts during dispatcher actions.
  
 
=== Proxy settings ===
 
=== Proxy settings ===
  
NetworkManager does not directly handle proxy settings, but if you are using GNOME, you could use [http://marin.jb.free.fr/proxydriver/ proxydriver] wich handles proxy settings using NetworkManager's informations. You can find the package for {{AUR|proxydriver}} in the [[AUR]].
+
NetworkManager does not directly handle proxy settings, but if you are using GNOME or KDE, you could use [http://marin.jb.free.fr/proxydriver/ proxydriver] wich handles proxy settings using NetworkManager's informations. proxydriver is found in the package {{AUR|proxydriver}}.
  
In order for proxydriver to be able to change the proxy settings, you would need to execute this command, as part of the GNOME startup process (System -> Preferences -> Startup Applications):
+
In order for ''proxydriver'' to be able to change the proxy settings, you would need to execute this command, as part of the GNOME startup process (System -> Preferences -> Startup Applications):
  
  xhost +si:localuser:your_username
+
  xhost +si:localuser:''your_username''
  
See: [[Proxy settings]]
+
See: [[Proxy settings]].
 +
 
 +
=== Disable NetworkManager ===
 +
 
 +
It might not be obvious, but the service automatically starts through ''dbus''. To completely disable it you can [[mask]] the services {{ic|NetworkManager}} and {{ic|NetworkManager-dispatcher}}.
  
 
== Testing ==
 
== Testing ==
  
NetworkManager applets are designed to load upon login so no further configuration should be necessary for most users.  If you have already disabled your previous network settings and disconnected from your network, you can now test if NetworkManager will work. The first step is to [[Daemon|start]] the ''networkmanager'' daemon.
+
NetworkManager applets are designed to load upon login so no further configuration should be necessary for most users.  If you have already disabled your previous network settings and disconnected from your network, you can now test if NetworkManager will work. The first step is to [[start]] {{ic|NetworkManager.service}}.
  
 
Some applets will provide you with a {{ic|.desktop}} file so that the NetworkManager applet can be loaded through the application menu.  If it does not, you are going to either have to discover the command to use or logout and login again to start the applet.  Once the applet is started, it will likely begin polling network connections with for auto-configuration with a DHCP server.
 
Some applets will provide you with a {{ic|.desktop}} file so that the NetworkManager applet can be loaded through the application menu.  If it does not, you are going to either have to discover the command to use or logout and login again to start the applet.  Once the applet is started, it will likely begin polling network connections with for auto-configuration with a DHCP server.
  
To start the GNOME applet in non-xdg-compliant window managers like [[Awesome]]:
+
To start the GNOME applet in non-xdg-compliant window managers like [[awesome]]:
  
 
  nm-applet --sm-disable &
 
  nm-applet --sm-disable &
  
For static IPs you will have to configure NetworkManager to understand them.  The process usually involves right-clicking the applet and selecting something like 'Edit Connections'.
+
For static IP addresses, you will have to configure NetworkManager to understand them.  The process usually involves right-clicking the applet and selecting something like 'Edit Connections'.
  
 
== Troubleshooting ==
 
== Troubleshooting ==
  
Some fixes to common problems.
+
=== No prompt for password of secured Wi-Fi networks ===
 +
 
 +
When trying to connect to a secured Wi-Fi network, no prompt for a password is shown and no connection is established. This happens when no keyring package is installed. An easy solution is to install {{Pkg|gnome-keyring}}. If you want the passwords to be stored in encrypted form, follow [[GNOME Keyring]] to set up the ''gnome-keyring-daemon''.
  
 
=== No traffic via PPTP tunnel ===
 
=== No traffic via PPTP tunnel ===
  
PPTP connection logins successfully, you see ppp0 interface with correct VPN IP, but you cannot even ping remote IP. It is due to lack of MPPE (Microsoft Point-to-Point Encryption) support in stock Arch pppd. It is recommended to first try with the stock Arch {{Pkg|ppp}} as it may work as intended.
+
PPTP connection logins successfully; you see a ppp0 interface with the correct VPN IP address, but you cannot even ping the remote IP address. It is due to lack of MPPE (Microsoft Point-to-Point Encryption) support in stock Arch pppd. It is recommended to first try with the stock Arch {{Pkg|ppp}} as it may work as intended.
  
To solve the problem it should be sufficient to install {{AUR|ppp-mppe}} from the [[AUR]].
+
To solve the problem it should be sufficient to install the {{AUR|ppp-mppe}}{{Broken package link|{{aur-mirror|ppp-mppe}}}} package.
 +
 
 +
See also [[WPA2 Enterprise#MS-CHAPv2]].
  
 
=== Network management disabled ===
 
=== Network management disabled ===
  
Sometimes when NetworkManager shuts down but the pid (state) file does not get removed and you will get a 'Network management disabled' message. If this happens, you'll have to remove it manually:
+
When NetworkManager shuts down but the pid (state) file is not removed, you will see a {{ic|Network management disabled}} message. If this happens, remove the file manually:
  
 
  # rm /var/lib/NetworkManager/NetworkManager.state
 
  # rm /var/lib/NetworkManager/NetworkManager.state
  
If this happens upon reboot, you can add an action to your {{ic|/etc/rc.local}} to have it removed upon bootup:
+
=== Problems with internal DHCP client ===
  
{{bc|<nowiki>nmpid=/var/lib/NetworkManager/NetworkManager.state
+
If you have problems with getting an IP address using the internal DHCP client, consider {{Pkg|dhclient}} as DHCP client.
[ -f $nmpid ] && rm $nmpid</nowiki>}}
+
  
=== NetworkManager prevents DHCPCD from using resolv.conf.head and resolv.conf.tail ===
+
After installation, update the NetworkManager config file:
  
Sometimes it is problematic to add static items to {{ic|resolv.conf}} when it is constantly rewritten by NetworkManager and {{ic|dhcpcd}}. A simple solution is using the following script:
+
{{hc|1=/etc/NetworkManager/NetworkManager.conf|2=
{{bc|<nowiki>
+
dhcp=dhclient
#!/bin/bash
+
}}
#
+
# /etc/NetworkManager/dispatcher.d/99-resolv.conf-head_and_tail
+
# Include /etc/resolv.conf.head and /etc/resolv.conf.tail to /etc/resolv.conf
+
#
+
# scripts in the /etc/NetworkManager/dispatcher.d/ directory
+
# are called alphabetically and are passed two parameters:
+
# $1 is the interface name, and $2 is “up” or “down” as the
+
# case may be.
+
  
resolvconf='/etc/resolv.conf';
+
This workaround might solve problems in big wireless networks like eduroam.
cat "$resolvconf"{.head,,.tail} 2>/dev/null > "$resolvconf".tmp
+
mv -f "$resolvconf".tmp "$resolvconf"
+
</nowiki>}}
+
  
This script is also available in the [https://aur.archlinux.org/packages/networkmanager-dispatch-resolv AUR] for convenience
+
=== Customizing resolv.conf ===
  
=== Preserving changes to resolv.conf ===
+
See the main page: [[resolv.conf]]. If you use {{Pkg|dhclient}}, you may try the {{AUR|networkmanager-dispatch-resolv}}{{Broken package link|{{aur-mirror|networkmanager-dispatch-resolv}}}} package.
  
NetworkManager will attempt to write DNS information from DHCP into {{ic|/etc/resolv.conf}}, overwriting the existing contents.  To prevent this, you can set the immutable bit on the file:
+
=== DHCP problems with dhclient ===
# chattr +i /etc/resolv.conf
+
  
To modify the file in the future, first remove the immutable bit:
+
If you have problems with getting an IP address via DHCP, try to add the following to your {{ic|/etc/dhclient.conf}}:
# chattr -i /etc/resolv.conf
+
  
=== DHCP problems ===
 
 
If you have problems with getting an IP via DHCP, try to add the following to your {{ic|/etc/dhclient.conf}}:
 
 
   interface "eth0" {
 
   interface "eth0" {
 
     send dhcp-client-identifier 01:aa:bb:cc:dd:ee:ff;
 
     send dhcp-client-identifier 01:aa:bb:cc:dd:ee:ff;
 
   }
 
   }
Where {{ic|aa:bb:cc:dd:ee:ff}} is the MAC address of this NIC. The MAC address can be found using the {{ic|ip link show eth0}} command from the {{Pkg|iproute2}} package.
 
  
For some (incompliant) routers, you will not be able to connect properly unless you comment the line
+
Where {{ic|aa:bb:cc:dd:ee:ff}} is the MAC address of this NIC. The MAC address can be found using the {{ic|ip link show ''interface''}} command from the {{Pkg|iproute2}} package.
  require dhcp_server_identifier
+
 
in {{ic|/etc/dhcpcd.conf}} (note that this file is distinct from {{ic|dhcpd.conf}}). This should not cause issues unless you have multiple DHCP servers on your network (not typical); see [http://technet.microsoft.com/en-us/library/cc977442.aspx this page] for more information.
+
=== Hostname problems ===
 +
 
 +
It depends on the NetworkManager plugins used, whether the hostname is forwarded to a router on connect. The generic "keyfile" plugin does not forward the hostname in default configuration. To make it forward the hostname, add the following to {{ic|/etc/NetworkManager/NetworkManager.conf}}:
 +
 
 +
  [keyfile]
 +
hostname=''your_hostname''
 +
 
 +
The options under {{ic|[keyfile]}} will be applied to network connections in the default {{ic|/etc/NetworkManager/system-connections}} path.  
 +
 
 +
Another option is to configure the DHCP client, which NetworkManager starts automatically, to forward it. NetworkManager utilizes {{Pkg|dhclient}} in default and falls back to its internal DHCP funtionality, if the former is not installed. To make ''dhclient'' forward the hostname requires to set a non-default option, ''dhcpcd'' forwards the hostname by default.
 +
 
 +
First, check which DHCP client is used (''dhclient'' in this example):
 +
 
 +
{{hc|<nowiki># journalctl -b | egrep "dhc"</nowiki>|
 +
...
 +
Nov 17 21:03:20 zenbook dhclient[2949]: Nov 17 21:03:20 zenbook dhclient[2949]: Bound to *:546
 +
Nov 17 21:03:20 zenbook dhclient[2949]: Listening on Socket/wlan0
 +
Nov 17 21:03:20 zenbook dhclient[2949]: Sending on  Socket/wlan0
 +
Nov 17 21:03:20 zenbook dhclient[2949]: XMT: Info-Request on wlan0, interval 1020ms.
 +
Nov 17 21:03:20 zenbook dhclient[2949]: RCV: Reply message on wlan0 from fe80::126f:3fff:fe0c:2dc.
 +
}}
 +
 
 +
==== Configure dhclient to push the hostname to the DHCP server ====
 +
 
 +
Copy the example configuration file:
 +
 
 +
# cp /usr/share/dhclient/dhclient.conf.example /etc/dhclient.conf
 +
 
 +
Take a look at the file - there will only really be one line we want to keep and ''dhclient'' will use it's defaults (as it has been using if you did not have this file) for the other options. This is the important line:
 +
 
 +
{{hc|/etc/dhclient.conf|2=send host-name = pick-first-value(gethostname(), "ISC-dhclient");}}
 +
 
 +
Force an IP address renewal by your favorite means, and you should now see your hostname on your DHCP server.
 +
 
 +
IPv6 push host name:
 +
 
 +
# cp /usr/share/dhclient/dhclient.conf.example /etc/dhclient6.conf
 +
 
 +
{{hc|/etc/dhclient6.conf|2=send fqdn.fqdn = pick-first-value(gethostname(), "ISC-dhclient");}}
 +
 
 +
==== Configure NetworkManager to use a specific DHCP client ====
 +
 
 +
If you want to explicitly set the DHCP client used by NetworkManager, it can be set in the global configuration:
 +
 
 +
{{hc|1=/etc/NetworkManager/NetworkManager.conf|2=dhcp=internal}}
 +
 
 +
The alternative {{ic|1=dhcp=dhclient}} is used per default, if this option is not set.
 +
 
 +
Then [[restart]] {{ic|NetworkManager.service}}.
 +
 
 +
{{Note|1=Support for {{Pkg|dhcpcd}} has been [https://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/networkmanager&id=a1df79cbcebaec0c043789eb31965e57d17b6cdb disabled] in {{Pkg|networkmanager}}-1.0.0-2 (2015-02-14).}}
  
 
=== Missing default route ===
 
=== Missing default route ===
Line 383: Line 428:
 
=== 3G modem not detected ===
 
=== 3G modem not detected ===
  
If NetworkManager (from v0.7.999) does not detect your 3G modem, but you still can connect using [[wvdial]], try installing
+
See [[USB 3G Modem#Network Manager]].
{{Pkg|modemmanager}} and restart NetworkManager daemon with {{ic|rc.d restart networkmanager}}. It may also be necessary to replug or restart your modem. This utility provides support for hardware not in NetworkManager's default database.
+
  
 
=== Switching off WLAN on laptops ===
 
=== Switching off WLAN on laptops ===
  
Sometimes NetworkManager will not work when you disable your WiFi adapter with a switch on your laptop and try to enable it again afterwards. This is often a problem with {{ic|rfkill}}. Install {{Pkg|rfkill}} from the [[official repositories]] and use  
+
Sometimes NetworkManager will not work when you disable your Wi-Fi adapter with a switch on your laptop and try to enable it again afterwards. This is often a problem with ''rfkill''. [[Install]] the {{Pkg|rfkill}} package and use:
  
 
  $ watch -n1 rfkill list all
 
  $ watch -n1 rfkill list all
  
to check if the driver notifies {{ic|rfkill}} about the wireless adapter's status.
+
to check if the driver notifies ''rfkill'' about the wireless adapter's status. If one identifier stays blocked after you switch on the adapter you could try to manually unblock it with (where X is the number of the identifier provided by the above output):
If one identifier stays blocked after you switch on the adapter you could try to manually unblock it with (where X is the number of the identifier provided by the above output):
+
  
 
  # rfkill event unblock X
 
  # rfkill event unblock X
  
=== Static IP settings revert to DHCP ===
+
=== Static IP address settings revert to DHCP ===
 
+
Due to an unresolved bug, when changing default connections to static IP, {{ic|nm-applet}} may not properly store the configuration change, and will revert to automatic DHCP.
+
 
+
To work around this issue you have to edit the default connection (e.g. "Auto eth0") in {{ic|nm-applet}}, change the connection name (e.g. "my eth0"), uncheck the "Available to all users" checkbox, change your static IP settings as desired, and click '''Apply'''.  This will save a new connection with the given name.
+
  
Next, you will want to make the default connection not connect automatically.  To do so, run
+
Due to an unresolved bug, when changing default connections to a static IP address, {{ic|nm-applet}} may not properly store the configuration change, and will revert to automatic DHCP.
  
$ sudo nm-connection-editor  # you must use sudo, not su
+
To work around this issue you have to edit the default connection (e.g. "Auto eth0") in {{ic|nm-applet}}, change the connection name (e.g. "my eth0"), uncheck the "Available to all users" checkbox, change your static IP address settings as desired, and click '''Apply'''.  This will save a new connection with the given name.
  
In the connection editor, edit the default connection (eg "Auto eth0") and uncheck "Connect automatically".  Click '''Apply''' and close the connection editor.
+
Next, you will want to make the default connection not connect automatically.  To do so, run {{ic|nm-connection-editor}} ('''not''' as root). In the connection editor, edit the default connection (e.g. "Auto eth0") and uncheck "Connect automatically".  Click '''Apply''' and close the connection editor.
  
 
=== Cannot edit connections as normal user ===
 
=== Cannot edit connections as normal user ===
  
See [[#Set_up_PolicyKit_permissions]].
+
See [[#Set up PolicyKit permissions]].
  
 
=== Forget hidden wireless network ===
 
=== Forget hidden wireless network ===
  
Since hidden network are not displayed in the selection list of the Wireless view, they cannot be forgotten (removed) with the GUI. You can delete one with the following command:
+
Since hidden networks are not displayed in the selection list of the Wireless view, they cannot be forgotten (removed) with the GUI. You can delete one with the following command:
  
  # rm /etc/NetworkManager/system-connections/[SSID]
+
  # rm /etc/NetworkManager/system-connections/''SSID''
$ sudo rm /etc/NetworkManager/system-connections/[SSID] # sudo equivalent
+
  
 
This works for any other connection.
 
This works for any other connection.
 +
 +
=== VPN not working in GNOME ===
 +
 +
When setting up OpenConnect or vpnc connections in NetworkManager while using GNOME, you will sometimes never see the dialog box pop up and the following error appears in {{ic|/var/log/errors.log}}:
 +
 +
localhost NetworkManager[399]: <error> [1361719690.10506] [nm-vpn-connection.c:1405] get_secrets_cb(): Failed to request VPN secrets #3: (6) No agents were available for this request.
 +
 +
This is caused by the GNOME NM Applet expecting dialog scripts to be at {{ic|/usr/lib/gnome-shell}}, when NetworkManager's packages put them in {{ic|/usr/lib/networkmanager}}.
 +
As a "temporary" fix (this bug has been around for a while now), make the following symlink(s):
 +
 +
* For OpenConnect: {{ic|ln -s /usr/lib/networkmanager/nm-openconnect-auth-dialog /usr/lib/gnome-shell/}}
 +
* For VPNC (i.e. Cisco VPN): {{ic|ln -s /usr/lib/networkmanager/nm-vpnc-auth-dialog /usr/lib/gnome-shell/}}
 +
 +
This may need to be done for any other NM VPN plugins as well, but these are the two most common.
 +
 +
=== Unable to connect to visible European wireless networks ===
 +
 +
WLAN chips are shipped with a default [[Wireless network configuration#Respecting the regulatory domain|regulatory domain]]. If your access point does not operate within these limitations, you will not be able to connect to the network. Fixing this is easy:
 +
 +
# [[Install]] {{Pkg|crda}}
 +
# Uncomment the correct Country Code in {{ic|/etc/conf.d/wireless-regdom}}
 +
# Reboot the system, because the setting is only read on boot
 +
 +
=== Automatic connect to VPN on boot is not working  ===
 +
 +
The problem occurs when the system (i.e. NetworkManager running as the root user) tries to establish a VPN connection, but the password is not accessible because it is stored in the Gnome keyring of a particular user.
 +
 +
A solution is to keep the password to your VPN in plaintext, as described in step (2.) of [[#Use dispatcher to connect to a VPN after a network connection is established]].
 +
 +
You do not need to use the dispatcher described in step (1.) to auto-connect anymore, if you use the new "auto-connect VPN" option from the {{ic|nm-applet}} GUI.
 +
 +
=== Systemd Bottleneck ===
 +
 +
Over time the log files ({{ic|/var/log/journal}}) can become very large. This can have a big impact on boot performance when using NetworkManager, see: [[Systemd#Boot time increasing over time]].
 +
 +
=== Regular network disconnects, latency and lost packets (WiFi) ===
 +
 +
NetworkManager does a scan every 2 minutes.
 +
 +
Some WiFi drivers have issues when scanning for base stations whilst connected/associated. Symptoms include VPN disconnects/reconnects and lost packets, web pages failing to load and then refresh fine.
 +
 +
Running {{ic|journalctl -f}} will indicate that this is taking place, messages like the following will be contained in the logs at regular intervals.
 +
 +
NetworkManager[410]: <info>  (wlp3s0): roamed from BSSID 00:14:48:11:20:CF (my-wifi-name) to (none) ((none))
 +
 +
There is a patched version of NetworkManager which should prevent this type of scanning: {{AUR|networkmanager-noscan}}.
 +
 +
Alternatively, if roaming is not important, the periodic scanning behavior can be disabled by locking the BSSID of the access point in the WiFi connection profile.
  
 
== Tips and tricks ==
 
== Tips and tricks ==
 +
 +
=== Encrypted Wi-Fi passwords ===
 +
 +
By default, NetworkManager stores passwords in clear text in the connection files at {{ic|/etc/NetworkManager/system-connections/}}. To print the stored passwords, use the following command:
 +
 +
# grep -H '^psk=' /etc/NetworkManager/system-connections/*
 +
 +
The passwords are accessible to the root user in the filesystem and to users with access to settings via the GUI (e.g. {{ic|nm-applet}}).
 +
 +
If it is preferable to save the passwords in encrypted form in a keyring instead of clear text. The downside of using a keyring is that the connections have to be set up for each user.
 +
 +
====Using Gnome-Keyring====
 +
 +
The keyring daemon has to be started and the keyring needs to be unlocked for the following to work.
 +
 +
Furthermore, NetworkManager needs to be configured not to store the password for all users. Using GNOME {{ic|nm-applet}}, run {{ic|nm-connection-editor}} from a terminal, select a network connection,  click {{ic|Edit}}, select the {{ic|Wifi-Security}} tab and click on the right icon of password and check {{ic|Store the password for this user}}.
 +
 +
====Using KDE Wallet====
 +
 +
{{Out of date|{{Pkg|plasma-nm}} has a different interface.}}
 +
 +
Using KDE's {{Pkg|kdeplasma-applets-plasma-nm}}{{Broken package link|{{aur-mirror|kdeplasma-applets-plasma-nm}}}}, click the applet, click on the top right {{ic|Settings}} icon, double click on a network connection, in the {{ic|General settings}} tab, untick {{ic|all users may connect to this network}}. If the option is ticked, the passwords will still be stored in clear text, even if a keyring daemon is running.
 +
 +
If the option was selected previously and you un-tick it, you may have to use the {{ic|reset}} option first to make the password disappear from the file. Alternatively, delete the connection first and set it up again.
 +
 +
=== Sharing internet connection over Wi-Fi ===
 +
 +
You can share your internet connection (e.g. 3G or wired) with a few clicks using nm. You will need a supported Wi-Fi card (Cards based on Atheros AR9xx or at least AR5xx are probably best choice). Please note that a [[firewall]] may interfere with internet sharing.
 +
 +
==== Ad-hoc ====
 +
 +
{{Style|"I think so"...}}
 +
 +
* [[Install]] the {{Pkg|dnsmasq}} package to be able to actually share the connection.
 +
* Custom {{ic|dnsmasq.conf}} may interfere with NetworkManager (not sure about this, but I think so).
 +
* Click on applet and choose "Create new wireless network".
 +
* Follow wizard (if using WEP, be sure to use 5 or 13 character long password, different lengths will fail).
 +
* Settings will remain stored for the next time you need it.
 +
 +
==== Real AP ====
 +
 +
Support of infrastructure mode (which is needed by Android phones as they intentionally do not support ad-hoc) is added by NetworkManager as of late 2012.
 +
 +
See [https://fedoraproject.org/wiki/Features/RealHotspot Fedora's wiki].
 +
 +
=== Sharing internet connection over Ethernet ===
 +
 +
Scenario: your device has internet connection over wi-fi and you want to share the internet connection to other devices over ethernet.
 +
 +
Requirements:
 +
* [[Install]] the {{Pkg|dnsmasq}} package to be able to actually share the connection.
 +
* Your internet connected device and the other devices are connected over a suitable ethernet cable (this usually means a cross over cable or a switch in between).
 +
* Internet sharing is not blocked by a [[firewall]].
 +
 +
Steps:
 +
* Run {{ic|nm-connection-editor}} from terminal.
 +
* Add a new ethernet connection.
 +
* Give it some sensible name. For example "Shared Internet"
 +
* Go to "IPv4 Settings".
 +
* For "Method:" select "Shared to other computers".
 +
* Save
 +
 +
Now you should have a new option "Shared Internet" under the Wired connections in NetworkManager.
  
 
=== Checking if networking is up inside a cron job or script ===
 
=== Checking if networking is up inside a cron job or script ===
  
Some cron jobs require networking to be up to succeed. You may wish to avoid running these jobs when the network is down. To accomplish this, add an '''if''' test for networking that queries NetworkManager's {{ic|nm-tool}} and checks the state of networking. The test shown here succeeds if any interface is up, and fails if they are all down. This is convenient for laptops that might be hardwired, might be on wireless, or might be off the network.  
+
Some ''cron'' jobs require networking to be up to succeed. You may wish to avoid running these jobs when the network is down. To accomplish this, add an '''if''' test for networking that queries NetworkManager's ''nm-tool'' and checks the state of networking. The test shown here succeeds if any interface is up, and fails if they are all down. This is convenient for laptops that might be hardwired, might be on wireless, or might be off the network.
if [ `nm-tool|grep State|cut -f2 -d' '` == "connected" ]; then
+
        #Whatever you want to do if the network is online
+
else
+
        #Whatever you want to do if the network is offline - note, this and the else above are optional
+
fi
+
  
This useful for a {{ic|cron.hourly}} script that runs {{ic|fpupdate}} for the F-Prot virus scanner signature update, as an example. Another way it might be useful, with a little modification, is to differentiate between networks using various parts of the output from {{ic|nm-tool}}; for example, since the active wireless network is denoted with an asterisk, you could grep for the network name and then grep for a literal asterisk.
+
{{bc|<nowiki>
 +
if [ $(nm-tool|grep State|cut -f2 -d' ') == "connected" ]; then
 +
    #Whatever you want to do if the network is online
 +
else
 +
    #Whatever you want to do if the network is offline - note, this and the else above are optional
 +
fi
 +
</nowiki>}}
  
=== Automatically unlock keyring after login ===
+
This useful for a {{ic|cron.hourly}} script that runs ''fpupdate'' for the F-Prot virus scanner signature update, as an example. Another way it might be useful, with a little modification, is to differentiate between networks using various parts of the output from ''nm-tool''; for example, since the active wireless network is denoted with an asterisk, you could grep for the network name and then grep for a literal asterisk.
  
==== GNOME ====
+
=== Connect to network with secret on boot ===
 +
 
 +
By default, NetworkManager will not connect to networks requiring a secret automatically on boot. This is because it locks such connections to the user who makes it by default, only connecting after they have logged in. To change this, do the following:
  
 
# Right click on the {{ic|nm-applet}} icon in your panel and select Edit Connections and open the Wireless tab
 
# Right click on the {{ic|nm-applet}} icon in your panel and select Edit Connections and open the Wireless tab
Line 443: Line 595:
 
# Check the boxes “Connect Automatically” and “Available to all users”
 
# Check the boxes “Connect Automatically” and “Available to all users”
 
Log out and log back in to complete.
 
Log out and log back in to complete.
 +
 +
=== Automatically unlock keyring after login ===
 +
 +
NetworkManager requires access to the login keyring to connect to networks requiring a secret. Under most circumstances, this keyring is unlocked automatically at login, but if it isn't, and NetworkManager isn't connecting on login, you can try the following.
 +
 +
==== GNOME ====
  
 
{{Note|The following method is dated and known not to work on at least one machine!}}
 
{{Note|The following method is dated and known not to work on at least one machine!}}
Line 454: Line 612:
 
:Next time you log in, you should be asked if you want the password to be unlocked automatically on login.
 
:Next time you log in, you should be asked if you want the password to be unlocked automatically on login.
  
==== KDE ====
+
==== SLiM login manager ====
{{Note|See http://live.gnome.org/GnomeKeyring/Pam for reference, and if you are using KDE with KDM, you can use {{AUR|pam-keyring-tool}} from the [[AUR]].}}
+
  
Put a script like the following in {{ic|~/.kde4/Autostart}}:
+
See [[SLiM#Gnome Keyring]].
  #!/bin/sh
+
  echo PASSWORD | /usr/bin/pam-keyring-tool --unlock --keyring=default -s
+
Similar should work with Openbox, LXDE, etc.
+
  
==== SLiM login manager ====
+
==== Troubleshooting ====
  
*In {{ic|/etc/pam.d/slim}}, add these lines at the end of the "auth" and "session" blocks if they do not exist already:
+
While you may type both values at connection time, {{Pkg|kdeplasma-applets-plasma-nm}}{{Broken package link|{{aur-mirror|kdeplasma-applets-plasma-nm}}}} 0.9.3.2-1 and above are capable of retrieving OpenConnect username and password directly from KWallet.
  auth            optional        pam_gnome_keyring.so
+
  session        optional        pam_gnome_keyring.so  auto_start
+
  
*In {{ic|/etc/pam.d/passwd}}, use this line for the 'password' block:
+
Open "KDE Wallet Manager" and look up your OpenConnect VPN connection under "Network Management|Maps". Click "Show values" and
  password    optional    pam_gnome_keyring.so
+
enter your credentials in key "VpnSecrets" in this form (replace ''username'' and ''password'' accordingly):
  
*In {{ic|~/.xinitrc}}, add this at the very top, before launching your window manager and other applications:
+
form:main:username%SEP%''username''%SEP%form:main:password%SEP%''password''
  # test for an existing bus daemon, just to be safe
+
  if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
+
    # if not found, launch a new one
+
    eval `dbus-launch --sh-syntax --exit-with-session`
+
    echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
+
  fi
+
  
:Next time you log in, you should be asked if you want the password to be unlocked automatically on login.
+
Next time you connect, username and password should appear in the "VPN secrets" dialog box.
  
 
=== Ignore specific devices ===
 
=== Ignore specific devices ===
  
Sometimes it may be desired that NetworkManager ignores specific devices and does not try to configure addresses and routes for them.
+
Sometimes it may be desired that NetworkManager ignores specific devices and does not try to configure addresses and routes for them.You can quickly and easily ignore devices by MAC or interface-name by using the following in {{ic|/etc/NetworkManager/NetworkManager.conf}}:
 
+
:1. You can quickly and easily ignore devices by MAC by using the following in {{ic|/etc/NetworkManager/NetworkManager.conf}} :
+
 
  [keyfile]
 
  [keyfile]
  unmanaged-devices=mac:00:22:68:1c:59:b1;mac:00:1E:65:30:D1:C4
+
  unmanaged-devices=mac:00:22:68:1c:59:b1;mac:00:1E:65:30:D1:C4;interface-name:eth0
:After you have put this in, [[Daemon|restart]] NetworkManager, and you should be able to configure interfaces without NetworkManager altering what you have set.
+
After you have put this in, [[Daemon|restart]] NetworkManager, and you should be able to configure interfaces without NetworkManager altering what you have set.
  
:2. If that is not appropriate, you could ignore by HAL.
+
=== Enable DNS Caching ===
::* First you have to find out the Hal UDI (e.g. with {{ic|lshal}}):
+
  ...
+
  info.product = 'Networking Interface'  (string)
+
  info.subsystem = 'net'  (string)
+
  info.udi = '/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55'  (string)
+
  linux.hotplug_type = 2  (0x2)  (int)
+
  linux.subsystem = 'net'  (string)
+
  ...
+
  
::* Add the udi to {{ic|/etc/NetworkManager/nm-system-settings.conf}}:
+
See [[dnsmasq#NetworkManager]] to enable the plugin that allows DNS caching using [[dnsmasq]].
  [keyfile]
+
    unmanaged-devices=/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55
+
  
:Multiple devices can be specified, delimited by semicolons:
+
=== Configuring MAC Address Randomization ===
  
  [keyfile]
+
As of version 1.4.0, NetworkManager supports two types MAC Address Randomization: randomization during scanning, and stable randomization. Both modes can be configured by modifying {{ic|/etc/networkManager/NetworkManager.conf}}.
    unmanaged-devices=/org/freedesktop/Hal/devices/net_00_1f_11_01_06_55;/org/freedesktop/Hal/devices/net_00_2c_6d_e2_08_af
+
  
:You do not need to restart NetworkManager for the changes to take effect.
+
Randomization during Wi-Fi scanning is enabled by default starting on version 1.2.0, and it can be disabled by adding the following lines to {{ic|/etc/NetworkManager/NetworkManager.conf}}:
  
:3. Devices could also be ignored at boot time by using following script (change {{ic|NetworkManager.conf}} with {{ic|nm-system-settings.conf}} if using a version of NetworkManager smaller than 0.8.1):
+
[device]
  #!/bin/sh
+
wifi.scan-rand-mac-address=no
  # author: tim noise <darknoise@drkns.net>
+
  COUNT=0
+
  TARGET_FILE="/etc/NetworkManager/NetworkManager.conf"
+
  for i in `lshal | grep -A6 'Networking Interface' | awk -F "'" '/info.udi = / {print $2}'`; do
+
      if [ $COUNT = 0 ]; then
+
          COUNT=$COUNT+1;
+
          echo "unmanaged-devices=$i" >> $TARGET_FILE
+
      else
+
          echo -n ";$i" >> $TARGET_FILE
+
      fi
+
  done
+
  printf "\n" >> $TARGET_FILE
+
  
:It can be changed to ignore WiFi devices, etc. being used on a non-persistant filesystem.
+
In contrast, stable randomization generates a different MAC address for each different connection. This is specially useful when, for example, a portal remembers your login status based on your MAC address. To enable this mode, you can use the option
  
=== Connect faster ===
+
[connection]
 +
wifi.cloned-mac-address=random
  
==== Disabling IPv6 ====
+
or
 +
 
 +
[connection]
 +
ethernet.cloned-mac-address=random
  
Slow connection or reconnection to the network may be due to superfluous IPv6 queries in NetworkManager. If there is no IPv6 support on the local network, connecting to a network may take longer than normal while NetworkManager tries to establish an IPv6 connection that eventually times out. The solution is to disable IPv6 within NetworkManager which will make network connection faster. This has to be done once for every network you connect to.
+
You can read more about it [https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/ here]
  
* Right-click on the network status icon.
+
=== Enable IPv6 Privacy Extensions ===
* Click on "Edit Connections".
+
* Go to the "Wired" or "Wireless" tab, as appropriate.
+
* Select the name of the network.
+
* Click on "Edit".
+
* Go to the "IPv6 Settings" tab.
+
* In the "Method" dropdown, choose "Ignore/Disabled".
+
* Click on "Save".
+
 
+
==== Speed up DHCP by disabling ARP probing in DHCPCD ====
+
 
+
{{ic|dhcpcd}} contains an implementation of a recommendation of the DHCP standard ([http://www.ietf.org/rfc/rfc2131.txt RFC2131] section 2.2) to check via ARP if the assigned IP address is really not taken. This seems mostly useless in home networks, so you can save about 5 seconds on every connect by adding the following line to {{ic|/etc/dhcpcd.conf}}:
+
 
+
noarp
+
 
+
This is equivalent to passing {{ic|--noarp}} to {{ic|dhcpcd}}, and disables the described ARP probing, speeding up connections to networks with DHCP.
+
 
+
==== Use OpenDNS servers ====
+
 
+
Create {{ic|/etc/resolv.conf.opendns}} with the nameservers:
+
 
+
nameserver 208.67.222.222
+
nameserver 208.67.220.220
+
 
+
And have the dispatcher replace the discovered DHCP servers with the OpenDNS ones:
+
 
+
{{hc|/etc/NetworkManager/dispatcher.d/dns-servers-opendns|<nowiki>
+
#!/bin/bash
+
# Use OpenDNS servers over DHCP discovered servers
+
  
cp -f /etc/resolv.conf.opendns /etc/resolv.conf</nowiki>}}
+
See [[IPv6#NetworkManager]]
  
Make the script executable:
+
== See also ==
  
# chmod +x /etc/NetworkManager/dispatcher.d/dns-servers-opendns
+
* [http://blogs.gnome.org/dcbw/2015/02/16/networkmanager-for-administrators-part-1/ NetworkManager for Administrators Part 1]

Latest revision as of 14:13, 7 September 2016

NetworkManager is a program for providing detection and configuration for systems to automatically connect to network. NetworkManager's functionality can be useful for both wireless and wired networks. For wireless networks, NetworkManager prefers known wireless networks and has the ability to switch to the most reliable network. NetworkManager-aware applications can switch from online and offline mode. NetworkManager also prefers wired connections over wireless ones, has support for modem connections and certain types of VPN. NetworkManager was originally developed by Red Hat and now is hosted by the GNOME project.

Warning: By default, Wi-Fi passwords are stored in clear text. See section #Encrypted Wi-Fi passwords

Contents

Installation

NetworkManager can be installed with the package networkmanager. The package does not include the tray applet nm-applet which is part of the network-manager-applet. It has functionality for basic DHCP support. For full featured DHCP and if you require IPv6 support, dhclient integrates it.

Note: You must ensure that no other service that wants to configure the network is running; in fact, multiple networking services will conflict. You can find a list of the currently running services with systemctl --type=service and then stop them. See #Configuration to enable the NetworkManager service.

VPN support

NetworkManager VPN support is based on a plug-in system. If you need VPN support via NetworkManager, you have to install one of the following packages:

Warning: VPN support is unstable, check the daemon processes options set via the GUI correctly and double-check with each package release.[1] [2] FS#47535

PPPoE / DSL support

Install rp-pppoe for PPPoE / DSL connection support.

Front-ends

To configure and have easy access to NetworkManager, most users will want to install an applet. This GUI front-end usually resides in the system tray (or notification area) and allows network selection and configuration of NetworkManager. Various applets exist for different types of desktops.

GNOME

GNOME's network-manager-applet works in all environments.

To store authentication details for connections (Wireless/DSL) install and configure GNOME Keyring.

Be aware that after enabling the tick-box option Make available to other users for a connection, NetworkManager stores the password in plain-text, though the respective file is accessible only to root (or other users via nm-applet). See #Encrypted Wi-Fi passwords.

KDE Plasma

Install the plasma-nm applet.

Xfce

While network-manager-applet works in Xfce, in order to see notifications, including error messages, nm-applet needs an implementation of the Freedesktop desktop notifications specification (see the Galapago Project) to display them. To enable notifications install xfce4-notifyd, a package that provides an implementation for the specification.

Without such a notification daemon, nm-applet outputs the following errors to stdout/stderr:

(nm-applet:24209): libnotify-WARNING **: Failed to connect to proxy
** (nm-applet:24209): WARNING **: get_all_cb: couldn't retrieve
system settings properties: (25) Launch helper exited with unknown
return code 1.
** (nm-applet:24209): WARNING **: fetch_connections_done: error
fetching connections: (25) Launch helper exited with unknown return
code 1.
** (nm-applet:24209): WARNING **: Failed to register as an agent:
(25) Launch helper exited with unknown return code 1

nm-applet will still work fine, though, but without notifications.

If nm-applet is not prompting for a password when connecting to new wifi networks, and is just disconnecting immediately, you may need to install gnome-keyring.

Should the applet not appear, install the xfce4-indicator-pluginAUR package. [3]

Openbox

To work properly in Openbox, the GNOME applet requires the xfce4-notifyd notification daemon for the same reason as in XFCE and the gnome-icon-theme package to be able to display the applet in the systray.

If you want to store authentication details (Wireless/DSL) install and configure gnome-keyring.

nm-applet installs the autostart file at /etc/xdg/autostart/nm-applet.desktop. If you have issues with it (e.g. nm-applet is started twice or is not started at all), see Openbox#autostart or [4] for solution.

Other desktops and window managers

In all other scenarios it is recommended to use the GNOME applet. You will also need to be sure that the gnome-icon-theme package is installed to be able to display the applet.

To store connection secrets install and configure GNOME Keyring.

In order to run nm-applet without a systray, you can use trayer or stalonetray. For example, you can add a script like this one in your path:

nmgui
#!/bin/sh
nm-applet    2>&1 > /dev/null &
stalonetray  2>&1 > /dev/null
killall nm-applet

When you close the stalonetray window, it closes nm-applet too, so no extra memory is used once you are done with network settings.

Command line

The following applications can be useful for configuring and managing networks without X.

nmcli

A command line frontend, nmcli, is included with networkmanager.

For usage information, see nmcli(1). Examples:

  • To connect to a wifi network:
    nmcli dev wifi connect <name> password <password>
  • To connect to a wifi on the wlan1 wifi interface:
    nmcli dev wifi connect <name> password <password> iface wlan1 [profile name]
  • To disconnect an interface:
    nmcli dev disconnect iface eth0
  • To reconnect an interface marked as disconnected:
    nmcli con up uuid <uuid>
  • To get a list of UUIDs:
    nmcli con show
  • To see a list of network devices and their state:
    nmcli dev
  • To turn off wifi:
    nmcli r wifi off

nmtui

A curses based graphical frontend, nmtui, is included with networkmanager.

For usage information, see nmtui(1).

nmcli-dmenu

Alternatively there is networkmanager-dmenu-gitAUR which is a small script to manage NetworkManager connections with dmenu instead of nm-applet. It provides all essential features such as connect to existing NetworkManager wifi or wired connections, connect to new wifi connections, requests passphrase if required, connect to existing VPN connections, enable/disable networking, launch nm-connection-editor GUI.

Configuration

NetworkManager will require some additional steps to be able run properly. Make sure you have configured /etc/hosts as described in Network configuration#Set the hostname section.

Enable NetworkManager

NetworkManager is controlled via NetworkManager.service. Once the NetworkManager daemon is started, it will automatically connect to any available "system connections" that have already been configured. Any "user connections" or unconfigured connections will need nmcli or an applet to configure and connect.

NetworkManager has a global configuration file at /etc/NetworkManager/NetworkManager.conf. Usually no configuration needs to be done to the global defaults.

Enable NetworkManager Wait Online

If you have services which fail if they are started before the network is up, you may use NetworkManager-wait-online.service in addition to NetworkManager.service. This is, however, rarely necessary because most networked daemons start up okay, even if the network has not been configured yet.

In some cases, the service will still fail to start successfully on boot due to the timeout setting in /usr/lib/systemd/system/NetworkManager-wait-online.service being too short. Change the default timeout from 30 to a higher value.

Set up PolicyKit permissions

See General troubleshooting#Session permissions for setting up a working session.

With a working session, you have several options for granting the necessary privileges to NetworkManager:

  • Option 1. Run a Polkit authentication agent when you log in, such as /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 (part of polkit-gnome). You will be prompted for your password whenever you add or remove a network connection.
  • Option 2. Add yourself to the wheel group. You will not have to enter your password, but your user account may be granted other permissions as well, such as the ability to use sudo without entering the root password.
  • Option 3. Add yourself to the network group and create the following file:
/etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules
polkit.addRule(function(action, subject) {
  if (action.id.indexOf("org.freedesktop.NetworkManager.") == 0 && subject.isInGroup("network")) {
    return polkit.Result.YES;
  }
});
All users in the network group will be able to add and remove networks without a password. This will not work under systemd if you do not have an active session with systemd-logind.

Network services with NetworkManager dispatcher

There are quite a few network services that you will not want running until NetworkManager brings up an interface. Good examples are NTPd and network filesystem mounts of various types (e.g. netfs). NetworkManager has the ability to start these services when you connect to a network and stop them when you disconnect. To activate the feature you need to start the NetworkManager-dispatcher.service.

Once the feature is active, scripts can be added to the /etc/NetworkManager/dispatcher.d directory. These scripts must be owned by root, otherwise the dispatcher will not execute them. For added security, set group ownership to root as well:

# chown root:root scriptname

Also, the script must have write permission for owner only, otherwise the dispatcher will not execute them:

# chmod 755 scriptname

The scripts will be run in alphabetical order at connection time, and in reverse alphabetical order at disconnect time. They receive two arguments: the name of the interface (e.g. eth0) and the status (up or down for interfaces and vpn-up or vpn-down for vpn connections). To ensure what order they come up in, it is common to use numerical characters prior to the name of the script (e.g. 10_portmap or 30_netfs (which ensures that the portmapper is up before NFS mounts are attempted).

Warning: If you connect to foreign or public networks, be aware of what services you are starting and what servers you expect to be available for them to connect to. You could make a security hole by starting the wrong services while connected to a public network

Avoiding the dispatcher timeout

If the above is working, then this section is not relevant. However, there is a general problem related to running dispatcher scripts which take longer to be executed. Initially an internal timeout of three seconds only was used. If the called script did not complete in time, it was killed. Later the timeout was extended to about 20 seconds (see the Bugtracker for more information). If the timeout still creates the problem, a work around may be to modify the dispatcher service file /usr/lib/systemd/system/NetworkManager-dispatcher.service to remain active after exit:

/etc/systemd/system/NetworkManager-dispatcher.service
.include /usr/lib/systemd/system/NetworkManager-dispatcher.service
[Service]
RemainAfterExit=yes

Now start and enable the modified NetworkManager-dispatcher service.

Warning: Adding the RemainAfterExit line to it will prevent the dispatcher from closing. Unfortunately, the dispatcher has to close before it can run your scripts again. With it the dispatcher will not time out but it also will not close, which means that the scripts will only run once per boot. Therefore, do not add the line unless the timeout is definitely causing a problem.

Start OpenNTPD

Install the networkmanager-dispatcher-openntpd package.

Mount remote folder with sshfs

As the script is run in a very restrictive environment, you have to export SSH_AUTH_SOCK in order to connect to your SSH agent. There are different ways to accomplish this, see this message for more information. The example below works with GNOME Keyring, and will ask you for the password if not unlocked already. In case NetworkManager connects automatically on login, it is likely gnome-keyring has not yet started and the export will fail (hence the sleep). The UUID to match can be found with the command nmcli con status or nmcli con list.

#!/bin/sh
USER='username'
REMOTE='user@host:/remote/path'
LOCAL='/local/path'

interface=$1 status=$2
if [ "$CONNECTION_UUID" = "uuid" ]; then
  case $status in
    up)
      export SSH_AUTH_SOCK=$(find /tmp -maxdepth 1 -type s -user "$USER" -name 'ssh')
      su "$USER" -c "sshfs $REMOTE $LOCAL"
      ;;
    down)
      fusermount -u "$LOCAL"
      ;;
  esac
fi

Use dispatcher to connect to a VPN after a network connection is established

In this example we want to connect automatically to a previously defined VPN connection after connecting to a specific Wi-Fi network. First thing to do is to create the dispatcher script that defines what to do after we are connected to the network.

1. Create the dispatcher script:
/etc/NetworkManager/dispatcher.d/vpn-up
#!/bin/sh
VPN_NAME="name of VPN connection defined in NetworkManager"
ESSID="Wi-Fi network ESSID (not connection name)"

interface=$1 status=$2
case $status in
  up|vpn-down)
    if iwgetid | grep -qs ":\"$ESSID\""; then
      nmcli con up id "$VPN_NAME"
    fi
    ;;
  down)
    if iwgetid | grep -qs ":\"$ESSID\""; then
      if nmcli con show --active | grep "$VPN_NAME"; then
        nmcli con down id "$VPN_NAME"
      fi
    fi
    ;;
esac

If you would like to attempt to automatically connect to VPN for all Wi-Fi networks, you can use the following definition of the ESSID: ESSID=$(iwgetid -r). Remember to set the script's permissions accordingly.

If you require and tick the nm-applet option to Make the VPN connection available to all users, trying to connect may still fail and NetworkManager will complain about 'no valid VPN secrets', because of the way VPN secrets are stored, which brings us to step 2:

2. Either edit the VPN connection configuration file to make NetworkManager store the secrets by itself rather than inside a keyring that will be inaccessible for root: open up /etc/NetworkManager/system-connections/name of your VPN connection and change the password-flags and secret-flags from 1 to 0.

Alternatively put the password directly in the configuration file adding the section vpn-secrets:

 [vpn]
 ....
 password-flags=0
 
 [vpn-secrets]
 password=your_password
Note: It may now be necessary to re-open the NetworkManager connection editor and save the VPN passwords/secrets again.

Use dispatcher to handle mounting of CIFS shares

Some CIFS shares are only available on certain networks or locations (e.g. at home). You can use the dispatcher to only mount CIFS shares that are present at your current location.

The following script will check if we connected to a specific network and mount shares accordingly:

/etc/NetworkManager/dispatcher.d/mount_cifs
#!/bin/bash
if [ "$2" = "up" ]
  if [ "$CONNECTION_UUID" = "uuid" ]
    mount /your/mount/point & 
    # add more shares as needed
  fi
fi
Note: You can get a list of uuids using nmcli.

The following script will unmount all CIFS before a disconnect from a specific network:

/etc/NetworkManager/dispatcher.d/pre-down.d/mount_cifs
#!/bin/bash
umount -a -l -t cifs
Note: Make sure this script is located in the pre-down.d subdirectory as shown above, otherwise it will unmount all shares on any connection state change.
Note: Ever since NetworkManager 0.9.8, the 'pre-down' and 'down' actions are not executed on shutdown or restart, so the above script will only work if you manually disconnect from the network. See this bug report for more info.

As before, do not forget to set the script permissions accordingly.

See also NFS#NetworkManager dispatcher for another example script that parses /etc/fstab mounts during dispatcher actions.

Proxy settings

NetworkManager does not directly handle proxy settings, but if you are using GNOME or KDE, you could use proxydriver wich handles proxy settings using NetworkManager's informations. proxydriver is found in the package proxydriverAUR.

In order for proxydriver to be able to change the proxy settings, you would need to execute this command, as part of the GNOME startup process (System -> Preferences -> Startup Applications):

xhost +si:localuser:your_username

See: Proxy settings.

Disable NetworkManager

It might not be obvious, but the service automatically starts through dbus. To completely disable it you can mask the services NetworkManager and NetworkManager-dispatcher.

Testing

NetworkManager applets are designed to load upon login so no further configuration should be necessary for most users. If you have already disabled your previous network settings and disconnected from your network, you can now test if NetworkManager will work. The first step is to start NetworkManager.service.

Some applets will provide you with a .desktop file so that the NetworkManager applet can be loaded through the application menu. If it does not, you are going to either have to discover the command to use or logout and login again to start the applet. Once the applet is started, it will likely begin polling network connections with for auto-configuration with a DHCP server.

To start the GNOME applet in non-xdg-compliant window managers like awesome:

nm-applet --sm-disable &

For static IP addresses, you will have to configure NetworkManager to understand them. The process usually involves right-clicking the applet and selecting something like 'Edit Connections'.

Troubleshooting

No prompt for password of secured Wi-Fi networks

When trying to connect to a secured Wi-Fi network, no prompt for a password is shown and no connection is established. This happens when no keyring package is installed. An easy solution is to install gnome-keyring. If you want the passwords to be stored in encrypted form, follow GNOME Keyring to set up the gnome-keyring-daemon.

No traffic via PPTP tunnel

PPTP connection logins successfully; you see a ppp0 interface with the correct VPN IP address, but you cannot even ping the remote IP address. It is due to lack of MPPE (Microsoft Point-to-Point Encryption) support in stock Arch pppd. It is recommended to first try with the stock Arch ppp as it may work as intended.

To solve the problem it should be sufficient to install the ppp-mppeAUR[broken link: archived in aur-mirror] package.

See also WPA2 Enterprise#MS-CHAPv2.

Network management disabled

When NetworkManager shuts down but the pid (state) file is not removed, you will see a Network management disabled message. If this happens, remove the file manually:

# rm /var/lib/NetworkManager/NetworkManager.state

Problems with internal DHCP client

If you have problems with getting an IP address using the internal DHCP client, consider dhclient as DHCP client.

After installation, update the NetworkManager config file:

/etc/NetworkManager/NetworkManager.conf
dhcp=dhclient

This workaround might solve problems in big wireless networks like eduroam.

Customizing resolv.conf

See the main page: resolv.conf. If you use dhclient, you may try the networkmanager-dispatch-resolvAUR[broken link: archived in aur-mirror] package.

DHCP problems with dhclient

If you have problems with getting an IP address via DHCP, try to add the following to your /etc/dhclient.conf:

 interface "eth0" {
   send dhcp-client-identifier 01:aa:bb:cc:dd:ee:ff;
 }

Where aa:bb:cc:dd:ee:ff is the MAC address of this NIC. The MAC address can be found using the ip link show interface command from the iproute2 package.

Hostname problems

It depends on the NetworkManager plugins used, whether the hostname is forwarded to a router on connect. The generic "keyfile" plugin does not forward the hostname in default configuration. To make it forward the hostname, add the following to /etc/NetworkManager/NetworkManager.conf:

[keyfile]
hostname=your_hostname

The options under [keyfile] will be applied to network connections in the default /etc/NetworkManager/system-connections path.

Another option is to configure the DHCP client, which NetworkManager starts automatically, to forward it. NetworkManager utilizes dhclient in default and falls back to its internal DHCP funtionality, if the former is not installed. To make dhclient forward the hostname requires to set a non-default option, dhcpcd forwards the hostname by default.

First, check which DHCP client is used (dhclient in this example):

# journalctl -b | egrep "dhc"
...
Nov 17 21:03:20 zenbook dhclient[2949]: Nov 17 21:03:20 zenbook dhclient[2949]: Bound to *:546
Nov 17 21:03:20 zenbook dhclient[2949]: Listening on Socket/wlan0
Nov 17 21:03:20 zenbook dhclient[2949]: Sending on   Socket/wlan0
Nov 17 21:03:20 zenbook dhclient[2949]: XMT: Info-Request on wlan0, interval 1020ms.
Nov 17 21:03:20 zenbook dhclient[2949]: RCV: Reply message on wlan0 from fe80::126f:3fff:fe0c:2dc.

Configure dhclient to push the hostname to the DHCP server

Copy the example configuration file:

# cp /usr/share/dhclient/dhclient.conf.example /etc/dhclient.conf

Take a look at the file - there will only really be one line we want to keep and dhclient will use it's defaults (as it has been using if you did not have this file) for the other options. This is the important line:

/etc/dhclient.conf
send host-name = pick-first-value(gethostname(), "ISC-dhclient");

Force an IP address renewal by your favorite means, and you should now see your hostname on your DHCP server.

IPv6 push host name:

# cp /usr/share/dhclient/dhclient.conf.example /etc/dhclient6.conf
/etc/dhclient6.conf
send fqdn.fqdn = pick-first-value(gethostname(), "ISC-dhclient");

Configure NetworkManager to use a specific DHCP client

If you want to explicitly set the DHCP client used by NetworkManager, it can be set in the global configuration:

/etc/NetworkManager/NetworkManager.conf
dhcp=internal

The alternative dhcp=dhclient is used per default, if this option is not set.

Then restart NetworkManager.service.

Note: Support for dhcpcd has been disabled in networkmanager-1.0.0-2 (2015-02-14).

Missing default route

On at least one KDE4 system, no default route was created when establishing wireless connections with NetworkManager. Changing the route settings of the wireless connection to remove the default selection "Use only for resources on this connection" solved the issue.

3G modem not detected

See USB 3G Modem#Network Manager.

Switching off WLAN on laptops

Sometimes NetworkManager will not work when you disable your Wi-Fi adapter with a switch on your laptop and try to enable it again afterwards. This is often a problem with rfkill. Install the rfkill package and use:

$ watch -n1 rfkill list all

to check if the driver notifies rfkill about the wireless adapter's status. If one identifier stays blocked after you switch on the adapter you could try to manually unblock it with (where X is the number of the identifier provided by the above output):

# rfkill event unblock X

Static IP address settings revert to DHCP

Due to an unresolved bug, when changing default connections to a static IP address, nm-applet may not properly store the configuration change, and will revert to automatic DHCP.

To work around this issue you have to edit the default connection (e.g. "Auto eth0") in nm-applet, change the connection name (e.g. "my eth0"), uncheck the "Available to all users" checkbox, change your static IP address settings as desired, and click Apply. This will save a new connection with the given name.

Next, you will want to make the default connection not connect automatically. To do so, run nm-connection-editor (not as root). In the connection editor, edit the default connection (e.g. "Auto eth0") and uncheck "Connect automatically". Click Apply and close the connection editor.

Cannot edit connections as normal user

See #Set up PolicyKit permissions.

Forget hidden wireless network

Since hidden networks are not displayed in the selection list of the Wireless view, they cannot be forgotten (removed) with the GUI. You can delete one with the following command:

# rm /etc/NetworkManager/system-connections/SSID

This works for any other connection.

VPN not working in GNOME

When setting up OpenConnect or vpnc connections in NetworkManager while using GNOME, you will sometimes never see the dialog box pop up and the following error appears in /var/log/errors.log:

localhost NetworkManager[399]: <error> [1361719690.10506] [nm-vpn-connection.c:1405] get_secrets_cb(): Failed to request VPN secrets #3: (6) No agents were available for this request.

This is caused by the GNOME NM Applet expecting dialog scripts to be at /usr/lib/gnome-shell, when NetworkManager's packages put them in /usr/lib/networkmanager. As a "temporary" fix (this bug has been around for a while now), make the following symlink(s):

  • For OpenConnect: ln -s /usr/lib/networkmanager/nm-openconnect-auth-dialog /usr/lib/gnome-shell/
  • For VPNC (i.e. Cisco VPN): ln -s /usr/lib/networkmanager/nm-vpnc-auth-dialog /usr/lib/gnome-shell/

This may need to be done for any other NM VPN plugins as well, but these are the two most common.

Unable to connect to visible European wireless networks

WLAN chips are shipped with a default regulatory domain. If your access point does not operate within these limitations, you will not be able to connect to the network. Fixing this is easy:

  1. Install crda
  2. Uncomment the correct Country Code in /etc/conf.d/wireless-regdom
  3. Reboot the system, because the setting is only read on boot

Automatic connect to VPN on boot is not working

The problem occurs when the system (i.e. NetworkManager running as the root user) tries to establish a VPN connection, but the password is not accessible because it is stored in the Gnome keyring of a particular user.

A solution is to keep the password to your VPN in plaintext, as described in step (2.) of #Use dispatcher to connect to a VPN after a network connection is established.

You do not need to use the dispatcher described in step (1.) to auto-connect anymore, if you use the new "auto-connect VPN" option from the nm-applet GUI.

Systemd Bottleneck

Over time the log files (/var/log/journal) can become very large. This can have a big impact on boot performance when using NetworkManager, see: Systemd#Boot time increasing over time.

Regular network disconnects, latency and lost packets (WiFi)

NetworkManager does a scan every 2 minutes.

Some WiFi drivers have issues when scanning for base stations whilst connected/associated. Symptoms include VPN disconnects/reconnects and lost packets, web pages failing to load and then refresh fine.

Running journalctl -f will indicate that this is taking place, messages like the following will be contained in the logs at regular intervals.

NetworkManager[410]: <info>  (wlp3s0): roamed from BSSID 00:14:48:11:20:CF (my-wifi-name) to (none) ((none))

There is a patched version of NetworkManager which should prevent this type of scanning: networkmanager-noscanAUR.

Alternatively, if roaming is not important, the periodic scanning behavior can be disabled by locking the BSSID of the access point in the WiFi connection profile.

Tips and tricks

Encrypted Wi-Fi passwords

By default, NetworkManager stores passwords in clear text in the connection files at /etc/NetworkManager/system-connections/. To print the stored passwords, use the following command:

# grep -H '^psk=' /etc/NetworkManager/system-connections/*

The passwords are accessible to the root user in the filesystem and to users with access to settings via the GUI (e.g. nm-applet).

If it is preferable to save the passwords in encrypted form in a keyring instead of clear text. The downside of using a keyring is that the connections have to be set up for each user.

Using Gnome-Keyring

The keyring daemon has to be started and the keyring needs to be unlocked for the following to work.

Furthermore, NetworkManager needs to be configured not to store the password for all users. Using GNOME nm-applet, run nm-connection-editor from a terminal, select a network connection, click Edit, select the Wifi-Security tab and click on the right icon of password and check Store the password for this user.

Using KDE Wallet

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: plasma-nm has a different interface. (Discuss in Talk:NetworkManager#)

Using KDE's kdeplasma-applets-plasma-nm[broken link: archived in aur-mirror], click the applet, click on the top right Settings icon, double click on a network connection, in the General settings tab, untick all users may connect to this network. If the option is ticked, the passwords will still be stored in clear text, even if a keyring daemon is running.

If the option was selected previously and you un-tick it, you may have to use the reset option first to make the password disappear from the file. Alternatively, delete the connection first and set it up again.

Sharing internet connection over Wi-Fi

You can share your internet connection (e.g. 3G or wired) with a few clicks using nm. You will need a supported Wi-Fi card (Cards based on Atheros AR9xx or at least AR5xx are probably best choice). Please note that a firewall may interfere with internet sharing.

Ad-hoc

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: "I think so"... (Discuss in Talk:NetworkManager#)
  • Install the dnsmasq package to be able to actually share the connection.
  • Custom dnsmasq.conf may interfere with NetworkManager (not sure about this, but I think so).
  • Click on applet and choose "Create new wireless network".
  • Follow wizard (if using WEP, be sure to use 5 or 13 character long password, different lengths will fail).
  • Settings will remain stored for the next time you need it.

Real AP

Support of infrastructure mode (which is needed by Android phones as they intentionally do not support ad-hoc) is added by NetworkManager as of late 2012.

See Fedora's wiki.

Sharing internet connection over Ethernet

Scenario: your device has internet connection over wi-fi and you want to share the internet connection to other devices over ethernet.

Requirements:

  • Install the dnsmasq package to be able to actually share the connection.
  • Your internet connected device and the other devices are connected over a suitable ethernet cable (this usually means a cross over cable or a switch in between).
  • Internet sharing is not blocked by a firewall.

Steps:

  • Run nm-connection-editor from terminal.
  • Add a new ethernet connection.
  • Give it some sensible name. For example "Shared Internet"
  • Go to "IPv4 Settings".
  • For "Method:" select "Shared to other computers".
  • Save

Now you should have a new option "Shared Internet" under the Wired connections in NetworkManager.

Checking if networking is up inside a cron job or script

Some cron jobs require networking to be up to succeed. You may wish to avoid running these jobs when the network is down. To accomplish this, add an if test for networking that queries NetworkManager's nm-tool and checks the state of networking. The test shown here succeeds if any interface is up, and fails if they are all down. This is convenient for laptops that might be hardwired, might be on wireless, or might be off the network.

if [ $(nm-tool|grep State|cut -f2 -d' ') == "connected" ]; then
    #Whatever you want to do if the network is online
else
    #Whatever you want to do if the network is offline - note, this and the else above are optional
fi

This useful for a cron.hourly script that runs fpupdate for the F-Prot virus scanner signature update, as an example. Another way it might be useful, with a little modification, is to differentiate between networks using various parts of the output from nm-tool; for example, since the active wireless network is denoted with an asterisk, you could grep for the network name and then grep for a literal asterisk.

Connect to network with secret on boot

By default, NetworkManager will not connect to networks requiring a secret automatically on boot. This is because it locks such connections to the user who makes it by default, only connecting after they have logged in. To change this, do the following:

  1. Right click on the nm-applet icon in your panel and select Edit Connections and open the Wireless tab
  2. Select the connection you want to work with and click the Edit button
  3. Check the boxes “Connect Automatically” and “Available to all users”

Log out and log back in to complete.

Automatically unlock keyring after login

NetworkManager requires access to the login keyring to connect to networks requiring a secret. Under most circumstances, this keyring is unlocked automatically at login, but if it isn't, and NetworkManager isn't connecting on login, you can try the following.

GNOME

Note: The following method is dated and known not to work on at least one machine!
  • In /etc/pam.d/gdm (or your corresponding daemon in /etc/pam.d), add these lines at the end of the "auth" and "session" blocks if they do not exist already:
 auth            optional        pam_gnome_keyring.so
 session         optional        pam_gnome_keyring.so  auto_start
  • In /etc/pam.d/passwd, use this line for the 'password' block:
 password    optional    pam_gnome_keyring.so
Next time you log in, you should be asked if you want the password to be unlocked automatically on login.

SLiM login manager

See SLiM#Gnome Keyring.

Troubleshooting

While you may type both values at connection time, kdeplasma-applets-plasma-nm[broken link: archived in aur-mirror] 0.9.3.2-1 and above are capable of retrieving OpenConnect username and password directly from KWallet.

Open "KDE Wallet Manager" and look up your OpenConnect VPN connection under "Network Management|Maps". Click "Show values" and enter your credentials in key "VpnSecrets" in this form (replace username and password accordingly):

form:main:username%SEP%username%SEP%form:main:password%SEP%password

Next time you connect, username and password should appear in the "VPN secrets" dialog box.

Ignore specific devices

Sometimes it may be desired that NetworkManager ignores specific devices and does not try to configure addresses and routes for them.You can quickly and easily ignore devices by MAC or interface-name by using the following in /etc/NetworkManager/NetworkManager.conf:

[keyfile]
unmanaged-devices=mac:00:22:68:1c:59:b1;mac:00:1E:65:30:D1:C4;interface-name:eth0

After you have put this in, restart NetworkManager, and you should be able to configure interfaces without NetworkManager altering what you have set.

Enable DNS Caching

See dnsmasq#NetworkManager to enable the plugin that allows DNS caching using dnsmasq.

Configuring MAC Address Randomization

As of version 1.4.0, NetworkManager supports two types MAC Address Randomization: randomization during scanning, and stable randomization. Both modes can be configured by modifying /etc/networkManager/NetworkManager.conf.

Randomization during Wi-Fi scanning is enabled by default starting on version 1.2.0, and it can be disabled by adding the following lines to /etc/NetworkManager/NetworkManager.conf:

[device]
wifi.scan-rand-mac-address=no

In contrast, stable randomization generates a different MAC address for each different connection. This is specially useful when, for example, a portal remembers your login status based on your MAC address. To enable this mode, you can use the option

[connection]
wifi.cloned-mac-address=random

or

[connection]
ethernet.cloned-mac-address=random

You can read more about it here

Enable IPv6 Privacy Extensions

See IPv6#NetworkManager

See also