Hi everyone, i have a problem with my wireless card.

I cant get an ip by using dhclient, but this only happens when i am alredy logged in.

If i put the following in /etc/rc.local it works.
Code:
iwconfig wlan0 essid "cuore"
iwconfig wlan0 key 2323232323
ifconfig wlan0 up
dhclient wlan0
It is extrange because when i am alredy logged in, it says there were no DHCPOFFERS. But when those commands are executed on the bootprocess, dhclient gives me an ip.

I can do pretty much everything when im logged in (scan networks, inject traffic, monitor mode, etc). The only thing that doesnt work when logged in, is actually making the connection.
I have even tried to put the ip manually but it also doesnt work.

Information:
Code:
root@haxple-laptop:~# uname -a
Linux haxple-laptop 2.6.29.4 #1 SMP Thu Jun 18 10:57:32 EDT 2009 i686 GNU/Linux
root@haxple-laptop:~# lspci | grep Atheros
01:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)
root@haxple-laptop:~# iwconfig
wlan0     IEEE 802.11bgn  ESSID:"cuore"
          Mode:Managed  Frequency:2.437 GHz  Access Point: 00:14:95:DB:E9:31
          Bit Rate=18 Mb/s   Tx-Power=27 dBm
          Retry min limit:7   RTS thr:off   Fragment thr=2352 B
          Encryption key:2323-2323-23   Security mode:open
          Power Management:off
          Link Quality=100/100  Signal level:-59 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

root@haxple-laptop:~# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 00:25:d3:d6:84:86
          inet addr:192.168.1.132  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::225:d3ff:fed6:8486/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:19744 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9292 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10621392 (10.6 MB)  TX bytes:1721055 (1.7 MB)
The card is alredy connect because of the /etc/rc.local instructions.

Its just i would like to do this without having to restart my computer everytime i decide to use a new network.

Thankyou.