Can Ubuntu server connect to a WPA2 encrypted wireless network?

I'm planning to maybe install Ubuntu server on an old machine. But my question is: can I install Ubuntu server on a machine and have it connect to my home network - wirelessly? I can't use a cable in this case.


Note: First off you will want to make sure that the server has wpa_supplicant installed. Servers don't always have it and that can make it difficult if you can't connect it to Ethernet at least once.

This is how I do it. (be sure to use your ip numbers and network interface name)

Wont need this part for a server it is just if you wanted to kill off everything that would be interfering on a desktop.

sudo stop network-manager
sudo killall wpa_supplicant #must stop network-manager before this as it resurrects it.
sudo killall nm-applet

this only needs to be done once unless the file gets trashed. (you can put the config anywhere really)

wpa_passphrase "YOUR_ESSID" | sudo tee /etc/wpa_supplicant.conf #and type your password

-B for background -s to log to syslog -c to tell it where the config is. -i interface

sudo wpa_supplicant -B -s -c /etc/wpa_supplicant.conf -i wlan0

for DHCP just use

sudo dhclient wlan0

for static ip

sudo ifconfig wlan0 192.168.1.12 #Be sure to set you ip to what works for you.

should be able to ping your router by ip. $ ping 192.168.1.1

sudo route add default gw 192.168.1.1 # use the ip of you router

should be able to ping the net at large. $ ping 8.8.8.8

echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

should be done. $ ping google.com

This will not last through a reboot. To make this persist through a reboot,

sudo nano /etc/network/interfaces

Add this to the bottom (substitute for wlan0 if you have a different interface):

auto wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant -B -c /etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant

Note that you might not have the KILLALL component installed if you have a minimal server. You can get killall with:

aptitude install psmisc

You can install a GUI interface to Ubuntu server to get Network Manager or following the wpa_supplicant on this page (https://help.ubuntu.com/community/WifiDocs/WPAHowTo).