# can't get IP on wlan [SOLVED]

## Ahenobarbi

After couple months of using eth connection I decided to resume using wireless ( note: I think I wasn't using WPA2 back then) at home but my wlan can't get IP.

Aparently I can conect to AP:

```

$/sbin/iwconfig wlan0

wlan0     IEEE 802.11g  ESSID:[correct]

          Mode:Managed  Frequency:2.437 GHz  Access Point: [correct]

          Bit Rate=1 Mb/s   Tx-Power:0 dBm   

          RTS thr:2347 B   Fragment thr:-1 B   

          Power Management:off

          Link Quality:78/100  Signal level:-46 dBm  Noise level:-96 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:64  Invalid misc:190   Missed beacon:0

```

but I don't have IP

```

$ /sbin/ifconfig wlan0

wlan0     Link encap:Ethernet  HWaddr [who cares?]

          inet6 addr: [doesn't matter, does it?] Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:3064 errors:0 dropped:0 overruns:0 frame:0

          TX packets:3246 errors:0 dropped:87 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:434515 (424.3 KiB)  TX bytes:398468 (389.1 KiB)

          Interrupt:5 Memory:fbffe800-fbfff000 

```

In dhcpcd repeats "carrier lost, carrier aqured, broadcasating, broadcasting, carrier lost" until it starts trying IP4ALL:

```
$ cat /var/log/messages

Aug  7 19:59:37 Yoach ADDRCONF(NETDEV_UP): wlan0: link is not ready

Aug  7 19:59:37 Yoach ndiswrapper (iw_set_ap_address:566): setting AP mac address failed (...)

Aug  7 19:59:43 Yoach ndiswrapper (iw_set_freq:325): setting configuration failed (...)

Aug  7 19:59:43 Yoach ndiswrapper (iw_set_ap_address:566): setting AP mac address failed (...)

Aug  7 19:59:45 Yoach ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

Aug  7 19:59:45 Yoach wpa_cli: interface wlan0 CONNECTED

Aug  7 19:59:46 Yoach rc-scripts: Configuration not set for wlan0 - assuming DHCP

Aug  7 19:59:46 Yoach dhcpcd[6353]: wlan0: dhcpcd 4.0.13 starting

Aug  7 19:59:46 Yoach dhcpcd[6353]: wlan0: broadcasting for a lease

Aug  7 19:59:50 Yoach dhcpcd[6353]: wlan0: carrier lost

Aug  7 19:59:50 Yoach dhcpcd[6353]: wlan0: carrier acquired

Aug  7 19:59:50 Yoach dhcpcd[6353]: wlan0: broadcasting for a lease

Aug  7 19:59:56 Yoach dhcpcd[6353]: wlan0: carrier lost

Aug  7 19:59:56 Yoach wlan0: no IPv6 routers present

Aug  7 19:59:56 Yoach dhcpcd[6353]: wlan0: carrier acquired

Aug  7 19:59:56 Yoach dhcpcd[6353]: wlan0: broadcasting for a lease

Aug  7 20:00:01 Yoach dhcpcd[6353]: wlan0: carrier lost

Aug  7 20:00:01 Yoach dhcpcd[6353]: wlan0: carrier acquired

Aug  7 20:00:01 Yoach dhcpcd[6353]: wlan0: broadcasting for a lease

Aug  7 20:00:07 Yoach dhcpcd[6353]: wlan0: carrier lost

Aug  7 20:00:07 Yoach dhcpcd[6353]: wlan0: carrier acquired

Aug  7 20:00:07 Yoach dhcpcd[6353]: wlan0: broadcasting for a lease

Aug  7 20:00:12 Yoach dhcpcd[6353]: wlan0: carrier lost

Aug  7 20:00:12 Yoach dhcpcd[6353]: wlan0: carrier acquired

Aug  7 20:00:12 Yoach dhcpcd[6353]: wlan0: broadcasting for a lease

Aug  7 20:00:17 Yoach dhcpcd[6353]: wlan0: carrier lost

Aug  7 20:00:17 Yoach dhcpcd[6353]: wlan0: carrier acquired

Aug  7 20:00:17 Yoach dhcpcd[6353]: wlan0: broadcasting for a lease

Aug  7 20:00:23 Yoach dhcpcd[6353]: wlan0: carrier lost

Aug  7 20:00:23 Yoach dhcpcd[6353]: wlan0: carrier acquired

Aug  7 20:00:23 Yoach dhcpcd[6353]: wlan0: broadcasting for a lease

Aug  7 20:00:26 Yoach dhcpcd[6353]: wlan0: timed out

Aug  7 20:00:26 Yoach dhcpcd[6353]: wlan0: trying to use old lease in `/var/lib/dhcpcd/dhcpcd-wlan0.lease'

Aug  7 20:00:26 Yoach dhcpcd[6353]: wlan0: checking 169.254.212.229 is available on attached networks

Aug  7 20:00:28 Yoach dhcpcd[6353]: wlan0: carrier lost

Aug  7 20:00:28 Yoach dhcpcd[6353]: wlan0: carrier acquired

Aug  7 20:00:28 Yoach dhcpcd[6353]: wlan0: checking 169.254.212.229 is available on attached networks

Aug  7 20:00:33 Yoach dhcpcd[6353]: wlan0: carrier lost

Aug  7 20:00:33 Yoach dhcpcd[6353]: wlan0: carrier acquired

Aug  7 20:00:33 Yoach dhcpcd[6353]: wlan0: checking 169.254.212.229 is available on attached networks

Aug  7 20:00:38 Yoach dhcpcd[6353]: wlan0: using IPv4LL address 169.254.212.229

Aug  7 20:00:39 Yoach dhcpcd[6485]: wlan0: carrier lost

Aug  7 20:00:39 Yoach dhcpcd[6485]: wlan0: carrier acquired

Aug  7 20:00:39 Yoach dhcpcd[6485]: wlan0: checking 169.254.212.229 is available on attached networks

```

```

# dmesg 

ADDRCONF(NETDEV_UP): wlan0: link is not ready

ndiswrapper (iw_set_ap_address:566): setting AP mac address failed (...)

ndiswrapper (iw_set_freq:325): setting configuration failed (...)

ndiswrapper (iw_set_ap_address:566): setting AP mac address failed (...)

ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

wlan0: no IPv6 routers present

```

I'm using ndiswrapper and wpa_supplican't.

part of /etc/conf.d/net about wlan0

```

modules_wlan0="wpa_supplicant"

wpa_supplicant_wlan0="-Dwext -dd"

```

and my /etc/wpa_supplicant/wpa_supplicant.conf

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0 

network={

   ssid="..."

   proto=RSN WPA2 

   key_mgmt=WPA-PSK

   pairwise=TKIP

   group=TKIP

   psk=...# generated with  wpa_passphrase 

        priority=5 

}

# there are some more "network"s but I don't think they matter 

```

Wireless works fine with other APs ( WEP/WPA/not enecrypted, not WPA2). Other machines, don't have any troube working with this AP. Does anyone have an idea how to get this working?

Edit:

I forgot that one...

```
# /etc/init.d/net.wlan0 start

 * Starting wlan0

 *   Starting wpa_supplicant on wlan0 ...

Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A' bridge 'N/A'

Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'

Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

ctrl_interface_group='0'

Line: 3 - start of a new network block

ssid - hexdump_ascii(len=4):

     (...)                                       (...)            

proto: 0x2

key_mgmt: 0x2

pairwise: 0x8

group: 0x8

PSK - hexdump(len=32): [REMOVED]

priority=5 (0x5)

Line: 13 - start of a new network block

ssid - hexdump_ascii(len=9):

     (...)                        (...)

proto: 0x1

key_mgmt: 0x2

pairwise: 0x8

group: 0x8

PSK (ASCII passphrase) - hexdump_ascii(len=11): [REMOVED]

priority=6 (0x6)

PSK (from passphrase) - hexdump(len=32): [REMOVED]

Line: 22 - start of a new network block

ssid - hexdump_ascii(len=8):

     (...)                           (...)

proto: 0x1

key_mgmt: 0x2

pairwise: 0x8

group: 0x8

PSK (ASCII passphrase) - hexdump_ascii(len=8): [REMOVED]

priority=6 (0x6)

PSK (from passphrase) - hexdump(len=32): [REMOVED]

Priority group 6

   id=1 ssid='...'

   id=2 ssid='...'

Priority group 5

   id=0 ssid='...'

Initializing interface (2) 'wlan0'

SIOCGIWRANGE: WE(compiled)=22 WE(source)=18 enc_capa=0xf

  capabilities: key_mgmt 0xf enc 0xf flags 0x0

WEXT: Operstate: linkmode=1, operstate=5

Own MAC address: (...)

wpa_driver_wext_set_wpa

wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_countermeasures

wpa_driver_wext_set_drop_unencrypted

RSN: flushing PMKID list in the driver

Setting scan request: 0 sec 100000 usec

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

ctrl_interface_group=0

Added interface wlan0

Daemonize..                                                                                                            [ ok ]

 *   Starting wpa_cli on wlan0 ...                                                                                     [ ok ]

 *     Backgrounding ...

```

Last edited by Ahenobarbi on Tue Aug 11, 2009 9:21 am; edited 1 time in total

----------

## NeddySeagoon

Ahenobarbi,

```
Bit Rate=1 Mb/s   Tx-Power:0 dBm    
```

is a bad sign.

Your Transmitter is off.

Try setting the TxPower 

```
iwconfig wlan0 txpower 30dBm
```

You can do something similar in /etc/config,d/net if you need to.

Also look into the kernels rfkill options.  

It looks like wlano came up, associated with the AP then the transmitter was switched off.

----------

## Ahenobarbi

It doesn't change anything

```
# iwconfig wlan0

wlan0     IEEE 802.11g  ESSID:"..."  

          Mode:Managed  Frequency:2.437 GHz  Access Point: ...

          Bit Rate=1 Mb/s   Tx-Power:0 dBm   

          RTS thr:2347 B   Fragment thr:-1 B   

          Encryption key:...   Security mode:restricted

          Power Management:off

          Link Quality:75/100  Signal level:-48 dBm  Noise level:-96 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

# iwconfig wlan0 txpower 30dBm

# iwconfig wlan0

wlan0     IEEE 802.11g  ESSID:"..."  

          Mode:Managed  Frequency:2.437 GHz  Access Point: ...

          Bit Rate=54 Mb/s   Tx-Power:0 dBm   

          RTS thr:2347 B   Fragment thr:-1 B   

          Encryption key:...   Security mode:restricted

          Power Management:off

          Link Quality:75/100  Signal level:-48 dBm  Noise level:-96 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:1   Missed beacon:0

```

 I'll turn encryption off and see what will iwconfig say then.

----------

## NeddySeagoon

Ahenobarbi,

```
          Bit Rate=54 Mb/s   Tx-Power:0 dBm 
```

Thats better 54Mb/s not 1Mb/s. I suspect iwconfig is not reporting your Tx power properly.

Everything else in that second iwconfig wlan0 looks lood.

Setting the txpower alone will not get you an IP, you need to run dhcpcd net.wlan0  too

----------

## Ahenobarbi

 *NeddySeagoon wrote:*   

> Ahenobarbi,
> 
> ```
>           Bit Rate=54 Mb/s   Tx-Power:0 dBm 
> ```
> ...

 

Hmm, you were right. When my "Bit Rate=54 Mb/s" I can use wireles properly. The problem is that if I "iwconfig wlan0 txpower 30dBm" Bit Rate stays good for a few seconds and then it drops to 1Mb/s ( and disconnects me).

Right now I'm using wireless and it works fine. I don't know why.

----------

## Ahenobarbi

Maybe it's because I updated to sys-kernel/gentoo-sources-2.6.30-r4 or because I made a few changes to kernel configuration ( a few previous kernels didn't work).

Thank yhou for you help, NeddySeagoon.

I'm marking it as SOLVED.

----------

