# How can I configure the default transmission rate for 802.11 (“WiFi”) in Debian 7 GNU/Linux?

I need to lower the transmission rate of my IEEE 802.11g network interface controller to have acceptable packet loss ratio (< 0.5 %), otherwise it becomes very high (> 50 % is typical, but it varies). I use NetworkManager to handle my network connection, however it (At least in this version of Debian) doesn't has a option to lower the transmission rate, so I do it manually through the command line with sudo iwconfig wlan0 rate 1M every time I power on the computer.

How can I configure my GNU/Linux system so that the transmission rate is 1 Mbit/s by default (without having to set it manually every time I boot the computer)?.

Note: I connect only to a single wireless network, but it's not always available every time I power on the computer (this is because I'm not in that location, not a technical problem), and connecting isn't immediate anyway, so I can't work around the problem by making a script that is run when I log-in to the graphic environment and does iwconfig lwan0 rate 1M.

If the setting can wait until after the interface is up (DHCP has finished), then there are a few different ways to run a script when the interface comes up.

The Debian way is to put a script in /etc/network/if-up.d/. This should work on Debian no matter what method you use to manage your interface (NetworkManager, ifupdown, etc). The interface name and a few other things are passed to the script using environment variables. An example script:

if [ "$IFACE" = "wlan0" ] ; then if iwconfig "$IFACE" | fgrep -q 'ESSID:"My Wireless Network"' ; then
iwconfig wlan rate 1M
fi
fi


The NetworkManager way is to put a script in /etc/NetworkManager/dispatcher.d/. This location should work on any Linux distribution as long as you're using NetworkManager. Here, the interface name is passed as the first command line argument. The script looks mostly the same; just replace "$IFACE" with "$1". In fact, if you look in that dir you will see a 01ifupdown compatibility script that makes NetworkManager run the "Debian way" scripts.

For more on writing the Debian-style scripts, man 5 interfaces and read through the "IFACE OPTIONS" section.

A couple of resources describing NetworkManager scripting can be found here and here.