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
sudo ifdown wlan0 && sudo ifup -v wlan0
and also:ping -c3 8.8.8.8
– chili555 Mar 04 '17 at 14:1750-cloud-init.cfg
. Sorry. – chili555 Mar 04 '17 at 15:04ubuntu-16.04-preinstalled-server-armhf+raspi3.img.xz
on my Raspberry Pi 3 – lomboboo Mar 04 '17 at 15:24