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
Information Howto: Getting Bluetooth (serial console) working on Debian pfeerick 14 9,283 08-19-2019, 04:33 AM
Last Post: Roverius
  [split] Better WiFi/BT module? moriel5 0 157 02-28-2019, 06:13 AM
Last Post: moriel5
  Schematics of Wifi/BT module gamelaster 7 801 09-11-2018, 02:02 PM
Last Post: gamelaster
  Installing another WiFi module on one of the buses mido2018 1 237 07-22-2018, 07:15 AM
Last Post: tllim
  Unable to activate wifi on Linux smouton 10 3,737 02-21-2018, 09:56 PM
Last Post: dkebler
  Pine64 doesn't recognize Wifi/BT Module clobeca 3 779 07-13-2017, 08:58 PM
Last Post: MarkHaysHarris777
  Better WiFi/BT module? fonix232 17 2,505 02-13-2017, 04:38 AM
Last Post: xalius
Sad wifi direct bj_jung 2 1,038 12-29-2016, 10:26 AM
Last Post: happytuna
  Enabling wifi c4tich 10 4,360 12-28-2016, 02:22 PM
Last Post: workaccountbro
  WIFI & Bluetooth? 7777777 14 8,685 12-24-2016, 05:01 AM
Last Post: Toriless

Forum Jump:


Users browsing this thread: 1 Guest(s)