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.
Answer
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.
Comments
Post a Comment