# wireless networking with dlink dwl g520[SOLVED]

## nek95

Hi all i just installed my first gentoo system and now i want to connect to the internet.In order to connect in windows i use a wireless D-Link AirPlus DWL-G520 Wireless PCI Adapter(rev.B) card.What i have to do in gentoo so i set it up?Last edited by nek95 on Mon May 28, 2007 7:50 pm; edited 3 times in total

----------

## manuels

you have to install the madwifi-ng drivers to make it work

----------

## nek95

Thanks for your reply.I emerged  *Quote:*   

> net-wireless/madwifi-ng and 
> 
> net-wireless/madwifi-ng-tools

  after that i did 

```
modprobe ath_pci
```

 and so the modules loaded

 *Quote:*   

> medic ~ # lsmod |grep ath
> 
> ath_rate_sample 12288 1
> 
> ath_pci 88416 0
> ...

 The administrator of the wireless router i want to connect to gave me the ssid of the network and a wpa-psk code and as i read in the handbook here i emerged  *Quote:*   

> net-wireless/wpa_supplicant

  and i put in /etc/conf.d/net that :

 *Quote:*   

> modules=( "wpa_supplicant" )
> 
> wpa_supplicant_ath0="-Dmadwifi"

  and in /etc/wpa_supplicant/wpa_supplicant.conf that :

 *Quote:*   

> # This is a network block that connects to any unsecured access point.
> 
> # We give it a low priority so any defined blocks are preferred.
> 
> network={
> ...

 

After that i run 

```
wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iath0 -Dmadwifi -B
```

 without any problem but i don't connect to the internet.Any ideas?

----------

## manuels

dont use -Dmadwifi but -Dwext.

You can use -d and -dd for debugging.

----------

## nek95

I run 

```
 wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iath0 -Dwext -B -dd
```

 with no luck.I get only this

 *Quote:*   

> Initializing interface 'ath0' 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'
> ...

 

----------

## manuels

Don't use -B for debugging

----------

## nek95

Sorry for my mistake.I run 

```
wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iath0 -Dwext  -dd
```

 and i get :

 *Quote:*   

> Initializing interface 'ath0' 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'
> ...

 

and more that i can't understand   :Sad: 

----------

## manuels

 *nek95 wrote:*   

> 
> 
> ```
> 
> Associated with 00:14:7f:32:b1:77
> ...

 

Sounds quite nice. Doesn't it?

----------

## nek95

Still i don't have internet and with wpa_gui i see that i don't have an ip address

----------

## TrinitronX

Looks like wpa_supplicant is doing it's job, now you just need to get your dhcp client to get an IP after it's associated.  I end up having to do this a lot on my ubuntu  box if for some reason I get disconnected.  I know in ubuntu I use: dhclient3 ath0.  However, gentoo uses dhcpcd (or another dhcp client if you chose a different one at install time.)  So the way to do this in gentoo would depend on what you're using.  (also I'm a gentoo n00b, so I'm not sure what the accepted way to release/renew an ip with dhcpcd is).

EDIT: It seems that: 

```
dhcpcd -n [interface here]
```

  works.  I don't have a wifi card on my gentoo box,  but it works on eth0.  If you do: 

```
tail -n 11 /var/log/syslog
```

 afterwards, you should see something like: "recieved SIGALRM, renewing lease", followed by more output from dhcpcd telling you what your ip is.

----------

## nek95

TrinitronX thank you   :Smile:  .With 

```
dhcpcd -n ath0
```

 it gets ip and is working.But there is a way so i have a startup script such as 

```
/etc/init.d/eth1
```

 ?Also how can i add a default route in gentoo?

----------

## manuels

you must set up /etc/conf.d/net (see net.example).

The default route should be setup automaticly

----------

## nek95

Well i am a little confused.To create a startup script for the ath0 interface i have to do 

```
ln -s /etc/init.d/net.lo /etc/init.d/net.ath0
```

 and add it to the default runlevel but the ath0 interface is created after running 

```
wpa_supplicant
```

 so i have to run it at boot?Also in order of dhcpcd to give ip to ath0 i have to put 

```
config_ath0=( "dhcp" )
```

 in /etc/conf.d/net?   :Rolling Eyes: 

----------

## tarpman

```
ath_pci
```

```
modules_ath0=( "wpa_supplicant" )
```

----------

## nek95

Well it is working with the steps i wrote the the above post   :Very Happy: .As i see in boot udev autoload already 

```
ath_pci
```

 module is there any need to add it to etc/modules.autoload.d/kernel-2.6?Now the only problem i have is that whenever i do 

```
emerge --sync
```

 i got a timeout error and it stops.Any ideas?

----------

## manuels

hmm, if udev loads this module you can remove it from modules.autoload.

do you only get a timeout at emerge --sync or also with your browser?

----------

## nek95

I removed it from modules.autoload .Timeout i only get with 

```
emerge --sync
```

.I also have tried downloading torrents and browsing with no problem.

----------

## manuels

ok, then check GENTOO_MIRRORS in /etc/make.conf

----------

## nek95

Thanks for the answer.I setup GENTOO_MIRRORS with 

```
app-portage/mirrorselect
```

 and everything is working ok now.

----------

