Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to use a USB WiFi adapter to connect to a wireless router.

I assume the adapter is brought to life with the correct driver, because # iwconfig gives some reasonable output:

wlan0     IEEE 802.11bg  ESSID:"MYNET"  
          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:1C:4A:A6:8F:0E   
          Bit Rate=54 Mb/s   Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on
          Link Quality=70/70  Signal level=-40 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:49   Missed beacon:0

Also, I assume that the authentication between the router and my adapter was successful, because # wpa_cli status says "COMPLETED":

Selected interface 'wlan0'
bssid=00:1c:4a:a6:8f:0e
ssid=MYNET
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=TKIP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
address=00:0d:0b:35:ca:14

Question 1: With information like this, am I correct to assume that my adapter runs fine as interface wlan0, and that the router has accepted my key and is ready and willing to establish a connection? I am not having any WPA2 authentication issues?

Now, to use wlan0, it needs an ip address, and the router is set up as a DHCP server, with DHCP addresses ranging from 192.168.2.100 to 192.168.2.199. As far as I understand the DHCP negotiation process, dhclient should work with the defaults, i.e. it broadcasts at 255.255.255.255, and the router should answer as 0.0.0.0, finally issuing an available address. Hoewever, # dhclient wlan0 -v, just gives up after a while:

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/00:0d:0b:35:ca:14
Sending on   LPF/wlan0/00:0d:0b:35:ca:14
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

Question 2: (Probably the harder part to answer?) Why is the broadcast DHCPDISCOVER not getting a proper reply, i.e. a DHCPOFFER?

Some more info and hints on possible gotchas I may or may not be running into:

  • The router does not use MAC filtering.
  • Using a static ip outside the router's DHCP range (192.168.2.70), I was able to connect and even get into the router's html configuration tool at 192.168.2.1.
  • The box I'm trying to connect from has a wired interface (eth0). Any chance that the DHCP client request from wlan0 is not sent over the air in order to establish a DHCP ip connection on 192.168.2.0, but into my wired subnet (192.168.1.0/255.255.255.0)? There's no DHCP server on the wired subnet, so the DHCP request may just end up being lost in 192.168.1.0/24? How would I debug and rule out something like this?
  • The box has Debian wheezy (7.0) installed. Having used the box in a wired subnet with static ip addresses, I may have forgotten to change a configuration somewhere that may be needed for dhclient to work.
share|improve this question

1 Answer 1

up vote 1 down vote accepted

I had a similar issue with my setup. My router (Linksys E2500) would not give a DHCP offer until the original DHCP lease for the machine's MAC expired.

To fix this, I had to manually remove the entry from my router's lease table and attempt to bring the wlan interface back up.

I'm not sure why this happens; perhaps someone more familiar with the way the hardware and DHCP works on Debian can enlighten us.

share|improve this answer
    
Hmmm... after manually changing my WiFi adapter's MAC address (ifconfig wlan0 down, ifconfig wlan0 hw ether newmac, ifconfig wlan0 up), dhclient was able to establish a connection and obtain an IP from the router. This seems to support your theory. I'll try some more things to make sure this is the root cause... –  zebonaut Jul 7 '13 at 21:23
1  
Check. This must have been the reason. As I'm typing this, I have diabled the wired interface (eth0), and the router has accepted my WiFi interface (wlan0), after the leases have all expired. –  zebonaut Jul 8 '13 at 21:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.