How do I connect my Raspberry Pi running Raspbian to an open wireless network using a USB wireless network adapter using the command line only?
The name of my wireless network is called "WildRouter," and here's how I've been trying to connect without success:
$ sudo iwconfig wlan0 essid WildRouter
$ sudo dhclient –v wlan0
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlan0/...
Sending on LPF/wlan0/...
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 21
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
What am I doing wrong?
Update 1
Then I tried following the "command line" section of this document, adding the following to my /etc/wpa_supplicant/wpa_supplicant.conf
:
network={
ssid="WildRouter"
}
Then ran the following:
$ sudo ifdown wlan0
$ sudo ifup wlan0
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
wpa_supplicant: /sbin/wpa_cli daemon failed to start
run-parts: /etc/network/if-up.d/wpasupplicant exited with return code 1
It still doesn't seem to be working.
Update 2
This is the content of my /etc/network/interfaces
:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
I added the psk
to /etc/wpa_supplicant/wpa_supplicant.conf
, leaving the value empty, because this is an open network (no password):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WildRouter"
psk=""
}
Even with adding psk, I still get the same result on "sudo ifup wlan0."
Update 3
The output from sudo iwlist wlan0 scan
:
Cell 04 - Address: B2:44:C8:23:CC:A7
ESSID:"WildRouter"
Protocol:IEEE 802.11bg
Mode:Master
Frequency:2.437 GHz (Channel 6)
Encryption key:off
Bit Rates:54 Mb/s
Quality=58/100 Signal level=100/100