Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to configure my wifi to reliably connect at start-up on a headless device.

I currently have done this with a simple entry in /etc/network/interfaces, along the lines of

auto wlan0
iface wlan0 inet static
    wpa-ssid <my ssid>
    wpa-psk <my psk>
    address <address>
    netmaks <netmask>
    gateway <gateway>

Now I also need to set txpower (which also requires me to set the region (reg) as I understand it).

I can do this from the command line with iw reg set ... and iwconfig wlan0 txpower .... However, what I need is for these values to be reliably set on startup.

I have looked in what I believe is the documentation for configuring wifi in /etc/interfaces, which is /usr/share/doc/wpasupplicant/README.modes.gz, but this does not seem to have any information on setting transmit power.

How can I achieve this?

share|improve this question
add comment

1 Answer 1

Try the up option described under "IFACE OPTIONS" here: http://manpages.ubuntu.com/manpages/precise/man5/interfaces.5.html

It, and similar options like pre-up, etc. allow you to execute arbitrary commands at various points during the configuration of your interface. So your /etc/network/interfaces might look like

auto wlan0
iface wlan0 inet static
    wpa-ssid <my ssid>
    wpa-psk <my psk>
    address <address>
    netmaks <netmask>
    gateway <gateway>

    # Command options with the same label (e.g. "up", "pre-up") are executed in the
    #  order in which they're specified.
    up iw reg set ...
    up iwconfig wlan0 txpower ...

    # If you have `rfkill` installed and want to disable (all) WiFi transmission
    #  while this interface is down.
    post-down rfkill wifi

You should also be able to use the option wireless-txpower ... since you have the wireless-tools (i.e. iwconfig) package installed, but I'm not sure how the sequencing of your commands would work in that case. Some (sparse) information on the wireless-[ ] options here: http://manpages.ubuntu.com/manpages/precise/man7/wireless.7.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.