Setting up Wi-Fi
Tip
- There is nothing more reliable than wired Ethernet, so it's better to use it. Wi-Fi with the steel case (on PiKVM V3 and V4) results in poor performance. But who are we to stop you... :)
- Devices based on Raspberry Pi Zero 2 W does not support 5GHz Wi-Fi.
The following describes how to setup a Wi-Fi connection. We recommend to do this while having a display and keyboard or a serial console connected directly to the Raspberry Pi as you will loose network connectivity once you connect to a Wi-Fi. Alternatively you can connect to the PiKVM via SSH. The built-in Web Terminal (available through the browser) should also work.
Take a look at the easiest way
This guide describes how to manually set up a Wi-Fi. An easier way is to use On-boot config. It is also mandatory for Zero 2 W board.
Setting up Wi-Fi manually¶
-
Make filesystem writable using the
rwcommand. -
Create the Wi-Fi settings file
/etc/systemd/network/wlan0.networkwith the following content:[Match] Name=wlan0 [Network] DHCP=yes DNSSEC=no [DHCP] ClientIdentifier=mac RouteMetric=50 -
Set network ESSID and password:
[root@pikvm ~]# wpa_passphrase 'MyNetwork' 'P@assw0rd' > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf [root@pikvm ~]# chmod 640 /etc/wpa_supplicant/wpa_supplicant-wlan0.confPiKVM V3, PiKVM V4, and DIY builds based on Raspberry Pi 4 include experimental support for connecting to WPA3 networks. To connect to a WPA3 network, you need to make sure your PiKVM is up-to-date, and edit the
/etc/wpa_supplicant/wpa_supplicant-wlan0.conffile after creating it:- uncomment the plain-text
psk=line, and comment/remove the hashedpsk=line; - add options
key_mgmt=SAEandieee80211w=2before the closing}line; - finally, add a global option
sae_pwe=2before thenetwork={line.
For instance, if your
/etc/wpa_supplicant/wpa_supplicant-wlan0.conflooks like this:network={ ssid="MyNetwork" #psk="P@assw0rd" psk=4134d31e95e6387761d485796310894b1ac5e9bb86b3b96e0dd3473cea440014 }You need to change it as follows:
sae_pwe=2 network={ ssid="MyNetwork" psk="P@assw0rd" #psk=4134d31e95e6387761d485796310894b1ac5e9bb86b3b96e0dd3473cea440014 key_mgmt=SAE ieee80211w=2 }Connecting to mixed WPA2/3 networks in WPA2 mode (older devices)
Add options
key_mgmt=WPA-PSK-SHA256 WPA-PSKandieee80211w=1to/etc/wpa_supplicant/wpa_supplicant-wlan0.confinside thenetwork={block.This enables WPA2 PMF (protected management frame) support, which is often necessary to connect to WPA2/3 mixed mode networks.
Using Wi-Fi with hidden ESSID
Add global option
scan_ssid=1to/etc/wpa_supplicant/wpa_supplicant-wlan0.confUsing 5GHz Wi-Fi in the USA
Add global option
country=USto/etc/wpa_supplicant/wpa_supplicant-wlan0.confBlock 2 GHz or 5 GHz
Add option
bssid=xx:xx:xx:xx:xx:xxto/etc/wpa_supplicant/wpa_supplicant-wlan0.confinside thenetwork={block.Here,
xx:xx:xx:xx:xx:xxis the MAC address of the specific 2 GHz or 5 GHz AP that you want to allow. All other APs in this network will be blocked. - uncomment the plain-text
-
Enable the
wpa_supplicant@wlan0service:
[root@pikvm ~]# systemctl enable wpa_supplicant@wlan0.service
- Make filesystem read-only again using
rocommand
Multiple Wi-Fi networks¶
You can configure PiKVM to connect to one of several known Wi-Fi networks.
To do this, just simply add the configuration of these networks.
Pay attention to the symbol >>, it is used to append at the end of configuration,
while a single > will overwrite the entire configuration.
-
Make the filesystem writeble with
rwcommand. -
Add some new networks:
[root@pikvm ~]# wpa_passphrase 'Wifi1' 'P@assw0rd' >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf [root@pikvm ~]# wpa_passphrase 'Wifi2' 'P@assw0rd' >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf [root@pikvm ~]# wpa_passphrase 'Wifi3' 'P@assw0rd' >> /etc/wpa_supplicant/wpa_supplicant-wlan0.confIf any of those networks enable or require WPA3, edit your
wpa_supplicant-wlan0.confas described above, making changes to relevantnetwork={...}blocks. -
Restart the service:
systemctl restart wpa_supplicant@wlan0.service. -
Make the filesystem read-only again using
rocommand
Antenna on PiKVM V4¶
PiKVM V4 has a robust metal case that protects your device from physical damage and electromagnetic interference. This also means that an external antenna must be used for Wi-Fi. We recommend the official Antenna Kit for Raspberry Pi.
To install the antenna, fix it in the round hole in the back side of the PiKVM, and plug the wire to the connector on the Compute Module 4.
Next, to activate the antenna, add line dtparam=ant2 to the /boot/config.txt file on PiKVM, and perform reboot.
Useful console commands¶
iwconfig- Manipulate the basic wireless parameters.iwlist- Allow's you to initiate scanning and list frequencies, bit-rates, encryption keys, etc.iwspy- Displays per node link quality.iwpriv- Allow's you to manipulate the Wireless Extensions specific to a driver (private).
Some examples
[root@pikvm ~]# iw dev wlan0 scan | egrep "signal:|SSID:" | sed -e "s/\tsignal: //" -e "s/\tSSID: //" | awk '{ORS = (NR % 2 == 0)? "\n" : " "; print}' | sort
[root@pikvm ~]# iwlist wlan0 scan | egrep "Cell|ESSID|Signal|Rates"
[root@pikvm ~]# iwlist wlan0 scan
[root@pikvm ~]# iw wlan0 info