Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5G Support #61

Merged
merged 4 commits into from
Oct 4, 2023
Merged

5G Support #61

merged 4 commits into from
Oct 4, 2023

Conversation

kphanipavan
Copy link
Contributor

Addresses #51 and below

Fixes:

  1. Adds Hotspot 2.0 support, which can be enabled using --hs20 flag, subject to the user's hostapd build.
  2. Adds forcing the hotspot to specified channel using --force_channel flag. Some WiFi cards, like my Intel AX201, can transmit to a channel while being connected to a WiFi AP in different channel.
  3. Format the flag options in the help section into relevant blocks, namely WiFi 4 and WiFi 5 config.
  4. Adds --use_ht and --use_vht separately to add require_ht and require_vht config option to hostapd config. They are mandatory if --ht_capab or --vht_capab are used.

Tests:

1. Using the stock config:

Command:

sudo ./lnxrouter -o wlp0s20f3 -g 11 --dns 127.0.0.1 --hostname - --ap wlp0s20f3 "Plant Hotspot" -p helios123 -c 149 --country IN --ieee80211n --ieee80211ac --ht_capab "[HT40+][HT40-][SHORT-GI-40][SHORT-GI-20][RX-STBC1][DSSS_CCK-40]" --vht_capab "[MAX-MPDU-11454][VHT160][RXLDPC][SHORT-GI-80][SHORT-GI-160][TX-STBC-2BY1][SU-BEAMFORMEE][MU-BEAMFORMEE]" --virt-name ap0

Fails to turn on hotspot as the WiFi card is already connected to my Univ's 5G WiFi, which is on channel 56 and which is not supported, as seen below:

Screenshot:

Screenshot_20230928_122253

2. Using --force_channel flag to overcome above:

Command:

sudo ./lnxrouter -o wlp0s20f3 -g 11 --dns 127.0.0.1 --hostname - --ap wlp0s20f3 "Plant Hotspot" -p helios123 -c 149 --country IN --ieee80211n --ieee80211ac --ht_capab "[HT40+][HT40-][SHORT-GI-40][SHORT-GI-20][RX-STBC1][DSSS_CCK-40]" --vht_capab "[MAX-MPDU-11454][VHT160][RXLDPC][SHORT-GI-80][SHORT-GI-160][TX-STBC-2BY1][SU-BEAMFORMEE][MU-BEAMFORMEE]" --virt-name ap0 --force_channel

Hostapd starts, but the channel width defaults to 40MHz. Below is a screenshot from the app Wifiman, showing analysis of the wifi created.

Screenshot:

3. Using the remaining flags for wider channel:

Command:

sudo ./lnxrouter -o wlp0s20f3 -g 11 --dns 127.0.0.1 --hostname - --ap wlp0s20f3 "Plant Hotspot" -p helios123 -c 149 --country IN --ieee80211n --ieee80211ac --ht_capab "[HT40+][HT40-][SHORT-GI-40][SHORT-GI-20][RX-STBC1][DSSS_CCK-40]" --vht_capab "[MAX-MPDU-11454][VHT160][RXLDPC][SHORT-GI-80][SHORT-GI-160][TX-STBC-2BY1][SU-BEAMFORMEE][MU-BEAMFORMEE]" --virt-name ap0 --force_channel --use_ht --use_vht --vht_channel_width 1 --seg0_center_freq_idx 155

WiFi starts with 80MHz channel as seen in the below screenshot.

Screenshot:

Guide to choosing the flag arguments for 80MHz channel and above:

  1. Get the ht_capab and vht_capab flags right, use the default hostapd config to build it.
Guide
  • Run iw list | grep -i -A 15 "band 1" to get a list of HT Capabilities. Example:

Screenshot_20230928_131635

result: [HT40+][HT40-][SHORT-GI-40][SHORT-GI-20][RX-STBC1][DSSS_CCK-40]

  • Run iw list | grep -i -A 15 "vht capabilities" to get a list of VHT Capabilities. Example:

Screenshot_20230928_132040

