0

I have to lower the range of a wlan adapter to limit the area I'm capturing data in. I'm using the newest version of Raspbian, Pi 4 and the adapter is ralink rt2870

I've tried adjusting the txpower using the iw dev wlan0 set txpower fixed 1(and any number up to 30) but I get command failed: Operation not support (-95)

iw reg get returns this which makes me believe the driver is hardcoded to 20dbm:

global
country 00: DFS-UNSET
    (2402 - 2472 @ 40), (N/A, 20), (N/A)
    (2457 - 2482 @ 20), (N/A, 20), (N/A), AUTO-BW, PASSIVE-SCAN
    (2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM, PASSIVE-SCAN
    (5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW, PASSIVE-SCAN
    (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW, PASSIVE-SCAN
    (5490 - 5730 @ 160), (N/A, 20), (0 ms), DFS, PASSIVE-SCAN
    (5735 - 5835 @ 80), (N/A, 20), (N/A), PASSIVE-SCAN
    (57240 - 63720 @ 2160), (N/A, 0), (N/A)

If there is no way to adjust the txpower, what other ways can I adjust/lower the range of the antenna?

I have already tried (and it works but might not be enough) to simply remove the antenna and just use the adapter. Last resort is simply buying lower power antenna or an adapter that support txpower change AND monitoring and is pi4 compatible

  • iw reg set BO; iwconfig wlan0 txpower 33 ? Else your driver do not support txpower change. – Ephemeral Jan 8 at 13:47
  • Please look is in the law of your country , for example here – Ephemeral Jan 8 at 13:58
  • @Ephemeral The txpower value does not change. Is there any other way of adjusting the power? – Kwandes Jan 8 at 14:18
  • From your page product : no Linux logo, only Windows and Mac. ... So no other way. Maybe try to find a driver on github. – Ephemeral Jan 8 at 14:51
  • Maybe try this following all steps on the page. – Ephemeral Jan 8 at 15:07
1

I do not have the ralink rt2870 USB/WiFi adapter but here are some general ideas I have tested with the built-in WiFi device that you should also verify with your adapter. How to set the txpower on a RPi 3B+ I have shown at Restrict WiFi range of Pi 3b+. It also works on a RPi 4B.

If I do not have a valid /etc/wpa_supplicant/wpa_supplicant.conf file, I get the same kernel's current regulatory domain information than you with iw reg get, in particular the second line also shows country 00: DFS-UNSET. This indicates for me, that you do not have a valid wpa_supplicant.conf. All following commands are only working with a client connection to a WiFi hotspot, So first you should connect to a WiFi network with a valid country=nn entry in wpa_supplicant.conf for the regulatory domain information.

With using default dhcpcd networking on Raspbian then I get:

rpi ~$ iw reg get
global
country US: DFS-FCC
        (2402 - 2472 @ 40), (N/A, 30), (N/A)
        (5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
        (5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
        (5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
        (5735 - 5835 @ 80), (N/A, 30), (N/A)
        (57240 - 63720 @ 2160), (N/A, 40), (N/A)

rpi ~$ iw dev wlan0 info
Interface wlan0
        ifindex 3
        wdev 0x1
        addr dc:a6:32:01:db:ed
        ssid TestNet
        type managed
        wiphy 0
        channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
        txpower 31.00 dBm

As the last line shows, txpower is set to 31.00 dBm and I cannot see any correlation to the kernels regulatory output.

I also have no problem to set:

rpi ~$ sudo iw dev wlan0 set txpower fixed 100
rpi ~$ iw dev wlan0 info
Interface wlan0
        ifindex 3
        wdev 0x1
        addr dc:a6:32:01:db:ed
        ssid TestNet
        type managed
        wiphy 0
        channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
        txpower 1.00 dBm

Your setting with ... fixed 1 is to low. You have to use the factor 100 to get 1.00 dBm.

| improve this answer | |
0

When I understand the objective correctly, the task is to capture data. For that purpose, you probably set your Wi-Fi interface into monitor mode and capture the frames being received.

If that is correct, fiddling with the Tx power (=transmit power) won’t help at all. You would either have to change the receiver sensitivity or the attenuation of the antenna.

Receiver sensitivity is a problem. Without development access to the Wi-Fi chip configuration, you are not likely to be successful.

Attenuation of the antenna is not a big problem. You could use an antenna with less antenna gain than your current model or simply put some meters of antenna cable between the antenna jack on the device and the actual antenna.

However: Why would you want to do that at all? If your Wi-Fi capture contains too many networks that are not of interest to you, simply filter them out while or after capturing.

Keep in mind: Making your sniffer worse will not only reduce its operating range, but it will also cause it to miss frames in the near field.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.