General settings for LAN and WLAN
EyeBot - Raspberry Pi Buster
T. Braunl, April 2022

General settings for LAN and WLAN
/etc/dhcpcd.conf

SSID and PASS
/etc/hostapd/hostapd.conf

Slave WLAN
/etc/wpa_supplicant/wpa_supplicant.conf 

-----------------------------------------
See info at:
https://www.raspberryconnect.com/projects/65-raspberrypi-hotspot-accesspoints/158-raspberry-pi-auto-wifi-hotspot-switch-direct-connection

WIFI SSID and Parameters:
/etc/hostapd/hostapd.conf

Pointing to .conf file (not required for Buster):
/etc/default/hostapd

Allow Hotspot Router functionality:
/etc/dnsmasq.conf

Source Interfaces  (currently EMPTY)
/etc/network/interfaces
  Add --> source-directory /etc/network/interfaces.d 

DHCP
/etc/dhcpcd.conf
  Add --> nohook wpa_supplicant

Auto Hotspot
/etc/systemd/system/autohotspot.service

Enable
sudo systemctl enable autohotspot.service

WIFI Script --- ALL AVAILABLE WIFI NETWORKS
/etc/wpa_supplicant/wpa_supplicant.conf

Hotspot Script
/usr/bin/autohotspot


===================================
/etc/hostapd/hostapd.conf
--> WLAN SSID will be automatically generated from MAC-Adress.

#2.4GHz setup wifi 80211 b,g,n
interface=wlan0
driver=nl80211
hw_mode=g
ssid=Pi-b4b1
channel=8
wmm_enabled=0
macaddr_acl=0
auth_algs=1
wpa=2
wpa_passphrase=raspberry
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
rsn_pairwise=CCMP

#80211n - Change GB to your WiFi country code
country_code=AU
ieee80211n=1
ieee80211d=1

-----------
/etc/dnsmasq.conf
--> Set to 10.1.1.2 .. 10.1.1.50

#AutoHotspot Config
#stop DNSmasq from using resolv.conf
no-resolv
#Interface to use
interface=wlan0
bind-interfaces
dhcp-range=10.0.0.50,10.0.0.150,12h
-----------

/etc/systemd/system/autohotspot.service

[Unit]
Description=Automatically generates an internet Hotspot when a valid ssid is not in range
After=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/autohotspot
[Install]
WantedBy=multi-user.target
----------------

/usr/bin/autohotspot
((long))
----------------

