Creating Wifi Access Point on BrainyPi

Steps to create Wifi Access point on BrainyPi.

  1. Steps that followed are:
    1. install hostapd and dnsmasq

      # Install hostapd and dnsmasq
      sudo apt update
      sudo apt install dnsmasq hostapd
      # Disable hostapd and dnsmasq
      sudo systemctl stop dnsmasq
      sudo systemctl stop hostapd
      
    2. configure dhcpd

      sudo nano /etc/dhcpcd.conf
      
      • add the lines
        interface wlan0
            static ip_address=192.168.4.1/24
            nohook wpa_supplicant
        
      sudo service dhcpcd restart
      
    3. configure dnsmasq

      sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
      sudo nano /etc/dnsmasq.conf
      
      • add lines
        interface=wlan0
        dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
        
      sudo systemctl start dnsmasq
      
    4. configure hostapd

      • edit file sudo nano /etc/default/hostapd
      • add line DAEMON_CONF="/etc/hostapd/hostapd.conf"
      • edit file sudo nano /etc/hostapd/hostapd.conf
      • add lines
        interface=wlan0
        driver=nl80211
        ssid=BrainyPi
        hw_mode=g
        channel=6
        ieee80211n=1
        wmm_enabled=1
        ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
        macaddr_acl=0
        auth_algs=1
        ignore_broadcast_ssid=0
        wpa=2
        wpa_key_mgmt=WPA-PSK
        wpa_passphrase=Admin@123
        rsn_pairwise=CCMP
        
      • start hostapd
        sudo systemctl unmask hostapd
        sudo systemctl enable hostapd
        sudo systemctl start hostapd
        
    5. configure Packet forwarding

      • edit file sudo nano /etc/sysctl.conf

      • add line net.ipv4.ip_forward=1

      • set iptable rules

        sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE  
        sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
        sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
        
      • save the iptable rules

        sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
        
      • restore the iptable rules on startup

        • edit file sudo nano /etc/rc.local
        • add line iptables-restore < /etc/iptables.ipv4.nat above exit
    6. reboot brainypi, run command sudo reboot

    7. wireless access point is ready.

References

  1. Create wireless access point | The Raspberry Pi Guide
  2. Setting up a Raspberry Pi 3 as an Access Point - SparkFun Learn
1 Like

Hi yogesh,
I was trying to create access point. I did same procedure as mentioned but not having luck to start access point. I did os update in past.

Hi @dnyanee47 ,

I tried the same steps on the latest release of Rbian OS v0.7.2-beta , and was able to create a Wifi access point.

You can check the version of the Rbian by running the command

os-version

There is one change that , I did was in Step 5, instead of adding the line iptables-restore < /etc/iptables.ipv4.nat above exit, I added the line after systemctl restart sshd

Please try this and let me know if this solves for you. If even after this Wifi access point is not getting created then please try running the command

sudo systemctl restart hostapd

See if the Wifi access point gets created.