Skip to content

QEMU LibreMesh instance with WiFi capabilities #1180

Closed

Description

@javierbrk
No description provided.

Activity

  1. VGDSpehar commented on Jul 2, 2025

    @VGDSpehar
    Contributor

    After experimenting quite a bit with different build, I think I have a working config.
    This is still subject to changes, especially if we want to use it along with vwifi

    config-libremesh-virtual-wifi-enabled.txt

    It relies on mac80211_hwsim module to simulate wifi inside a qemu virtual machine.

    Once the firmware compiled, the virtual machine can simply be set up like this :
    qemu-system-x86_64 \ -enable-kvm \ -nographic \ -drive if=virtio,file=path/to/your/image,format=raw \ -m 512

    By default, the module loads up with 2 radios, and for some reasons that I'm still investigating, LibreMesh sets them up in the 6g band, but that comes with limitation : the 6g bands requires wpa3 to be set up, but that's currently outside my scope of testing, so you have to manually set up the radios to operate in the 2g or some of the 5g bands. Otherwise, nothing happens, especially no logs about the issue!

    After selecting the channels and reloading wifi you'll finally be able to see the different interfaces show up.

    You'll also see a hwsim0 interface appear, but from my understanding, this is only a mock up radio only used for debugging. Haven't experimented with it yet.

  2. VGDSpehar commented on Jul 4, 2025

    @VGDSpehar
    Contributor

    When the mac80211-hwsim module gets inserted, it adds by default two (virtual) physical radios :

    iw phy | grep phy
    Wiphy phy1
            wiphy index: 1
    Wiphy phy0
            wiphy index: 0
    

    The issue with these virtual radios, is that they expose limitless capabilites : they can emit in the 2g/5g/6g bands, as can be seen from the result of the following command :
    iw phy phy0 info

    The issue is as follow : At first boot, libremesh will set up the /etc/config/wireless :

    config wifi-device 'radio0'
    option type 'mac80211'
    option path 'virtual/mac80211_hwsim/hwsim0'
    option band '6g'
    option channel '11'
    option htmode 'HT20'
    option disabled '0'
    option distance '1000'
    option noscan '1'

    config wifi-device 'radio1'
    option type 'mac80211'
    option path 'virtual/mac80211_hwsim/hwsim1'
    option band '6g'
    option channel '11'
    option htmode 'HT20'
    option disabled '0'
    option distance '1000'
    option noscan '1'
    [...]

    Two issues :

    This leads to the rest of the configuration to fail, and the virtual wifi interfaces will stay in the in the DOWN state.

    The dirty fix to that is to manually change the band of the radios :
    uci set wireless.radio0.band=2g;uci set wireless.radio1.band=2g;uci commit; wifi reload

    Then wait a bit for the set up to finish, and you'll finally have virtual interfaces show up and associate (in the wlan*-mesh cases) :

    iwinfo
    wlan0-ap ESSID: "LibreMesh.org"
    Access Point: 02:00:00:00:00:00
    Mode: Master Channel: 11 (2.462 GHz) HT Mode: HT20
    Center Channel 1: 11 2: unknown
    Tx-Power: 20 dBm Link Quality: unknown/70
    Signal: unknown Noise: unknown
    Bit Rate: unknown
    Encryption: none
    Type: nl80211 HW Mode(s): 802.11ac/ax/b/be/g/n
    Hardware: unknown [Generic MAC80211]
    TX power offset: unknown
    Frequency offset: unknown
    Supports VAPs: yes PHY name: phy0

    wlan0-apname ESSID: "LibreMesh.org/LiMe-123456"
    Access Point: 42:00:00:00:00:00
    Mode: Master Channel: 11 (2.462 GHz) HT Mode: HT20
    Center Channel 1: 11 2: unknown
    Tx-Power: 20 dBm Link Quality: unknown/70
    Signal: unknown Noise: unknown
    Bit Rate: unknown
    Encryption: none
    Type: nl80211 HW Mode(s): 802.11ac/ax/b/be/g/n
    Hardware: unknown [Generic MAC80211]
    TX power offset: unknown
    Frequency offset: unknown
    Supports VAPs: yes PHY name: phy0

    wlan0-mesh ESSID: "LiMe"
    Access Point: 0E:00:00:00:00:00
    Mode: Mesh Point Channel: 11 (2.462 GHz) HT Mode: HT20
    Center Channel 1: 11 2: unknown
    Tx-Power: 20 dBm Link Quality: 70/70
    Signal: -30 dBm Noise: unknown
    Bit Rate: 130.0 MBit/s
    Encryption: none
    Type: nl80211 HW Mode(s): 802.11ac/ax/b/be/g/n
    Hardware: unknown [Generic MAC80211]
    TX power offset: unknown
    Frequency offset: unknown
    Supports VAPs: yes PHY name: phy0

    wlan1-ap ESSID: "LibreMesh.org"
    Access Point: 02:00:00:00:01:00
    Mode: Master Channel: 11 (2.462 GHz) HT Mode: HT20
    Center Channel 1: 11 2: unknown
    Tx-Power: 20 dBm Link Quality: unknown/70
    Signal: unknown Noise: unknown
    Bit Rate: unknown
    Encryption: none
    Type: nl80211 HW Mode(s): 802.11ac/ax/b/be/g/n
    Hardware: unknown [Generic MAC80211]
    TX power offset: unknown
    Frequency offset: unknown
    Supports VAPs: yes PHY name: phy1

    wlan1-apname ESSID: "LibreMesh.org/LiMe-123456"
    Access Point: 42:00:00:00:01:00
    Mode: Master Channel: 11 (2.462 GHz) HT Mode: HT20
    Center Channel 1: 11 2: unknown
    Tx-Power: 20 dBm Link Quality: unknown/70
    Signal: unknown Noise: unknown
    Bit Rate: unknown
    Encryption: none
    Type: nl80211 HW Mode(s): 802.11ac/ax/b/be/g/n
    Hardware: unknown [Generic MAC80211]
    TX power offset: unknown
    Frequency offset: unknown
    Supports VAPs: yes PHY name: phy1

    wlan1-mesh ESSID: "LiMe"
    Access Point: 0E:00:00:00:01:00
    Mode: Mesh Point Channel: 11 (2.462 GHz) HT Mode: HT20
    Center Channel 1: 11 2: unknown
    Tx-Power: 20 dBm Link Quality: 70/70
    Signal: -30 dBm Noise: unknown
    Bit Rate: 21.7 MBit/s
    Encryption: none
    Type: nl80211 HW Mode(s): 802.11ac/ax/b/be/g/n
    Hardware: unknown [Generic MAC80211]
    TX power offset: unknown
    Frequency offset: unknown
    Supports VAPs: yes PHY name: phy1

    And to check if they're meshing :

    root@LiMe-123456:~# iwinfo wlan1-mesh assoclist
    0E:00:00:00:00:00 -30 dBm / unknown (SNR -30) 70 ms ago
    RX: 14.4 MBit/s, MCS 1, 20MHz 1001 Pkts.
    TX: 26.0 MBit/s, MCS 9, 20MHz 12 Pkts.
    expected throughput: 15.2 MBit/s

    root@LiMe-123456:~# iwinfo wlan0-mesh assoclist
    0E:00:00:00:01:00 -30 dBm / unknown (SNR -30) 80 ms ago
    RX: 26.0 MBit/s, MCS 9, 20MHz 1221 Pkts.
    TX: 14.4 MBit/s, MCS 1, 20MHz 11 Pkts.
    expected throughput: 23.8 MBit/s

  3. ilario commented on Jul 5, 2025

    @ilario
    Member

    Thanks for the report!!

    Can you post the output of lime-config and of lime-report?

  4. VGDSpehar commented on Jul 5, 2025

    @VGDSpehar
    Contributor

    Yes, you can find both outputs here :
    lime-config.txt
    lime-report.txt

  5. ilario commented on Jul 7, 2025

    @ilario
    Member

    I suppose we should update the code in this file:
    https://github.com/libremesh/lime-packages/blob/master/packages/lime-system/files/usr/lib/lua/lime/wireless.lua

    Can you do that?

    My opinion is that we should not try to support 6 GHz until when someone owns some actual 6 GHz hardware for testinh the support. So I would modify the code so that 6 GHz gets ignored, and a warning message gets printed. And same thing for 60 GHz but there's no need to do this now :)

  6. VGDSpehar commented on Jul 8, 2025

    @VGDSpehar
    Contributor

    Sure, I will take care of that!
    From my quick look up there seems to be an issue with the logic for checking in which band the radio is operating, and the fact that 6g band have overlapping channel names with 2g band.

      local radioBand = wireless.is5Ghz(radioName) and '5ghz' or '2ghz'
    

    Seems to be one of the culprits.

  7. ilario commented on Jul 23, 2025

    @ilario
    Member

    Should have been fixed by #1207.
    In the future, if anyone gets some 6 GHz hardware, we could actually support 6 GHz radios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions