Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


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

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
products:sbc:vim4:applications:wifi-sta-ap-mode [2022/07/05 04:19]
frank fixup syntax error
products:sbc:vim4:applications:wifi-sta-ap-mode [2023/02/17 11:05]
hyphop [Go Online!]
Line 1: Line 1:
-====== Wi-Fi STA/AP Mode ======+====== VIM4 Wi-Fi STA/AP Mode ======
  
 ===== Introduction ===== ===== Introduction =====
  
-This document mainly introduces the STA+AP mode of Wi-Fi. You'll learn how to open a hotspot while connected to the Internet. +This documentation will introduce how to setup the Wi-Fi working on STA+AP mode at the same time.
- +
-===== System Configuration ===== +
- +
-==== Upgrade System ==== +
- +
-Please make sure you use the latest image, if not please follow [[/products/sbc/common/configurations/upgrade-system|Upgrade The System]] to upgrade your system.+
  
 ==== Configuration Instructions ==== ==== Configuration Instructions ====
Line 15: Line 9:
 Configure ''wlan0'' to ''STA'' mode, and ''wlan1'' to ''AP'' mode. Configure ''wlan0'' to ''STA'' mode, and ''wlan1'' to ''AP'' mode.
  
-=== Add Wlan1 Interface === 
  
-```sh +=== Setup Wlan1 as a Hotspot ===
-khadas@Khadas:~$ sudo iw phy phy0 interface add wlan1 type managed +
-```+
  
-Use ''ifconfig'' to check if ''wlan1'' has been added successfully:+Setup ''wlan1'' as a hotspot.
  
-```sh +=2.4 GHz Frequency ==
-khadas@Khadas:~$ ifconfig  +
-wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500 +
-        ether 18:93:7f:a9:9d:0e  txqueuelen 1000  (Ethernet) +
-        RX packets 0  bytes 0 (0.0 B) +
-        RX errors 0  dropped 0  overruns 0  frame 0 +
-        TX packets  bytes 180 (180.0 B) +
-        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0+
  
-wlan1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500 +For example, the following commands will create AP configuration named ''Hostspot'' on interface ''wlan1''with SSID ''khadas_ap_2.4G''''2.4GHz'' band, ''channel 1'', ''WPA2-PSK'' security, ''CCMP encryption'' and passphrase ''12345678''.
-        ether 1a:93:7f:a9:9d:0e  txqueuelen 1000  (Ethernet) +
-        RX packets 0  bytes 0 (0.0 B) +
-        RX errors 0  dropped 0  overruns 0  frame 0 +
-        TX packets 0  bytes 0 (0.0 B) +
-        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 +
-```+
  
-=== Setup Wlan1 as a Hotspot === 
  
