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

Alfa AWUS036ACM and multi SSID access point with hostapd ? #3

Open
CpServiceSpb opened this issue Aug 9, 2021 · 20 comments
Open

Alfa AWUS036ACM and multi SSID access point with hostapd ? #3

CpServiceSpb opened this issue Aug 9, 2021 · 20 comments

Comments

@CpServiceSpb
Copy link

I recently got AWUS036ACM based on Mediatek MT7612U chip plugged to USB3 port of server where Ubunt 18.04 x64 LTS was installed.
At the time I can not get multi ssid working configuration with the module and hostapd.
I get:

wlan: interface state UNINITIALIZED->COUNTRY_UPDATE
wlan: interface state COUNTRY_UPDATE->HT_SCAN
20/40 MHz operation not permitted on channel pri=6 sec=10 based on overlapping BSSes
Using interface wlan with hwaddr 02:aa:bb:cc:dd:50 and ssid "My2G"
Could not set interface wlan2 flags (UP): Device or resource busy
Failed to add BSS (BSSID=02:aa:bb:cc:dd:51)
Interface initialization failed
wlan: interface state HT_SCAN->DISABLED
wlan: AP-DISABLED
wlan: interface state DISABLED->DISABLED
wlan2: AP-DISABLED
hostapd_free_hapd_data: Interface wlan2 wasn't started
wlan: AP-DISABLED
hostapd_free_hapd_data: Interface wlan wasn't started
nl80211: deinit ifname=wlan disabled_11b_rates=0

Driver using within hostapd is nl80211.
My hostapd conf file:

ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
interface=wlan
driver=nl80211
#bridge=br0

### IEEE 802.11
ssid=Wifi2G
# Band: a = 5g (a/n/ac), g = 2g (b/g/n)
hw_mode=g
channel=6
max_num_sta=128
auth_algs=1
#macaddr_acl=0

### DFS
country_code=US
ieee80211d=1
ieee80211h=1

### IEEE 802.11n
ieee80211n=1
ht_capab=[RXLDPC][HT20][HT40+][HT40-][SHORT-GI-20][SHORT-GI-40][MAX-AMSDU-3839][DSSS_CCK-HT40]

### IEEE 802.11ac
#ieee80211ac=1
#vht_oper_chwidth=1
#vht_capab=[HT40-]
#vht_oper_centr_freq_seg0_idx=46

### IEEE 802.11i
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=12345678
wpa_group_rekey=60
wpa_gmk_rekey=3600

bss=wlan2
ssid=Wifi2GGuest
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=11111111
wpa_group_rekey=60
wpa_gmk_rekey=3600

#ignore_broadcast_ssid=0
logger_syslog_level=0

### WMM
wmm_enabled=1
uapsd_advertisement_enabled=1
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0

### TX queue parameters
tx_queue_data3_aifs=7
tx_queue_data3_cwmin=15
tx_queue_data3_cwmax=1023
tx_queue_data3_burst=0
tx_queue_data2_aifs=3
tx_queue_data2_cwmin=15
tx_queue_data2_cwmax=63
tx_queue_data2_burst=0
tx_queue_data1_aifs=1
tx_queue_data1_cwmin=7
tx_queue_data1_cwmax=15
tx_queue_data1_burst=3.0
tx_queue_data0_aifs=1
tx_queue_data0_cwmin=3
tx_queue_data0_cwmax=7
tx_queue_data0_burst=1.5

The wlan mac first ocet is changed to 02.

What do I do wrong ?

@morrownr
Copy link
Owner

morrownr commented Aug 9, 2021

I have concerns about your hostapd.conf but first, run and post the results of:

$ iw dev

@morrownr
Copy link
Owner

Quote: "ht_capab=[RXLDPC][HT20][HT40+][HT40-][SHORT-GI-20][SHORT-GI-40][MAX-AMSDU-3839][DSSS_CCK-HT40]"

Some recommendations:

You are setting up to use 2.4 ghz which is band 1. Your ht_capab line needs to reflect that. The command to check capabilities is:

$ iw list

Problem: [DSSS_CCK-HT40] is not supported so adding it will cause hostapd to not come up.

Problem: [RXLDPC] is not correct for ht_capab. It is correct for vht_capab.

Problem: [MAX-AMSDU-3839] is the default so it is unnecessary.

The below is a proper full capability line for band 1 use for the Alfa ACM:

ht_capab=[LDPC][HT40+][HT40-][GF][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1]

@CpServiceSpb
Copy link
Author

CpServiceSpb commented Aug 10, 2021

Here is:
iw dev

phy#0
        Interface wlan
                ifindex 6
                wdev 0x1
                addr 02:aa:bb:cc:dd:50
                ssid Wifi2G
                type AP
                channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
                txpower 23.00 dBm

I changed capabilities to
ht_capab=[LDPC][HT40+][HT40-][GF][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1]
But nothing changes:

wlan: interface state UNINITIALIZED->COUNTRY_UPDATE
wlan: interface state COUNTRY_UPDATE->HT_SCAN
20/40 MHz operation not permitted on channel pri=6 sec=10 based on overlapping BSSes
Using interface wlan with hwaddr 02:aa:bb:cc:dd:50 and ssid "Wifi2G"
Could not set interface wlan2 flags (UP): Device or resource busy
Failed to add BSS (BSSID=02:aa:bb:cc:dd:51)
Interface initialization failed
wlan: interface state HT_SCAN->DISABLED
wlan: AP-DISABLED
wlan: interface state DISABLED->DISABLED
wlan2: AP-DISABLED
hostapd_free_hapd_data: Interface wlan2 wasn't started
wlan: AP-DISABLED
hostapd_free_hapd_data: Interface wlan wasn't started
nl80211: deinit ifname=wlan disabled_11b_rates=0

There is no wlan2 interface upped at boot time.

The driver is from the box.
May be other driver is necessary.

@CpServiceSpb
Copy link
Author

It seems I solved the situation by adding bssid for each ssid and 1st octet of each other bssid is increased to 4, for example:

ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
interface=wlan
driver=nl80211
#bridge=br0

### IEEE 802.11
# Band: a = 5g (a/n/ac), g = 2g (b/g/n)
hw_mode=g
channel=6
max_num_sta=128
auth_algs=1
#macaddr_acl=0

### DFS
country_code=US
ieee80211d=1
ieee80211h=1

### IEEE 802.11n
ieee80211n=1
#ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40]
#ht_capab=[HT40+][HT40-][SHORT-GI-20][SHORT-GI-40][MAX-AMSDU-7935]
ht_capab=[LDPC][HT40+][HT40-][GF][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1]

### IEEE 802.11ac
#ieee80211ac=1
#vht_oper_chwidth=1
#vht_capab=[HT40-]
#vht_oper_centr_freq_seg0_idx=46

### IEEE 802.11i
bssid=02:aa:bb:cc:dd:50
ssid=Wifi2G
wpa=2
wpa_key_mgmt=WPA-PSK
#wpa_pairwise=TKIP
rsn_pairwise=CCMP
wpa_passphrase=8126887887
wpa_group_rekey=60
wpa_gmk_rekey=3600

bss=wlan2
bssid=06:aa:bb:cc:dd:55
ssid=Wifi2GGuest
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=11111111
wpa_group_rekey=60
wpa_gmk_rekey=3600

#ignore_broadcast_ssid=0
logger_syslog_level=0

### WMM
wmm_enabled=1
uapsd_advertisement_enabled=1
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0

### TX queue parameters
tx_queue_data3_aifs=7
tx_queue_data3_cwmin=15
tx_queue_data3_cwmax=1023
tx_queue_data3_burst=0
tx_queue_data2_aifs=3
tx_queue_data2_cwmin=15
tx_queue_data2_cwmax=63
tx_queue_data2_burst=0
tx_queue_data1_aifs=1
tx_queue_data1_cwmin=7
tx_queue_data1_cwmax=15
tx_queue_data1_burst=3.0
tx_queue_data0_aifs=1
tx_queue_data0_cwmin=3
tx_queue_data0_cwmax=7
tx_queue_data0_burst=1.5

Is ithere blue or other color led on module as on awus036ac ?
And is signal power tunnable on awus036acm ?

@morrownr
Copy link
Owner

Quote: "Is there blue or other color led on module as on awus036ac ?"

That is a good question. I started to investigate this issue myself a few months ago but I ended up busy on something else.

Quote: "And is signal power tunnable on awus036acm ?"

Yes, subject to the legal limitations. Example:

$ sudo iw dev wlan set txpower fixed 1600

@morrownr
Copy link
Owner

morrownr commented Aug 10, 2021

The following issue has some info about setting up guest (multi SSID):

https://github.com/morrownr/USB-WiFi/issues

It is Issue 3. You may have it figured out by now but I thought I would pass the info/


Regarding the LED, when I have some time in a few weeks, I think I am going to investigate the issue with the LED. For me, if the LED was flashing, I would be looking for a way to turn it off but it would be nice for it to be configurable. I was able to add that capability to the Realtek drivers I support. Are you a C coder?


I am curious about the setup you have as I have a line on my todo list to write a guide for setting up an AP on Ubuntu. How did you handle the networking setup with Ubuntu server?

@CpServiceSpb
Copy link
Author

CpServiceSpb commented Aug 10, 2021

Regarding LED, it do not light in my item.
Regrding set up, I posted working hostapd.con file.
At other aspects I have quite complicated configuration:
Bind9 as dns with 'view' set up,, Freeradius as dhcp operating in depend on interface, Iptables as firewall.
Most of these is not necessar to usual user.
Also I removed network manager, netplan and installed ifupdown.

I think it is possible to set up AP with dnsmasq or Bind9/Isc-dhcp.
It would be easier.

At the time I have one point to need to be solved - assign IP for guest wlan interface.
When I solve it I will try to add my some "dollars/pounds/rubles" to the future guide.

@CpServiceSpb
Copy link
Author

CpServiceSpb commented Aug 11, 2021

At the time I could assign an IP to guest virtual wlan interface, but there is no activity on the interface even I try to connect to unlike main wlan interface.
At the time I don't understand how it solve.
Here is log:

wlan: interface state UNINITIALIZED->COUNTRY_UPDATE
wlan: interface state COUNTRY_UPDATE->HT_SCAN
20/40 MHz operation not permitted on channel pri=6 sec=10 based on overlapping BSSes
Using interface wlan with hwaddr 02:aa:bb:cc:dd:50 and ssid "Wifi2G"
Using interface wlan2 with hwaddr 06:aa:bb:cc:dd:55 and ssid "Wifi2GGuest"
wlan: interface state HT_SCAN->ENABLED
wlan: AP-ENABLED

May be some activation of wlan2 is necessary, looks like:

wlan2: interface state HT_SCAN->ENABLED
wlan2: AP-ENABLED

@morrownr
Copy link
Owner

I wish I could help but I have no visibility on the specifics of how your networking is setup.

What I can do is work on adding the instructions for a guest setup to the Bridged Wireless Access Point document as I have time.

@CpServiceSpb
Copy link
Author

CpServiceSpb commented Aug 11, 2021

I think that there is no network level, it is wi-fi level at itself.
Because there is no any log messages when hostapd run at foreground mode.
There is no bridge at all.
There are 2 interfaces: wlan and wlan2

I found out, if bssid is not to specify manually in hostapd.conf with +2 for 1st octet for each bssid but change phywlan mac 1st octet to 02, new mac for other then 1st bssid will not generate at automatic mode.

wlan: interface state UNINITIALIZED->COUNTRY_UPDATE
wlan: interface state COUNTRY_UPDATE->HT_SCAN
20/40 MHz operation not permitted on channel pri=6 sec=10 based on overlapping BSSes
Using interface wlan with hwaddr 02:aa:bb:cc:dd:50 and ssid "My2G"
Could not set interface wlan2 flags (UP): Device or resource busy
Failed to add BSS (BSSID=02:aa:bb:cc:dd:51)

@CpServiceSpb
Copy link
Author

CpServiceSpb commented Aug 12, 2021

Alfa support sent me https://docs.alfa.com.tw/Support/Linux/MT7612U/
There is mentioned on/off/blinking of the LED:
under root user:
cd /sys/kernel/debug/ieee80211/phy0/mt76
echo 0x770 > regidx
either
echo 0x800000 > regval # Turn LED ON
or
echo 0x820000 > regval # Turn LED OFF
or
echo 0x840000 > regval # Make LED BLINK

@morrownr
Copy link
Owner

Good find. Have you tried it?

@CpServiceSpb
Copy link
Author

CpServiceSpb commented Aug 13, 2021

Yes. It works.

@morrownr
Copy link
Owner

Okay. That tells me the code for LED support is in the driver.

What we need are good ole module parameters for each option as it would work with secure mode and be persistent. We should probably consider using "blink" mode as the default.

The main box I am on right now is in secure mode as I need at least one system with secure mode for testing and what you are doing is locked out in secure mode... unless you do a temp unlock and that gets into something that is beyond user friendly.

As I get time, I will take a good look and see about submitting a pull request to Linux Wireless.

@CpServiceSpb
Copy link
Author

The one hing I can not win it is additional SSID has no any activity on interface connected with it.

@CpServiceSpb
Copy link
Author

CpServiceSpb commented Aug 15, 2021

As a brief:
There is Ubuntu 18.04 x64 LTS with USB Alfa AWUS036ACM based on Mediatek 7612u, out-of-box driver, netplan and network manager are removed, hostapd 2.6 is installed as well as ifupdown.
The Wi-fi device works as AP – at mater mode – real wlan interface is appeared after driver loaded – IP is assigned via ifupdown – let’ s call it “real” interface, and “private” BSSID.
Even second interface connected to other BSSID is appeared after hostapd started and IP is assigned for the interface via ifupdown - let’ s call it “virtual” interface, and “guest” BSSID.
Mac address of real interface is changed to 02:aa:bb:cc:dd:50 (when original is 00:aa:bb:cc:dd:5e) using ifupdown.
At the time:

  1. No any traffic is via virtual interface even at authentication stage;
  2. Mac address of virtual interface is not able to be generated automatically.
    As I understand, it has to be 02:aa:bb:cc:dd:51, but the following error is appeared:
Using interface wlx00aabbccdd5d with hwaddr 02:aa:bb:cc:dd:50 and ssid "Private"
Could not set interface wlan2 flags (UP): Device or resource busy
Failed to add BSS (BSSID=02:aa:bb:cc:dd:51)
Interface initialization failed.

Now mac address of virtual interface of “guest” BSSID must be specified manually to +2 for the first octet and other octet doesn’ t matter.
In the case hostapd will start and virtual wlan interface will be created, otherwise there will be the same error.
And there is still not traffic via virtual interface !

But I founded the solution !!
I don’ t know if it is the right solution, nevertheless it works.

That is:
mac for real “private” interface must be begin from either 02 or 04 or …, for example 02:a1:b2:c3:d4:50
mac for virtual interface must be +2 to the first octet, other octets must be strictly equals of each ones of real interface, for example 04:a1:b2:c3:d4:50, NOT 04:a1:b2:c3:d4:51 or NOT 02:a1:b2:c3:d4:51 or NOT 04:a1:ba:c3:d4:50 !

If one of octet of virtual interface after first will differ from the appropriate octet of real interface, traffic will not go through virtual interface.
For other devices, which support multi BSSID, mac address of a virtual interface can be generated automatically, or the 1st octet of mac remains 02.

@morrownr
Copy link
Owner

Good brief. Now I see what you are doing.

There is an issue where the MULTI SSID support is discussed at:

morrownr/USB-WiFi#3

I have not had to time to try it yet but I plan on it. Maybe it contains some information that will be of use to you and maybe you can contact the author if need be.

@CpServiceSpb
Copy link
Author

CpServiceSpb commented Aug 16, 2021

Ohh, if I saw it earlier I would save a lot of time but didn' t get a lot of my own experience.

@Medullitus
Copy link

Ohh, if I saw it earlier I would save a lot of time but didn' t get a lot of my own experience.

Would it be a problem to use fluxion and evil twin attack with it?

@Medullitus
Copy link

Good brief. Now I see what you are doing.

There is an issue where the MULTI SSID support is discussed at:

morrownr/USB-WiFi#3

I have not had to time to try it yet but I plan on it. Maybe it contains some information that will be of use to you and maybe you can contact the author if need be.

Would it be a problem to use fluxion and evil twin attack with it?

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

No branches or pull requests

3 participants