Skip to content

How to increase txpower #31

@ctrlaltkills

Description

@ctrlaltkills

of my wifi device
Asked 4 years, 6 months ago
Modified 3 months ago
Viewed 34k times
6

Okay, so I've been needing to increase my wireless adapter's txpower.

I have an internal RTL8188EE, and a TP-Link USB adapter.

I bought the TP-Link after reading how well it worked with linux, and turns out it doesn't run nearly as well as the RTL8188EE I already had. Anyway, I don't think the TP adapter can increase txpower at all, but I know for a fact the internal adapter can. I'm somewhat new to Linux, I first installed Ubuntu (I think 16.04?) alongside Windows back in like 2016 but didn't get real into it until the past year or so, and I've been distro hopping to find the best one for me, so right now I have an internal 256GB Crucial SSD with 6 different root partitions, each one having a corresponding 100GB home partition on my external Hard Drive. I have Manjaro Deepin, Solus Budgie, Ubuntu 18.04, Fedora 30, Zorin 15, and MX Linux, along with KDE Neon on another External HDD.

So, when I began trying to increase my txpower, I tried all the solutions listed on here, itsFOSS, the Arch/Manjaro forums, and anywhere else I could find.

I've tried txpower-unlocker, I've tried wireless-regdb-pentest, I've tried everything. I've hit a ridiculous number of walls with all the attempts, except for with Manjaro. I somehow not only got it to work, but actually have it permanently set to 30 dBm, every boot. But the same (or equivalent) steps given for the other distros I have do not work at all. With Ubuntu, I tried the Ubuntu-specific txpower-unlocker git script. It gives me no errors, it'll reg set to BO, but when I give the commands:

ifconfig wlp2s0 down
iw reg set BO
iwconfig wlp2s0 txpower 30
ifconfig wlp2s0 up
and then

iwconfig wlp2s0
It still shows

[matt@localhost ~]$ sudo iwconfig wlp2s0 txpower 30.00
[matt@localhost ~]$ sudo ifconfig wlp2s0 up
[matt@localhost ~]$ iwconfig
virbr0-nic no wireless extensions.
wlp2s0 IEEE 802.11 ESSID:"NETGEAR35"
Mode:Managed Frequency:2.412 GHz Access Point: 28:80:88:C4:BF:DB
Bit Rate=72.2 Mb/s Tx-Power=20 dBm
Retry short limit:7 RTS thr=2347 B Fragment thr:off
Power Management:off
Link Quality=70/70 Signal level=-36 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:2 Missed beacon:0
I have tried it with automated scripts, I've tried doing it manually. I've tried everything. Like I said, I know it's got nothing to do with the card, because it works on Manjaro, but even then after I updated to the newest Linux kernel on Manjaro it refuses to change, just like all the rest. I've had to stay at 4.19.14 to keep it at 30. And sure enough, my 10Mb broadband connection stays at 10mbps on every speed test there is when I'm on Manjaro, and I consistently download at 1-1.3 Mbps, whereas it'll wildly fluctuate with most of the other distros. MX Linux and Zorin seem to be pretty consistent, so I haven't had to bother trying to change it since they get between 9.5 and 10Mb without it. But what I don't understand, and would love it if someone could explain it to me, is how I can have 3 different distributions, running on the same computer, using the same Linux kernel (5.0.8), on MX, Zorin, and Ubuntu 18.04.3, and MX and Ubuntu are based on Debian, and Zorin is based on Ubuntu, yet the wireless quality varies so greatly?

