Setting up wireless (WPA2) on ubuntu server 14.04

To start off with, I'm really new to using linux so, if possible, be descriptive in your responses. I really want to learn but don't have a big knowledge-base on the subject. I'm sorry if I missed to provide some information that I should have to be able to get decent feedback, I'm really trying ^_^

Hardware: PCI wireless card:

00:08.0 Network Controller [0280]: Ralink corp. RT2500 Wireless 802.11bg [1814:0201] rev 01

I'm trying to setup a home server for git/atlassian/DLNA streaming/torrenting/... usage and want to use the Ubuntu 14.04 server. I've installed the server and am currently trying to connect it to my wireless network, this is the first thing I'm trying and I'm already failing horribly..

The first thing I tried was checking if I could actually find my wireless network:

sudo iwlist wlan0 scan

wlan0 No scan results

I then tried to configure my networking file and based it on the information I got from my windows laptop wireless configuration (only necessary stuff inclided) :

Standaardgateway. . . . . . . . . : fe80::5e35:3bff:fe20:930a%11
                                      192.168.0.1
  DHCP-server . . . . . . . . . . . : 192.168.0.1


  DNS-servers . . . . . . . . . . . : 2a02:1800:100::42:2
                                      2a02:1800:100::42:1
                                      195.130.131.130
                                      195.130.130.2
  Zoeklijst voor verbindingsspec. DNS-achtervoegsels :
                                      telenet.be

So I used

sudo nano /etc/network/interfaces to setup the file as:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.0.1 (also tried 192.168.1.1)
wpa-ssid myssid
wpa-psk mypassword
dns-nameservers 195.130.131.130 195.130.130.2 (from the windows config)

Then making the machine use the new settings: sudo ifdown wlan0 && sudo ifup -v wlan0 I get:

... 
wpa_supplicant: configuring network blaock -- 0
wpa_supplicant:  wpa-ssid "myssid" -- OK
wpa_supplicant: wpa-pask *** -- OK
wpa_supplicant: enabling network block 0 -- OK
ip addr add 192.168.1.150/255.255.255.0 broadcast 192.168.1.255  dev wlan0 label wlan0

RTNETLINK answers: File exists
Failed to bring up wlan0

hope you guys can help me!


Solution 1:

Please, execute the steps below. You will need root privileges to run some of them, so use "sudo", for example, whenever required.

If your wireless interface is down, run:

ifconfig wlan0 up

Then, execute:

wpa_passphrase <ssid> > <filename>

Where ssid is your network's SSID and filename is the name of a file where the key is going to be stored ("wlan.conf" could be a name). You will be immediatly prompted to type the "wifi" PASSWORD. Do so.

Then, execute:

wpa_supplicant -Dwext -i wlan0 -c <filename> -B

Finally, ask for an IP address:

dhclient -r
dhclient wlan0

And you're ready.

Solution 2:

First of all, if your Windows machine, attached to the same router and therefore in the same network, reports the gateway address as 192.168.0.1, then you want the same in Ubuntu:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
address 192.168.0.150
netmask 255.255.255.0
gateway 192.168.0.1 
wpa-ssid myssid
wpa-psk mypassword
dns-nameservers 195.130.131.130 195.130.130.2

Of greater concern is that the wireless interface gets no scan results. That suggests that there is no wireless interface yet, implying that the hardware and an appropriate driver haven't yet combined. Check:

iwconfig

Do you see an interface wlan0? If not, we'll investigate the hardware and see if we can load a driver. If your wireless card in an internal PCI device, please edit your question to add details of the device from the terminal:

lspci -nn | grep 0280

The pipe symbol | is on the right side of my keyboard on the same key with backslash. If it is USB, post:

lsusb