2
0
mirror of https://github.com/pikvm/pikvm synced 2024-11-01 09:20:17 +00:00
pikvm/pages/wifi_config.md

88 lines
3.8 KiB
Markdown
Raw Normal View History

# Setting up WiFi / WLAN
The following describes how to setup a WiFi connection on the default pikvm builds based on Arch Linux. The process might vary for other Linux distros.
I'd recommend to do this while having a display and keyboard connected directly to the Raspberry Pi as you will loose network connectivity once you connect to a WiFi.
2021-02-08 00:56:53 +00:00
Alternatively you can connect to the pikvm via ssh. The built-in Terminal (available through the browser) should also work.
2021-01-14 16:26:56 +00:00
**Note:** I'm omitting any sudo prefix for commands as the default installation runs as root anyway. If your installation does not run as root you'll have to add `sudo` in front of each command.
## Make filesystem writeable
By default the pikvm filesystem is read-only. In order to make changes you'll need to switch to read-write mode. Do this by typing `rw` in the console.
```
rw
```
## Enable WiFi auto roaming mode
2021-02-08 00:56:53 +00:00
If you want your Raspberry Pi to automatically connect to any configured and available WiFi networks you have to set the following option. On Raspberry Pis wlan0 is the default name of the wlan device.
```
systemctl enable netctl-auto@wlan0.service
```
## Create WiFi profiles
### via GUI
You can create WiFi profiles either manually or by using `wifi-menu` - GUI. This requires the WiFi you want to connect to in signal range.
```
wifi-menu -o
```
The `-o` makes sure that the WiFi passphrase is stored encrypted. Otherwise it will be stored in cleartext in the profile file. `wifi-menu` will scan for all available WiFi networks and provide you a list:
2020-08-16 14:02:28 +00:00
2020-08-16 14:12:59 +00:00
![Wifi Menu 1](/img/wifi-1.png)
Select the WiFi you want to connect to and give the profile file a name. The default name is wlan0-wifiname:
2020-08-16 14:02:28 +00:00
2020-08-16 14:12:59 +00:00
![Wifi Menu 2](/img/wifi-2.png)
Enter the WPA-Passphrase:
2020-08-16 14:02:28 +00:00
2020-08-16 14:12:59 +00:00
![Wifi Menu 3](/img/wifi-3.png)
2021-02-08 00:56:53 +00:00
Afterwards `wifi-menu` will try to connect to the WiFi. If you're connected via ssh or the Web Terminal you'll loose connection to the Raspberry Pi. Most DHCP servers will give the Raspberry Pi a new (and usually different) IP address for each interface (LAN / WLAN).
If everything worked out you should be connected to your WiFi now. `wifi-menu` created a new profile file for you in */etc/netctl*.
### manually
If you want to store the WiFi passphrase encrypted you have to generate it via `wpa_passphrase`:
```
wpa_passphrase wifiname this_is_my_great_and_secure_key_1234567890
```
2020-08-16 14:02:28 +00:00
2020-08-16 14:12:59 +00:00
![WPA passphrase generation](/img/wifi-4.png)
2020-08-16 14:02:28 +00:00
Copy the second hexadecimal string without *psk=*. In this example _814c45d0f88f60636532b034c463639a506670f8ba3c7965e62cdbc1989f6d66_.
Create a new file with the editor of your choice:
```
nano /etc/netctl/wlan0-wifiname
```
or
```
vi /etc/netctl/wlan0-wifiname
```
Copy the following template into the file and modify it with your parameters.
**Attention:** Please note the \\" after Key= is required for encrypted passphrases. If you want to put your WiFi passphrase in cleartext the \\" is not required. See [this](https://github.com/joukewitteveen/netctl/blob/master/docs/netctl.profile.5.txt) for the quoting rules and more WiFi profile configuration options.
```
Description='My great WiFi'
Interface=wlan0
Connection=wireless
Security=wpa
ESSID=wifiname
IP=dhcp
Key=\"814c45d0f88f60636532b034c463639a506670f8ba3c7965e62cdbc1989f6d66
```
Save the file and you're good to go. You can manually connect to the profile you've just created with:
```
netctl-auto switch-to wlan0-wifiname
```
### 5GHz WiFi in the US
If you want to connect to a 5GHz WiFi in the US and it's not listed, create `/etc/wpa_supplicant/wpa_supplicant-wlan0.conf` with a single line `country=US`, and enable it with:
```
systemctl enable wpa_supplicant@wlan0
```
## Make filesystem read-only again
Do this by typing `ro` in the console
```
ro
```
2020-08-16 14:02:28 +00:00
## Additional resources
2020-08-16 14:12:59 +00:00
- [Arch Linux Wiki for netctl](https://wiki.archlinux.org/index.php/Netctl)