RPi 4 as a Wifi AP and a Wifi Client at the same time?

I am running OpenWrt on a Pi4. I can make it an AP and I can make it a Wifi Client.
When I try to make the Pi4 become an AP AND a wifi client then neither work.

Can OpenWrt on the Pi 4 be an AP and a Wifi client at the same time?

Output of iw list on my Pi 4:

root@OpenWrt:~# iw list
Wiphy phy0
        wiphy index: 0
        max # scan SSIDs: 10
        max scan IEs length: 2048 bytes
        max # sched scan SSIDs: 16
        max # match sets: 16
        max # scan plans: 1
        max scan plan interval: 508
        max scan plan iterations: 0
        Retry short limit: 7
        Retry long limit: 4
        Coverage class: 0 (up to 0m)
        Available Antennas: TX 0 RX 0
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * P2P-client
                 * P2P-GO
                 * P2P-device
        Band 1:
                Capabilities: 0x1022
                        HT20/HT40
                        Static SM Power Save
                        RX HT20 SGI
                        No RX STBC
                        Max AMSDU length: 3839 bytes
                        DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 16 usec (0x07)
                HT TX/RX MCS rate indexes supported: 0-7
                Frequencies:
                        * 2412 MHz [1] (20.0 dBm)
                        * 2417 MHz [2] (20.0 dBm)
                        * 2422 MHz [3] (20.0 dBm)
                        * 2427 MHz [4] (20.0 dBm)
                        * 2432 MHz [5] (20.0 dBm)
                        * 2437 MHz [6] (20.0 dBm)
                        * 2442 MHz [7] (20.0 dBm)
                        * 2447 MHz [8] (20.0 dBm)
                        * 2452 MHz [9] (20.0 dBm)
                        * 2457 MHz [10] (20.0 dBm)
                        * 2462 MHz [11] (20.0 dBm)
                        * 2467 MHz [12] (20.0 dBm)
                        * 2472 MHz [13] (20.0 dBm)
                        * 2484 MHz [14] (disabled)
        Band 2:
                Capabilities: 0x1062
                        HT20/HT40
                        Static SM Power Save
                        RX HT20 SGI
                        RX HT40 SGI
                        No RX STBC
                        Max AMSDU length: 3839 bytes
                        DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 16 usec (0x07)
                HT TX/RX MCS rate indexes supported: 0-7
                VHT Capabilities (0x00001020):
                        Max MPDU length: 3895
                        Supported Channel Width: neither 160 nor 80+80
                        short GI (80 MHz)
                        SU Beamformee
                VHT RX MCS set:
                        1 streams: MCS 0-9
                        2 streams: not supported
                        3 streams: not supported
                        4 streams: not supported
                        5 streams: not supported
                        6 streams: not supported
                        7 streams: not supported
                        8 streams: not supported
                VHT RX highest supported: 0 Mbps
                VHT TX MCS set:
                        1 streams: MCS 0-9
                        2 streams: not supported
                        3 streams: not supported
                        4 streams: not supported
                        5 streams: not supported
                        6 streams: not supported
                        7 streams: not supported
                        8 streams: not supported
                VHT TX highest supported: 0 Mbps
                Frequencies:
                        * 5170 MHz [34] (20.0 dBm)
                        * 5180 MHz [36] (20.0 dBm)
                        * 5190 MHz [38] (20.0 dBm)
                        * 5200 MHz [40] (20.0 dBm)
                        * 5210 MHz [42] (20.0 dBm)
                        * 5220 MHz [44] (20.0 dBm)
                        * 5230 MHz [46] (20.0 dBm)
                        * 5240 MHz [48] (20.0 dBm)
                        * 5260 MHz [52] (20.0 dBm) (radar detection)
                        * 5280 MHz [56] (20.0 dBm) (radar detection)
                        * 5300 MHz [60] (20.0 dBm) (radar detection)
                        * 5320 MHz [64] (20.0 dBm) (radar detection)
                        * 5500 MHz [100] (20.0 dBm) (radar detection)
                        * 5520 MHz [104] (20.0 dBm) (radar detection)
                        * 5540 MHz [108] (20.0 dBm) (radar detection)
                        * 5560 MHz [112] (20.0 dBm) (radar detection)
                        * 5580 MHz [116] (20.0 dBm) (radar detection)
                        * 5600 MHz [120] (20.0 dBm) (radar detection)
                        * 5620 MHz [124] (20.0 dBm) (radar detection)
                        * 5640 MHz [128] (20.0 dBm) (radar detection)
                        * 5660 MHz [132] (20.0 dBm) (radar detection)
                        * 5680 MHz [136] (20.0 dBm) (radar detection)
                        * 5700 MHz [140] (20.0 dBm) (radar detection)
                        * 5720 MHz [144] (disabled)
                        * 5745 MHz [149] (13.0 dBm)
                        * 5765 MHz [153] (13.0 dBm)
                        * 5785 MHz [157] (13.0 dBm)
                        * 5805 MHz [161] (13.0 dBm)
                        * 5825 MHz [165] (13.0 dBm)
        valid interface combinations:
                 * #{ managed } <= 1, #{ P2P-device } <= 1, #{ P2P-client, P2P-GO } <= 1,
                   total <= 3, #channels <= 2
                 * #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1,
                   total <= 4, #channels <= 1
        Supported extended features:
                * [ 4WAY_HANDSHAKE_STA_PSK ]: 4-way handshake with PSK in station mode
                * [ 4WAY_HANDSHAKE_STA_1X ]: 4-way handshake with 802.1X in station mode
                * [ DFS_OFFLOAD ]: DFS offload
                * [ SAE_OFFLOAD ]: SAE offload support

