Create a WiFi hotspot on Debian 8
#1
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
My forum topics:
• Create a WiFi hotspot on Debian 8
• Turn your Pine64 into a music server with mpd
• Adjust brightness of LCD on Armbian Desktop with 1 click
• My cases for Pine64 (acryl, lego & wood)

• Pine 64 - DACH - Facebook page for german-speaking Pine64-fans.
  Reply
#2
Works fine on Rock64
  Reply
#3
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
  Reply
#4
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
My forum topics:
• Create a WiFi hotspot on Debian 8
• Turn your Pine64 into a music server with mpd
• Adjust brightness of LCD on Armbian Desktop with 1 click
• My cases for Pine64 (acryl, lego & wood)

• Pine 64 - DACH - Facebook page for german-speaking Pine64-fans.
  Reply
#5
(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
  Reply
#6
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
  Reply
#7
(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 
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Better WiFi/BT module? moriel5 3 5,850 05-18-2022, 01:55 PM
Last Post: moriel5
  WIFI/BT Power Supply / VBAT-EXT xalius 3 5,357 08-12-2021, 06:41 AM
Last Post: Luke490
  Better WiFi/BT module? fonix232 20 28,141 08-11-2021, 09:27 AM
Last Post: Jean-Marc LACROIX
  Wifi / Bluetooth Board Update S265 2 4,618 07-30-2020, 04:53 PM
Last Post: S265
Information Howto: Getting Bluetooth (serial console) working on Debian pfeerick 14 34,560 08-19-2019, 04:33 AM
Last Post: Roverius
  Schematics of Wifi/BT module gamelaster 7 10,929 09-11-2018, 02:02 PM
Last Post: gamelaster
  Installing another WiFi module on one of the buses mido2018 1 3,984 07-22-2018, 07:15 AM
Last Post: tllim
  Unable to activate wifi on Linux smouton 10 17,364 02-21-2018, 09:56 PM
Last Post: dkebler
  Pine64 doesn't recognize Wifi/BT Module clobeca 3 6,709 07-13-2017, 08:58 PM
Last Post: MarkHaysHarris777
Sad wifi direct bj_jung 2 5,919 12-29-2016, 10:26 AM
Last Post: happytuna

Forum Jump:


Users browsing this thread: 1 Guest(s)