PINE64
Create a WiFi hotspot on Debian 8 - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=4)
+--- Forum: Pine A64 Hardware, Accessories and POT (https://forum.pine64.org/forumdisplay.php?fid=32)
+---- Forum: Wifi/BT Module (https://forum.pine64.org/forumdisplay.php?fid=33)
+---- Thread: Create a WiFi hotspot on Debian 8 (/showthread.php?tid=4383)



Create a WiFi hotspot on Debian 8 - JulianM - 03-19-2017

Hello together!

I tried something to create a WiFi hotspot with officially WiFi/bluetooth module by pine64 via ethernet and this is my solution.
Feel free to discuss about this topic Smile

Note: The WiFi hotspot is using the internet connection via ethernet. I wasn't able to bridge the internet connection from wlan0 to wlan1!
Note 2: I haven't installed NetworkManager on my system. NetworkManager can be responsible for problems with these instructions.



Install hostapd (create a hotspot), dnsmasq (dhcp server) and iptables-persistent (firewall settings)
Code:
apt-get install hostapd dnsmasq iptables-persistent



Change the config of hostapd
/etc/hostapd/hostapd.conf
Code:
interface=wlan0
driver=nl80211
ssid=MyPrivateHotspot
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=MyVeryStrongPassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP



Change the config of dnsmasq
/etc/dnsmasq.conf
Code:
no-resolv
interface=wlan0
dhcp-range=10.0.0.3,10.0.0.20,12h
server=8.8.8.8
server=8.8.4.4
Restart dnsmasq to apply the new config
Code:
/etc/init.d/dnsmasq restart



Activate forwarding of IPv4
/etc/sysctl.conf
Code:
Just uncomment the following line:
net.ipv4.ip_forward=1
Apply it without reboot with the following command:
Code:
sysctl -w net.ipv4.ip_forward=1



Setup the network configuration
/etc/network/interfaces
Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
        pre-up iptables-restore < /etc/network/iptables.rules

iface wlan1 inet manual

auto wlan0
iface wlan0 inet static
        address 10.0.0.1
        broadcast 10.0.0.255
        netmask 255.255.255.0
And restart the network:
Code:
/etc/init.d/networking restart



Apply iptables rules
Code:
iptables -A FORWARD -o eth0 -i wlan0 -s 10.0.0.1/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 



Save the iptables rules
Code:
iptables-save > /etc/network/iptables.rules



Create the WiFi hotspot
Code:
hostapd /etc/hostapd/hostapd.conf



You're done!


Best regards
Julian


RE: Create a WiFi hotspot on Debian 8 - S3phi40T - 03-14-2018

Works fine on Rock64


RE: Create a WiFi hotspot on Debian 8 - waqasnasir - 02-13-2019

I have to set up a web server on the SBC so that when it runs , it creates a hotspot around it and the client phones or tablets can connect to access the web-resources present on the webserver.
I am a newbie, please guide me how can i set it up?
I will be using this setup in the environment with no internet connectivity.
Help me out by guiding me to the right direction.
Thank you


RE: Create a WiFi hotspot on Debian 8 - JulianM - 02-13-2019

Hi waqasnasir,

just create the hotspot as explained and install your favourite webserver.
Change ip-address of the webserver to your local network (like 192.168.0.1) and that's it - nothing special.

There is a ton of tutorials for installing a webserver Smile

Best regards
Julian


RE: Create a WiFi hotspot on Debian 8 - tllim - 02-18-2019

(02-13-2019, 11:37 AM)JulianM Wrote: Hi waqasnasir,

just create the hotspot as explained and install your favourite webserver.
Change ip-address of the webserver to your local network (like 192.168.0.1) and that's it - nothing special.

There is a ton of tutorials for installing a webserver Smile

Best regards
Julian

Hi Julian,

Glad to "see" you again :-)

... TL


RE: Create a WiFi hotspot on Debian 8 - imjtrial@gmail.com - 03-08-2019

I bought ROCK64 USB WIFI 802.11B/G/N (RTL8188EU) form Pine64

but I follow this guide but got errot

hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Line 2: invalid/unknown driver 'nl80211'
1 errors found in configuration file '/etc/hostapd/hostapd.conf'
Failed to set up interface with /etc/hostapd/hostapd.conf
Failed to initialize interface

Which driver should I fill on hostapd.conf
and if I do need a driver, where and how to get it

THANKS


RE: Create a WiFi hotspot on Debian 8 - waqasnasir - 03-10-2019

(02-13-2019, 11:37 AM)JulianM Wrote: Hi waqasnasir,

just create the hotspot as explained and install your favourite webserver.
Change ip-address of the webserver to your local network (like 192.168.0.1) and that's it - nothing special.

There is a ton of tutorials for installing a webserver Smile

Best regards
Julian


Thank you Julian, 
I will try the solution. 
My scenarios is however little different. I have to use the setup in the environment where there will be no LAN and no Wifi connection.  So the Rock64 or Rockpro64 will be able to generate an Access point with its own SSID that the other mobile devices can connect to to access the Webserver resources. 

The whole setup will run in villages in an offline state ..  Internet will not be there and is not at all required..

At the moment, I have both Rock64 and Rockpro64 with configured web server and running smoothly.  Both can connect to Wifi as well.  
I have a portable battery operated Access Point (Seperate hardware) , that can create an SSID and i am able to connect the ROCKs to it and the mobile devices are connected to the same SSID and can access the resources on the Webserver. 

I am trying to find a way to get rid of the hardware Access Point and make the setup smaller where the ROCKS can generate their own SSID for the mobile devices to connect to. 
That need lead me to your page while i was searching for a software based access point / hotspot solution. 

After reading the above details, do you think that the tutorial can work in my scenario, or what you suggest ?  I am just one step away for success in my project ..  
Also please mentioned ( as per your knowledge ) whether the software based hotspot or Access point has simultaneous connections limit or not ?  May be in my situation, around 50, 60 mobile devices will try to connect to the SSID at the same time. 
The hardware Access Point , theoretically can connect to 256 devices simultanously, but i am not sure about the scenario of software based Hotspot/Access Point. 

Thank you .. 
Regards
Waqas