2

I am a newbie to both network and Linux. I am now trying to connect to a WEP wireless network by command line on my Ubuntu 8.10, because the Network Manager does not support 64 bit WEP.

(1) I firstly bring down the Network Manager and then try to connect to a wireless network, whose essid is candy and password is 5673212741. But it fails as shown in the following. The signal is not very strong, but I can connect to it in Windows 7. I wonder why and how to do it correctly for Ubuntu?

$ sudo /etc/init.d/NetworkManager stop  
 * Stopping network connection manager NetworkManager        [ OK ]   
$ sudo iwconfig wlan0 essid candy  
 opendo iwconfig wlan0 key 18018ce78e open  
$ sudo iwconfig wlan0 key 5673212741 open   
$ sudo  dhclient wlan0  
There is already a pid file /var/run/dhclient.pid with pid 9971  
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/  

wmaster0: unknown hardware address type 801  
wmaster0: unknown hardware address type 801  
Listening on LPF/wlan0/00:0e:9b:cd:4e:18  
Sending on   LPF/wlan0/00:0e:9b:cd:4e:18  
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 20  
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13  
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9  
No DHCPOFFERS received.  
No working leases in persistent database - sleeping.  
$ ping www.bbc.co.uk  
ping: unknown host www.bbc.co.uk

(2) A less important question: why the scan for wireless networ does not work after I bring down the Network Manager?

$ sudo /etc/init.d/NetworkManager stop  
 * Stopping network connection manager NetworkManager         [ OK ]   
$ sudo iwlist wlan0 scan  
wlan0     Interface doesn't support scanning : Network is down      

Thanks and regards!

1 Answer 1

4
sudo /sbin/ifconfig wlan0 up
sudo /sbin/iwlist wlan0 scan
sudo /sbin/iwconfig wlan0 essid "candy"
sudo /sbin/iwconfig wlan0 key 4104672851
sudo /sbin/iwconfig wlan0 enc on

then check using sudo /sbin/iwconfig wlan0 to make sure it looks configured, then sudo dhclient wlan0

2) scanning fails because bringing down Network Manager brings the interface wlan0 down. sudo /sbin/ifconfig wlan0 up will re-enable scanning.

6
  • sometimes it helps to do another sudo /sbin/iwlist wlan0 scan, to make sure you get 'connected' to your access point (verify with iwconfig wlan0) if dhclient fails, it brings the interface down, that's why it was telling you it 'didn't support scanning'
    – cpbills
    May 15, 2010 at 19:07
  • you can also look at using wicd i use it it has a console app and a gui control panel, etc... nice and simple, not sure if it supports 64bit WEP, but it does WPA2 just fine...
    – cpbills
    May 15, 2010 at 19:20
  • Thanks, cpbills! It now connects to the wireless network. I was wondering what is the last command "sudo /sbin/iwconfig wlan0 enc on" for? Is it necessary?
    – Tim
    May 15, 2010 at 19:21
  • it makes sure encryption is on, fairly redundant, since i believe setting a key enables encryption, by default. but just to be certain...
    – cpbills
    May 15, 2010 at 19:23
  • I am not sure why I lost connection a few minutes after the connection was established. Is the connection not able to last long, or it may be the signal is not strong enough? If the connection is lost due to the signal not strong and stable enough, is it possible that the connection is built automatically instead of having to issue the commands everytime? I am considering command line way only. Thanks!
    – Tim
    May 15, 2010 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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