I’ve pretty much followed this guide, but I
slighty modified the config files to make the configuration easier.
First thing to do is to disable our Wi-Fi interface from Network-Manager:
We can do that by adding the access point mac address to
and then we can restart the NetworkManager with
service NetworkManager restart
Hostapd is an access point software you can use to turn your Wi-Fi adapter to an hotspot.
After installing Hostapd with
apt-get install hostapd we must create a config file for it:
interface=wlan0 driver=nl80211 ssid=basic channel=1 auth_algs=1 wpa=2 wpa_key_mgmt=WPA-PSK wpa_pairwise=CCMP wpa_passphrase=testpw12345
Where the interface is my wi-fi interface (you can see what is yours using
iwconfig), the driver is a generic driver which works with most wi-fi cards, and finally I choose as my Wi-Fi ssid “basic”
and WPA2 encryption with “testpw12345” as a password.
You can do all sorts of things with hostapd settings, as shown in “site” and “site”
I do not changed anything from the original guide
apart not using a dns_entries file because I didn’t need one.
So after installing dnsmasq (
apt-get install dnsmasq) I created the config file and saved it in /etc/dnsmasq.d/hotspot.conf:
interface=wlan0 dhcp-range=10.0.0.10,10.0.0.100,8h dhcp-option=3,10.0.0.1 dhcp-option=6,10.0.0.1 server=22.214.171.124 log-queries log-dhcp
Then we need to enable reading of this new config file in
/etc/dnsmasq.conf by uncommenting line containing
I created an automated script which starts all the services I need and wait for a Ctrl-C to close the hotspot.
You can find the source code, and the config files here.
If you prefer to set up the hotspot manually the commands are:
Assign an IP to our Wi-Fi interface:
ifconfig wlan0 10.0.0.1/24 up
dnsmasq -C /etc/dnsmasq.conf
Setting up IP forwanding to the other interface (eth0 in my case):
sysctl -w net.ipv4.ip_forward=1
iptables -P FORWARD ACCEPT
iptables --table nat -A POSTROUTING -o eth0 -j MASQUERADE
hostapd /etc/hostapd.conf -B
This is the most commond errors that happened during my tests: