Wireless connection by using command screen

9,106

Since the wireless is using WEP encryption, first make sure to comment out all lines about wlan0 in /etc/network/interface.
Then do the following (replace "essid" and wepkey with your actual wireless name and key):

sudo ifconfig wlan0 down
sudo ifconfig wlan0 up  
sudo iwconfig wlan0 essid "essid"
sudo iwconfig wlan0 key wepkey

Check if everything looks fine with:

sudo iwconfig wlan0

Then start dhclient:

sudo dhclient wlan0

If still no success your card might not support adhoc. More information here.

other sources:

How do I connect my server to a WEP encrypted wireless network?

Share:
9,106
Xentius
Author by

Xentius

Updated on September 18, 2022

Comments

  • Xentius
    Xentius almost 2 years

    I installed Ubuntu 12.04 armhf to my beagleboard-xm and now trying to connect to a wireless network. First, I checked if I can search for available networks:

    ubuntu@arm:~$ iwlist scan
    lo        Interface doesn't support scanning.
    
    usb0      Interface doesn't support scanning.
    
    wlan0     Scan completed :
              Cell 01 - Address: EA:7D:EF:60:C9:0B
                        Channel:1
                        Frequency:2.412 GHz (Channel 1)
                        Quality=70/70  Signal level=-23 dBm
                        Encryption key:on
                        ESSID:"ghostrider"
                        Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                                  24 Mb/s; 36 Mb/s; 54 Mb/s
                        Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s
                        Mode:Ad-Hoc
                        Extra:tsf=000000005a1ab50e
                        Extra: Last beacon: 6242ms ago
                        IE: Unknown: 000A67686F73747269646572
                        IE: Unknown: 010882848B962430486C
                        IE: Unknown: 030101
                        IE: Unknown: 06020000
                        IE: Unknown: 2A0100
                        IE: Unknown: 2F0100
                        IE: Unknown: 32040C121860
                        IE: Unknown: 2D1A2C181BFF00000000000000000000000000000000000000000000
                        IE: Unknown: 3D16010800000000FF000000000000000000000000000000
                        IE: Unknown: DD09001018020000000000
    

    Then I edited /etc/network/interfaces file to the following:

    root@arm:/etc/wpa_supplicant# cat /etc/network/interfaces
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    iface eth0 inet dhcp
    # Example to keep MAC address between reboots
    #hwaddress ether DE:AD:BE:EF:CA:FE
    
    # WiFi Example
    auto wlan0
    iface wlan0 inet dhcp
        wpa-ssid "ghostrider"
        wpa-psk "b34d373eb2fb836a43b0afffe783c7d0af694724506c9e77b06d1021302905bf"
    

    But I cannot still connect to the wireless network:

    root@arm:/etc/wpa_supplicant# iwconfig
    lo        no wireless extensions.
    
    usb0      no wireless extensions.
    
    wlan0     IEEE 802.11bgn  ESSID:off/any  
              Mode:Managed  Access Point: Not-Asociated   Tx-Power=20 dBm   
              Retry  long limit:7   RTS thr:off   Fragment thr:off
              Encryption key:off
              Power Management:on
    
    eth0      no wireless extensions.
    
    root@arm:/etc/network# ifup wlan0
    Failed to bring up wlan0.
    

    What is wrong? Should I change any other files also? But I think it was enough. By the way if you are curious about where that wpa-psk came from:

    zero@ghostrider:~$ wpa_passphrase ghostrider 34bddf67c2
    network={
        ssid="ghostrider"
        #psk="34bddf67c2"
        psk=b34d373eb2fb836a43b0afffe783c7d0af694724506c9e77b06d1021302905bf
    }
    

    I will appreciate any effort to help.

    Regards, Amadeus

    ps: Also I tried to connect manually:

    root@arm:/etc/network# iwconfig wlan0 essid ghostrider key s:34bddf67c2
    

    But this did not solve my problem also.

    `root@arm:/home/ubuntu# ifup wlan0 Failed to bring up wlan0. root@arm:/home/ubuntu# tail -f /var/log/syslog Dec 31 18:05:13 arm dhclient: No DHCPOFFERS received. Dec 31 18:05:15 arm dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9 Dec 31 18:05:24 arm dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15 Dec 31 18:05:39 arm dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12 Dec 31 18:05:51 arm dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7 Dec 31 18:05:58 arm dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9 Dec 31 18:06:07 arm dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 20 Dec 31 18:06:27 arm dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 18 Dec 31 18:06:45 arm dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8 Dec 31 18:06:53 arm dhclient: No DHCPOFFERS received.

    Properties of the network that I am trying to connect:

    `enter image description here

    enter image description here

    • Evandro Silva
      Evandro Silva over 11 years
      Have you tried service networking restart after editing /etc/network/interfaces?
    • Xentius
      Xentius over 11 years
      @EvandroSilva I did not, but I thought rebooting the device would do the same. Anyways, I tried it now and stuck at here about 10mins: * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces * Reconfiguring network interfaces...
    • Xentius
      Xentius over 11 years
      @EvandroSilva Allright, here is the output: Failed to bring up wlan0.
    • Evandro Silva
      Evandro Silva over 11 years
      Try following @rosch instructions, I would answer something similar.
    • rosch
      rosch over 11 years
      Did you create your ghostrider wifi in ad-hoc mode on purpose? Is a dhcp server running?
    • DennisOakdale
      DennisOakdale over 11 years
      @rosch yes I did create it to tether my laptop's internet. I can successfully connect it via my android phone or ipad.
  • Xentius
    Xentius over 11 years
    # ifdown wlan0 && ifup wlan0 ifdown: interface wlan0 not configured Failed to bring up wlan0. # /etc/init.d/networking restart Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces * Reconfiguring interfaces... Failed to bring up eth0. Failed to bring up wlan0.
  • DennisOakdale
    DennisOakdale over 11 years
    @rosch yes I followed all 3 steps but got that error. Now I tried what you suggested and after ifup wlan0 step, I got the error: Failed to bring up wlan0.
  • DennisOakdale
    DennisOakdale over 11 years
    @rosch according to syslog, it seems like my problem is related dhcp server. I edited the question could you please check again?
  • rosch
    rosch over 11 years
    Your are not getting a response from your dhcp server. But first, what type of encryption are you using? Is it WEP? You iwlist scan output is cut off so I cannot see what it is.
  • Xentius
    Xentius over 11 years
    @rosch I edited my question and added some more information (pictures) about the network. Also, I checked once more the output of iwlist scan, and there does not exist any other information about the ad-hoc network that I am trying to connect. (as I stated in my question, I created this ad-hoc network to share my laptop's internet connection with beagleboard-xm,ipad-iphone etc. I did not use any complicated tools to create this network. I simply did it by following Network>wireless>use as hotspot on my Ubuntu 12.04 system)
  • rosch
    rosch over 11 years
    I changed my answer as you are using wep and not wpa. If this does not work you might have to use another driver for your card or it does not support adhoc.