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


Messages In This Thread
Create a WiFi hotspot on Debian 8 - by JulianM - 03-19-2017, 04:36 PM
RE: Create a WiFi hotspot on Debian 8 - by tllim - 02-18-2019, 01:37 AM

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

Forum Jump:


Users browsing this thread: 1 Guest(s)