2

I am trying to set my Pi2 to have DHCP allocated IP for its USB WiFi dongle. However, everything it got was a 169.254.x.x (169.254.155.42) IP address. Setting static IP works somehow, but with some other problems. Here is my /etc/network/interfaces:

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

The wpa_supplicant.conf looks like this:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="My_SSID"
    psk="My_Wifi_password"
    #proto=RSN
    #key_mgmt=WPA-PSK
    #pairwise=CCMP
    #auth_alg=OPEN
}

The dhcpcd.conf is unmodified. Can you give me some suggestions to find out the source of problem? Thanks.

  • The file you have posted has multiple errors and will not work. See raspberrypi.stackexchange.com/a/37921/8697 for tutorial – Milliways Feb 15 '16 at 11:30
  • I have already tried the method of using wpa_supplicant for wlan0: [ iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf ] as stated in the link, but the result was the same. – menuhin Feb 15 '16 at 16:24
  • @Milliways I tried out the exact settings of the tutorial again and edited the post accordingly (this was actually where I came from) and the problem was why I kept on experimenting different settings. – menuhin Feb 15 '16 at 19:11
  • The 169 address is link-local - it is what happens before allocation. Have you tried using GUI? You need to confirm that the WiFi Dongle (You give no details) is detected and has a driver. Assuming this is OK dmesg should show attempt to connect. – Milliways Feb 15 '16 at 21:46
  • @Milliways thanks for prompting me to do a dmesg which led to some more fruitful search. – menuhin Feb 15 '16 at 23:37
1

I thought I found the root cause of the problem:

The WiFi USB dongle was not fully supported: it has a Realtek RTL8191S WLAN chipset and although it was fully recognized and even the static IP somewhat worked, DHCP was not fully supported. Some other people ran into similar problems with the same dongle: http://www.forum-raspberrypi.de/Thread-csl-wlan-usb-stick-funktioniert-nicht

I did an rpi-update to update the firmware and then after reboot, I amended the /etc/network/interfaces file back from static IP to using DHCP allocated IP, and everything worked for almost 2 whole days. And then it stopped working again after some other software package updates and installation I performed. :\

  • It stopped working again - after 1-2 day of consistently working in multiple rebooting, I just installed something trivial (e.g. apache2, php5, MySQL, emacs' elpa), Pi2 is getting only 169.254.x.x address again. However, I definitely can see my Wifi network with a $sudo iwlist wlan0 scan, with 100/100 signal level. This keeps me badly scratching my head. – menuhin Feb 17 '16 at 8:38
  • try sudo iwconfig wlan0 power off if you adapter supports power management schemes it will turn off the wifi after some days of working. – Shan-Desai Mar 18 '16 at 15:00

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.