# [solved] Gentoo and Wlan: Connection/DHCP problems

## haarp

Heya.

Recently, I got myself a WRT54GL router with Tomato on it. Though I could aswell try to use Wlan for the first time in addition to my wired network. So I read the Gentoo Handbook and Wiki about that.

My current setup is via wpa_supplicant and ndiswrapper. The driver itself is working fine. The router's internal IP is 192.168.0.1 and runs a DHCP server.

/etc/conf.d/net:

```
modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dndiswrapper"

wpa_timeout_wlan0=15

config_wlan0=( "dhcp" )

```

/etc/wpa_supplicant/wpa_supplicant.conf:

```
# The below line not be changed otherwise we refuse to work

ctrl_interface=/var/run/wpa_supplicant

# Ensure that only root can read the WPA configuration

ctrl_interface_group=0

network={

  ssid="*myNetworkSSID*"

  proto=WPA2

  key_mgmt=WPA-PSK

  pairwise=CCMP TKIP

  group=CCMP TKIP

  psk="*notgonnatellya*"

  priority=2

}

```

So. When I start wpa_supplicant manually:

```
#wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf
```

```
CTRL-EVENT-SCAN-RESULTS 

CTRL-EVENT-SCAN-RESULTS 

Trying to associate with *routerMACaddress* (SSID='*myNetworkSSID*' freq=2472 MHz)

Associated with *routerMACaddress*

WPA: Key negotiation completed with *routerMACaddress* [PTK=CCMP GTK=TKIP]

CTRL-EVENT-CONNECTED - Connection to *routerMACaddress* completed (auth) [id=1 id_str=]

```

After which I can use dhcp

```
#dhcpcd wlan0
```

```
wlan0: dhcpcd 4.0.7 starting

wlan0: broadcasting for a lease

wlan0: offered 192.168.0.6 from 192.168.0.1

wlan0: checking 192.168.0.6 is available on attached networks

wlan0: acknowledged 192.168.0.6 from 192.168.0.1

wlan0: leased 192.168.0.6 for 86400 seconds

```

Well, looking good so far. "ifconfig" shows the interface with the correct IP. I unplug my wired network to test the Wireless one, but no deal. I get no connection at all, not to the router, not to the Internet, nothing. Meh.

Second problem: This is all supposed to work automatically. So I do

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

```
 * Caching service dependencies ...                                                                                                                     [ ok ]

 * Service net.wlan0 starting

 * WARNING:  net.wlan0 has started but is inactive

```

Meh. ifconfig shows no IP. It's supposed to get one automatically. Let's try that manually.

```
#dhcpcd wlan0
```

```
wlan0: dhcpcd 4.0.7 starting

wlan0: waiting for carrier

wlan0: timed out

```

Oh what the heck? Nothing works. I guess the Init script is stuck somewhere and can't complete ("has started but is inactive"), which is the reason dhcpcd fails aswell

So I got 2 problems:

Manual method: I can get an IP, but after disconnecting the wired network I can't surf over the wireless one

Init-script method: Can't even get an IP, dhcpcd times out.

Any help will be appreciated  :Smile: Last edited by haarp on Mon Feb 23, 2009 12:35 pm; edited 1 time in total

----------

## nixnut

Is your wired nic on the same subnet as your wlan nic? If so your routing table is probably still showing that all traffic for that subnet should go out via your wired nic

----------

## NeddySeagoon

haarp,

Don't unplug your wired connection, do 

```
/etc/init.d/net.eth0 stop
```

so its entries are removed from the routing table too.

----------

## haarp

 *NeddySeagoon wrote:*   

> haarp,
> 
> Don't unplug your wired connection, do 
> 
> ```
> ...

 

Heh, that's exactly what I thought to be the problem aswell after some more trials  :Smile:  But thanks for the confirmation.

However, the other problem remains...

----------

## UberLord

You specified -Dndiswrapper in /etc/conf.d/net, but your "working" example commandline neglected this. The wpa_supplicant default is -Dwext, so just try removing that configuration directive from /etc/conf.d/net

----------

## haarp

 *UberLord wrote:*   

> You specified -Dndiswrapper in /etc/conf.d/net, but your "working" example commandline neglected this. The wpa_supplicant default is -Dwext, so just try removing that configuration directive from /etc/conf.d/net

 

That's strange, since I'm 1000% sure that I'm using ndiswrapper.

Well, removing that from the config seems to work. kind of. New problem: As soon as he gets an IP, he closes the connection again. This stuff is looping in syslog:

```
Feb 23 13:19:25 madcat wpa_cli: interface wlan0 CONNECTED

Feb 23 13:19:26 madcat dhcpcd[22423]: wlan0: dhcpcd 4.0.7 starting

Feb 23 13:19:26 madcat dhcpcd[22423]: wlan0: broadcasting for a lease

Feb 23 13:19:26 madcat dhcpcd[22423]: wlan0: offered 192.168.0.6 from 192.168.0.1

Feb 23 13:19:26 madcat dhcpcd[22423]: wlan0: checking 192.168.0.6 is available on attached networks

Feb 23 13:19:27 madcat ntpd[5544]: kernel time sync status change 0001

Feb 23 13:19:31 madcat dhcpcd[22423]: wlan0: acknowledged 192.168.0.6 from 192.168.0.1

Feb 23 13:19:31 madcat dhcpcd[22423]: wlan0: leased 192.168.0.6 for 86400 seconds

Feb 23 13:19:31 madcat wpa_cli: interface wlan0 DISCONNECTED

Feb 23 13:19:31 madcat dhcpcd[22453]: wlan0: received SIGTERM, stopping

Feb 23 13:19:32 madcat wpa_cli: interface wlan0 CONNECTED

Feb 23 13:19:32 madcat dhcpcd[23400]: wlan0: dhcpcd 4.0.7 starting

Feb 23 13:19:32 madcat dhcpcd[23400]: wlan0: broadcasting for a lease

Feb 23 13:19:32 madcat dhcpcd[23400]: wlan0: offered 192.168.0.6 from 192.168.0.1

Feb 23 13:19:32 madcat dhcpcd[23400]: wlan0: checking 192.168.0.6 is available on attached networks

Feb 23 13:19:37 madcat dhcpcd[23400]: wlan0: acknowledged 192.168.0.6 from 192.168.0.1

Feb 23 13:19:37 madcat dhcpcd[23400]: wlan0: leased 192.168.0.6 for 86400 seconds

Feb 23 13:19:37 madcat wpa_cli: interface wlan0 DISCONNECTED

Feb 23 13:19:38 madcat dhcpcd[23432]: wlan0: received SIGTERM, stopping
```

strange, eh?

edit: After a few iterations of cat-and-mouse between wlan0 and dhcpcd, it finally seems to have settled on an IP and seems to be working. Thanks!

----------

