Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There's probably a MUCH more elgant way to solve this, but basically, i have a terribly minimal ubuntu system that connects to a wireless network. At the moment i'm using a script that calls wpa supplicant and dhclient, to connect. I'd like to have this automatic - but i've had no luck with /etc/network/interfaces, or getting the script i use to run on boot.

A working solution from either approach would be 'correct'. Using network manager isn't really what i want, so that's out, and i will not need roaming. the config file for wpa_supplicant works, as does the whole setup when run from terminal.

share|improve this question
up vote 4 down vote accepted

You want to edit /etc/network/interfaces so it automatically brings it up on boot. It should look something like this for your wireless:

iface wlan0 inet dhcp
wireless-key s:KEY
wireless-essid NETWORK_SSID

auto wlan0

replace KEY with your wireless key, and NETWORK_SID with your router's SSID.

If you wish to use your script on startup...

copy it to /etc/init.d (replace script path appropriately):

sudo cp /path/to/script /etc/init.d

make it executable (ensure it has a shebang line at the top, eg. #!/bin/bash):

sudo chmod +x /etc/init.d/script

add the default startup symbolic links:

sudo update-rc.d script defaults

you'll get output similar to the following:

Adding system startup for /etc/init.d/script ...
   /etc/rc0.d/K20script -> ../init.d/script
   /etc/rc1.d/K20script -> ../init.d/script
   /etc/rc6.d/K20script -> ../init.d/script
   /etc/rc2.d/S20script -> ../init.d/script
   /etc/rc3.d/S20script -> ../init.d/script
   /etc/rc4.d/S20script -> ../init.d/script
   /etc/rc5.d/S20script -> ../init.d/script

your script should now run at startup.

share|improve this answer
i went for the latter solution and it works well enough. – Journeyman Geek Jan 4 '10 at 12:14

It's not a good solution, but you should be able to call your script from /etc/rc.local

Just make sure that if anything you need is in /usr/local it is referenced absolutely, as the $PATH for rc.local does not include /usr/local stuff

share|improve this answer

Not sure if this works in all cases but heres my setup that seems to work fine. I use a RaLink RT2500

auto wlan0
iface wlan0 inet static
    wireless-mode managed
    wireless-essid XXXXXXXXXXXX
    wireless-key XXXXXXXXXX

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

#start wireless at boot - added by ckendall 20100304
ifup wlan0

exit 0
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .