This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
products:sbc:vim4:applications:wifi-sta-ap-mode [2023/02/17 11:08] hyphop |
products:sbc:vim4:applications:wifi-sta-ap-mode [2025/05/15 06:30] (current) nick |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== VIM4 Wi-Fi STA/AP Mode ====== | + | ====== VIM4 Wi-Fi STA/AP Mode Configuration |
| - | How to setup the Wi-Fi working on STA+AP | + | ===== Overview ===== |
| + | This guide explains how to configure dual Wi-Fi mode using the provided script (v1.0), enabling simultaneous operation in: | ||
| - | Configure | + | STA+AP Mode: '' |
| + | ETH+AP Mode: '' | ||
| - | ===== Setup Wlan1 as a Hotspot | + | ===== Prerequisites |
| - | Setup '' | + | Root privileges required |
| - | ==== 2.4 GHz Frequency ==== | + | Ensure wireless interfaces are properly identified: |
| - | For example, the following commands will create AP configuration named '' | + | STA interface: '' |
| + | AP interface: '' | ||
| - | ```shell | + | Ethernet interface: '' |
| - | sudo nmcli con add type wifi ifname wlan1 mode ap con-name Hostspot ssid khadas_ap_2.4G | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless.band bg | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless.channel 1 | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.key-mgmt wpa-psk | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.proto rsn | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.group ccmp | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.pairwise ccmp | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.psk 12345678 | + | |
| - | sudo nmcli con modify Hostspot ipv4.method shared | + | |
| - | sudo nmcli con up Hostspot | + | |
| - | ``` | + | |
| - | ==== 5 GHz Frequency | + | ===== Configuration Script Usage ===== |
| + | Run the script with root privileges: | ||
| + | |||
| + | ``` | ||
| + | sudo khadas_ap.sh | ||
| + | ``` | ||
| - | For example, the following commands will create AP configuration named '' | ||
| - | ```shell | + | ==== Main Menu Options ==== |
| - | sudo nmcli con add type wifi ifname wlan1 mode ap con-name Hostspot ssid khadas_ap_5G | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless.band a | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless.channel 149 | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.key-mgmt wpa-psk | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.proto rsn | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.group ccmp | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.pairwise ccmp | + | |
| - | sudo nmcli con modify Hostspot 802-11-wireless-security.psk 12345678 | + | |
| - | sudo nmcli con modify Hostspot ipv4.method shared | + | |
| - | sudo nmcli con up Hostspot | + | |
| ``` | ``` | ||
| + | ======================================== | ||
| + | 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 '' | ||
| - | Use '' | + | 2.ETH+AP Mode - For devices with Ethernet port: creates NAT forwarding between |
| - | ```shell | + | 3.Stop All Services - Terminates AP/DHCP/NAT services |
| - | $ ifconfig | + | |
| - | wlan0: flags=4163< | + | 4.Exit - Quit the script |
| - | inet 192.168.31.219 | + | |
| - | inet6 fda2: | + | ==== Configuration Steps ==== |
| - | inet6 fe80:: | + | |
| - | inet6 fda2: | + | Select operation mode from menu |
| - | ether 10: | + | |
| - | RX packets 4271 bytes 3725737 (3.7 MB) | + | For AP modes (1 or 2): |
| - | RX errors 0 dropped 13 overruns 0 frame 0 | + | |
| - | TX packets 1663 bytes 321613 (321.6 KB) | + | * Enter SSID for hotspot |
| - | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | + | |
| + | | ||
| + | | ||
| + | * Dnsmasq DHCP setup | ||
| + | * IP forwarding | ||
| + | | ||
| + | |||
| + | ===== Verification ===== | ||
| + | Check interface status after configuration: | ||
| - | wlan1: flags=4163< | ||
| - | inet 10.42.0.1 | ||
| - | inet6 fe80:: | ||
| - | ether 12: | ||
| - | RX packets 1569 bytes 299041 (299.0 KB) | ||
| - | RX errors 0 dropped 0 overruns 0 frame 0 | ||
| - | TX packets 3241 bytes 3693502 (3.6 MB) | ||
| - | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
| ``` | ``` | ||
| + | ifconfig wlan0 && ifconfig wlan1 | ||
| + | ``` | ||
| + | Verify internet connectivity (STA+AP mode): | ||
| - | ===== Go Online! ===== | + | ``` |
| + | ping -I wlan0 google.com | ||
| + | ``` | ||
| + | Test hotspot access: | ||
| - | Verify that '' | + | 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 | ||
| - | <WRAP info > | ||
| - | You need to connect Wi-Fi first. | ||
| </ | </ | ||
| + | ===== 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 | ||
| - | khadas@Khadas: | ||
| - | PING td-balancer-dc11-60-161.wixdns.net (185.230.60.161) from 192.168.124.80 wlan0: 56(84) bytes of data. | ||
| - | 64 bytes from 185.230.60.161 (185.230.60.161): | ||
| - | 64 bytes from 185.230.60.161 (185.230.60.161): | ||
| - | 64 bytes from 185.230.60.161 (185.230.60.161): | ||
| - | ... | ||
| ``` | ``` | ||
| + | ps aux | grep -E ' | ||
| + | ``` | ||
| + | No Internet Access: | ||
| - | Verify | + | Verify |
| - | * Name: 2.4G/'' | + | |
| - | * Password:'' | + | |
| + | ``` | ||
| + | iwconfig wlan0 | ||
| + | ``` | ||
| + | Check NAT rules: | ||
| + | |||
| + | ``` | ||
| + | iptables -t nat -L -n -v | ||
| + | ``` | ||
| + | DHCP Failures: | ||
| + | |||
| + | Confirm dnsmasq running: | ||
| + | |||
| + | ``` | ||
| + | systemctl status dnsmasq | ||
| + | ``` | ||