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

I did tried it many times on my Banana pi M2 zero, each time at the end I get an error about a port 53 already in us. I really stocked now. I’m running the latest bullseye on it. Armbian_22.11.0-trunk_Bananapim2zero_bullseye_edge_6.0.9.img

this tutorial is for bananapi bsp image, you should try armbian-config to set the hotspot