|Setting up wireless networking from the command line in Ubuntu|
|Step-by-step guide for setting up joining a wireless access point on Ubuntu from the command line.|
|FeedbackBy Preston Hunt, 09 April 2011|
It took a lot longer to figure this out than it should have. So here it is for future Google searchers:
By default, Ubuntu uses Network Manager running in Gnome to set up wireless networks. This is a problem for many reasons. You may not be running Gnome. It requires extensive use of the mouse (keyboard control is impossible). It requires each user to manually configure the network settings. And the network is only running when a user is logged in. This last one is the most egregious; as a core service, networking should always be running regardless of whether a user is logged in!
Here is a recipe for switching from Network Manager to ifup:
Stop Network Manager from starting on boot
sudo vi /etc/init/network-manager.conf Change the line "start on (xxx)" to "start on (xxx and never)"
Stop any running instances of Network Manager
sudo initctl stop network-manager
- Edit the interfaces file to add the wireless settings
sudo vi /etc/network/interfaces
Add a new section at the end of the file (tweak these settings as necessary, this example is for WPA2):
auto wlan0 iface wlan0 inet dhcp wpa-ssid network-name-here wpa-psk passphrase-here wpa-proto WPA2 wpa-driver wext wpa-key-mgmt WPA-PSK
- Start the network
sudo ifup wlan0 (Or you can reboot)