Difference between revisions of "WiFi"
(Created page with "Category:RaspiOS Category:Networking == Configuration == When configuring the raspberry pi headless or when using a Lite version without an X server, use Uses Unix...") |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:RaspiOS]] | [[Category:RaspiOS]] | ||
[[Category:Networking]] | [[Category:Networking]] | ||
+ | [[Category:Configuration]] | ||
== Configuration == | == Configuration == | ||
When configuring the raspberry pi headless or when using a Lite version without an X server, use [[Uses Unix Library::wpa_supplicant]], configuration file located at <code>/etc/wpa_supplicant/wpa_supplicant.conf</code>, to configure it. | When configuring the raspberry pi headless or when using a Lite version without an X server, use [[Uses Unix Library::wpa_supplicant]], configuration file located at <code>/etc/wpa_supplicant/wpa_supplicant.conf</code>, to configure it. | ||
+ | |||
+ | '''Note:''' you can also create the <code>wpa_supplicant.conf</code> 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: | All configurations need preamble like this at the top of the configuration: | ||
Line 14: | Line 17: | ||
</pre> | </pre> | ||
− | === WEP === | + | === WEP/Auto === |
The simplest configuration is something like... | The simplest configuration is something like... | ||
Line 24: | Line 27: | ||
network={ | network={ | ||
− | |||
ssid="NAME OF NETWORK" | ssid="NAME OF NETWORK" | ||
psk="PASSWORD" | psk="PASSWORD" | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
+ | This is the entry that is generated by using <code>raspi-config</code> | ||
=== WPA === | === WPA === | ||
Line 51: | Line 55: | ||
key_mgmt=WPA-PSK | key_mgmt=WPA-PSK | ||
pairwise=CCMP | pairwise=CCMP | ||
− | |||
auth_alg=OPEN | auth_alg=OPEN | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
+ | == Interfaces == | ||
+ | |||
+ | If you need a static IP you can use the <code>/etc/network/interfaces</code> file to refer to the wpa_supplicant configuration: | ||
+ | |||
+ | <pre> | ||
+ | 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 | ||
+ | </pre> | ||
+ | |||
+ | Interfaces are then launched with <code>ifup</code> and <code>ifdown</code> -- eg. <code>ifup wlan0</code> to open the wifi connection | ||
== References == | == References == | ||
− | * https://forums.raspberrypi.com/viewtopic.php?f=28&t=50312 | + | * [[Cites URL::https://forums.raspberrypi.com/viewtopic.php?f=28&t=50312]] |
− | * https://coderwall.com/p/v290ta/raspberry-pi-wifi-setup-with-wpa2-psk-aes | + | * [[Cites URL::https://coderwall.com/p/v290ta/raspberry-pi-wifi-setup-with-wpa2-psk-aes]] |
+ | * [[Cites URL::https://www.raspberrypi.com/documentation/computers/configuration.html#adding-the-network-details-to-your-raspberry-pi]] - See also for encrypting stored passkeys |
Latest revision as of 23:18, 28 December 2021
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