PDA

View Full Version : [ubuntu] 8.10: Can connect to wireless via gui nm-applet, but not from command line



Atmospherian
April 10th, 2009, 03:38 PM
When i use gnome, i can connect to my wireless networks at home and at work (both use WEP) with no problems. I recently switched to using wmii and no longer have access to the network applet in gnome.

I have been trying to connect to networks via the command line but have not had much success.

Here is a script i am using to connect to a network:

#!/bin/sh
sudo ifconfig wlan0 down
sudo dhclient -r wlan0
sudo ifconfig wlan0 up
sudo iwconfig wlan0 essid "$1"
sudo iwconfig wlan0 key $2
sudo iwconfig wlan0 key open
sudo iwconfig wlan0 mode Managed
sudo dhclient wlan0

This appears to make a connection, but the dhclient never picks up an IP.


DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3, 7, 14, 15, etc.

What does the network manager app in gnome do behinds the scenes that i am not doing on the command line? What do i need to add/change/remove from my script to make it work?

btw, my wireless card is a RTL8187.

Thanks

iponeverything
April 10th, 2009, 04:31 PM
:) if only it were that easy!

Here is how I do it. By adding the interface to the interfaces file, it will no longer be managed by network manager..

in /etc/network/interfaces:


iface wlan0_rename inet dhcp
wpa-conf /etc/wpa_supplicant.conf


in /etc/wpa_supplicant.conf:


ctrl_interface=/var/run/wpa_supplicant


network={
ssid="KabulWabble"
proto=WPA
group=TKIP
scan_ssid=1
key_mgmt=WPA-PSK
psk="This is my Passphrase, add yours here."
}

Atmospherian
April 10th, 2009, 04:48 PM
:) if only it were that easy!

Here is how I do it. By adding the interface to the interfaces file, it will no longer be managed by network manager..

in /etc/network/interfaces:


iface wlan0_rename inet dhcp
wpa-conf /etc/wpa_supplicant.conf


in /etc/wpa_supplicant.conf:


ctrl_interface=/var/run/wpa_supplicant


network={
ssid="KabulWabble"
proto=WPA
group=TKIP
scan_ssid=1
key_mgmt=WPA-PSK
psk="This is my Passphrase, add yours here."
}


That would probably work if i was using WPA, but im using WEP :(

iponeverything
April 10th, 2009, 05:00 PM
do a "man wpa_supplicant.conf"

I think it should with WEP fine.

iponeverything
April 10th, 2009, 05:06 PM
here is an example that I found at:


http://www.rrze.uni-erlangen.de/dienste/internet-zugang/wlan/wpa_supplicant.conf


# Shared WEP key connection (no WPA, no IEEE 802.1X)
network={
ssid="static-wep-test"
key_mgmt=NONE
wep_key0="abcde"
wep_key1=0102030405
wep_key2="1234567890123"
wep_tx_keyidx=0
priority=5
}

Atmospherian
April 10th, 2009, 05:36 PM
i get this:


Trying to associate with xx:xx:xx:xx:xx:xx (SSID='blah' freq=2462 MHz)
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Authentication with xx:xx:xx:xx:xx:xx timed out.

sfleite
April 14th, 2009, 02:48 AM
Thank you Atmospherian.
You really help me.
Regards,
Saulo.