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.

So I have a dilemma where my girlfriend wants to use her DS on my wireless network when she's over, but the thing is old and only supports WEP. My network is normally WPA2 - something I'm not really comfortable with changing, for obvious reasons. As an interim solution, I've been logging into my router, switching the settings so she could play, and then switching them back when she was done. This has gotten old pretty fast, because every time I do it I have to:

  1. Login into the router's administrative interface
  2. Change the settings to WEP and then reboot the device, which disconnects my laptop from the internet.
  3. Edit the wireless settings for my network connection on my laptop
  4. Reconnect.

Then I have to repeat this process when I want to go back to WPA. Obviously, this is entirely too much work. So I decided to script it.

To handle the router's settings, I wrote two selenium tests - one to login to the router and switch to WEP, the other to switch back to WPA. These are tested and work - and can be called from the command line via selenium RC.

The problem I'm having is the wifi settings. I need to stop the automatic attempt at reconnection (since the saved settings will not work after the router gets switched), change the authentication type from WPA to WEP (or back again), change the password to the appropriate one and then finally reconnect.

Sorry this has been so long winded - just trying to explain the situation to see if anyone has any alternatives to my method and also hope my desire for laziness garners some sympathy.

In brief - does anyone know how I can control my wifi settings and connections via the command line?

I'm using ubuntu 10.10 with gnome.

Thanks!

share|improve this question

2 Answers 2

I would use two different ESSIDs (eg. myNetworkWpa, myNetworkWep) with different passwords and let Ubuntu reconnect automatically when either of them disappears. No need to script anything.

share|improve this answer

Use the nmcli Network Manager Command Line Interface.

nmcli con list gives you a list of all your known connection profiles.

Use nmcli con up id '<Name of the connection profile goes here, e.g. Auto foo>' to connect to a given connection profile. As long as you create a separate connection profile for your router in Network Manager with different authentication setups, you can use the command above to change between them.

share|improve this answer

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.