result: [MAX-MPDU-11454][VHT160][RXLDPC][SHORT-GI-80][SHORT-GI-160][TX-STBC-2BY1][SU-BEAMFORMEE][MU-BEAMFORMEE]

  1. Pick a base channel and check whether your WiFi card can transmit at your desired frequency.
Guide
  • Check the specifications for your card, make sure it supports 5GHz N or AC wireless.

  • Check if the AP can be initiated on the desired channel, using iw list | grep -E "dBm\)|\(disabled\)"

  1. Decide whether you want to use 40, 80 or 160MHz channel and pick the corresponding index:
    0 for 40MHz
    1 for 80MHz
    2 for 160MHz
    3 for 80+80MHz

  2. From WLAN Channels, in the 5GHz table and under the F0 Index column, pick the index under the required channel width which includes your base channel, called the segment 0 channel.

Example: Example:

Screenshot_20230928_140808

I wanted 80MHz channel with base channel as 149. The channel index corresponding to those settings is 155.

After collecting the required data, use this format: --use_vht --force_channel --seg0_center_freq_idx <segment 0 channel> -c <base channel> --vht_channel_width <channel width index>

So for my setup: --use_vht --force_channel --seg0_center_freq_idx 155 -c 149 --vht_channel_width 1

Notes:

  • Please don't just copy my HT and VHT Capabilities, highly suggest you make your own
  • If anyone successfully makaged to create a 5G WiFi hotspot with the above flags, I encourage you to post your findings here. Every little detail can help others.
  • Intel (and some others) WIFi cards randomly loose and gain the ability to transmit hotspot on certain channels, beware of that. One can patch the CRDA database and permantly alter that behaviour. YMMV.
  • GaryWill plis merge this 😅

@kphanipavan
Copy link
Contributor Author

@garywill

@garywill
Copy link
Owner

garywill commented Oct 2, 2023

Wonderful! Thank you for PR @kphanipavan !

Although I don't have a 5G wifi hardware to test, it looks great, I'll merge it.

Actually I've been thinking about changing -c <channel>'s behavior.
If user specify a channel then the script auto fallbacks to another, that is not wanted.
So let's just don't add a --force_channel option, but make -c have --force_channel's feature.

I'll bump version to 0.7.x after merging this

lnxrouter Outdated Show resolved Hide resolved
@kphanipavan
Copy link
Contributor Author

kphanipavan commented Oct 2, 2023

Regarding the force channel behaviour, I found this to be the expected behaviour when I started using your script.

But, IMO, having it the current way can provide a verbose interface to the user. One can suggest a channel with -c, let the script decide if it is valid, and if the user wants to, they can enforce it using --force_channel.

@kphanipavan kphanipavan marked this pull request as ready for review October 2, 2023 13:34
@garywill
Copy link
Owner

garywill commented Oct 4, 2023

Already in dev branch and I did some modifications and changes.
Please share your opinions and comments.

Will merge into master finally

@kphanipavan
Copy link
Contributor Author

Can I have some more context for 183cf44, other than this, everything looks fine. Tested 0.7.0b just now, working as intended.

@garywill
Copy link
Owner

garywill commented Oct 4, 2023

When hostapd run, it will output its .conf file path

This is what I get on my PC:

Starting hostapd
Setting /usr/sbin/hostapd to complain mode.
Warning: profile hostapd represents multiple programs
Warning: profile hostapd represents multiple programs
hostapd PID: 5532
Configuration file: /dev/shm/lnxrouter_tmp/lnxrouter.wlan0.conf.oXo0Ky/hostapd.conf
Using interface x0wlan0 with hwaddr 2e:ee:68:xxxxxx and ssid "xxx"
x0wlan0: interface state UNINITIALIZED->ENABLED
x0wlan0: AP-ENABLED

@garywill garywill merged commit 9d874db into garywill:master Oct 4, 2023
@kphanipavan
Copy link
Contributor Author

When hostapd run, it will output its .conf file path

Doesn't seem to happen on mine for some reason, tq for clarification.

Also, may I know why the b for version?

@garywill
Copy link
Owner

garywill commented Oct 5, 2023

Doesn't seem to happen on mine for some reason

Really? What's your hostapd version?
To check if I was the only one who see these lines

hostapd PID: 5532
Configuration file: /dev/shm/lnxrouter_tmp/lnxrouter.wlan0.conf.oXo0Ky/hostapd.conf

I searched issues for users' logs.
Seems people do have those two lines


The reason of version b (beta) to differ from a stable release is:

  1. -c behavior changed. I can't ensure there's 100% bug-free on the script logic
  2. I myself can't test those 5GHz features (I don't have hardware)

So, we need to give some time for users to test

@kphanipavan
Copy link
Contributor Author

kphanipavan commented Oct 5, 2023

Hostapd version: v2.11-devel, built from source.

lnxrouter output on my end:

linux-router 0.7.0b (https://github.com/garywill/linux-router)
Released under LGPL, with no warranty. Use on your own risk.

PID: 1143357
Target interface is wlp0s20f3 (<redacted>)   PCI: 0000:00:14.3 Network controller [0280]: Intel Corporation Comet Lake PCH CNVi WiFi [8086:06f0]
Use random MAC address f4:cf:71:06:68:66
wlp0s20f3 already working in channel 161 (5805 MHz)
WARN: Wifi adapter already working in channel 161, which is different than target channel 2
Creating a virtual WiFi interface... 
ap0 created
Setting ap0 new MAC address f4:cf:71:06:68:66 ...

haveged_watchdog PID: 1143561

Starting hostapd
hostapd PID: 1143566
ap0: interface state UNINITIALIZED->COUNTRY_UPDATE
Low entropy detected, starting haveged
haveged: command socket is listening at fd 3

iptables v1.8.9 (nf_tables)
NOTICE: Not showing all operations done to iptables rules

WARN: Since you're using in this mode (specify Internet interface), make sure you've read Notice 1


WARN: You specified Internet interface but this host is providing local DNS. In some unexpected case (eg. mistaken configurations), queries may leak to other interfaces, which you should be aware of.


iptables: NAT 
MASQUERADE  all opt -- in * out wlp0s20f3  192.168.11.0/24 !-> 192.168.11.0/24   /* lrt1143357ap0 */
ACCEPT  all opt -- in ap0 out wlp0s20f3  192.168.11.0/24  -> 0.0.0.0/0   /* lrt1143357ap0 */
ACCEPT  all opt -- in wlp0s20f3 out ap0  0.0.0.0/0  -> 192.168.11.0/24   /* lrt1143357ap0 */
Loaded kernel module nf_nat_pptp

iptables: allow DNS
ACCEPT  tcp opt -- in ap0 out *  192.168.11.0/24  -> 192.168.11.1   tcp dpt:53 /* lrt1143357ap0 */
ACCEPT  udp opt -- in ap0 out *  192.168.11.0/24  -> 192.168.11.1   udp dpt:53 /* lrt1143357ap0 */

iptables: allow dhcp
ACCEPT  udp opt -- in ap0 out *  0.0.0.0/0  -> 0.0.0.0/0   udp dpt:67 /* lrt1143357ap0 */

Starting dnsmasq
Oct  5 07:31:08 dnsmasq[1143605]: started, version 2.89 cachesize 150
Oct  5 07:31:08 dnsmasq[1143605]: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conntrack ipset nftset auth cryptohash DNSSEC loop-detect inotify dumpfile
Oct  5 07:31:08 dnsmasq-dhcp[1143605]: DHCP, IP range 192.168.11.10 -- 192.168.11.250, lease time 1h
Oct  5 07:31:08 dnsmasq-dhcp[1143605]: DHCP, sockets bound exclusively to interface ap0
Oct  5 07:31:08 dnsmasq[1143605]: using nameserver 127.0.0.1#53
Oct  5 07:31:08 dnsmasq[1143605]: cleared cache
dnsmasq PID: 1143605
ap0: interface state COUNTRY_UPDATE->HT_SCAN

== Setting up completed, now linux-router should be working ==
20/40 MHz operation not permitted on channel pri=2 sec=6 based on overlapping BSSes
Fallback to 20 MHz
ap0: interface state HT_SCAN->ENABLED
ap0: AP-ENABLED 
^Cap0: interface state ENABLED->DISABLED
ap0: AP-DISABLED 
ap0: CTRL-EVENT-TERMINATING 


Doing cleanup.. 
nl80211: deinit ifname=ap0 disabled_11b_rates=0
Oct  5 07:34:12 dnsmasq[1143605]: exiting on receipt of SIGTERM
Killed dnsmasq.pid 1143605 dnsmasq
Failed to kill haveged_watchdog.pid 1143561 , it may have exited
Killed keep_running.pid 1143635 bash
Undoing iptables changes ..
Exiting: This is the only running instance
Cleaning up done

I will see if theres a config option to change for the build.


b now makes sense, cheers...

@Supernovatux
Copy link

Hey the below command does not work. It says ERROR: Your adapter can not transmit to channel 149, frequency band 5GHz.. But I can transmit over channel 149 at 80Mhz channel width with windows and achieve a PHY speed of 867 Mbps.

sudo lnxrouter --ap wlan0 supernovatux -p qwerty123 --wifi4 --req-ht --wifi5 --req-vht --freq-band 5 \
      --vht-capab [MAX-MPDU-11454][RXLDPC][SHORT-GI-80][TX-STBC-2BY1][SU-BEAMFORMEE][MU-BEAMFORMEE][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN] \
      --ht-capab [HT40+][HT40-][SHORT-GI-40][SHORT-GI-20][GF][RX-STBC1][DSSS_CCK-40][MAX-AMSDU-7935] \
      -c 149 --vht-ch-width 1 --vht-seg0-ch 155 --country IN --hostapd-debug 1 --no-virt

I have attached some details below

  • iw list | grep -i -A 15 "band 1"
Band 1: Capabilities: 0x9ff RX LDPC HT20/HT40 SM Power Save disabled RX Greenfield RX HT20 SGI RX HT40 SGI TX STBC RX STBC 1-stream Max AMSDU length: 7935 bytes No DSSS/CCK HT40 Maximum RX AMPDU length 65535 bytes (exponent: 0x003) Minimum RX AMPDU time spacing: No restriction (0x00) HT TX/RX MCS rate indexes supported: 0-15 HE Iftypes: managed
  • iw list | grep -i -A 15 "vht capabilities"
VHT Capabilities (0x339071b2): Max MPDU length: 11454 Supported Channel Width: neither 160 nor 80+80 RX LDPC short GI (80 MHz) TX STBC SU Beamformee MU Beamformee RX antenna pattern consistency TX antenna pattern consistency VHT RX MCS set: 1 streams: MCS 0-9 2 streams: MCS 0-9 3 streams: not supported 4 streams: not supported 5 streams: not supported
  • iw list | grep -E "dBm)|(disabled)"
* 2412.0 MHz [1] (20.0 dBm) * 2417.0 MHz [2] (20.0 dBm) * 2422.0 MHz [3] (20.0 dBm) * 2427.0 MHz [4] (20.0 dBm) * 2432.0 MHz [5] (20.0 dBm) * 2437.0 MHz [6] (20.0 dBm) * 2442.0 MHz [7] (20.0 dBm) * 2447.0 MHz [8] (20.0 dBm) * 2452.0 MHz [9] (20.0 dBm) * 2457.0 MHz [10] (20.0 dBm) * 2462.0 MHz [11] (20.0 dBm) * 2467.0 MHz [12] (20.0 dBm) (no IR) * 2472.0 MHz [13] (20.0 dBm) (no IR) * 2484.0 MHz [14] (20.0 dBm) (no IR) * 5180.0 MHz [36] (20.0 dBm) * 5200.0 MHz [40] (20.0 dBm) (no IR) * 5220.0 MHz [44] (20.0 dBm) (no IR) * 5240.0 MHz [48] (20.0 dBm) (no IR) * 5260.0 MHz [52] (20.0 dBm) (no IR, radar detection) * 5280.0 MHz [56] (20.0 dBm) (no IR, radar detection) * 5300.0 MHz [60] (20.0 dBm) (no IR, radar detection) * 5320.0 MHz [64] (20.0 dBm) (no IR, radar detection) * 5500.0 MHz [100] (20.0 dBm) (no IR, radar detection) * 5520.0 MHz [104] (20.0 dBm) (no IR, radar detection) * 5540.0 MHz [108] (20.0 dBm) (no IR, radar detection) * 5560.0 MHz [112] (20.0 dBm) (no IR, radar detection) * 5580.0 MHz [116] (20.0 dBm) (no IR, radar detection) * 5600.0 MHz [120] (20.0 dBm) (no IR, radar detection) * 5620.0 MHz [124] (20.0 dBm) (no IR, radar detection) * 5640.0 MHz [128] (20.0 dBm) (no IR, radar detection) * 5660.0 MHz [132] (20.0 dBm) (no IR, radar detection) * 5680.0 MHz [136] (20.0 dBm) (no IR, radar detection) * 5700.0 MHz [140] (20.0 dBm) (no IR, radar detection) * 5720.0 MHz [144] (20.0 dBm) (no IR, radar detection) * 5745.0 MHz [149] (20.0 dBm) (no IR) * 5765.0 MHz [153] (20.0 dBm) (no IR) * 5785.0 MHz [157] (20.0 dBm) (no IR) * 5805.0 MHz [161] (20.0 dBm) (no IR) * 5825.0 MHz [165] (20.0 dBm) (no IR) * 5845.0 MHz [169] (disabled) * 5865.0 MHz [173] (disabled) * 5885.0 MHz [177] (disabled)
  • No logs in dmesg
  • Toggling --no-virt does not hellp.
  • I commented the lines responsible for this frequency/channel check in lnxrouter and got the following logs

linux-router 0.7.6 (https://github.com/garywill/linux-router)
Released under LGPL, with no warranty. Use on your own risk.

PID: 48517
Target interface is wlan0 (a2:62:2b:29:dc:cd)
PCI: 0000:04:00.0
System-already-loaded driver: mt7921e
Network controller [0280]: MEDIATEK Corp. MT7921 802.11ax PCI Express Wireless Network Adapter [14c3:7961]

Use random LAN IPv4 address 192.168.230.1
Creating a virtual WiFi interface...
x0wlan0 created
Set x0wlan0 unmanaged by NetworkManager
Assigning MAC address a2:62:2b:29:dc:d7 to virtual interface x0wlan0 according to wlan0 ...

iptables v1.8.10 (nf_tables)
Notice: Not showing all operations done to iptables rules

haveged_watchdog PID: 48691

Starting hostapd
hostapd PID: 48696
random: Trying to read entropy from /dev/random
Configuration file: /dev/shm/lnxrouter_tmp/lnxrouter.wlan0.conf.IPFTJ8/hostapd.conf
ctrl_interface_group=0
nl80211: Kernel version: Linux 6.12.5-2-cachyos (#1 SMP PREEMPT_DYNAMIC Sun, 15 Dec 2024 09:12:45 +0000; x86_64)
nl80211: Maximum supported attribute ID: 332
nl80211: Initialize interface x0wlan0 (driver: mt7921e)
nl80211: TDLS supported
nl80211: TDLS external setup
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:10
nl80211: Supported cipher 00-0f-ac:8
nl80211: Supported cipher 00-0f-ac:9
nl80211: Supported cipher 00-0f-ac:6
nl80211: Supported cipher 00-0f-ac:13
nl80211: Supported cipher 00-0f-ac:11
nl80211: Supported cipher 00-0f-ac:12
nl80211: Using driver-based off-channel TX
nl80211: Driver-advertised extended capabilities (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: Driver-advertised extended capabilities mask (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: key_mgmt=0x1ff0f enc=0xfef auth=0x7 flags=0x24003d10d35bfbe0 flags2=0x123 rrm_flags=0x30 probe_resp_offloads=0x0 max_stations=0 max_remain_on_chan=5000 max_scan_ssids=4
nl80211: interface x0wlan0 in phy phy0
nl80211: Set mode ifindex 50 iftype 3 (AP)
nl80211: Failed to set interface 50 to mode 3: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
Low entropy detected, starting haveged
haveged: command socket is listening at fd 3
nl80211: Set mode ifindex 50 iftype 3 (AP)
nl80211: Mode change succeeded while interface is down
nl80211: Setup AP(x0wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x558874cd7a20
nl80211: Register frame type=0xb0 (WLAN_FC_STYPE_AUTH) nl_handle=0x558874cd7a20 match= multicast=0
nl80211: Register frame type=0x0 (WLAN_FC_STYPE_ASSOC_REQ) nl_handle=0x558874cd7a20 match= multicast=0
nl80211: Register frame type=0x20 (WLAN_FC_STYPE_REASSOC_REQ) nl_handle=0x558874cd7a20 match= multicast=0
nl80211: Register frame type=0xa0 (WLAN_FC_STYPE_DISASSOC) nl_handle=0x558874cd7a20 match= multicast=0
nl80211: Register frame type=0xc0 (WLAN_FC_STYPE_DEAUTH) nl_handle=0x558874cd7a20 match= multicast=0
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x558874cd7a20 match= multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x558874cd7a20 match=04 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x558874cd7a20 match=0501 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x558874cd7a20 match=0503 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x558874cd7a20 match=0504 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x558874cd7a20 match=06 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x558874cd7a20 match=08 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x558874cd7a20 match=09 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x558874cd7a20 match=0a multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x558874cd7a20 match=11 multicast=0
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x558874cd7a20 match=7f multicast=0
rfkill: initial event: idx=3 type=1 op=0 soft=0 hard=0
nl80211: Add own interface ifindex 50 (ifidx_reason -1)
nl80211: if_indices[16]: 50(-1)
nl80211: Do not open EAPOL RX socket - using control port for RX
phy: phy0
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
x0wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Previous country code 00, new country code IN
Continue interface setup after channel list update
ctrl_iface not configured!
random: Got 20/20 bytes from /dev/random
RTM_NEWLINK: ifi_index=50 ifname=x0wlan0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x1002 ()
nl80211: Ignore interface down event since interface x0wlan0 is up
RTM_NEWLINK: ifi_index=50 ifname=x0wlan0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK: ifi_index=3 ifname=wlan0 wext ifi_family=0 ifi_flags=0x1003 ([UP])
nl80211: Event message available
nl80211: Ignored event 34 (NL80211_CMD_NEW_SCAN_RESULTS) for foreign interface (ifindex 3 wdev 0x0 wiphy -1)

iptables: NAT
MASQUERADE all opt -- in * out !x0wlan0 192.168.230.0/24 !-> 192.168.230.0/24 /* lrt48517x0wlan0 /
ACCEPT all opt -- in x0wlan0 out * 192.168.230.0/24 -> 0.0.0.0/0 /
lrt48517x0wlan0 /
ACCEPT all opt -- in * out x0wlan0 0.0.0.0/0 -> 192.168.230.0/24 /
lrt48517x0wlan0 */
Loaded kernel module nf_nat_pptp

iptables: allow DNS
ACCEPT tcp opt -- in x0wlan0 out * 192.168.230.0/24 -> 192.168.230.1 tcp dpt:53 /* lrt48517x0wlan0 /
ACCEPT udp opt -- in x0wlan0 out * 192.168.230.0/24 -> 192.168.230.1 udp dpt:53 /
lrt48517x0wlan0 */

iptables: allow dhcp
ACCEPT udp opt -- in x0wlan0 out * 0.0.0.0/0 -> 0.0.0.0/0 udp dpt:67 /* lrt48517x0wlan0 */

Starting dnsmasq
Dec 20 23:55:08 dnsmasq[48748]: started, version 2.90 cachesize 150
Dec 20 23:55:08 dnsmasq[48748]: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conntrack ipset nftset auth cryptohash DNSSEC loop-detect inotify dumpfile
Dec 20 23:55:08 dnsmasq-dhcp[48748]: DHCP, IP range 192.168.230.10 -- 192.168.230.250, lease time 1h
Dec 20 23:55:08 dnsmasq-dhcp[48748]: DHCP, sockets bound exclusively to interface x0wlan0
Dec 20 23:55:08 dnsmasq[48748]: reading /etc/resolv.conf
Dec 20 23:55:08 dnsmasq[48748]: using nameserver 127.0.0.53#53
Dec 20 23:55:08 dnsmasq[48748]: cleared cache
dnsmasq PID: 48748
Channel list update timeout - try to continue anyway
nl80211: Regulatory information - country=00
nl80211: 2402-2472 @ 40 MHz 20 mBm
nl80211: 2457-2482 @ 20 MHz 20 mBm (no IR)
nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR)
nl80211: 5170-5250 @ 80 MHz 20 mBm (no IR)
nl80211: 5250-5330 @ 80 MHz 20 mBm (DFS) (no IR)
nl80211: 5490-5730 @ 160 MHz 20 mBm (DFS) (no IR)
nl80211: 5735-5835 @ 80 MHz 20 mBm (no IR)
nl80211: 57240-63720 @ 2160 MHz 0 mBm
nl80211: Added 802.11b mode based on 802.11g information
nl80211: Mode IEEE 802.11g: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467[NO_IR] 2472[NO_IR] 2484[NO_IR]
nl80211: Mode IEEE 802.11a: 5180 5200[NO_IR] 5220[NO_IR] 5240[NO_IR] 5260[NO_IR][RADAR] 5280[NO_IR][RADAR] 5300[NO_IR][RADAR] 5320[NO_IR][RADAR] 5500[NO_IR][RADAR] 5520[NO_IR][RADAR] 5540[NO_IR][RADAR] 5560[NO_IR][RADAR] 5580[NO_IR][RADAR] 5600[NO_IR][RADAR] 5620[NO_IR][RADAR] 5640[NO_IR][RADAR] 5660[NO_IR][RADAR] 5680[NO_IR][RADAR] 5700[NO_IR][RADAR] 5720[NO_IR][RADAR] 5745[NO_IR] 5765[NO_IR] 5785[NO_IR] 5805[NO_IR] 5825[NO_IR] 5845[DISABLED] 5865[DISABLED] 5885[DISABLED]
nl80211: Mode IEEE 802.11b: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467[NO_IR] 2472[NO_IR] 2484[NO_IR]
Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=20 dBm
Allowed channel: mode=2 chan=36 freq=5180 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=20 dBm
Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=20 dBm
Frequency 5745 (primary) not allowed for AP mode, flags: 0x853 NO-IR
Primary frequency not allowed
x0wlan0: IEEE 802.11 Configured channel (149) or frequency (5745) (secondary_channel=1) not found from the channel list of the current mode (2) IEEE 802.11a
x0wlan0: IEEE 802.11 Hardware does not support configured channel
Could not select hw_mode and channel. (-3)
x0wlan0: interface state COUNTRY_UPDATE->DISABLED
x0wlan0: AP-DISABLED
hostapd_interface_deinit_free(0x558874ccc2b0)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0x558874ccc2b0)
x0wlan0: interface state DISABLED->DISABLED
hostapd_bss_deinit: deinit bss x0wlan0
x0wlan0: Deauthenticate all stations
nl80211: send_mlme - da=ff:ff:ff:ff:ff:ff sa=a2:62:2b:29:dc:d7 bssid=a2:62:2b:29:dc:d7 noack=0 freq=0 no_cck=0 offchanok=0 wait_time=0 no_encrypt=0 fc=0xc0 (WLAN_FC_STYPE_DEAUTH) nlmode=3
nl80211: send_mlme - Use bss->freq=0
nl80211: send_mlme -> send_frame_cmd
nl80211: CMD_FRAME freq=0 wait=0 no_cck=0 no_ack=0 offchanok=0
CMD_FRAME - hexdump(len=26): c0 00 00 00 ff ff ff ff ff ff a2 62 2b 29 dc d7 a2 62 2b 29 dc d7 00 00 03 00
nl80211: Frame command failed: ret=-22 (Invalid argument) (freq=0 wait=0)
x0wlan0: AP-DISABLED
hostapd_cleanup(hapd=0x558874ccd820 (x0wlan0))
x0wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface x0wlan0 wasn't started
hostapd_interface_deinit_free: driver=0x55886d0d8960 drv_priv=0x558874cd9010 -> hapd_deinit
nl80211: deinit ifname=x0wlan0 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
netlink: Operstate: ifindex=50 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 50 iftype 2 (STATION)
nl80211: Failed to set interface 50 to mode 2: -16 (Device or resource busy)
nl80211: Try mode change after setting interface down
nl80211: Set mode ifindex 50 iftype 2 (STATION)
nl80211: Mode change succeeded while interface is down
nl80211: Teardown AP(x0wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Unsubscribe mgmt frames handle 0x8888dd00fc45f2a9 (AP teardown)
hostapd_interface_free(0x558874ccc2b0)
hostapd_interface_free: free hapd 0x558874ccd820
hostapd_cleanup_iface(0x558874ccc2b0)
hostapd_cleanup_iface_partial(0x558874ccc2b0)
hostapd_cleanup_iface: free iface=0x558874ccc2b0

== Setting up completed, now linux-router should be working ==
Error occured

ERROR: hostapd failed. (tip: try '--hostapd-debug' to get some debug info)

Error occured

Doing cleanup..
Dec 20 23:55:16 dnsmasq[48748]: exiting on receipt of SIGTERM
Killed dnsmasq.pid 48748 dnsmasq
Terminated
Killed haveged_watchdog.pid 48691 lnxrouter
Killed keep_running.pid 48794 bash
Undoing iptables changes ..
Exiting: This is the only running instance
Cleaning up done

@kphanipavan
Copy link
Contributor Author

I am guessing you have an Intel card. 5G Hotspot works fine in Windows with Intel wifi cards but doesn't work well on Linux. Features section, point 2 and Notes section in my initial comment, 5Ghz is either not supported or supports during certain times.

@Supernovatux
Copy link

Hey mine is a Mediatek card. It uses mt7921e driver. As per the features section wifi5 @ 80mhz should work right. I am using kernel ver 6.12.

@Supernovatux
Copy link

Heyy mb, I was missing core/wireless-regdb package.
The below now works but link speed is still only 390Mbps compared to 867 on windows.
Command used

sudo lnxrouter --ap wlan0 supernovatux -p qwerty123 --wifi4 --wifi5 --freq-band 5 \
            --vht-capab [MAX-MPDU-11454][RXLDPC][SHORT-GI-80][TX-STBC-2BY1][SU-BEAMFORMEE][MU-BEAMFORMEE][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN] \
            --ht-capab [LDPC][HT40+][HT40-][SHORT-GI-40][SHORT-GI-20][GF][TX-STBC][RX-STBC1][DSSS_CCK-40][MAX-AMSDU-7935] \
            -c 149 --vht-ch-width 1 --vht-seg0-ch 155 --no-virt --country IN

@Supernovatux
Copy link

Heyy mb, I was missing core/wireless-regdb package. The below now works but link speed is still only 390Mbps compared to 867 on windows. Command used

sudo lnxrouter --ap wlan0 supernovatux -p qwerty123 --wifi4 --wifi5 --freq-band 5 \
            --vht-capab [MAX-MPDU-11454][RXLDPC][SHORT-GI-80][TX-STBC-2BY1][SU-BEAMFORMEE][MU-BEAMFORMEE][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN] \
            --ht-capab [LDPC][HT40+][HT40-][SHORT-GI-40][SHORT-GI-20][GF][TX-STBC][RX-STBC1][DSSS_CCK-40][MAX-AMSDU-7935] \
            -c 149 --vht-ch-width 1 --vht-seg0-ch 155 --no-virt --country IN

Sorry for the spam. Link speed is 867Mbps on my Redmi Note 12 pro, One plus Nord CE reports it as 390Mbps but using the network increased the number to 433Mbps now. Thanks @kphanipavan for your work :)

Anyways, @garywill should this be documented, will a PR be appreciated to README.md

@kphanipavan
Copy link
Contributor Author

Glad you figured it out. That package provides restrictions to your wifi card about which channel is allowed for hotspot. Adding it to the hotspot dependency list makes sense. @Supernovatux you are welcome to open an MR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants