How to Connect To WiFi From the CLI (terminal) on Debian 11 bullseye with WPA_Supplicant

How to Connect To WiFi From the command line terminal on Debian 11 bullseye with WPA_Supplicant

We can connect to WPA2 wireless network on Debian 11 bullseye  using wpa_supplicant easilly

1. First, we must install wpasupplicant and wireless-tools,  As root or with sudo run

apt install wpasupplicant wireless-tools

2. We need find the name of your WiFi interface name. we can find name of your WiFi interface by run simple command

$ ip a

you can see my WiFi interface is wlx18a6f70f1bc8, but yours will probably be different maybe wlan0 or other.

2. Next step you scan list of available SSID WiFi networks. If you already know the name of the SSID WiFi network that you want to connect to, you can skip this step.

you can scan list of available SSID WiFi networks you want to connect to with this simple command. As root or with sudo, run:

sudo iwlist wifi-interface scan | grep -i ssid

change wifi-interface with your WiFi interface name, for example my WiFi interface is wlx18a6f70f1bc8

sudo iwlist wlx18a6f70f1bc8 scan | grep -i ssid

3. Connect to Wi-fi network using wpa_supplicant

Run the following command to create wpa_supplicant.conf. Replace ESSID and Wi-fi password with your own.

wpa_passphrase your-ESSID your-password | sudo tee /etc/wpa_supplicant.conf

for example, I want connect my “Share Share Share” ESSID

wpa_passphrase “Share Share Share” 12345678 | sudo tee /etc/wpa_supplicant.conf

note : you must type manual (because copy paste didnt work for me)

4. Now connect your wireless card to your wireless access point use the following command to

sudo wpa_supplicant -c /etc/wpa_supplicant.conf -i wifi-interface

replace wifi-interface with your wifi-interface

5.  Last step get private IP address from DHCP server, use the following command:

sudo dhclient wifi-interface

replace wifi-interface with your wifi-interface

6. try to ping

ping google.com

Leave a Comment

Your email address will not be published. Required fields are marked *