Blog | G5 Cyber Security

Fake Wi-Fi Hotspot: Setup Guide

TL;DR

Yes, you can create a fake Access Point (AP) using your wireless card and software like hostapd and dnsmasq on Linux. This allows you to simulate a Wi-Fi network, potentially for testing or educational purposes. Be aware that creating a fake AP to intercept data is illegal in many jurisdictions. This guide focuses on the technical setup; ethical use is your responsibility.

Setting Up a Fake Access Point

  1. Check Your Wireless Card’s Capabilities: Not all wireless cards support AP mode (also known as Master Mode). Use
    iwconfig

    in the terminal. Look for ‘Mode: Managed, Master’. If you only see ‘Managed’, your card might not work.

    • If it says ‘Master’ or has multiple modes including ‘Master’, proceed to step 2.
    • If it doesn’t support AP mode, you may need a different wireless adapter.
  2. Install Required Software: You’ll need hostapd (for creating the access point) and dnsmasq (for providing DHCP and DNS services).
    sudo apt update
    sudo apt install hostapd dnsmasq
  3. Configure hostapd: Create a configuration file for your AP.
    sudo nano /etc/hostapd/hostapd.conf

    Add the following (adjust as needed):

    interface=wlan0
    driver=nl80211
    ssid=MyFakeWiFi
    hw_mode=g
    channel=6
    wpa=2
    wpa_passphrase=yourpassword
    wpa_key_mgmt=WPA-PSK
    auth_algs=1
    wpa_pairwise=TKIP CCMP
    rsn_pairwise=CCMP

    Replace wlan0 with your wireless interface name, MyFakeWiFi with the desired network name (SSID), and yourpassword with a strong password.

  4. Configure dnsmasq: Create a configuration file for dnsmasq.
    sudo nano /etc/dnsmasq.conf

    Add the following:

    interface=wlan0
    dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,12h
    dhcp-option=3,192.168.4.1
    dhcp-option=6,8.8.8.8,8.8.4.4

    Replace wlan0 with your wireless interface name.

  5. Enable IP Forwarding: Allow traffic to be routed through the AP.
    sudo sysctl -w net.ipv4.ip_forward=1

    To make this permanent, edit

    /etc/sysctl.conf

    and uncomment or add the line:

    net.ipv4.ip_forward=1

    , then run

    sudo sysctl -p
  6. Start the Access Point: Start hostapd and dnsmasq.
    sudo systemctl unmask hostapd
    sudo systemctl enable hostapd
    sudo service hostapd start
    sudo systemctl restart dnsmasq
  7. Bring Up the Wireless Interface: Ensure your wireless interface is up.
    sudo ifconfig wlan0 up

    Replace wlan0 with your wireless interface name.

  8. Test the Access Point: Connect to ‘MyFakeWiFi’ (or whatever SSID you chose) from another device. Check if it receives an IP address in the 192.168.4.x range and can access the internet (if configured).

Important Considerations

Exit mobile version