I take this...

valid interface combinations:
* #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1,
total <= 4, #channels <= 1

.. to mean that the Pi 4 can be both at the same time.. (managed = client, AP = AP).
This YouTube video appears to demonstrate both operating together on a Pi 4.

/etc/config/wifi

config wifi-device 'radio0'
        option type 'mac80211'
        option path 'platform/soc/fe300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1'
        option country 'IE'
        option hwmode '11g'
        option channel 'auto'

config wifi-iface 'radio24g'
        option device 'radio0'
        option mode 'ap'
        option ssid 'OpenWrt-2.4G'
        option encryption 'psk2'
        option key 'password'
        option network 'lan'

config wifi-iface 'wifinet2'
        option device 'radio0'
        option mode 'sta'
        option network 'wwan'
        option ssid 'eir77597326-2.4G'
        option encryption 'psk2'
        option key 'password'

Both AP and client get the same Channel number. I tried with the 2.4GHz radio setting the Mode to Legacy. I also tried with just the 5GHz radio, both on same channels, but again neither work if you want them both to work at the same time.

/etc/config/network

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'

config interface 'lan'
        option ifname 'eth0'
        option proto 'dhcp'
        option type 'bridge'

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'wwan'
        option proto 'dhcp'

Currently, I just have OpenWrt Pi as another host connected to my LAN getting it's ip via dhcp from the home modem/router. Do I need to put OpenWrt and the home router on separate subnets?

What else can I try?

Cheers,

Flex

Just wondering if anyone has experience with this? Is there a developer I could ask who knows about OpenWrt on the Pi 4? It's limitations and known bugs?

Cheers,

Flex

The routed client requires the wan as a separate subnet, since a regular AP-STA connection doesn't support bridging the STA end. Basically your router acts as one device on the WAN network and uses NAT to have multiple LAN users pass through that one device.

But that isn't why it can't run AP and STA at the same time. That is a limitation in the driver as it's a Broadcom chip. They have poor open-source support.

The Pi 4 is cheap and has a lot of memory and CPU power, but it isn't made for hardcore networking like something purpose built as a router.

4 Likes

I currently have OpenWrt on a Pi4 just as another host in my LAN connected to my home router/modem... while I'm getting to learn about OpenWrt. In my current config I have the ISP modem connected to the Pi4 via a usb/ethernet adapter at eth1 and eth0 is intended to join to other clients... maybe another switch.

Can you explain that a bit more please? Are you referring to my OpenWrt router as the "routed client"?

My network config:
/etc/config/network

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'

config interface 'lan'
        option ifname 'eth0'
        option proto 'dhcp'
        option type 'bridge'

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'wwan'
        option proto 'dhcp'

I suppose in this configuration OpenWrt on my Pi 4 thinks that my ISP modem/router is in the wan and everything on the other side of the Pi4 is the LAN zone.

Getting back to my question about having Client Wifi and AP on a Pi at the same time.. thank you for explaining that it's not possible. But in your response above do you mean that the LAN interface of the Pi4 would need to be on a diff subnet to the rest of my home LAN for simultaneous Client Wifi and AP to even theoretically be possible?

I suppose that makes sense in that I'm currently really using OpenWrt on a Pi4 as a single port switch in my home LAN and OpenWrt is designed to assume that the network on either side of it is of course in a different subnet (home lan vs public internet)

Thank you!

Flex

As a router, the Pi LAN would have a static IP which is different from the WAN network. Your user(s) would connect to the LAN as a separate network. More than one LAN machine can be connected by using an Ethernet switch. The wifi client would be the Internet connection via the wan network-- that network would take a DHCP address from the upstream router, and again this can't be the same IP range as the lan.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.