This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
products:sbc:edge2:applications:wifi-sta-ap-mode [2023/05/20 04:35] nick |
products:sbc:edge2:applications:wifi-sta-ap-mode [2025/04/23 06:40] (current) nick |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Edge2 Wi-Fi AP Mode ====== | + | ====== Edge2 Wi-Fi STA/AP Mode Configuration |
| - | This documentation | + | ===== Download ===== |
| + | ``` | ||
| + | wget https:// | ||
| + | sudo chmod 777 khadas_ap.sh | ||
| + | sudo mv khadas_ap.sh / | ||
| + | ``` | ||
| + | We will add it in next version and users could also rebuild the image. | ||
| + | ===== Overview ===== | ||
| + | This guide explains | ||
| - | ===== Setup Wlan0 as a Hotspot ===== | + | STA+AP Mode: '' |
| - | ==== 2.4 GHz Frequency ==== | + | ETH+AP Mode: '' |
| - | For example, the following commands will create AP configuration named '' | + | ===== Prerequisites ===== |
| + | Root privileges required | ||
| - | ```shell | + | Ensure wireless interfaces are properly identified: |
| - | sudo nmcli con add type wifi ifname | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless.band bg | + | STA interface: '' |
| - | sudo nmcli con modify Hostspot 802-11-wireless.channel 1 | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.key-mgmt wpa-psk | + | AP interface: '' |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.proto rsn | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.group ccmp | + | Ethernet interface: '' |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.pairwise ccmp | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.psk 12345678 | + | ===== Configuration Script Usage ===== |
| - | sudo nmcli con modify Hostspot ipv4.addresses 192.168.2.1/ | + | Run the script with root privileges: |
| - | sudo nmcli con modify Hostspot ipv4.gateway 192.168.2.1 | + | |
| - | sudo nmcli con modify Hostspot ipv4.method shared | + | ``` |
| - | sudo nmcli con up Hostspot | + | sudo khadas_ap.sh |
| ``` | ``` | ||
| - | ==== 5 GHz Frequency ==== | ||
| - | For example, the following commands will create | + | ==== Main Menu Options ==== |
| + | ``` | ||
| + | ======================================== | ||
| + | WiFi Configuration Tool v1.0 | ||
| + | ======================================== | ||
| + | 1. STA+AP Mode | ||
| + | 2. ETH+AP Mode | ||
| + | 3. Stop All Services | ||
| + | 4. Exit | ||
| + | ======================================== | ||
| + | Please select an option [1-4]: | ||
| + | ``` | ||
| + | 1.STA+AP Mode - Recommended for most devices: creates NAT forwarding between | ||
| - | ```shell | + | 2.ETH+AP Mode - For devices with Ethernet port: creates NAT forwarding between '' |
| - | sudo nmcli con add type wifi ifname wlan0 mode ap con-name Hostspot ssid khadas_ap_5G | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless.band a | + | 3.Stop All Services |
| - | sudo nmcli con modify Hostspot 802-11-wireless.channel 149 | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.key-mgmt wpa-psk | + | 4.Exit - Quit the script |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.proto rsn | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.group ccmp | + | ==== Configuration Steps ==== |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.pairwise ccmp | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.psk 12345678 | + | Select operation mode from menu |
| - | sudo nmcli con modify Hostspot ipv4.addresses 192.168.2.1/24 | + | |
| - | sudo nmcli con modify Hostspot ipv4.gateway 192.168.2.1 | + | For AP modes (1 or 2): |
| - | sudo nmcli con modify Hostspot ipv4.method shared | + | |
| - | sudo nmcli con up Hostspot | + | * Enter SSID for hotspot |
| + | * Set password (WPA2-PSK required) | ||
| + | * Script automatically handles: | ||
| + | * Hostapd configuration | ||
| + | * Dnsmasq DHCP setup | ||
| + | * IP forwarding | ||
| + | * iptables NAT rules | ||
| + | |||
| + | ===== Verification ===== | ||
| + | Check interface status after configuration: | ||
| + | |||
| + | ``` | ||
| + | ifconfig wlan0 && ifconfig wlan1 | ||
| ``` | ``` | ||
| + | Verify internet connectivity (STA+AP mode): | ||
| - | Use '' | + | ``` |
| + | ping -I wlan0 google.com | ||
| + | ``` | ||
| + | Test hotspot access: | ||
| + | |||
| + | SSID: [Your configured SSID] | ||
| + | |||
| + | Password: [Your set password] | ||
| + | |||
| + | Client IP range: 192.168.43.2-254 | ||
| + | |||
| + | ===== Important Notes ===== | ||
| + | <WRAP important> | ||
| + | Edge2 Device Limitations: | ||
| + | |||
| + | No Ethernet interface ('' | ||
| + | |||
| + | ETH+AP Mode (Option 2) will not function | ||
| + | |||
| + | Use STA+AP Mode (Option 1) exclusively | ||
| + | |||
| + | </ | ||
| + | ===== Technical Details ===== | ||
| + | |||
| + | IP Configuration: | ||
| + | |||
| + | * AP Static IP: 192.168.43.1/ | ||
| + | * DHCP Range: 192.168.43.2-254 | ||
| + | * DNS: Google DNS (8.8.8.8) via port 5353 | ||
| + | |||
| + | Security: | ||
| + | |||
| + | * WPA2-PSK encryption | ||
| + | * CCMP/AES cipher mandatory | ||
| + | |||
| + | Default channel: 6 | ||
| + | |||
| + | Dependencies: | ||
| + | |||
| + | * dnsmasq (DHCP server) | ||
| + | * hostapd (AP configuration) | ||
| + | * iptables (NAT forwarding) | ||
| + | |||
| + | ===== Troubleshooting ===== | ||
| + | |||
| + | AP Not Appearing: | ||
| + | |||
| + | Confirm | ||
| + | |||
| + | Check for conflicting services: | ||
| - | ```shell | ||
| - | $ ifconfig | ||
| - | wlan0: flags=4163< | ||
| - | inet 192.168.2.1 | ||
| - | inet6 fda2: | ||
| - | inet6 fe80:: | ||
| - | inet6 fda2: | ||
| - | ether 10: | ||
| - | RX packets 4271 bytes 3725737 (3.7 MB) | ||
| - | RX errors 0 dropped 13 overruns 0 frame 0 | ||
| - | TX packets 1663 bytes 321613 (321.6 KB) | ||
| - | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
| ``` | ``` | ||
| + | ps aux | grep -E ' | ||
| + | ``` | ||
| + | No Internet Access: | ||
| - | ===== Verify | + | Verify |
| - | You connect to AP '' | + | ``` |
| + | iwconfig wlan0 | ||
| + | ``` | ||
| + | Check NAT rules: | ||
| + | ``` | ||
| + | iptables -t nat -L -n -v | ||
| + | ``` | ||
| + | DHCP Failures: | ||
| + | Confirm dnsmasq running: | ||
| + | |||
| + | ``` | ||
| + | systemctl status dnsmasq | ||
| + | ``` | ||