Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

How to Use NetworkManager: A Beginner’s Step-by-Step Guide

How to Use NetworkManager: A Beginner’s Step-by-Step Guide

NetworkManager is a powerful tool that simplifies managing network connections on Linux systems. Whether you need to connect to Wi-Fi, Ethernet, or VPN, NetworkManager offers an easy way to configure and control your network settings without manually editing configuration files. This guide walks beginners through using NetworkManager effectively, covering everything from basic setup to troubleshooting common issues.

What You’ll Need

  • A Linux system with NetworkManager installed (most modern distros include it by default)
  • Access to a terminal or graphical interface (GUI) depending on your preference
  • Basic user permissions (sudo or root access recommended for some commands)
  • Network credentials (Wi-Fi password, VPN details, etc.) if applicable

Step-by-Step

  1. Check if NetworkManager is installed and running.
    Open a terminal and run:
    systemctl status NetworkManager
    If it’s active and running, you can proceed. If not, install it via your package manager, for example:
    sudo apt install network-manager (Debian/Ubuntu) or
    sudo dnf install NetworkManager (Fedora).
  2. Understand the two primary interfaces:
    • nmcli: Command-line interface for NetworkManager.
    • nmtui: Text user interface (menu-driven).
    • GUI tools: Many desktop environments provide graphical frontends such as “nm-applet” or “Network Settings”.

    Choose the interface that suits you best.

  3. List available network devices.
    Run:
    nmcli device status
    This shows your network interfaces (Ethernet, Wi-Fi, etc.) and their states (connected, disconnected).
  4. Scan for Wi-Fi networks (if using Wi-Fi).
    Run:
    nmcli device wifi list
    This lists nearby Wi-Fi networks with their SSIDs, signal strength, and security.
  5. Connect to a Wi-Fi network via command line.
    Use:
    nmcli device wifi connect "SSID" password "your_password"
    Replace “SSID” with the network name. If the network is open (no password), omit the password part.
  6. Confirm your connection.
    Run:
    nmcli connection show --active
    This shows active connections. You can also check your IP address with:
    ip addr show or nmcli device show.
  7. Create a new network connection profile.
    Profiles store your connection settings for reuse.
    To add a new Wi-Fi connection manually:
    nmcli connection add type wifi ifname wlan0 con-name mywifi ssid SSID
    Then set the password:
    nmcli connection modify mywifi wifi-sec.key-mgmt wpa-psk
    nmcli connection modify mywifi wifi-sec.psk "your_password"
    Finally, activate:
    nmcli connection up mywifi
  8. Manage Ethernet connections.
    Ethernet connections usually connect automatically. To list Ethernet connections:
    nmcli device status
    To manually bring Ethernet up or down, use:
    nmcli device connect eth0 or nmcli device disconnect eth0 (replace eth0 with your device name).
  9. Use nmtui for a user-friendly text interface.
    Run:
    nmtui
    This opens a menu where you can activate connections, edit existing profiles, or add new ones without remembering commands.
  10. Disconnect or delete a connection.
    To disconnect:
    nmcli connection down "connection_name"
    To delete a connection profile:
    nmcli connection delete "connection_name"
  11. Enable NetworkManager to start on boot.
    To ensure NetworkManager manages your network automatically:
    sudo systemctl enable NetworkManager
    sudo systemctl start NetworkManager
  12. Explore graphical tools if preferred.
    Most desktop environments provide GUI network managers (e.g., GNOME’s Network Settings or KDE’s Plasma Network Manager). Use these to manage connections visually.
  13. Configure VPN or advanced connections.
    NetworkManager supports VPN plugins (OpenVPN, WireGuard, etc.). Install relevant plugins and create VPN profiles through GUI or nmcli to secure your traffic.

Common Mistakes

  • Trying to use NetworkManager commands without sufficient permissions. Many commands require sudo or root.
  • Confusing interface names (like wlan0, wlp3s0). Use nmcli device status to identify correct device names.
  • Assuming NetworkManager manages all interfaces by default. Some systems disable it on certain devices; check /etc/NetworkManager/NetworkManager.conf.
  • Not installing necessary plugins for VPN or special connection types.
  • Forgetting to activate a newly created connection profile.
  • Using incorrect SSID or password when connecting to Wi-Fi, leading to failed authentication.
  • Overlapping manual network configurations with NetworkManager-managed profiles causing conflicts.

Tips

  • Use nmcli -p for pretty output, making it easier to read command results.
  • Save connection profiles for networks you frequently use to connect automatically in the future.
  • Use nmcli general status to get an overview of NetworkManager’s global state.
  • For Wi-Fi troubleshooting, check logs with journalctl -u NetworkManager.
  • Consider GUI tools if you are uncomfortable with command line.
  • If you have multiple network interfaces, prioritize connections with nmcli connection modify "conn_name" connection.autoconnect-priority N where higher N is higher priority.
  • When scripting network changes, use nmcli commands for consistent automation.

Troubleshooting

If your connection does not work as expected, here are some common troubleshooting steps:

  • Check NetworkManager status: Run systemctl status NetworkManager to ensure it’s running.
  • Verify device states: Use nmcli device status to see if your network device is recognized and enabled.
  • Restart NetworkManager: Sometimes, restarting helps:
    sudo systemctl restart NetworkManager
  • Check Wi-Fi credentials: Ensure correct SSID and password. Wrong credentials cause authentication failures.
  • View logs: Check detailed logs for errors:
    journalctl -u NetworkManager -b
  • Disable conflicting network tools: Other network managers (like Wicd or manual ifcfg scripts) can conflict with NetworkManager. Disable or remove them.
  • Check hardware switch: Some laptops have physical Wi-Fi switches or function keys that can disable wireless interfaces.
  • Reset connection profiles: Delete and recreate problematic profiles to clear misconfigurations.
  • Update NetworkManager: Ensure you have the latest version, as bugs and hardware support improve over time.
  • Check firewall rules: Firewalls can block network traffic; verify settings if some connections fail.

Frequently Asked Questions

What is NetworkManager and why should I use it?
NetworkManager is a service that automates and simplifies network configuration on Linux, handling wired, wireless, and VPN connections easily.
Can I use NetworkManager without a graphical interface?
Yes. You can use nmcli or nmtui in the terminal without needing a GUI.
How do I find my wireless device name?
Run nmcli device status or ip link to see device names like wlan0 or wlp3s0.
Why won’t NetworkManager connect to my Wi-Fi?
Common reasons include wrong password, Wi-Fi disabled by hardware switch, or driver issues. Check logs and device status for clues.
Can NetworkManager manage VPN connections?
Yes, NetworkManager supports VPNs via plugins for OpenVPN, WireGuard, and others, allowing easy setup and management.
How do I make NetworkManager start automatically at boot?
Enable it with sudo systemctl enable NetworkManager and start it with sudo systemctl start NetworkManager.

NetworkManager is a versatile and user-friendly tool that can greatly simplify your network management on Linux. By following these steps and tips, even beginners can confidently configure and troubleshoot their connections. Experiment with the command line and GUI options to find your preferred workflow, and keep this guide handy for common issues and questions.

Related

How to Use NetworkManager: A Beginner’s Step-by-Step Guide
Scroll to top