Proper Hotspot setup

After a while of trail and error, I have finally found how to ‘properly’ set up a hotspot for the BPi-M2 Magic.

Please note that I’m just a beginner with this stuff, so if you have any tips, let me know.

1. Install hostapd and dnsmasq:

apt install hostapd dnsmasq

2. Edit /etc/hostapd/hostapd.conf

nano /etc/hostapd/hostapd.conf

so that the file looks like:

interface=wlan0
driver=nl80211
country_code=NL
ssid=TEST
hw_mode=g
channel=6
wpa=2
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0

3. Start the hostapd service

service hostapd start

4. Add hostapd to boot

update-rc.d hostapd enable

5. Edit NetworkManager so it doesn’t interfere with our network adapter (wlan0) (Find the mac address by using ifconfig, and change that in the following lines)

nano /etc/NetworkManager/conf.d/10-ignore-interfaces.conf

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=mac:00:00:00:00:00:00

6. Restart networking service:

systemctl restart networking

7. Edit the following file to enable AP Mode with our adapter

nano /var/lib/bananapi/bpi-init.d/S10-bpi-hw-wifi.sh

Make sure to change the file as such the line under bpi-m2m) looks like:

  bpi-r18-avs)
    modprobe bcmdhd
    ;;
  bpi-m2m)
    modprobe bcmdhd op_mode=2 firmware_path=/lib/firmware/ap6212/fw_bcm43438a1.bin
    ;;
  bpi-m2u)
    modprobe bcmdhd
    ;;

8. Edit dnsmasq config file:

nano /etc/dnsmasq.conf

interface=wlan0
dhcp-range=10.0.0.2,10.0.0.5,255.255.255.0,12h

9. Add this to the following network file:

nano /etc/network/interfaces

auto wlan0
iface wlan0 inet static
  address 10.0.0.1
  netmask 255.255.255.0

10. Start dnsmasq service:

service dnsmasq start

11. Add dnsmasq to start at boot

update-rc.d dnsmasq enable

12. Reboot device

reboot

1 Like