Debian

How to Configure WiFi on Debian 12 Headless Server

Configuring the WiFi networks on the Debian 12 desktop operating system is very easy. But, it’s not the case for the Debian 12 server operating system. On Debian 12 server, you won’t have a graphical user interface. So, you have to configure the WiFi network on the Debian 12 server operating system from the command line.

In this article, we will show you how to configure the WiFi on a Debian 12 headless server from the command line.

Topic of Contents:

  1. Installing the WiFi Network Driver/Firmware on Debian 12
  2. Installing the WPA Supplicant on Debian 12
  3. Generating the WPA Passphrase for WiFi SSIDUsing WPA Supplicant
  4. Finding the WiFi Network Interface Name on Debian 12
  5. Configuring the WiFi Network on Debian 12
  6. Restarting the Networking Service on Debian 12
  7. Checking If the WiFi Is Working on Debian 12
  8. Conclusion

Installing the WiFi Network Driver/Firmware on Debian 12

Before you can use WiFi on Debian 12, you must install the correct driver/firmware for your WiFi hardware. If you need any assistance in installing the correct driver/firmware for your WiFi hardware on Debian 12, read this article.

Installing the WPA Supplicant on Debian 12

WPA supplicant is used to configure the WiFi networks on the Debian 12 headless server operating system. WPA supplicant is not installed by default on the Debian 12 server. You can easily install it from the official Debian 12 package repository.

First, update the APT package database cache with the following command:

$ sudo apt update

 

To install the WPA Supplicant on Debian 12, run the following command:

$ sudo apt install wpasupplicant

 

To confirm the installation, press Y and then press <Enter>.

WPA Supplicant is being installed. It takes a few seconds to complete.

WPA Supplicant should be installed on your Debian 12 system at this point.

Generating the WPA Passphrase for WiFi SSID Using WPA Supplicant

Before you can configure the WiFi on your Debian 12 server system to connect to your WiFi network, you have to generate an encrypted WiFi password for the WiFi network that you want to connect to using the WPA supplicant.

To generate an encrypted password for the “Your-WiFi-Name-SSID” WiFi network which has the “very_secret_password” password using the WPA Supplicant, run the following command:

$ wpa_passphrase Your-WiFi-Name-SSID "very_secret_password"

 

An encrypted password for the “Your-WiFi-Name-SSID” WiFi network should be generated as you can see in the marked section of the following screenshot. Note it:

Finding the WiFi Network Interface Name on Debian 12

To find the WiFi network interface name of your Debian 12 system that you want to configure, run the following command:

$ ip a

 

In our case, the WiFi network interface name is “wlxa09f10efd9be”. Note the network interface name of your Debian 12 system as you will need it later.

Configuring the WiFi Network on Debian 12

To configure the WiFi network, open the /etc/network/interfaces file with the nano text editor as follows:

$ sudo nano /etc/network/interfaces

 

Once the /etc/network/interfaces file is opened, add the following lines in the configuration file. Make sure to replace the “wpa-ssid” and “wpa-psk” with your WiFI SSID and encrypted password, respectively.

allow-hotplug wlxa09f10efd9be
iface wlxa09f10efd9be inet dhcp
    wpa-ssid Your-WiFi-Name-SSID
    wpa-psk 812c294d0db35b391a6deb6d0bd169802526f069e914ed1ee26ad8551109cdf2

 

Once you’re done configuring the WiFi network, press <Ctrl> + X followed by Y and <Enter> to save the /etc/network/interfaces configuration file.

Restarting the Networking Service on Debian 12

For the changes to take effect, restart the networking service of your Debian 12 server with the following command:

$ sudo systemctl restart networking.service

 

Checking If the WiFi Is Working on Debian 12

If you’re successfully connected to your desired WiFi network, the WiFi network interface should have an assigned IP address.

To check whether an IP address is assigned to the WiFi network interface, run the following command:

$ ip a

 

An IP address should be assigned to your WiF network interface. In our case, the IP address is 192.168.0.113 as you can see in the following screenshot:

Conclusion

In this article, we showed you how to install the WPA supplicant on Debian 12 and generate an encrypted password for your WiFi SSID using the WPA Supplicant. We also showed you how to configure the WiFi on the Debian 12 headless server using the WPA Supplicant.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.