Debian – Issues with connecting to open WiFi network via /etc/network/interfaces

debianifconfignetworkingwifi

I've previously been able to connect to an open WiFi network on a BeagleBone with a WiFi dongle by adding the following to /etc/network/interfaces:

auto wlan0
allow-hotplug wlan0 # For automatic connection
iface wlan0 inet dhcp
    wireless-essid OpenNetwork

However, this just doesn't seem to work anymore. I've tried multiple BeagleBones and multiple WiFi adapters, but I always get something like this:

$ ifup wlan0
Listening on LPF/wlan0/b4:75:0e:1f:2c:b4
Sending on   LPF/wlan0/b4:75:0e:1f:2c:b4
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 17
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 2
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

What's weird is that I am able to connect with the following:

iwconfig wlan0 essid OpenNetwork && dhclient wlan0

Any suggestions?

Best Answer

This is what worked for me. That's quite a dirty fix, I hope someone can improve this answer.

wlp3s0 is my wifi network interface, DIR-300NRU is the ssid. Adjust those to your case.

My interface config in /etc/network/interfaces:

auto wlp3s0
allow-hotplug wlp3s0
iface wlp3s0 inet dhcp
wireless-essid "DIR-300NRU"
wireless-mode managed

I run:

sudo ifup wlp3s0

(next step is not a part of the solution)

I check my wifi device:

$ sudo iw dev wlp3s0 info
Interface wlp3s0
        ifindex 3
        wdev 0x1
        addr 74:df:bf:b5:07:bb
        type managed
        wiphy 0
        txpower 20.00 dBm

While DHCP is trying to connect, I run the following in another terminal:

sudo iw dev wlp3s0 connect DIR-300NRU

Now wifi is working until I restart my system. I can see that the output of sudo iw dev wlp3s0 info changes to:

$ sudo iw dev wlp3s0 info
Interface wlp3s0
        ifindex 3
        wdev 0x1
        addr 74:df:bf:b5:07:bb
        ssid DIR-300NRU
        type managed
        wiphy 0
        channel 1 (2412 MHz), width: 40 MHz, center1: 2422 MHz
        txpower 20.00 dBm
Related Question