Introduction to NetworkManager
NetworkManager is a set of
co-operative tools that make networking simple and straightforward.
Whether you use WiFi, wired, 3G, or Bluetooth, NetworkManager
allows you to quickly move from one network to another: Once a
network has been configured and joined once, it can be detected and
re-joined automatically the next time it's available.
Note
Development versions of BLFS may not build or run some packages
properly if LFS or dependencies have been updated since the most
recent stable versions of the books.
Note
Make sure that you disable the systemd-networkd service or
configure it not to manage the interfaces you want to manage with
NetworkManager.
Package Information
NetworkManager Dependencies
Required
libndp-1.9
Recommended
cURL-8.11.0, dhcpcd-10.1.0, GLib-2.82.4 (with
GObject Introspection), iptables-1.8.11, libpsl-0.21.5, newt-0.52.24 (for nmtui), nss-3.107, Polkit-125 (runtime), PyGObject-3.50.0, Systemd-256.5, Vala-0.56.17, and
wpa_supplicant-2.11 (runtime, built with
D-Bus support)
Optional
BlueZ-5.79, D-Bus Python-1.3.2 (for the test suite),
GnuTLS-3.8.8 (can be used instead of nss-3.107),
GTK-Doc-1.34.0, jansson-2.14,
ModemManager-1.18.12, UPower-1.90.6, Valgrind-3.24.0, dnsmasq, firewalld, libaudit,
libteam,
mobile-broadband-provider-info, PPP, and RP-PPPoE
Kernel Configuration
If you wish to run the tests, check that at least the following
options are enabled in the kernel configuration. Those options have
been determined to be necessary, but may not be sufficient.
Recompile the kernel if necessary:
[*] Networking support ---> [NET]
Networking options --->
[*] TCP/IP networking [INET]
<*/M> IP: tunneling [NET_IPIP]
<*/M> IP: GRE demultiplexer [NET_IPGRE_DEMUX]
<*/M> IP: GRE tunnels over IP [NET_IPGRE]
<*> The IPv6 protocol ---> [IPV6]
<*/M> IPv6: IPv6-in-IPv4 tunnel (SIT driver) [IPV6_SIT]
<*/M> IPv6: GRE tunnel [IPV6_GRE]
[*] IPv6: Multiple Routing Tables [IPV6_MULTIPLE_TABLES]
[*] MPTCP: Multipath TCP [MPTCP]
[*] MPTCP: IPv6 support for Multipath TCP [MPTCP_IPV6]
<*/M> 802.1Q/802.1ad VLAN Support [VLAN_8021Q]
[*] QoS and/or fair queueing ---> [NET_SCHED]
<*> Stochastic Fairness Queueing (SFQ) [NET_SCH_SFQ]
<*> Token Bucket Filter (TBF) [NET_SCH_TBF]
<*> Fair Queue Controlled Delay AQM (FQ_CODEL) [NET_SCH_FQ_CODEL]
<*> Ingress/classifier-action Qdisc [NET_SCH_INGRESS]
Device Drivers --->
[*] Network device support ---> [NETDEVICES]
[*] Network core driver support [NET_CORE]
<*/M> Bonding driver support [BONDING]
<*/M> Dummy net driver support [DUMMY]
<*/M> Ethernet team driver support ---> [NET_TEAM]
<*/M> MAC-VLAN support [MACVLAN]
<*/M> MAC-VLAN based tap driver [MACVTAP]
<*/M> IP-VLAN support [IPVLAN]
<*/M> Virtual eXtensible Local Area Network (VXLAN) [VXLAN]
<*/M> Virtual ethernet pair device [VETH]
<*/M> Virtual Routing and Forwarding (Lite) [NET_VRF]
Installation of NetworkManager
Fix the python scripts so that they use Python 3:
grep -rl '^#!.*python$' | xargs sed -i '1s/python/&3/'
Install NetworkManager by running
the following commands:
mkdir build &&
cd build &&
meson setup .. \
--prefix=/usr \
--buildtype=release \
-D libaudit=no \
-D nmtui=true \
-D ovs=false \
-D ppp=false \
-D selinux=false \
-D qt=false \
-D session_tracking=systemd \
-D modem_manager=false &&
ninja
An already active graphical session with a bus address is necessary
to run the tests. To test the results, issue ninja test.
A few tests may fail, depending on enabled kernel options.
Now, as the root
user:
ninja install &&
mv -v /usr/share/doc/NetworkManager{,-1.50.0}
If you have not passed the -D docs=true
option to meson, you
can install the pregenerated manual pages with (as the root
user):
for file in $(echo ../man/*.[1578]); do
section=${file##*.} &&
install -vdm 755 /usr/share/man/man$section
install -vm 644 $file /usr/share/man/man$section/
done
If you have not used -D docs=true
, the
pregenerated HTML documentation can also be installed with (as the
root
user):
cp -Rv ../docs/{api,libnm} /usr/share/doc/NetworkManager-1.50.0
Command Explanations
--buildtype=release
:
Specify a buildtype suitable for stable releases of the package, as
the default may produce unoptimized binaries.
-D docs=true
: Use this switch to enable
building man pages and documentation if GTK-Doc-1.34.0
is installed.
-D nmtui=true
: This switch
enables building nmtui.
-D ovs=false
: This switch
disable the Open vSwitch integration because it needs jansson-2.14. Remove it if you have jansson-2.14 installed on your system.
-D modem_manager=false
:
This switch is required if ModemManager is not installed. Omit this
switch if you have built ModemManager and mobile-broadband-provider-info.
-D
session_tracking=systemd
: This switch is used to set
systemd-logind as the
default program for session tracking.
-D ppp=false
: This switch
disables PPP support in
NetworkManager since the programs
necessary for it are not installed. Remove this switch if you need
PPP support and have PPP
installed.
-D libaudit=no
and
-D selinux=false
: This
switch disables support for libaudit and SELinux since they are not
used in BLFS.
-D qt=false
: This switch
disables the Qt 5 examples.
-D crypto=gnutls
: Use this switch if
you have GnuTLS installed and want to use it for certificate and
key operations in NetworkManager, instead of using NSS (the
default).
-D crypto=null
: Use this switch if
neither NSS nor GnuTLS is installed but you want to build
NetworkManager anyway. This switch will make NetworkManager lack
some features (for example 802.1X).
-D suspend_resume=upower
: Use this
switch if you have UPower-1.90.6 installed and want to use
it (instead of Systemd-256.5) for suspend and resume
support.
Configuring NetworkManager
Config Files
/etc/NetworkManager/NetworkManager.conf
Configuration Information
For NetworkManager to work, at
least a minimal configuration file must be present. Such a file
is not installed with make
install. Issue the following command as the
root
user to create a minimal
NetworkManager.conf
file:
cat >> /etc/NetworkManager/NetworkManager.conf << "EOF"
[main]
plugins=keyfile
EOF
This file should not be modified directly by users of the system.
Instead, system specific changes should be made using
configuration files in the /etc/NetworkManager/conf.d
directory.
To allow polkit to manage authorizations, add the following
configuration file:
cat > /etc/NetworkManager/conf.d/polkit.conf << "EOF"
[main]
auth-polkit=true
EOF
To use something other than the built-in dhcp client (recommended
if using only nmcli), use the following
configuration (valid values include either dhcpcd or internal):
cat > /etc/NetworkManager/conf.d/dhcp.conf << "EOF"
[main]
dhcp=
dhcpcd
EOF
To prevent NetworkManager from
updating the /etc/resolv.conf
file,
add the following configuration file:
cat > /etc/NetworkManager/conf.d/no-dns-update.conf << "EOF"
[main]
dns=none
EOF
For additional configuration options, see man 5 NetworkManager.conf.
To allow regular users to configure network connections, you
should add them to the netdev
group, and create a polkit rule
that grants access. Run the following commands as the
root
user:
groupadd -fg 86 netdev &&
/usr/sbin/usermod -a -G netdev <username>
cat > /usr/share/polkit-1/rules.d/org.freedesktop.NetworkManager.rules << "EOF"
polkit.addRule(function(action, subject) {
if (action.id.indexOf("org.freedesktop.NetworkManager.") == 0 && subject.isInGroup("netdev")) {
return polkit.Result.YES;
}
});
EOF
Systemd Unit
To start the NetworkManager daemon at boot,
enable the previously installed systemd unit by running the
following command as the root
user:
Note
If using Network Manager to
manage an interface, any previous configuration for that
interface should be removed, and the interface brought down
prior to starting Network
Manager.
systemctl enable NetworkManager
Starting in version 1.11.2 of NetworkManager, a systemd unit named
NetworkManager-wait-online.service
is enabled, which is used to prevent services that require
network connectivity from starting until NetworkManager establishes a connection. To
disable this behavior, run the following command as the
root
user:
systemctl disable NetworkManager-wait-online
Contents
Installed Programs:
NetworkManager, nmcli, nm-online, nmtui,
and, symlinked to nmtui: nmtui-connect, nmtui-edit, and
nmtui-hostname
Installed Libraries:
libnm.so and several modules under
/usr/lib/NetworkManager
Installed Directories:
/etc/NetworkManager, /usr/include/libnm,
/usr/lib/NetworkManager, /usr/share/doc/NetworkManager-1.50.0,
/usr/share/gtk-doc/html/{libnm,NetworkManager} (if the
documentation is built), and /var/lib/NetworkManager
Short Descriptions
nmcli
|
is a command-line tool for controlling NetworkManager and getting its
status
|
nm-online
|
is an utility to determine whether you are online
|
nmtui
|
is an interactive ncurses-based user interface for
nmcli
|
nmtui-connect
|
is an interactive ncurses-based user interface to
activate/deactivate connections
|
nmtui-edit
|
is an interactive ncurses-based user interface to edit
connections
|
nmtui-hostname
|
is an interactive ncurses-based user interface to edit
the hostname
|
NetworkManager
|
is the network management daemon
|
libnm.so
|
contains functions used by NetworkManager
|