-Setup ''wlan1'' as a hotspot, and allow automatic connections.+```shell 
 +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 ==
  
-== 2.4 GHz Frequency ==+For example, the following commands will create AP configuration named ''Hostspot'' on interface ''wlan1'', with SSID ''khadas_ap_5G'', ''5GHz'' band, ''channel 149'', ''WPA2-PSK'' security, ''CCMP encryption'' and passphrase ''12345678''.
  
-We shall name our hotspot ''khadas_ap'', with password ''12345678''+```shell 
-```sh +sudo nmcli con add type wifi ifname wlan1 mode ap con-name Hostspot ssid khadas_ap_5G 
-sudo nmcli con add type wifi ifname wlan1 con-name Hostspot autoconnect yes ssid khadas_ap +sudo nmcli con modify Hostspot 802-11-wireless.band a 
-sudo nmcli con modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared +sudo nmcli con modify Hostspot 802-11-wireless.channel 149 
-sudo nmcli con modify Hostspot wifi-sec.key-mgmt wpa-psk +sudo nmcli con modify Hostspot 802-11-wireless-security.key-mgmt wpa-psk 
-sudo nmcli con modify Hostspot wifi-sec.psk "12345678" +sudo nmcli con modify Hostspot 802-11-wireless-security.proto rsn 
-sudo nmcli con modify Hostspot ipv4.addresses 192.168.2.20/24 +sudo nmcli con modify Hostspot 802-11-wireless-security.group ccmp 
-sudo nmcli con modify Hostspot ipv4.gateway 192.168.2.1 +sudo nmcli con modify Hostspot 802-11-wireless-security.pairwise ccmp 
-sudo nmcli con up Hostspot+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 == 
  
-To setup a 5GHz network, you’ll need to use the channel argument. \\ +Use ''ifconfig'' to check if everything has been setup correctly:
-We shall name our hotspot ''khadas_ap'', with password ''12345678''+
-```sh +
-$ sudo nmcli con add type wifi ifname wlan1 con-name Hostspot autoconnect yes ssid khadas_ap +
-$ sudo nmcli c modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band a 802-11-wireless.channel 149 802-11-wireless.powersave 2 ipv4.method shared +
-$ sudo nmcli con modify Hostspot wifi-sec.key-mgmt wpa-psk +
-$ sudo nmcli con modify Hostspot wifi-sec.psk "12345678" +
-$ sudo nmcli con modify Hostspot ipv4.addresses 192.168.2.20/24 +
-$ sudo nmcli con modify Hostspot ipv4.gateway 192.168.2.1 +
-$ sudo nmcli con up Hostspot +
-```+
  
-Use ''ifconfig'' to check if everything has been setup correctly: +```shell 
-```sh +$ ifconfig 
-khadas@Khadas:~$ ifconfig +wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500 
-wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500 +        inet 192.168.31.219  netmask 255.255.254.0  broadcast 192.168.31.255 
-        ether 18:93:7f:a9:9d:0e  txqueuelen 1000  (Ethernet) +        inet6 fda2:a164:f7fb:4b66:1466:7d8b:b8e3:49a  prefixlen 64  scopeid 0x0<global> 
-        RX packets  bytes (0.0 B+        inet6 fe80::6eed:eaf2:6ba8:5cd7  prefixlen 64  scopeid 0x20<link> 
-        RX errors 0  dropped  overruns 0  frame 0 +        inet6 fda2:a164:f7fb:4b66:a823:4487:8651:4d61  prefixlen 64  scopeid 0x0<global> 
-        TX packets  bytes 180 (180.0 B)+        ether 10:2c:6b:10:d5:0a  txqueuelen 1000  (Ethernet) 
 +        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         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  
 wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500 wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
-        inet 192.168.2.20  netmask 255.255.255.0  broadcast 192.168.2.255 +        inet 10.42.0. netmask 255.255.255.0  broadcast 10.42.0.255 
-        inet6 fe80::2069:83c5:2e4c:2614  prefixlen 64  scopeid 0x20<link> +        inet6 fe80::6342:2516:ef70:23a0  prefixlen 64  scopeid 0x20<link> 
-        ether 1a:93:7f:a9:9d:0e  txqueuelen 1000  (Ethernet) +        ether 12:2c:6b:10:d5:0a  txqueuelen 1000  (Ethernet) 
-        RX packets  bytes (0.0 B)+        RX packets 1569  bytes 299041 (299.0 KB)
         RX errors 0  dropped 0  overruns 0  frame 0         RX errors 0  dropped 0  overruns 0  frame 0
-        TX packets 18  bytes 1312 (1.KB)+        TX packets 3241  bytes 3693502 (3.6 MB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 ``` ```
Line 93: Line 76:
 ===== Go Online! ===== ===== Go Online! =====
  
-Turn off Ethernet: 
- 
-```sh 
-khadas@Khadas:~$ sudo ifconfig eth0 down 
-``` 
  
-Verify that wlan0 has a working internet connection:+Verify that ''wlan0'' has a working internet connection:
 <WRAP info > <WRAP info >
 You need to connect Wi-Fi first. You need to connect Wi-Fi first.
 </WRAP> </WRAP>
-```sh+```shell
 khadas@Khadas:~$ sudo ping -I wlan0 www.khadas.com 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. PING td-balancer-dc11-60-161.wixdns.net (185.230.60.161) from 192.168.124.80 wlan0: 56(84) bytes of data.
Line 113: Line 91:
  
 Verify that ''wlan1'' can be used as a hotpot: Verify that ''wlan1'' can be used as a hotpot:
-  * Name: 2.4G/''khadas_ap'', 5G/''khadas_ap_5G''+  * Name: 2.4G/''khadas_ap_2.4G'', 5G/''khadas_ap_5G''
   * Password:''12345678''   * Password:''12345678''
  
Last modified: 2023/02/17 11:08 by hyphop