How to make the Wi-Fi module working in AP + STA mode in the same time?

I am running Linux Khadas 4.9.224 #29 Ubuntu release.

I noticed that the AP6398S Wi-Fi module support running AP + STA mode in the same time.
How can I enable this feature?
By the way, How can I use the Wi-Fi direct mode for Ubuntu?

How can I make the p2p0 wlan1 appear as the following image?

Please try this:

Configrure wlan0 as STA mode, wlan1 as AP mode.

  • Add wlan1
$ sudo iw phy phy0 interface add wlan1 type managed

Check:

khadas@Khadas:~$ ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.120  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::ca63:14ff:fe70:43e6  prefixlen 64  scopeid 0x20<link>
        ether c8:63:14:70:43:e6  txqueuelen 1000  (Ethernet)
        RX packets 56  bytes 5934 (5.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 72  bytes 6686 (6.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 14  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        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

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 18:93:7f:67:9c:f8  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

wlan1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 1a:93:7f:67:9c:f8  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 AP

SSID: khadas_ap
PASSWORD: 12345678

$ sudo nmcli con add type wifi ifname wlan1 con-name Hostspot autoconnect yes ssid khadas_ap
$ sudo nmcli con modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band bg 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

Check again:

khadas@Khadas:~$ ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.120  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::ca63:14ff:fe70:43e6  prefixlen 64  scopeid 0x20<link>
        ether c8:63:14:70:43:e6  txqueuelen 1000  (Ethernet)
        RX packets 83  bytes 8070 (8.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 92  bytes 8226 (8.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 14  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        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

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 18:93:7f:67:9c:f8  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

wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.20  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::9476:5c95:8f76:ba05  prefixlen 64  scopeid 0x20<link>
        ether 1a:93:7f:67:9c:f8  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19  bytes 1374 (1.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan1 works in STA mode.

1 Like

Thank you for your help.
The STA mode is working with the AP mode in the same time.

khadas@Khadas:~$ iwconfig
wlan1     IEEE 802.11  ESSID:"myAP"  
      Mode:Master  **Frequency**:2.412 GHz  Access Point: 6E:21:A2:9B:27:16   
      Bit Rate=72 Mb/s   Tx-Power:32 dBm   
      Retry min limit:7   RTS thr:off   Fragment thr:off
      Power Management:off
      
lo        no wireless extensions.
sit0      no wireless extensions.
eth0      no wireless extensions.
tunl0     no wireless extensions.
ip6_vti0  no wireless extensions.

wlan0     IEEE 802.11  ESSID:"OFFICE_5G"  
      Mode:Master  **Frequency**:5.785 GHz  Access Point: 50:BD:5F:63:CA:30   
      Bit Rate=325 Mb/s   Tx-Power:32 dBm   
      Retry min limit:7   RTS thr:off   Fragment thr:off
      Power Management:off
      Link Quality=5/5  Signal level=-55 dBm  Noise level=-90 dBm
      Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
      Tx excessive retries:0  Invalid misc:0   Missed beacon:0

The above log is the output for iwconfig .
How can I choose the frequency which is used for wlan0 or wlan1?
for example, I want use 2.4GHz for wlan1 while use 5GHz for wlan0.