WiFi

From Autopilot Wiki
Revision as of 23:18, 28 December 2021 by Jonny (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Configuration

When configuring the raspberry pi headless or when using a Lite version without an X server, use wpa_supplicant, configuration file located at /etc/wpa_supplicant/wpa_supplicant.conf, to configure it.

Note: you can also create the wpa_supplicant.conf file in the /boot directory of a freshly flashed disk image to configure the raspi headlessly, eg. without needing to attach a keyboard/monitor to it.

All configurations need preamble like this at the top of the configuration:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

WEP/Auto

The simplest configuration is something like...

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
 ssid="NAME OF NETWORK"
 psk="PASSWORD"
}

This is the entry that is generated by using raspi-config

WPA

network={
 scan_ssid=1
 ssid="NAME OF NETWORK"
 psk="PASSWORD"
 key_mgmt=WPA-PSK
}


WPA2

network={
 ssid="NAME OF NETWORK"
 psk="PASSWORD"
 proto=RSN
 key_mgmt=WPA-PSK
 pairwise=CCMP
 auth_alg=OPEN
}

Interfaces

If you need a static IP you can use the /etc/network/interfaces file to refer to the wpa_supplicant configuration:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
address 192.168.1.60
netmask 255.255.255.0
gateway 192.168.1.1
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

Interfaces are then launched with ifup and ifdown -- eg. ifup wlan0 to open the wifi connection

References