1
2
3
4
| apt install \
wpasupplicant \
wireless-tools \
--no-install-recommends
|
Identify your wireless interface#
First, let’s figure out your wireless interface name using
You’ll see output like this:
1
2
3
4
5
6
7
| 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UP mode DEFAULT group default qlen 1000
link/ether 98:fa:9b:31:a4:h6 brd ff:ff:ff:ff:ff:ff
altname enp0s31f6
3: wlp2s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether d0:ab:d5:11:4r:5c brd ff:ff:ff:ff:ff:ff
|
Look for the line that starts with something like wl????
— that’s your wireless interface. In this example, it’s wlp2s0
. Make a note of it, you’ll use it in the next steps.
1
2
| wpa_passphrase SSID_NAME PASSPHRASE \
| tee -a /etc/wpa_supplicant/wpa_supplicant.conf
|
You might need to add these lines too at the beginning of the file:
1
2
3
| update_config=1 # allow wpa_supplicant to update (overwrite) configuration
country=COUNTRY_CODE # please refers to ISO/IEC alpha2 country code
ctrl_interface=DIR=/run/wpa_supplicant GROUP=0
|
Other options can be seen on this link: https://w1.fi/cgit/hostap/plain/wpa_supplicant/wpa_supplicant.conf
For comparison, this is what I’ve got:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| update_config=1
country=ID
ctrl_interface=DIR=/run/wpa_supplicant GROUP=0
network={
ssid="REDACTED"
#psk="REDACTED"
psk=REDACTED
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
group=CCMP
pairwise=CCMP
priority=10
}
|
Open the /etc/network/interfaces
file, and update it with your network details. Use the example below as a template and adjust it to match your Wi-Fi interface name, SSID, and other settings:
1
2
3
4
| auto wlp2s0 # change this to your interface name
iface wlp2s0 inet dhcp # this one too
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf # path to wpa-supplicant config file
dns-nameservers 1.1.1.1 9.9.9.9 # DNS server you want to use
|
Put them to actions#
Now after wpa_supplicant and network interface being configured, time to apply the update.
1
2
3
| systemctl enable --now wpa_supplicant.service # refresh the configs
systemctl restart networking.service # you might need to wait a couple seconds here
|
Check the result#
Use command below to confirm does the interface got IP from DHCP server or not:
1
2
3
4
| ip addr show [INTERFACE NAME]
# example
ip addr show wlp2s0
|
That’s it, you’ve successfully configure Wireless Connection on Linux.