Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:common:applications:wifi-sta-ap-mode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
products:sbc:common:applications:wifi-sta-ap-mode [2022/06/30 02:31]
nick ↷ Page name changed from products:sbc:common:applications:wifi_sta_ap_mode to products:sbc:common:applications:wifi-sta-ap-mode
products:sbc:common:applications:wifi-sta-ap-mode [2025/02/19 02:32] (current)
jacobe
Line 1: Line 1:
-Wi-Fi STA/AP Mode+====== VIMs Wi-Fi STA/AP Mode Configuration ====== 
 + 
 +===== Download ===== 
 +``` 
 +wget https://raw.githubusercontent.com/khadas/fenix/refs/heads/master/archives/filesystem/common/usr/local/bin/khadas_ap.sh 
 +sudo chmod 777 khadas_ap.sh 
 +sudo mv khadas_ap.sh /usr/local/bin 
 +``` 
 +We will add it in next version and users could also rebuild the image. 
 +===== Overview ===== 
 +This guide explains how to configure dual Wi-Fi mode using the provided script (v1.0), enabling simultaneous operation in: 
 + 
 +STA+AP Mode: ''wlan0'' as STA (connects to existing Wi-Fi) + ''wlan1'' as AP (creates hotspot) 
 + 
 +ETH+AP Mode: ''eth0'' as Ethernet uplink + ''wlan1'' as AP (//Note: Not available on Edge2 devices//
 + 
 +===== Prerequisites ===== 
 + 
 +Root privileges required 
 + 
 +Ensure wireless interfaces are properly identified: 
 + 
 +STA interface: ''wlan0'' 
 + 
 +AP interface: ''wlan1'' 
 + 
 +Ethernet interface: ''eth0'' (not present on Edge2) 
 + 
 +===== Configuration Script Usage ===== 
 +Run the script with root privileges: 
 + 
 +``` 
 +sudo khadas_ap.sh 
 +``` 
 + 
 + 
 +==== 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 ''wlan0'' (STA) and ''wlan1'' (AP), requires existing Wi-Fi connection on ''wlan0'', hotspot IP: ''192.168.43.1'' (DHCP range: 192.168.43.2-254) 
 + 
 +2.ETH+AP Mode - For devices with Ethernet port: creates NAT forwarding between ''eth0'' and ''wlan1''//Not functional on Edge2 devices// (no eth0 interface). Same hotspot IP range as STA+AP mode 
 + 
 +3.Stop All Services - Terminates AP/DHCP/NAT services 
 + 
 +4.Exit - Quit the script 
 + 
 +==== Configuration Steps ==== 
 + 
 +Select operation mode from menu 
 + 
 +For AP modes (1 or 2): 
 + 
 +  * 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): 
 + 
 +``` 
 +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 (''eth0''
 + 
 +ETH+AP Mode (Option 2) will not function 
 + 
 +Use STA+AP Mode (Option 1) exclusively 
 + 
 +</WRAP> 
 +===== Technical Details ===== 
 + 
 +IP Configuration: 
 + 
 +  * AP Static IP: 192.168.43.1/24 
 +  * 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 ''wlan1'' interface exists 
 + 
 +Check for conflicting services: 
 + 
 +``` 
 +ps aux | grep -E 'hostapd|dnsmasq' 
 +``` 
 +No Internet Access: 
 + 
 +Verify STA connection: 
 + 
 +``` 
 +iwconfig wlan0 
 +``` 
 +Check NAT rules: 
 + 
 +``` 
 +iptables -t nat -L -n -v 
 +``` 
 +DHCP Failures: 
 + 
 +Confirm dnsmasq running: 
 + 
 +``` 
 +systemctl status dnsmasq 
 +```
Last modified: 2022/06/30 02:31 by nick