Setting up a wireless interface on Debian 12

A couple of days ago I had the idea of a home server. The main reason is to install Home Assistant and try to make my home smarter (at least in some ways).
For this I decided to use an old laptop and install Debian 12 on it. To take advantage of all the hardware I installed it with no GUI (no desktop, no window manager). Just like a real server :D

After the installation and when I logged on to it, I noticed that I have no internet connection. Well, I need to connect my laptop server to my Wi-Fi network.

Here are the steps:

  1. First, you need to know the interface name. Do ip a:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens5f5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 20:cf:30:71:44:a4 brd ff:ff:ff:ff:ff:ff
altname enp3s0f5
inet 192.168.18.10/24 brd 192.168.18.255 scope global ens5f5
valid_lft forever preferred_lft forever
inet6 fe80::22cf:30ff:fe71:44a4/64 scope link
valid_lft forever preferred_lft forever
3: wls1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 48:5d:60:3c:53:0a brd ff:ff:ff:ff:ff:ff
altname wlp2s0
inet 192.168.18.100/24 brd 192.168.18.255 scope global dynamic wls1
valid_lft 3571sec preferred_lft 3571sec
inet6 fe80::4a5d:60ff:fe3c:530a/64 scope link
valid_lft forever preferred_lft forever

Is wls1 in my case.

  1. Scan for available wireless networks: sudo iwlist wls1 scan | grep ESSID.
1
2
3
4
5
6
7
ESSID:"NoMeRobesElWiFi"
ESSID:"WIFI-MATIAS"
ESSID:"GOMEZZZZ"
ESSID:"CTi-CHIESSA"
ESSID:"CTi-RAMOS133"
ESSID:"Apocalipsis"
ESSID:"TP-Link_056C"

Looking for your WiFi ESSID.

  1. Next, use wpasupplicant to save the profile. Do:
1
wpa_passphrase NoMeRobesElWiFi uff#Altaclaveclave! | sudo tee /etc/wpa_supplicant.conf

and then

1
sudo wpa_supplicant -c /etc/wpa_supplicant.conf -i wls1

to connect. Check with sudo iwconfig.

You should then be connected to the WiFi router, but you may not have an IP assigned to you. So you need to do the following

1
sudo dhclient wls1

Check it with ip a to see the details.

Happy hacking!