Mutt
Professional
- Messages
- 1,371
- Reaction score
- 914
- Points
- 113
Fake Wi-Fi hotspots are created to bypass anti-fraud systems that check geolocation against neighboring Wi-Fi hotspots. To set up a fake Wi-Fi hotspot (e.g. for testing or creating a honeypot) on a Raspberry Pi, you can use tools such as hostapd and dnsmasq. Below is a step-by-step guide for setting up using a Raspberry Pi (using Raspberry Pi OS as an example). Make sure you have a Wi-Fi adapter that supports Access Point mode.
If you have any questions or problems with the settings, write and I will help!
Requirements:
- Raspberry Pi with an OS installed (e.g. Raspberry Pi OS).
- A Wi-Fi adapter that supports AP mode (e.g. built-in Wi-Fi on Raspberry Pi 3/4 or an external USB adapter).
- Superuser rights (sudo).
- Connect to the Internet (for example, via Ethernet or a second Wi-Fi adapter if you want to distribute the Internet).
Step 1: Update your system
- Connect to your Raspberry Pi (via SSH or terminal).
- Run the commands to update the system:
Bash:sudo apt update sudo apt upgrade -y
Step 2: Install the required packages
Install hostapd (to create an access point) and dnsmasq (for DHCP and DNS):
Bash:
sudo apt install hostapd dnsmasq -y
Step 3: Setting up the Wi-Fi adapter
- Make sure your Wi-Fi adapter supports AP mode. Check this with:
Bash:iw list
- If you are using built-in Wi-Fi (eg wlan0), temporarily disable its management:
Bash:sudo systemctl stop dhcpcd sudo nmcli radio wifi off
Step 4: Configure hostapd
- Create a configuration file for hostapd:
Bash:sudo nano /etc/hostapd/hostapd.conf
- Add the following settings (replace wlan0 with your interface if different):
Code:interface=wlan0 driver=nl80211 ssid=FakeWiFi hw_mode=g channel=6 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=YourPassword wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
- ssid: the name of your fake Wi-Fi hotspot.
- wpa_passphrase: password for connection (at least 8 characters).
- channel: Wi-Fi channel (1-13, choose the least busy one).
- Specify the path to the configuration file:
Bash:sudo nano /etc/default/hostapd
Code:DAEMON_CONF="/etc/hostapd/hostapd.conf"
Step 5: Configure dnsmasq
- Create a configuration file for dnsmasq:
Bash:sudo nano /etc/dnsmasq.conf
- Add the following lines:
Code:interface=wlan0 dhcp-range=192.168.1.2,192.168.1.100,12h
- Set up a static IP for the Wi-Fi interface:
Bash:sudo nano /etc/dhcpcd.conf
Code:interface wlan0 static ip_address=192.168.1.1/24 nohook wpa_supplicant
- Restart dhcpcd:
Bash:sudo systemctl restart dhcpcd
Step 6: Enable Routing (Optional)
If you want devices connected to the fake access point to have access to the Internet (via Ethernet or another interface), set up routing:- Enable packet forwarding:
Bash:sudo nano /etc/sysctl.conf
Bash:net.ipv4.ip_forward=1
- Apply changes:
Bash:sudo sysctl -p
- Configure NAT using iptables (replace eth0 with your internet interface):
Bash:sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
- Save the iptables rules:
Bash:sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
Bash:sudo nano /etc/rc.local
Bash:iptables-restore < /etc/iptables.ipv4.nat
Step 7: Start the services
- Start hostapd and dnsmasq:
Bash:sudo systemctl unmask hostapd sudo systemctl enable hostapd sudo systemctl start hostapd sudo systemctl enable dnsmasq sudo systemctl start dnsmasq
- Reboot your Raspberry Pi to check:
Bash:sudo reboot
Step 8: Verification
- After rebooting, find the FakeWiFi network on your device (eg smartphone).
- Connect using the specified password (YourPassword).
- Make sure your device has an IP address (e.g. 192.168.1.x) and, if necessary, internet access.
Additional tips
- Logging connections: To analyze connections to the fake access point, you can set up logging in dnsmasq or use tools such as tcpdump:
Bash:sudo tcpdump -i wlan0
- Security: If this is a honeypot, make sure the access point is isolated from your main network to minimize risks.
- Wi-Fi Channel: Use a tool like iwlist wlan0 scan to select the least crowded channel.
If you have any questions or problems with the settings, write and I will help!