Creating Software Access Point like Connectify for Windows [hostapd + dnsmasq]

Published: by

  • Categories:

Android phones can't connect to Adhoc connections bu default. They need to be rooted and the default wpa_supplicant binary has to be replaced by a custom binary.

Linux seems to miss a "Connectify for Linux" but creating a software access point isn't that difficult.

This post is stolen from here and only contains the part which is important without overflowing the reader with the details.

First install the two packages, hostapd & dnsmasq. Ensure that your hostapd.conf looks similar to this.

ssid=shadyabhi's ThinkpadX220
max_num_sta=255 # max number of clients
wpa=2           # use WPA2
wpa_pairwise=TKIP CCMP

Uncomment the line conf-dir=/etc/dnsmasq.d in /etc/dnsmasq.conf that includes all the conf files from /etc/dnsmasq.d/. Create a file /etc/dnsmasq.d/dhcpd (create the folder if required) with the following contents.


Some final steps include giving ip to wlan0, enabling IP forwarding & adding a masquerade rule (replace eth0 with whatever interface has the default route).

sysctl net.ipv4.ip_forward=1 
ifconfig wlan0 #IP is this because our dns server will service ips from to with 12h lease time
iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE # setup NAT

I assume that everyone has left the past and now everyone uses systemd. Start the two daemons..

systemctl start hostapd.service
systemctl start dnsmasq.service

You should have a working Software Access Point by now! I told you, it wasn't that hard.

(You might want to add DAEMON_CONF=/etc/hostapd/hostapd.conf in /etc/default/hostapd in Ubuntu)

Well, this post shouldn't entirely be a copy of wiki so what if you want to see what all connects are your clients making in a pretty GUI, use iftop for that. Fireup the program with command $iftop -i wlan0 and you'll have pretty GUI like

If you want to see, what all IPs have been given by your DHCP server, checkout the file /var/lib/misc/dnsmasq.leases.

[root@archlinux shadyabhi]# cat /var/lib/misc/dnsmasq.leases
1353095739 31:32:33:34:0a:48 android-9asdc9de3c88b1d9 *
[root@archlinux shadyabhi]# 

The first column tells when was the lease given.