I absolutely love Linux so far, to the point where I've realized that I'll never find one perfect distro and I'll probably always have 3 to 4 permanent ones, but that's precisely why this drives me crazy. I've put Linux distros on my Aunt and girlfriend's computers (to their approval, they couldn't believe how much faster their machines run now), but issues like the txpower thing that make NO sense to me cause me to obsess and spend hours and hours glued to the computer getting frustrated as hell, to the point where the other day my girlfriend rolled over and said, "sudo make me a cup of coffee." cause she figured that would work. ...it did. But anyway, sorry for the diatribe, this is my first Linux forum post, I've been insistent on figuring all this out without asking for any help myself.

networkingwireless
Share
Improve this question
Follow
edited Sep 11, 2020 at 7:49

karel
113k109109 gold badges277277 silver badges307307 bronze badges
asked Aug 13, 2019 at 1:09

Matt McDonald
6111 gold badge11 silver badge22 bronze badges
Add a comment
2 Answers
Sorted by:

Highest score (default)
7

What you want to achieve is not that easy, but it can be done.

First of all, increasing the txpower might violate the law. Thats one reason why you cannot increase that power beyond a certain value, without manipulating / circumventing these built in restrictions.

The following instructions worked like charm using my Raspberry Pi 3b+ with debian buster and debian stretch. It should work with minor modifications on other distributions also.

If you open a terminal and type iw reg get you should see the limitations for your country:

iw reg get

global
country 98: DFS-UNSET
(2402 - 2472 @ 40), (N/A, 20), (N/A)
(2457 - 2482 @ 25), (N/A, 20), (N/A), NO-IR
(2474 - 2482 @ 8), (N/A, 20), (N/A), NO-OFDM, NO-IR
(5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW, NO-IR
(5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW, NO-IR
(5490 - 5710 @ 160), (N/A, 20), (0 ms), DFS, NO-IR
(57240 - 63720 @ 2160), (N/A, 0), (N/A)

phy#1
country GB: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20), (N/A)
(5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW
(5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW
(5490 - 5710 @ 160), (N/A, 27), (0 ms), DFS
(57000 - 66000 @ 2160), (N/A, 40), (N/A)

phy#0
country GB: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20), (N/A)
(5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW
(5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW
(5490 - 5710 @ 160), (N/A, 27), (0 ms), DFS
(57000 - 66000 @ 2160), (N/A, 40), (N/A)
If it is unset you get the generic "world" country code. To set your country you could type iw reg set

This post here describes pretty good, what you have to do, to circumvent the restriction.

Step 1 - Install Packages

apt install python-future python-m2crypto libgcrypt20 libgcrypt20-dev libnl-dev
Step 2 - Download CRDA and the regulatory database files

wget https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git/snapshot/wireless-regdb-master-2019-06-03.tar.gz
wget https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git/snapshot/crda-4.14.tar.gz
Step 3 - Unpack the files

tar xfv crda-4.14.tar.gz
tar xfv wireless-regdb-master-2019-06-03.tar.gz
Step 4 - Manipulate the restrictions

Open the db.txt file in terminal nano wireless-regdb-master-2019-06-03/db.txt Scroll down to your countrycode. Mine is DE for Deutschland / Germany:

country DE: DFS-ETSI
(2400 - 2483.5 @ 40), (100 mW)
(5150 - 5250 @ 80), (200 mW), NO-OUTDOOR, AUTO-BW, wmmrule=ETSI
(5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS, AUTO-BW, wmmrule=ETSI
(5470 - 5725 @ 160), (500 mW), DFS, wmmrule=ETSI
# short range devices (ETSI EN 300 440-1)
(5725 - 5875 @ 80), (25 mW)
# 60 GHz band channels 1-4 (ETSI EN 302 567)
(57000 - 66000 @ 2160), (40)
I modify the first line, that corresponds to the 2.4 GHZ frequency band to my needs and leave the rest as it was because i am not interested in the 5 or 60 GHZ bands:

country DE: DFS-ETSI
(2400 - 2483.5 @ 40), (2000 mW)
(5150 - 5250 @ 80), (200 mW), NO-OUTDOOR, AUTO-BW, wmmrule=ETSI
(5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS, AUTO-BW, wmmrule=ETSI
(5470 - 5725 @ 160), (500 mW), DFS, wmmrule=ETSI
# short range devices (ETSI EN 300 440-1)
(5725 - 5875 @ 80), (25 mW)
# 60 GHz band channels 1-4 (ETSI EN 302 567)
(57000 - 66000 @ 2160), (40)
Apart from that it seems that my wireless cards AWUS036NHA seem to be stuck in a country set by the manufacturer. In my particular case it is GB. So i have to change that one:

So i modify

country GB: DFS-ETSI
(2402 - 2482 @ 40), (20)
(5170 - 5250 @ 80), (20), AUTO-BW, wmmrule=ETSI
(5250 - 5330 @ 80), (20), DFS, AUTO-BW, wmmrule=ETSI
(5490 - 5710 @ 160), (27), DFS, wmmrule=ETSI
# 60 GHz band channels 1-4, ref: Etsi En 302 567
(57000 - 66000 @ 2160), (40)

to

country GB: DFS-ETSI
(2402 - 2482 @ 40), (30)
(5170 - 5250 @ 80), (20), AUTO-BW, wmmrule=ETSI
(5250 - 5330 @ 80), (20), DFS, AUTO-BW, wmmrule=ETSI
(5490 - 5710 @ 160), (27), DFS, wmmrule=ETSI
# 60 GHz band channels 1-4, ref: Etsi En 302 567
(57000 - 66000 @ 2160), (40)
Step 5 - Make regulatory.bin

cd into your wireless-regdb-master-2019-06-03 folder and type make

cd wireless-regdb-master-2019-06-03/
make
This will create a few new files.

wireless-regdb-master-2019-06-03# ls
CONTRIBUTING dbparse.pyc LICENSE regulatory.bin.5 root.key.pub.pem sha1sum.txt
db2bin.py db.txt Makefile regulatory.db root.x509.pem web
db2fw.py debian-example README regulatory.db.5 sforshee.key.pub.pem wireless-regdb.spec
dbparse.py gen-pubcert.sh regulatory.bin regulatory.db.p7s sforshee.x509.pem
Step 6 - Backup your files

Before overwriting our original regulatory files i suggest you do a backup.

Do a backup of

cp /lib/firmware/regulatory.db /lib/firmware/regulatory.db-backup
cp /lib/firmware/regulatory.db.p7s /lib/firmware/regulatory.db.p7s-backup
cp /lib/crda/regulatory.bin /lib/crda/regulatory.bin-backup
Step 7 - Apply modifications

From inside your wireless-regdb-master-2019-06-03 folder do copy the new created files from Step 5 to their appropriate locations:

cp regulatory.db regulatory.db.p7s /lib/firmware/
cp regulatory.bin /lib/crda/
Step 8 - Sign / Validate

From inside your wireless-regdb-master-2019-06-03 folder do copy the *.pub.pem files to the unpacked crda folder:

cp *.pub.pem ../crda-4.14/pubkeys
Do also copy the @.pub.pem file from inside your /lib/crda/pubkey to your unpacked crda/pubkeys folder

cp /lib/crda/pubkeys/*@*pub.pem ../crda-4.14/pubkeys/
Then cd into that folder.

cd ../crda-4.14/
and type make && make install

Step 8.1 - The Error-Case

In case you receive the following error:

ERROR: The file: /usr/lib/crda/regulatory.bin is missing. You need this in place in order
to verify CRDA. You can get it from:

git://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git

Once cloned (no need to build) cp regulatory.bin to /usr/lib/crda/regulatory.bin
Use "make noverify" to disable verification

Makefile:100: recipe for target '/usr/lib/crda/regulatory.bin' failed
make: *** [/usr/lib/crda/regulatory.bin] Error 1
open the Makefile nano Makefile and change line

REG_BIN?=/usr/lib/crda/regulatory.bin
to

REG_BIN?=/lib/crda/regulatory.bin
and type make clean && make && make install"
https://askubuntu.com/questions/1165300/how-to-increase-txpower-of-my-wifi-device#:~:text=How%20to%20increase%20txpower,clean%20%26%26%20make%20%26%26%20make%20install

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions