A Linux-based Wi-Fi Access Point setup automation tool that configures your system to create a virtual wireless access point using hostapd, dnsmasq, and iptables.
This project provides both automated and manual setup options for creating a wireless access point on Linux systems (tested on Debian/Ubuntu-based distributions). It creates a virtual interface (ap0) that operates alongside your existing wireless connection (wlan0), allowing your device to act as both a Wi-Fi client and access point simultaneously.
- Virtual Interface Creation: Creates a virtual
ap0interface without interfering with your primarywlan0connection - DHCP Server: Automatic IP address assignment for connected clients (192.168.50.50-150)
- NAT & Routing: Internet sharing from primary connection to access point clients
- WPA2 Security: Secure wireless network with custom SSID and password
- Persistent Configuration: Services and settings survive system reboots
- Linux system (Debian/Ubuntu-based)
- Wireless adapter supporting AP mode
- Root/sudo privileges
- Required packages:
hostapd,dnsmasq,iptables,iw
Run the setup script with your desired SSID and password:
chmod +x setup_ap.sh
./setup_ap.sh "YOUR_SSID" "YOUR_PASSWORD"Example:
./setup_ap.sh "MyAccessPoint" "SecurePassword123"For step-by-step manual configuration, refer to manuel_setup.txt which provides detailed instructions for:
- Installing required packages
- Creating virtual interface
- Configuring DHCP (dnsmasq)
- Configuring access point (hostapd)
- Setting up NAT and IP forwarding
- Making configurations persistent
- Access Point IP: 192.168.50.1
- DHCP Range: 192.168.50.50 - 192.168.50.150
- Subnet Mask: 255.255.255.0
- Lease Time: 12 hours
- Channel: 6 (2.4 GHz)
- Security: WPA2-PSK
- Virtual Interface: Creates
ap0as a virtual wireless interface - DHCP Server:
dnsmasqprovides IP addresses to connecting clients - Access Point:
hostapdmanages the wireless access point functionality - NAT & Routing:
iptablesrules enable internet sharing fromwlan0toap0 - IP Forwarding: Kernel parameter enables packet forwarding between interfaces
After setup, verify the access point is running:
# Check interface status
ip addr show ap0
# Check hostapd service
sudo systemctl status hostapd
# Check dnsmasq service
sudo systemctl status dnsmasq
# View connected clients
sudo iw dev ap0 station dump- Interface not created: Ensure your wireless adapter supports AP mode
iw list | grep "Supported interface modes" -A 8
- Services failing: Check logs
sudo journalctl -u hostapd -e sudo journalctl -u dnsmasq -e
- No internet on clients: Verify IP forwarding and iptables rules
cat /proc/sys/net/ipv4/ip_forward # Should output: 1 sudo iptables -t nat -L -n -v
setup_ap.sh- Automated setup scriptmanuel_setup.txt- Step-by-step manual configuration guideREADME.md- This file
This project is provided as-is for educational and practical purposes.
Contributions, issues, and feature requests are welcome!
- The setup requires both
wlan0(for internet connection) and createsap0(for access point) - Modifications may be needed for different network interfaces (e.g.,
wlan1instead ofwlan0) - Ensure your primary wireless connection is established before running the setup
- Some systems may require additional driver support for virtual interface creation