2021-10-12 18:45:00 +00:00
# Setting up Wi-Fi
2023-07-23 22:17:34 +00:00
!!! tip
2023-08-08 22:13:32 +00:00
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... :)
2023-07-23 22:17:34 +00:00
2023-08-08 22:13:32 +00:00
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.
2021-10-19 07:05:26 +00:00
Alternatively you can connect to the PiKVM via SSH. The built-in Web Terminal (available through the browser) should also work.
2021-10-12 18:45:00 +00:00
2023-07-23 22:17:34 +00:00
!!! note "Setting up Wi-Fi in the boot config (semi-auto)"
2023-12-02 13:48:35 +00:00
Check out [this guide ](on_boot_config.md ) guide. It is mandatory if you're using Zero 2 W board.
It will useful in most other cases, especially if you have physical access to the memory card.
2021-10-12 18:45:00 +00:00
2024-02-11 15:32:39 +00:00
!!! note
Devices based on Raspberry Pi Zero 2 W does not support 5GHz Wi-Fi.
2021-10-19 07:05:26 +00:00
2021-10-12 18:45:00 +00:00
2023-07-23 22:17:34 +00:00
## Setting up Wi-Fi manually
2021-10-12 18:45:00 +00:00
1. Make filesystem writable using `rw` command.
2021-10-19 05:00:53 +00:00
2. Create Wi-Fi settings file `/etc/systemd/network/wlan0.network` with following content:
2021-10-12 18:45:00 +00:00
2021-10-19 05:00:53 +00:00
```ini
[Match]
2021-10-19 05:13:29 +00:00
Name=wlan0
2021-10-12 18:45:00 +00:00
2021-10-19 05:00:53 +00:00
[Network]
DHCP=yes
DNSSEC=no
2021-10-12 18:45:00 +00:00
2021-10-19 05:00:53 +00:00
[DHCP]
ClientIdentifier=mac
2023-12-02 13:48:35 +00:00
RouteMetric=50
2021-10-12 18:45:00 +00:00
```
2021-10-19 05:00:53 +00:00
3. Set network ESSID and password:
2021-10-12 18:45:00 +00:00
```
2023-03-26 01:04:39 +00:00
# wpa_passphrase 'MyNetwork' 'P@assw0rd' > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
2023-09-27 12:18:48 +00:00
# chmod 640 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
2021-10-12 18:45:00 +00:00
```
2021-12-07 02:57:39 +00:00
2021-10-19 05:00:53 +00:00
!!! note "Using Wi-Fi with hidden ESSID"
Add option `scan_ssid=1` to `/etc/wpa_supplicant/wpa_supplicant-wlan0.conf`
!!! note "Using 5GHz Wi-Fi in the USA"
Add option `country=US` to `/etc/wpa_supplicant/wpa_supplicant-wlan0.conf`
2021-12-07 02:58:36 +00:00
2021-10-19 05:00:53 +00:00
4. Enable WPA-supplicant service:
```
2021-10-19 05:13:29 +00:00
systemctl enable wpa_supplicant@wlan0.service
2021-10-19 05:00:53 +00:00
```
5. Make filesystem read-only again using `ro` command
2021-10-12 18:45:00 +00:00
## 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).
2022-03-05 18:56:42 +00:00
??? example "Some examples"
2021-10-12 18:45:00 +00:00
```
# iw dev wlan0 scan | egrep "signal:|SSID:" | sed -e "s/\tsignal: //" -e "s/\tSSID: //" | awk '{ORS = (NR % 2 == 0)? "\n" : " "; print}' | sort
```
```
# iwlist wlan0 scan | egrep "Cell|ESSID|Signal|Rates"
```
```
# iwlist wlan0 scan
```
```
# iw wlan0 info
```
## Additional resources
2021-10-19 05:00:53 +00:00
* [Arch Linux Wiki for systemd-networkd ](https://wiki.archlinux.org/title/systemd-networkd )