1

I've installed a fresh Ubuntu 16.04 server and can't get WIFI to work. My /etc/network/interfaces file looks like this:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
wpa-ssid lomboboo
wpa-psk password

I also tried this setup as it was suggested in this answer:

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.1.1
wpa-ssid lomboboo
wpa-psk password
dns-nameservers 8.8.8.8 192.168.1.1

But none of them work.

Also this is info from ifconfig enter image description here

P.S. Don't know if it matters - Ubuntu 16.04 server is running on Raspberry Pi 3.

EDITED sudo ifdown wlan0 && sudo ifup -v wlan0 output: enter image description here

ping -c3 8.8.8.8 output:

connect: Network is unreachable
  • Please edit your question to add the results of: sudo ifdown wlan0 && sudo ifup -v wlan0 and also: ping -c3 8.8.8.8 – chili555 Mar 4 '17 at 14:17
  • @chili555 just updated the question – lomboboo Mar 4 '17 at 14:40
  • Is this a virtual machine? I don't understand 50-cloud-init.cfg. Sorry. – chili555 Mar 4 '17 at 15:04
  • @chili555 actually no, it is not. I've installed Ubuntu from this image ubuntu-16.04-preinstalled-server-armhf+raspi3.img.xz on my Raspberry Pi 3 – lomboboo Mar 4 '17 at 15:24
4

I suspect that you have set wpa-psk in /etc/network/interfaces to the passphrase for your wireless network. That will not work.

Let's say the SSID for my router is MYROUTER, and I set the WPA/WPA2 passphrase on my router to MySecretPassphrase. At first glance, you would think that /etc/network/interfaces should look like this:

wpa-ssid MYROUTER
wpa-psk MySecretPassphrase

Wrong. I made this mistake a few months ago, and it took me a while to figure why it was not working. In short, wpa-psk should be set to the 256-bit pre-shared key for this SSID. Do not set wpa-psk to the passphrase.

How do you that? By using the wpa_passphrase command (if it isn't installed, you can install it with sudo apt install wpasupplicant). From the man page:

wpa_passphrase pre-computes PSK entries for network configuration blocks of a wpa_supplicant.conf file. An ASCII passphrase and SSID are used to generate a 256-bit PSK.

Let's give it a try:

~$ wpa_passphrase MYROUTER MySecretPassphrase

Output:

network={
    ssid="MYROUTER"
    #psk="MySecretPassphrase"
    psk=93763b13c803b7269956cb9bf584c75eb0fd0e99c51ecf49598a4016a29aa3f1
}

Assuming the wireless adapter is labeled wlan0, the /etc/network/interfaces file for the example above should look like this:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
wpa-ssid MYROUTER
wpa-psk 93763b13c803b7269956cb9bf584c75eb0fd0e99c51ecf49598a4016a29aa3f1

Instead of typing this long string or using copy/paste, you can do this to append the relevant lines to /etc/network/interfaces:

~$ wpa_passphrase MYROUTER MySecretPassphrase | grep -vE "{|#|}" | tr -d '\t' | sudo tee -a /etc/network/interfaces

Then edit /etc/network/interfaces to make sure everything looks right.

Finally, either reboot or restart the networking service:

~$ sudo service networking restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.