How to Configure NetworkManager for WiFi in Debian 12 Bookworm

This article provides a step-by-step guide on how to configure WiFi using NetworkManager in Debian 12 Bookworm.

Introduction

Debian 12 Bookworm, one of the most stable Linux distributions, uses NetworkManager as the default networking service. NetworkManager simplifies the process of configuring network connections, including WiFi, through both graphical and command-line interfaces.

In this guide, we will explore how to configure WiFi using NetworkManager in Debian 12, covering various methods, including the GUI, command line (nmcli), and text-based interface (nmtui). Whether you are a beginner or an advanced user, this article will help you set up and troubleshoot WiFi connectivity effectively.


Step 1: Check NetworkManager Installation

Before configuring WiFi, ensure that NetworkManager is installed and running. Debian 12 should come with it pre-installed, but you can verify this using the following command:

systemctl status NetworkManager

If NetworkManager is not installed, install it using:

sudo apt update
sudo apt install network-manager

Enable and start the service if it is not running:

sudo systemctl enable --now NetworkManager

Step 2: Identify Your Wireless Interface

To configure WiFi, you first need to identify your network interface. Run the following command:

nmcli device status

This will output a list of network devices. Look for an entry labeled wifi or wlan0, wlan1, etc. If no wireless device is listed, ensure your WiFi adapter is detected using:

ip a | grep wlan

If your WiFi adapter is missing, ensure that it is not disabled via BIOS, hardware switch, or kernel module.


Step 3: Enable WiFi Interface

If your WiFi adapter is disabled, enable it using:

nmcli radio wifi on

Verify that it is enabled:

nmcli radio

If the WiFi interface is soft-blocked, unblock it with:

rfkill unblock wifi

Step 4: Scan for Available WiFi Networks

Once the WiFi adapter is enabled, scan for available networks using:

nmcli device wifi list

This command will display a list of available WiFi networks.


Step 5: Connect to a WiFi Network

To connect to a WiFi network, use:

nmcli device wifi connect "SSID" password "your_password"

Replace "SSID" with your WiFi network name and "your_password" with the actual password. If the connection is successful, NetworkManager will save the credentials for future use.

To verify the connection:

nmcli connection show --active

Step 6: Configure WiFi Using nmtui (Text-Based Interface)

For users who prefer a text-based interactive interface, NetworkManager provides nmtui (NetworkManager Text User Interface). Install it if necessary:

sudo apt install network-manager

Launch nmtui:

nmtui
  1. Select Activate a connection.
  2. Choose your WiFi network and enter the password.
  3. Press OK to save the settings.

After connecting, verify the connection using:

nmcli connection show --active

Step 7: Configure a Static IP Address (Optional)

By default, NetworkManager assigns an IP address via DHCP. To set a static IP address, use the following:

nmcli connection modify "SSID" ipv4.addresses "192.168.1.100/24" ipv4.gateway "192.168.1.1" ipv4.dns "8.8.8.8,8.8.4.4" ipv4.method manual

Apply the changes:

nmcli connection up "SSID"

To check the configuration:

nmcli connection show "SSID"

Step 8: Managing WiFi Connections

Listing Saved Networks

To list all saved WiFi networks:

nmcli connection show

Deleting a WiFi Network

To delete a saved WiFi network:

nmcli connection delete "SSID"

Restarting NetworkManager

If you experience connectivity issues, restart NetworkManager:

sudo systemctl restart NetworkManager

Step 9: Troubleshooting WiFi Issues

Checking Logs

To check NetworkManager logs for troubleshooting:

journalctl -u NetworkManager --no-pager | tail -50

Checking Kernel Messages

If your WiFi adapter is not working properly, check the kernel logs:

dmesg | grep wlan

Debugging with nmcli

For a more detailed analysis, use:

nmcli device status
nmcli device wifi rescan
nmcli connection show "SSID"

Conclusion

Configuring NetworkManager for WiFi in Debian 12 Bookworm is straightforward with both graphical and command-line tools. Whether using nmcli, nmtui, or GUI-based settings, you can efficiently manage your WiFi connections. If issues arise, troubleshooting using logs and status commands can help diagnose problems.

By following this guide, you should be able to set up and manage WiFi connections easily in Debian 12. Happy networking!