Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

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

Edge2 Wi-Fi AP Mode

This documentation will introduce how to setup Wi-Fi working on AP mode.

Setup Wlan0 as a Hotspot

2.4 GHz Frequency

For example, the following commands will create AP configuration named Hostspot on interface wlan0, with SSID khadas_ap_2.4G, 2.4GHz band, channel 1, WPA2-PSK security, CCMP encryption and passphrase 12345678.

sudo nmcli con add type wifi ifname wlan0 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.addresses 192.168.2.1/24
sudo nmcli con modify Hostspot ipv4.gateway 192.168.2.1
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 Hostspot on interface wlan0, with SSID khadas_ap_5G, 5GHz band, channel 149, WPA2-PSK security, CCMP encryption and passphrase 12345678.

sudo nmcli con add type wifi ifname wlan0 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.addresses 192.168.2.1/24
sudo nmcli con modify Hostspot ipv4.gateway 192.168.2.1
sudo nmcli con modify Hostspot ipv4.method shared
sudo nmcli con up Hostspot

Use ifconfig to check if everything has been setup correctly:

$ ifconfig
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.1  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::f0c0:48fd:6d47:6a4b  prefixlen 64  scopeid 0x20<link>
        ether 70:f7:54:e2:90:89  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 30  bytes 4448 (4.4 KB)
        TX errors 0  dropped 2 overruns 0  carrier 0  collisions 0

Verify

You connect to AP khadas_ap_2.4G or khadas_ap_5G with password 12345678.

Last modified: 2023/05/20 04:39 by nick