linux - Why wireless adatper stop to work?

07
2014-07
  • AndreaNobili

    today I correctly installed the driver for the TP-LINK TL-WN725N USB wireless adapter on my RaspBerry Pi (I use RaspBian that is a Debian), then I setted up the wifi using the wpa-supplicant as explained in this tutorial:

    http://www.maketecheasier.com/setup-wifi-on-raspberry-pi/

    This worked fine untill this evening. Then suddenly it stopped to work when I try to connect in SSH and the Raspberry is on the wireless (or rather it should be, as this is not in the list of my router's DHCP connected Client)

    The strange thing is that the USB wirless adapter blink so I think that this is not a driver problem.

    If I try to connect it by the ethernet I have no problem. It appear in my router's DHCP connected Client and I can connect to it by SSH.

    When I connect to it using ethernet if I perform an ifconfig command I obtain:

    pi@raspberrypi ~ $ ifconfig
    eth0      Link encap:Ethernet  HWaddr b8:27:eb:2a:9f:b0  
              inet addr:192.168.1.9  Bcast:192.168.1.255  Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:48 errors:0 dropped:0 overruns:0 frame:0
              TX packets:59 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:6006 (5.8 KiB)  TX bytes:8268 (8.0 KiB)
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:8 errors:0 dropped:0 overruns:0 frame:0
              TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:1104 (1.0 KiB)  TX bytes:1104 (1.0 KiB)
    
    wlan0     Link encap:Ethernet  HWaddr e8:94:f6:19:80:4c  
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    

    So it seems that the wlan0 USB wireless adapter driver is correctly loaded.

    If I remove the USB wireless adapter and put it again into the USB port, the lasts lines of dmesg log is:

    [   20.303172] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
    [   20.306340] RTL871X: set bssid:00:00:00:00:00:00
    [   20.306726] RTL871X: set ssid [g\xffffffc6isQ\xffffffffJ\xffffffec)\xffffffcd\xffffffba\xffffffba\xffffffab\xfffffff2\xfffffffb\xffffffe3F|\xffffffc2T\xfffffff8\x1b\xffffffe8\xffffffe7\xffffff8dvZ.c3\xffffff9f\xffffffc9\xffffff9a\xffffff9aD\xffffffa7\x1a\xffffffa0\x1a\xffffff8b] fw_state=0x00000008
    [   21.614585] RTL871X: indicate disassoc
    [   21.908495] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
    [   25.006282] Adding 102396k swap on /var/swap.  Priority:-1 extents:1 across:102396k SSFS
    [   26.247997] RTL871X: nolinked power save enter
    

    As you can see some of these line are related to the RTL871X that is my USB wireless adapter, but I don't know is that these line report an error or if it is all ok.

    Looking at the adapter status I obtain:

    pi@raspberrypi ~ $ ip  link list dev wlan0
    3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT qlen 1000
        link/ether e8:94:f6:19:80:4c brd ff:ff:ff:ff:ff:ff
    

    As you can see the mode is DORMANT but I think that this is normal because now I am connected using ethernet.

    I tryied to set up the adapter but it seems that I obtain no result, infact:

    pi@raspberrypi ~ $ sudo ip link set dev wlan0 up 
    pi@raspberrypi ~ $ ip  link list dev wlan0
    3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT qlen 1000
        link/ether e8:94:f6:19:80:4c brd ff:ff:ff:ff:ff:ff
    pi@raspberrypi ~ $ sudo ip link set dev wlan0 up 
    

    This is my /etc/network/interfaces file content and it is ok:

    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
    

    and it is the /etc/wpa_supplicant/wpa_supplicant.conf that I think is ok (I did not change it compared to when it worked):

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    network={
            ssid="MY-NETWORK"
            psk="mypassword"
            key_mgmt=WPA-PSK
    }
    

    and infact if I execute a network scan I correctly find MY-NETWORK in the network list,infact:

    pi@raspberrypi ~ $ sudo iwlist wlan0 scan | grep ESSID
                        ESSID:"TeleTu_74888B0060AD"
                        ESSID:"MY-NETWORK"
                        ESSID:"FASTWEB-1-PT6NtjL4TOSe"
                        ESSID:"DC"
    

    So I reboot the system and I remove the ethernet cable but when I try to connect again to my raspberry I obatin the following error message:

    andrea@andrea-virtual-machine:~$ sudo ssh  [email protected]
    ssh: connect to host 192.168.1.9 port 22: No route to host
    

    It seems that it can't connect using wireless.

    What could be the problem? What am I missing? How can I solve this situation?

    Tnx

  • Answers
  • MariusMatutiae

    In your /etc/network/interfaces file, you should substitute wpa-conf to wpa-roam.

    They are used for different aims. In particular when you want to connect via wpa_supplicant.conf, you should definitely use wpa_conf, you can see a very clear discussion of that in this posting on a sister site.

    It appears instead that wpa-roam can only be used with manual inet method, see here.

    This works fine for at-boot connections to a given network. I am less clear about what happens if you plug in and then unplug an ethernet cable. You raspberry may or may not need to restart its etworking service to function properly once again.


  • Related Question

    linux - Wireless networking issue with Ubuntu
  • Tim

    I must say I am really new to the networking stuff and Linux (Ubuntu 8.10). I am unable to connect to my wireless network after running these commands to change the MAC address and run in monitor mode:

    airmon-ng stop wlan0 
    ifconfig wlan0 down
    macchanger --mac 00:11:22:33:44:55 wlan0
    airmon-ng start wlan0 
    

    The reason I did this is because I want to test how secure my wireless network is (first stopping and trying to change the MAC, and then using air-crack-ng).

    Here is what I have tried to reconnect to my wireless network:

    1. Firstly I think I should change wlan0 to where it was (especially the Mac address) with the following commands:

      ifconfig mon0 down
      ifconfig wlan0 down
      macchanger --mac 00:0e:9b:ab:56:19 # myoriginalMacAddress
      airmon-ng stop wlan0
      ifconfig wlan0 up
      
    2. Secondly I tried to connect to my wireless network in my WICD but it failed at obtaining IP address after going through validating authentication. So I exited WICD and tried to do the same thing in terminal:

      $ sudo iwconfig wlan0 essid "mywireless"
      $ sudo dhclient wlan0
      There is already a pid file /var/run/dhclient.pid with pid 23682
      killed old client process, removed PID file
      Internet Systems Consortium DHCP Client V3.1.1
      Copyright 2004-2008 Internet Systems Consortium.
      All rights reserved.
      For info, please visit http://www.isc.org/sw/dhcp/
      
      mon0: unknown hardware address type 803
      wmaster0: unknown hardware address type 801
      mon0: unknown hardware address type 803
      wmaster0: unknown hardware address type 801
      Listening on LPF/wlan0/00:0e:9b:ab:56:19
      Sending on   LPF/wlan0/00:0e:9b:ab:56:19
      Sending on   Socket/fallback
      DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
      DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
      DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
      DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15
      DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12
      DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 1
      No DHCPOFFERS received.
      No working leases in persistent database - sleeping.
      

    Here is the ifconfig output of my network adapters if it can help:

    $ ifconfig
    
    eth0      Link encap:Ethernet  HWaddr 00:c0:9f:8d:23:74  
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
              Interrupt:19 Base address:0x1800 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:4457 errors:0 dropped:0 overruns:0 frame:0
              TX packets:4457 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:493002 (493.0 KB)  TX bytes:493002 (493.0 KB)
    
    wlan0     Link encap:Ethernet  HWaddr 00:0e:9b:ab:56:19  
              UP BROADCAST NOTRAILERS PROMISC ALLMULTI  MTU:576  Metric:1
              RX packets:1508929 errors:0 dropped:0 overruns:0 frame:0
              TX packets:768144 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:806027375 (806.0 MB)  TX bytes:78834873 (78.8 MB)
    
    wlan0:avahi Link encap:Ethernet  HWaddr 00:0e:9b:ab:56:19  
              inet addr:169.254.5.92  Bcast:169.254.255.255  Mask:255.255.0.0
              UP BROADCAST NOTRAILERS PROMISC ALLMULTI  MTU:576  Metric:1
    
    wmaster0  Link encap:UNSPEC  HWaddr 00-0E-9B-CD-4E-18-00-00-00-00-00-00-00-00-00-00  
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    

    Does anyone know what my problem is and how to solve it?


  • Related Answers
  • Registered

    What version of Linux/Unix are you running, because not all commands are the same for wireless?

    Command:

    $ cat /etc/*-release

    And why are you stopping and trying to spoof(change your MAC) before you connect to your wireless AP(access point)or wireless router, instead of just connecting to it?

    This should only apply if you are planning to do some wireless pentest/auditing or to see how secure your wireless network router/ap is.

    ifconfig mon0 down ifconfig wlan0 down macchanger --mac 00:0e:9b:ab:56:19 # myoriginalMacAddress airmon-ng stop wlan0 ifconfig wlan0 up

    The reason you are having issues with you second command or (2) is cause of all the other unnecessary stuff you just did on number 1.

  • Registered

    Okay, you might want to try these guys from the Ubuntu Forums:

    I highly recommend to start here if you want to learn about the commands and hardware (compatible wireless card)requirements for auditing a wireless network, based on your distro(distribution).

    Registration is free and so is the help; in addition, to the fact that the help will be more specialized to your distro(distribution) as opposed to me or anyone here just giving your generic linux commands that might or might not work for your given distro.

    Option one:

    http://ubuntuforums.org/showthread.php?t=1015877

    Option two: If you think you have the hardware verify below:

    http://www.aircrack-ng.org/doku.php?id=compatibility%5Fdrivers

    Once you have verified that you hardware(wireless card is indeed supported), we move to step three which is also optional.

    Option three: Download

    This:

    http://www.securityfocus.com/archive/1/506235/30/0/threaded

    OR

    http://www.remote-exploit.org/backtrack%5Fdownload.html

    It's a live CD, and it's the fastest and most secure way to audit you wireless network: It comes with Gerix-Wifi-Cracker; in addition, to Wepbuster another tool to easily crack varisous type of Wireless routers (WPA and WEP).

    If you are brave enough and have a backup and are not scared of messing up your linux box, you can also just install these tools using apt-get or synaptic.

    The only difference is that with the tools you rarely have to change your card from Managed mode to Monitor mode, and do all the typing, since the tools will do that for you.

    However, if you install you will be at the command line, and probably spending some time at the Ubuntu Forums. In addition if you break something or mess something up, you are probably going to have to fix it, unlike windows, unless if you have a backup or the time to be tinkering with breaking stuff and fixing, linux like Unix is a big time hogger especially for a beginner.