Bus 001 Device 004: ID 0411:0158 BUFFALO INC. (formerly MelCo., Inc.) WLI-UC-GNHP Wireless LAN Adapter
auto lo iface lo inet loopback iface eth0 inet dhcp iface default inet dhcp
auto lo iface lo inet loopback iface eth0 inet dhcp auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1
Add the parts in bold to make it look like this
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 # ap_scan can be 0, 1, or 2. Some sources say to use 2 but it did not work for me. 1 did. ap_scan=1 eapol_version=1 network={ ssid="YOURSSID" # This is needed for hidden SSIDs scan_ssid=1 mode=0 psk=reallylonghexnumber # RSN for WPA2 or WPA for WPA1 proto=RSN # WPA-PSK or WPA-EAP key_mgmt=WPA-PSK # CCMP for AES or TKIP for TKIP. pairwise=CCMP # OPEN for WPA1/2 or SHARED or LEAP auth_alg=OPEN }
Make sure to tab indent the network section
Use a hex version of your passphrase as it will eliminate any messups caused by special characters. To get this use the wpa_passphrase command
wpa_passphrase <SSID> [passphrase]
If you have special characters in your passphrase you can enclose the passphrase with quotes. It will show you what the passphrase was that it used so you can double check it used the correct passphrase.
Note: If you use the actual passphrase it must be inside quotes. The hex number should not be inside quotes
These settings will depend on what you have your network configured with. Adjust them accordinly.
Now cross your fingers and reboot to make sure everything comes up properly
sudo reboot
If everything came up properly and you can connect to your Raspberry Pi over SSH or you can ping google.com congratulations. Continue reading if you want a static IP
Static IP Address
Open /etc/network/interfaces again and we’re going to make some changes
Change
iface wlan0 inet dhcp
to
iface wlan0 inet static
Now add the following lines. These values will be dependent on your network configuration again. Adjust them accordinly
address 192.168.1.11 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1
When you’re finished it should look like this
auto lo iface lo inet loopback iface eth0 inet dhcp auto wlan0 allow-hotplug wlan0 iface wlan0 inet static address 192.168.1.11 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
Cross your fingers and reboot again to make sure it all comes up and is working correctly. If you’re able to ping the IP you just configured congratulations.