First off, as a prerequisite it is needed to have a CLI access to the Debian OS. It can be done using a keyboard and a screen connected to the Raspberry Pi, or using a SSH connection. If you have followed the post of how to install Debian On a Raspberry Pi 4, you should be able to access with SSH using the Ethernet (RJ45) port.
Also, you should have the SSID and the password of your Wi-Fi connection, and it should be enabled the DHCP protocol in your router.
Initial situation
In the initial situation we have 3 interfaces defined: lo
, eth0
(the only one with IP address), and wlan0
, the protagonist of this post.
root@medusa:~# ip address
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: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether e4:5f:01:d9:eb:3a brd ff:ff:ff:ff:ff:ff
inet 10.0.4.210/24 brd 10.0.4.255 scope global dynamic eth0
valid_lft 83280sec preferred_lft 83280sec
inet6 fe80::e65f:1ff:fed9:eb3a/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether e4:5f:01:d9:eb:3b brd ff:ff:ff:ff:ff:ff
root@medusa:~#
Configure the WLAN interface (Wi-Fi)
To configure the Wi-Fi interface, it is needed to know the SSID of your Wi-Fi connection, and the password.
Next step is to edit the wlan0
file interface:
vi /etc/network/interfaces.d/wlan0
And left the next configuration without comments and with the correct values (instead of my-network-ssid and s3kr3t_P4ss):
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid my-network-ssid
wpa-psk s3kr3t_P4ss
Note I have not include the iface wlan0 inet6 dhcp
line because I don’t have IPv6 active in my LAN. As you should have the DHCP protocol active, your router should assign you a new IP address.
Reboot
And finally it is recommended to reboot the system to apply the changes. Maybe there is another way to apply the changes but I haven’t try.
systemctl reboot
Wi-Fi connectivity ready
After the reboot, the system should now be connected to the Wi-Fi. It can be check using the ip address
command.
root@medusa:~# ip address
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: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether e4:5f:01:d9:eb:3a brd ff:ff:ff:ff:ff:ff
inet 10.0.4.210/24 brd 10.0.4.255 scope global dynamic eth0
valid_lft 83280sec preferred_lft 83280sec
inet6 fe80::e65f:1ff:fed9:eb3a/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether e4:5f:01:d9:eb:3b brd ff:ff:ff:ff:ff:ff
inet 10.0.4.215/24 brd 10.0.4.255 scope global dynamic eth0
valid_lft 83280sec preferred_lft 83280sec
inet6 fe80::e65f:1ff:fed9:eb3b/64 scope link
valid_lft forever preferred_lft forever
root@medusa:~#
As you can see, now wlan0
interface has the IP address assigned and the interface is working.