I want to restrict the wifi range of my Pi in order to only have a really small range of around one or two meters for my access point. I'm not totally new, but I don't know any way to reach the goal or find a solution, cause somehow everyone wants to raise up the wifi range ;D Anyway, I would be glad about a solution! Cheers guys!
You can get info about the interface from the access point with:
rpi ~$ sudo iw dev wlan0 info Interface wlan0 ifindex 3 wdev 0x1 addr b8:27:eb:06:e8:8b ssid RPiNet type AP wiphy 0 channel 1 (2412 MHz), width: 20 MHz, center1: 2412 MHz txpower 31.00 dBm rpi ~$
The last line give you the transmit power. On my Raspberry Pi 3B+ it shows the maximum of 31.00 dBm. There is a command to set the
txpower with for example:
rpi ~$ sudo iw dev wlan0 set txpower fixed 100
This will set the txpower to 1.00 dBm. It should really reduce the range to some meters. If not you are free to reduce it what you like.
The value at the end of the command to set txpower is messured in mBm, so 100 means 1.00 dBm and 50 means 0.50 dBm. Look at
sudo iw help | less and search for
txpower. You will find:
dev <devname> set txpower <auto|fixed|limit> [<tx power in mBm>] Specify transmit power level and setting type. phy <phyname> set txpower <auto|fixed|limit> [<tx power in mBm>] Specify transmit power level and setting type.
I haven't tested it but it should do the thing.