Sample Header Ad - 728x90

Simultaneous wlan0 & wlan1 access points (via hostapd)

7 votes
1 answer
2486 views
I am trying to set up 2 wireless access points from linux device (Debian Jessy). Both AP's should work simultaneously & share Internet connection (as shown below).
    _____       ___________ 
    |   | eth0 |           | wlan0(AccessPoint 2.5G) 
    |box|-----WLAN0_Stick WLAN1_Stick 
My initial config (hostapd & dnsmasq) for single wlan0 (AccessPoint 2.5G) 

**/etc/hostapd.conf**
    # Define interface
    interface=wlan0
    # Select driver
    driver=nl80211
    # Set access point name
    ssid=AP-wifi-2G
    # Set access point harware mode to 802.11g
    hw_mode=g
    # Set WIFI channel (can be easily changed)
    channel=6
    # Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
    wpa=2
    wpa_passphrase=wifi123456
**/etc/dnsmasq.conf**
    # Bind to only one interface
    bind-interfaces
    # Choose interface for binding
    interface=wlan0
    # Specify range of IP addresses for DHCP leasses
    dhcp-range=192.168.150.2,192.168.150.10
In order to initialize AP1 I use following bash-script **start.sh**
    !/bin/bash
    # Start
    # Configure IP address for WLAN
    sudo ifconfig wlan0 192.168.150.1
    # Start DHCP/DNS server
    sudo service dnsmasq restart
    # Enable routing
    sudo sysctl net.ipv4.ip_forward=1
    # Enable NAT
    sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    # Run access point daemon
    sudo hostapd /etc/hostapd.conf
    # Stop
    # Disable NAT
    sudo iptables -D POSTROUTING -t nat -o eth0 -j MASQUERADE
    # Disable routing
    sudo sysctl net.ipv4.ip_forward=0
    # Disable DHCP/DNS server
    sudo service dnsmasq stop
This config works fine for single AP (wlan0, AccessPoint 2.5G) I added the 2nd config /etc/hostapd_5G.conf for wlan1 similar as /etc/hostapd.conf & changed dnsmasq.conf & start.sh (wlan0->wlan1 for testing) - it also worked good in 5G. But I need to run wlan0 AP & wlan1 AP simultaneously. I think I need to modify dnsmasq.conf for second interface. But I don't know how to do this. Anyone please help with simultaneous configuration (wlan0 AP & wlan1 AP).
Asked by Milena Jelasova (71 rep)
Jun 10, 2017, 02:00 PM
Last activity: Jul 9, 2025, 06:04 PM