Configuring each interface by hand does not survive reboots and is awkward on laptops that move between networks. NetworkManager is a service that handles this for you. It is common on desktop distributions and on Fedora and RHEL. Some servers use systemd-networkd instead.
Devices and connections
NetworkManager separates two ideas:
- A device is an interface, such as
enp3s0. - A connection is a saved set of settings that can be activated on a device.
One device can have several connections, such as one for home and one for the office.
Looking around
nmcli is the command-line client:
$ nmcli device status
DEVICE TYPE STATE CONNECTION
enp3s0 ethernet connected Wired connection 1
lo loopback connected (externally) loVersions older than 1.42 usually show lo as unmanaged.
$ nmcli connection showThe second lists saved connections. Columns and states vary a little between versions.
Creating a static connection
$ sudo nmcli connection add type ethernet con-name lab ifname enp3s0 \
ipv4.method manual ipv4.addresses 192.168.1.60/24 \
ipv4.gateway 192.168.1.1 ipv4.dns 192.168.1.1
$ sudo nmcli connection up labipv4.method manual means you supply the address. With auto, the usual setting for a new profile, the address comes from DHCP. To change a saved setting, use modify, then activate the connection again so it takes effect:
$ sudo nmcli connection modify lab ipv4.dns 192.168.1.2
$ sudo nmcli connection up labSwitching connections can drop a remote session, so practise on a console.
Other interfaces
nmtuigives a text menu in the terminal, if installed.- Desktop environments offer a graphical applet.
nmcli device wifi listshows nearby wireless networks.
Saved profiles are commonly stored in /etc/NetworkManager/system-connections/. Some older Red Hat systems use files in /etc/sysconfig/network-scripts/. Prefer nmcli to editing by hand.
Check that the service is running with systemctl status NetworkManager.
Try it
- Run
nmcli device status. - Run
nmcli connection showand match connections to devices. - Show one connection's full settings with
nmcli connection showfollowed by its name.
Check your understanding
Network Manager
All 4 sections ยท no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.