From charlesreid1

Wifi Config for UGR Wifi Project

See the following repo, which has details of how to configure /etc/network/interfaces:

https://git.charlesreid1.com/rpi/pi-join-wifi

The basics:

Joining Unencrypted Wifi

This supposes you want to join a wifi network called MyWifiNetwork that is unencrypted. Add the following wireless network information to /etc/network/interfaces.d/widy.cfg, which is a config file specific to this wifi router that you can use to swap wifi network configurations in and out:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid OpenWrt

Next, include this config file in your /etc/network/interfaces file by adding the last line shown to it:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

source /etc/network/interfaces.d/mywifi.cfg

Once you get these two network configuration files squared away, the Raspberry Pi should join that wifi network on boot.

Joining Encrypted Wifi

To join an encrypted wifi, use a slightly different syntax for the config file. Call this securenet.cfg and put it in /etc/network/interfaces.d/securenet.cfg:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhp
wpa-ssid SecureNetwork
wpa-psk abcdefg123

Next, reference this file in the /etc/network/interfaces file the same way as for unsecured networks:

...

source /etc/network/interfaces.d/securenet.cfg

This should connect to the wifi network SecureNetwork automatically on boot.

Making Raspberry Pi a Hotspot

Debugging

If the wifi network is not connecting, or is not connecting on boot, check /var/log/syslog, which will contain a detailed error log from the network.

Flags