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 [2022/07/05 04:18] frank Add Wi-Fi STA+AP mode |
products:sbc:vim4:applications:wifi-sta-ap-mode [2023/02/17 11:08] (current) hyphop |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Wi-Fi STA/AP Mode ====== | + | ====== |
- | ===== Introduction ===== | + | How to setup the Wi-Fi working on STA+AP mode at the same time. |
- | This document mainly introduces the STA+AP mode of Wi-Fi. You'll learn how to open a hotspot while connected to the Internet. | + | Configure '' |
- | ===== System Configuration ===== | ||
- | ==== Upgrade System | + | ===== Setup Wlan1 as a Hotspot ===== |
- | Please make sure you use the latest image, if not please follow [[/ | + | Setup '' |
- | ==== Configuration Instructions | + | ==== 2.4 GHz Frequency |
- | Configure | + | For example, the following commands will create AP configuration named '' |
- | === Add Wlan1 Interface === | ||
- | ```sh | + | ```shell |
- | khadas@Khadas: | + | 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 | ||
``` | ``` | ||
- | Use '' | + | ==== 5 GHz Frequency ==== |
- | ```sh | + | For example, the following commands will create AP configuration named '' |
- | khadas@Khadas: | + | |
- | wlan0: flags=4099< | + | |
- | ether 18: | + | |
- | RX packets 0 bytes 0 (0.0 B) | + | |
- | RX errors 0 dropped 0 overruns 0 frame 0 | + | |
- | TX packets 2 bytes 180 (180.0 B) | + | |
- | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | + | |
- | wlan1: flags=4099< | + | ```shell |
- | ether 1a: | + | sudo nmcli con add type wifi ifname |
- | RX packets 0 bytes 0 (0.0 B) | + | sudo nmcli con modify Hostspot 802-11-wireless.band a |
- | RX errors 0 dropped 0 overruns 0 frame 0 | + | sudo nmcli con modify Hostspot 802-11-wireless.channel 149 |
- | TX packets 0 bytes 0 (0.0 B) | + | sudo nmcli con modify Hostspot 802-11-wireless-security.key-mgmt wpa-psk |
- | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | + | 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 | ||
``` | ``` | ||
- | === Setup Wlan1 as a Hotspot === | + | Use '' |
- | Setup '' | + | ```shell |
- | + | $ ifconfig | |
- | + | wlan0: flags=4163<UP,BROADCAST,RUNNING, | |
- | == 2.4 GHz Frequency == | + | inet 192.168.31.219 netmask 255.255.254.0 broadcast |
- | + | inet6 fda2: | |
- | We shall name our hotspot '' | + | inet6 fe80:: |
- | ```sh | + | inet6 fda2:a164: |
- | $ sudo nmcli con add type wifi ifname wlan1 con-name Hostspot autoconnect yes ssid khadas_ap | + | ether 10:2c:6b:10:d5:0a |
- | $ sudo nmcli con modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared | + | RX packets |
- | $ sudo nmcli con modify Hostspot wifi-sec.key-mgmt wpa-psk | + | RX errors 0 dropped |
- | $ sudo nmcli con modify Hostspot wifi-sec.psk " | + | TX packets |
- | $ sudo nmcli con modify Hostspot ipv4.addresses 192.168.2.20/ | + | |
- | $ sudo nmcli con modify Hostspot ipv4.gateway 192.168.2.1 | + | |
- | $ sudo nmcli con up Hostspot | + | |
- | ``` | + | |
- | == 5 GHz Frequency == | + | |
- | + | ||
- | To setup a 5GHz network, you’ll need to use the channel argument. | + | |
- | 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 " | + | |
- | $ sudo nmcli con modify Hostspot ipv4.addresses | + | |
- | $ sudo nmcli con modify Hostspot ipv4.gateway 192.168.2.1 | + | |
- | $ sudo nmcli con up Hostspot | + | |
- | ``` | + | |
- | + | ||
- | Use '' | + | |
- | ```sh | + | |
- | khadas@Khadas:~$ ifconfig | + | |
- | wlan0: flags=4099<UP, | + | |
- | ether 18:93:7f:a9:9d:0e | + | |
- | RX packets | + | |
- | RX errors 0 dropped | + | |
- | TX packets | + | |
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< | wlan1: flags=4163< | ||
- | inet 192.168.2.20 | + | inet 10.42.0.1 |
- | inet6 fe80::2069:83c5:2e4c:2614 | + | inet6 fe80::6342:2516:ef70:23a0 |
- | ether 1a:93:7f:a9:9d:0e | + | ether 12:2c:6b:10:d5:0a |
- | RX packets | + | RX packets |
RX errors 0 dropped 0 overruns 0 frame 0 | RX errors 0 dropped 0 overruns 0 frame 0 | ||
- | TX packets | + | TX packets |
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 72: | ||
===== Go Online! ===== | ===== Go Online! ===== | ||
- | Turn off Ethernet: | + | Verify that '' |
- | ```sh | ||
- | khadas@Khadas: | ||
- | ``` | ||
- | |||
- | 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. | ||
</ | </ | ||
- | ```sh | + | |
+ | ```shell | ||
khadas@Khadas: | 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. | 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 88: | ||
Verify that '' | Verify that '' | ||
- | * Name: 2.4G/'' | + | * Name: 2.4G/'' |
* Password:'' | * Password:'' | ||