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:05] hyphop [Go Online!] |
products:sbc:vim4:applications:wifi-sta-ap-mode [2025/02/19 02:32] (current) jacobe |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== VIM4 Wi-Fi STA/AP Mode ====== | + | ====== VIM4 Wi-Fi STA/AP Mode Configuration |
- | ===== Introduction | + | ===== 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 how to configure dual Wi-Fi mode using the provided script (v1.0), enabling simultaneous operation in: | ||
- | This documentation will introduce how to setup the Wi-Fi working on STA+AP mode at the same time. | + | STA+AP Mode: '' |
- | ==== Configuration Instructions ==== | + | ETH+AP Mode: '' |
- | Configure '' | + | ===== Prerequisites ===== |
+ | Root privileges required | ||
- | === Setup Wlan1 as a Hotspot === | + | Ensure wireless interfaces are properly identified: |
- | Setup '' | + | STA interface: |
- | == 2.4 GHz Frequency == | + | AP interface: '' |
- | For example, the following commands will create AP configuration named '' | + | Ethernet interface: |
+ | ===== Configuration Script Usage ===== | ||
+ | Run the script with root privileges: | ||
- | ```shell | + | ``` |
- | sudo nmcli con add type wifi ifname wlan1 mode ap con-name Hostspot ssid khadas_ap_2.4G | + | sudo khadas_ap.sh |
- | 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 == | ||
- | For example, the following commands will create AP configuration named '' | + | ==== Main Menu Options ==== |
- | + | ``` | |
- | ```shell | + | ======================================== |
- | sudo nmcli con add type wifi ifname wlan1 mode ap con-name Hostspot ssid khadas_ap_5G | + | WiFi Configuration Tool v1.0 |
- | sudo nmcli con modify Hostspot 802-11-wireless.band a | + | ======================================== |
- | sudo nmcli con modify Hostspot 802-11-wireless.channel 149 | + | 1. STA+AP Mode |
- | sudo nmcli con modify Hostspot 802-11-wireless-security.key-mgmt wpa-psk | + | 2. ETH+AP Mode |
- | sudo nmcli con modify Hostspot 802-11-wireless-security.proto rsn | + | 3. Stop All Services |
- | sudo nmcli con modify Hostspot 802-11-wireless-security.group ccmp | + | 4. Exit |
- | sudo nmcli con modify Hostspot 802-11-wireless-security.pairwise ccmp | + | ======================================== |
- | sudo nmcli con modify Hostspot 802-11-wireless-security.psk 12345678 | + | Please select an option [1-4]: |
- | sudo nmcli con modify Hostspot ipv4.method shared | + | |
- | sudo nmcli con up Hostspot | + | |
``` | ``` | ||
+ | 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< | + | |
- | inet 192.168.31.219 | + | |
- | 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 | + | |
- | wlan1: flags=4163< | + | 4.Exit - Quit the script |
- | inet 10.42.0.1 | + | |
- | inet6 fe80::6342: | + | ==== Configuration Steps ==== |
- | ether 12: | + | |
- | RX packets 1569 bytes 299041 (299.0 KB) | + | Select operation mode from menu |
- | RX errors 0 dropped 0 overruns 0 frame 0 | + | |
- | TX packets 3241 bytes 3693502 (3.6 MB) | + | For AP modes (1 or 2): |
- | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | + | |
+ | * Enter SSID for hotspot | ||
+ | | ||
+ | | ||
+ | | ||
+ | * Dnsmasq DHCP setup | ||
+ | | ||
+ | | ||
+ | |||
+ | ===== Verification ===== | ||
+ | Check interface status after configuration: | ||
+ | |||
+ | ``` | ||
+ | ifconfig wlan0 && ifconfig wlan1 | ||
``` | ``` | ||
+ | Verify internet connectivity (STA+AP mode): | ||
- | ===== Go Online! | + | ``` |
+ | 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 | ||
- | Verify that '' | ||
- | <WRAP info > | ||
- | You need to connect Wi-Fi first. | ||
</ | </ | ||
- | ```shell | + | ===== Technical Details ===== |
- | khadas@Khadas:~$ sudo ping -I wlan0 www.khadas.com | + | |
- | PING td-balancer-dc11-60-161.wixdns.net (185.230.60.161) from 192.168.124.80 wlan0: 56(84) bytes of data. | + | IP Configuration: |
- | 64 bytes from 185.230.60.161 (185.230.60.161): icmp_seq=1 ttl=240 time=293 ms | + | |
- | 64 bytes from 185.230.60.161 | + | * AP Static IP: 192.168.43.1/24 |
- | 64 bytes from 185.230.60.161 | + | * DHCP Range: |
- | ... | + | * DNS: Google DNS (8.8.8.8) via port 5353 |
+ | |||
+ | Security: | ||
+ | |||
+ | * WPA2-PSK encryption | ||
+ | * CCMP/AES cipher mandatory | ||
+ | |||
+ | Default channel: 6 | ||
+ | |||
+ | Dependencies: | ||
+ | |||
+ | * dnsmasq | ||
+ | * hostapd | ||
+ | * iptables (NAT forwarding) | ||
+ | |||
+ | ===== Troubleshooting ===== | ||
+ | |||
+ | AP Not Appearing: | ||
+ | |||
+ | Confirm '' | ||
+ | |||
+ | Check for conflicting services: | ||
``` | ``` | ||
+ | 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 | ||
+ | ``` |