15

I would like to increase the power of my wireless adapter but when I enter

sudo iwconfig wlan0 txpower 30mW

in the terminal and then check with iwconfig I can see that the txpower is still what it used to be before I tried changing it.

My network controller is:

02:00.0 Network controller: Intel Corporation Wireless 7260 (rev 73)

And here is the ifconfig output if that helps:

wlan0   
Link encap:Ethernet  HWaddr 80:19:34:f5:39:08  
inet addr:192.168.1.129  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::8219:34ff:fef5:3908/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:4474 errors:0 dropped:0 overruns:0 frame:0
TX packets:3726 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:2361924 (2.3 MB)  TX bytes:520175 (520.1 KB)

However, just as a side note, sudo iwconfig wlan0 power off is working, for switching wlan0's power management off.

1
  • what does sudo iwlist txpower wlan0 say?
    – j0h
    Mar 30, 2015 at 3:07

6 Answers 6

15
+100

@wie5Ooma, Is right about violating the law. but about the answering the question. As it goes:

WARNING Removing all restrictions is illegal in the United States. This is only for educational reasons, and if you choose to apply it and break the law, then that is your choice and not mine. Please be careful putting this into action. This is for Education purpose only!

  • First we gonna need to use some packages:

    • python-m2crypto
    • libgcrypt11
    • libgcrypt11-dev
    • libnl-dev
  • To check if they're installed:

    dpkg -s python-m2crypto libgcrypt11 libgcrypt11-dev libnl-dev
    
  • If not, to install:

    apt-get install python-m2crypto libgcrypt11 libgcrypt11-dev libnl-dev
    
  • Now, you'll need wireless regulatory database CRDA, and wireless-regdb tools to build the database read by CRDA to provide regulatory domains to the Linux kernel.

  • Navigate to the download folder and unzip the files.

Now here is the interesting part. This is where we actually get to change the regulations. Change your directory to the wireless-regdb folder, and in there you will find a file called db.txt. This is the file we will edit. Let's take a quick look at it:

more db.txt

more of db.txt

  • Now let's take a look at a few things here. Look at what I underlined above. First, let's notice the first entry (country 00) which is the world regulatory domain and this is applied before all else. So when you turn on your BackTrack system, the world domain is applied to you first and then you can change regulatory domains from there to other countries like country AM.

The second thing I underlined, which can go a max of 20 dBm, the third thing I underlined, on the 2.4ghz band. If you wanna change how high you can go, that is the number you want to change.

  • For example, let's change Bolivia's rules*

    nano db.txt Scroll down until you find country BO. enter image description here

  • Look at what I highlighted. This is the number we want to change.

If your card can go up to 2000 mW, then you would change that number to 33, which stands for 33 dBm, which is approximately 2000 mW. The number you are replacing is in decibels.

I am not sure about your card, some wireless cards like the AWUS036NHA may be stuck in a country and cannot be changed from that country. In that case, Find out which country your card believes it is in and change that country's configurations.

Quick DECIBEL understanding:

Every 10 decibels is a 10X increase in power starting from 1 dBm equal to 1mW... 10 dBm equals 10 mW, 20 dBm equals 100 mW, 30 dBm equals 1000 mW, and so on. Quick DECIBEL understanding:

Every 10 decibels is a 10X increase in power starting from 1 dBm equal to 1mW... 10 dBm equals 10 mW, 20 dBm equals 100 mW, 30 dBm equals 1000 mW, and so on. Every 3 decibels is approximately double that of the prior power, so 30 dBm is 1000 mW, if we add 3 dBm, then we can double the power such that 33 dBm is about equal to 2000 mW. Every 3 decibels is approximately double that of

the prior power, so 30 dBm is 1000 mW, if we add 3 dBm, then we can double the power such that 33 dBm is about equal to 2000 mW.

Now, Pay attention.

enter image description here

Notice now I changed the number to 33. When we are finished here, when I change my regulatory domain to BO, i can set my txpower to 33.

  • Now save the changes when you are done by pressing first, Ctrl+X, then Y, and finally, Enter.

Now you need to swap our old regulatory file with the one you downloaded. While still in the wireless-regdb directory, just enter the command make.

You'll notice you have some new files now in that directory. This is good. your regulatory.bin file in this directory now needs to be replaced with the old one.

First navigate to the authentic regulatory.db's location.

cd /usr/lib/crda

And let's also make a backup of the old one just in case (Recommended).

mv regulatory.bin regulatoryOLD.bin

Now let's bring in the new one. Go back to your directory of our new regulatory.bin and let's copy it over and verify it's there.

cd {path to your new regulatory.bin}
cp regulatory.bin /usr/lib/crda/regulatory.bin
cd /usr/lib/crda
ls

Validating Now we have our new regulatory.db, but it is not valid yet. Go back to the wireless-regdb directory and you'll notice you have some files with an extension of .pem. Copy ALL files ending with a .pem into your downloaded crda directory in pubkeys. These are the files that CRDA will use to check if regulatory.bin is valid.

cd ~/Desktop/wireless-regdb-2013.10.11
cp root.key.pub.pem ~/Desktop/crda-1.1.3/pubkeys/root.key.pub.pem
cp linville.key.pub.pem
~/Desktop/crda-1.1.3/pubkeys/linville.key.pub.pem

And verify:

cd ~/Desktop/crda-1.1.3/pubkeys
ls

Finally, Now go up a directory from where you are back to the downloaded crda directory and install this puppy.

cd ..
make
make install

You should be seeing something like that. enter image description here

If so, reboot: sudo reboot

After reboot:

iw reg set BO
iwconfig wlan0 txpower 33
7
  • 3
    john_s has a stability problem with a Intel card and not a problem with the wireless power (a X-Y problem meta.stackexchange.com/questions/66377/what-is-the-xy-problem) However, your answer is the best answer for the question, it will work only for high power antennas, but your answer deserves the bounty.
    – 0x2b3bfa0
    Apr 5, 2015 at 8:14
  • @j0h said below: The Bolivia trick should only work if the db is less than 30. If you look at the bolivia settings, the limit is 30. if you want to switch to bolivia, and go higher, you need to edit and recompile the database that contains the regional settings. why you wouldn't use US, I don't know, there is a US in the database. try this: null-byte.wonderhowto.com/how-to/… youll need to find the actual source for crda though. I found this page in the man page for wireless.wiki.kernel.org/en/developers/Regulatory#crda
    – 0x2b3bfa0
    Apr 5, 2015 at 8:34
  • 1
    Where is the regulatory.db file? On ubuntu 16.04 I don't even have the /usr/lib/crda folder. I found it in the /lib/crda folder. Aug 29, 2016 at 13:35
  • It never created a linville.key.pub.pem key for me. Aug 29, 2016 at 13:53
  • I am trying to lower the txpower (to test), and it still remains unchanged to 20dBm. Any ideas?
    – chefarov
    Mar 27, 2018 at 12:52
7

You're trying to boost the transmission power, however that's subject to limitations both legally and technically. Wireless transmissions observe CRDA rules which put simply is a list that describes what maximum transmission power is allowed. Your device/operating system has a country code therefore knows what to do. If there is no countrycode it operates at generic values that are always safe to use.

There's more: Certain cards are even technically limited. They've an in built fixed country code and are constructed such that they can't use a higher power whatever you try.

I have an Intel wireless card too and Tx power is always at 16 whatever I try to increase it.

2
  • Hi wie5Ooma, essentially, I don't want to violate law and I'm not particularly aiming for setting the wireless adapter to 30wM. However, under Windows the signal strength that is shown and also the felt speed of the connection is much better and more stable. Any other hints on what I could try?
    – JoHKa
    Mar 17, 2015 at 0:23
  • Now you're slightly shifting the question towards the realm of opinion-based. Without any numerical evidence I really can't tell if there's any difference between Windows and Linux because I don't use Windows. I have to think a little more about this. On a side note: are you aware that you're writing wM instead of mW? So it should be first a small M followed by a capital W spelling mW which stands for milliWatt.
    – wie5Ooma
    Mar 17, 2015 at 21:42
3

This can be because you are in a country with a limiting law. You can increase the power beyond your local limit but this will likely be breaking the law. This is only for high power antennas.

METHOD 1:

Open terminal and copy paste the following commands:

ifconfig wlan0 down
iw reg set BO
iwconfig wlan0 txpower 30
ifconfig wlan0 up

If above method gives the following error then go for METHOD 2.

Error for wireless request "Set Tx Power" (8B26) :
SET failed on device wlan0 ; Invalid argument.

METHOD 2:

Open terminal and copy paste the following commands:

ifconfig wlan0 down
iw reg set BO
iwconfig wlan0 channel 13
iwconfig wlan0 txpower 30
ifconfig wlan0 up

SOURCE: This page

21
  • 1
    Oh, I meant sudo iwconfig wlan0 txpower 30mW. Even when I do sudo iwconfig wlan0 txpower 20mW instead of 30mW, it's not working.
    – JoHKa
    Mar 18, 2015 at 12:38
  • How do you know that it doesn't works?
    – 0x2b3bfa0
    Mar 18, 2015 at 12:53
  • @ Helio: thanks for getting back. For both methods step 2 sudo iw reg set B0 produces the following error message: not a valid ISO/IEC 3166-1 alpha2 Special non-alpha2 usable entries: 00 World Regulatory domain
    – JoHKa
    Mar 19, 2015 at 21:32
  • @ Helio: I was thinking that I could see whether it's working by simply entering iwconfig and checking the number behind Tx-Power=NUMBER HERE dBm
    – JoHKa
    Mar 19, 2015 at 21:36
  • 1
    It is BO with O, as BOlivia, not B-zero
    – 0x2b3bfa0
    Mar 19, 2015 at 21:36
2

Type these commands, they will enable AGG TX and can greatly improve the performance of wireless N networks. This bug report says that performance dropped by 85% without the use of 11n_disable=8

sudo rmmod iwlmvm
sudo rmmod iwlwifi
sudo modprobe iwlwifi 11n_disable=8

Now, try your computer as you would do normally. If the signal is still low, this solution is probably not a solution for your case. In this case, just restart the computer to revert the change you did. If it becomes normal and fast, do it permanently by typing the following line in the terminal:

sudo gedit /etc/modprobe.d/iwlwifi-disable11n.conf

A file will be opened (it may not exist before that). At the end of the file, paste the following line then save:

options iwlwifi 11n_disable=8

After saving, just quit and reboot.


If this doesn't work, replace 11n_disable=8 with 11n_disable=1 and repeat procedure.

7
  • Hi Helio, thanks for this. When entering sudo rmmod iwlwifi I'm getting the following error message: rmmod: ERROR: Module iwlwifi is in use by: iwlmvm Shall I deactivate iwlmvm?
    – JoHKa
    Mar 25, 2015 at 21:54
  • 1
    I fail to see what this answer has to do with the original question. This '11n_disable' trick does not improve signal strength and on 11n networks effectively impairs the connection because you're disabling N-speed capabilities here thereby limiting speed to 11g, being it 54Mb/s instead of 150 or depending on your equipment even 300 Mb/s.
    – wie5Ooma
    Mar 25, 2015 at 22:49
  • @wie5Ooma you have reason, however it will improve the connection stability, and about the speed, I think that will not be a great loss, however, is john_s which will have the last word ;-)
    – 0x2b3bfa0
    Mar 26, 2015 at 8:57
  • @john_s yes, you may remove iwlmvm if it's loaded. Use this command: sudo rmmod iwlmvm. I updated my post.
    – 0x2b3bfa0
    Mar 26, 2015 at 9:02
  • 1
    The Bolivia trick should only work if the db is less than 30. If you look at the bolivia settings, the limit is 30. if you want to switch to bolivia, and go higher, you need to edit and recompile the database that contains the regional settings. why you wouldn't use US, I don't know, there is a US in the database. try this:null-byte.wonderhowto.com/how-to/… youll need to find the actual source for crda though. I found this page in the man page for crda:wireless.wiki.kernel.org/en/developers/Regulatory#crda
    – j0h
    Mar 31, 2015 at 4:22
1

Hello I personally use Kali linux 2 with an ALPHA network card awus036nh and I use method 1 to change the tx card's power.

For those of you having some trouble with BO reg set , try with GY reg set instead. It's fully functional for me whereas it fails with BO ! Hope it helps!

ifconfig wlan1 down
iw reg set GY
iwconfig wlan1 txpower 30
ifconfig wlan1 up
0

For Ubuntu 16.10, crda is under /lib/crda/. In order to compile the new 'crda', do:

sudo su
cp -r /lib/crda /usr/lib/crda
cd /usr/lib/crda
mv regulatory.bin regulatory.bin.bak
cd {path to your new regulatory.bin}
cp regulatory.bin /usr/lib/crda/regulatory.bin

Then move the generated *.pem files to your downloaded crda directory:

cd {path to downloads folder}/wireless-regdv-YYYY.MM.DD
cp {path to your new regulatory.bin}/*.pem pubkeys/
make
make install

Now copy the crda folder back from '/usr/lib/crda' to its default path in Ubuntu 16:

cp -r /usr/lib/crda /lib/ 

sudo reboot and iw reg set {country-code}.

I've used this method to set my wifi to use the frequency ranges and legal power-levels allocated to the amateur radio service of my country. This is restricted to licensed amateur radio operators only.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .