You bought a WiFi card that can be used at 500mw or even 1w. You run iwconfig and see that txpower is only set to 20. You try to set it to 30, and it doesn’t let you. You try to set your location to Bolivia, because you read that this would fix it, but it doesn’t help.
Maybe that card is an Alfa AWUS036NHA, or maybe it’s a different model.
Well it turns out that some cards have the location set in their EEPROM, so even if you are located in Canada, where you should be able to set your power to 27, you can’t go above 20 because the card thinks it’s in the UK.
Here’s how to fix it in Linux. These instructions have been tested in Backtrack 5RC3.
Here is how things work:
When the card is hooked up, a call is made to CRDA, which will set your location from the data contained on the eeprom. Then, wireless-regdb’s provided regulatory.bin file contains the appropriate restrictions to apply for this location. So all that is needed to fix this is to put a regulatory.bin that replaces the wrong country’s restrictions with the appropriate ones. However, that binary file is signed, and the system verifies it hasn’t been tampered with. Here are the simple steps you need to follow in the right order to defeat this check.
WARNING: Removing all restrictions might be illegal. Do not do it, and if you do, then that’s your decision to break the law, not mine.
- Ensure you have the following packages installed: python-m2crypto libgcrypt11 libgcrypt11-dev libnl-dev
- Download wireless-regdb and CRDA from Kernel.org. Be sure to grab the latest versions.
- Extract them, each in their own directory.
- In the wireless-regdb directory, you will find db.txt. This is the ASCII version of regulatory.bin. Edit it to your liking, but remember that restrictions are applied first for the “world” (00), and then for the country. So for example, BO has no restrictions, so copy that over to the “World” restrictions. See warning about legality above. Apply the proper restrictions for your country to the country your card believes it’s in. That way, your country’s restrictions will apply even for a card that believes it is for example in “GB”.
- make wireless-regdb.
- The compilation process generated a self-signed regulatory.bin. Overwrite the one that was on your system (which you should backup first) in /usr/lib/crda/regulatory.bin
- Copy any .pem files from the wireless-regdb extracted directory to the crda/pubkeys directory. This is what crda will use to check regulatory.bin is valid.
- Go into the extracted crda directory and make. If you get an access denied on key2pub, you might want to chmod +x that file.
- make install CRDA.
- Reboot and test your card. It should now be allowed to work at the maximum power allowed in your country!