Skip to content
TrySitePrice

Debian / Ubuntu Linux: Setup Wireless Access Point (WAP) with Hostapd

Best/Tutorial

Here's an overview of the steps to set up a wireless access point (WAP) with hostapd on Debian or Ubuntu Linux:

  1. Install hostapd and its dependencies:
 
sudo apt-get update
sudo apt-get install hostapd dnsmasq
  1. Configure hostapd:

Create a new configuration file for hostapd, for example at "/etc/hostapd/hostapd.conf". Add the following lines to the file, replacing "ssid" and "password" with the desired values:

 
interface=wlan0
driver=nl80211
ssid=YourSSIDrnhw_mode=grnchannel=6
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=YourPasswordrnwpa_key_mgmt=WPA-PSKrnwpa_pairwise=TKIPrnrsn_pairwise=CCMP
  1. Configure dnsmasq:

Create a new configuration file for dnsmasq, for example at "/etc/dnsmasq.conf". Add the following lines to the file:

 
interface=wlan0
listen-address=127.0.0.1
bind-interfacesrnserver=8.8.8.8
domain-neededrnbogus-privrndhcp-range=192.168.50.50,192.168.50.150,12h
  1. Start hostapd:
 
sudo hostapd /etc/hostapd/hostapd.conf
  1. Start dnsmasq:
 
sudo service dnsmasq start
  1. Configure the network interface:
 
sudo ifconfig wlan0 192.168.50.1
  1. Enable IP forwarding:
 
sudo sysctl net.ipv4.ip_forward=1
  1. Set up NAT:
 
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADErnsudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPTrnsudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

After completing these steps, your WAP should be up and running. You can verify by connecting to the WAP from another device and checking the network connection.