# Wireless is Pain

## Qylvaran

I have a DWL-G122, and I am using the rt2x00 driver.  The driver appears to work, and I can get the 'lnk' light to come on on my usb dongle.  The 'act' light even blinks when I try to do something.  I cannot, however, connect to the internet with the thing.  I can't even connect to my router's configuration menu.  What follows is a copy/paste of my actions from login and setup to ping.

```
ender@jane ~ $ sudo iwconfig     

lo        no wireless extensions.

                                 

eth0      no wireless extensions.

                                 

sit0      no wireless extensions.

                                        

eth1      IEEE 802.11bg  ESSID:off/any                                      

          Mode:Auto  Frequency:2.412 GHz  Access Point: Not-Associated

          Bit Rate:54 Mb/s   Tx-Power:off   Sensitivity:10/0

          RTS thr:off   Fragment thr:off                  

          Encryption key:off                           

          Link Quality:0  Signal level:0  Noise level:0           

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

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

                                  

ender@jane ~ $ sudo iwconfig eth1 essid default

ender@jane ~ $ sudo iwconfig

lo        no wireless extensions.

                                                                   

eth0      no wireless extensions.

                                                                                                           

sit0      no wireless extensions.

                                

eth1      IEEE 802.11bg  ESSID:off/any

          Mode:Auto  Frequency:2.412 GHz  Access Point: Not-Associated                                     

          Bit Rate:54 Mb/s   Tx-Power:off   Sensitivity:10/0

          RTS thr:off   Fragment thr:off

          Encryption key:off

          Link Quality:0  Signal level:0  Noise level:0

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

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

ender@jane ~ $ sudo iwconfig eth1 key 0000000000 open

ender@jane ~ $ sudo iwconfig

lo        no wireless extensions.

eth0      no wireless extensions.

sit0      no wireless extensions.

eth1      IEEE 802.11bg  ESSID:off/any

          Mode:Auto  Frequency:2.412 GHz  Access Point: Not-Associated

          Bit Rate:54 Mb/s   Tx-Power:off   Sensitivity:10/0

          RTS thr:off   Fragment thr:off

          Encryption key:0000-0000-00   Security mode:open

          Link Quality:0  Signal level:0  Noise level:0

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

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

ender@jane ~ $ sudo dhcpcd eth1

ender@jane ~ $ sudo iwconfig

lo        no wireless extensions.

                                 

eth0      no wireless extensions.

                                 

sit0      no wireless extensions.

                                 

eth1      IEEE 802.11bg  ESSID:"default"

          Mode:Managed  Frequency:2.437 GHz  Access Point: 00:11:95:48:E7:FE

          Bit Rate:11 Mb/s   Tx-Power:100   Sensitivity:10/0          

          RTS thr:off   Fragment thr:off                    

          Encryption key:0000-0000-00   Security mode:open

          Link Quality:0  Signal level:0  Noise level:0

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

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

                                                                  

ender@jane ~ $ ping www.google.com

ping: unknown host www.google.com              

ender@jane ~ $ sudo lsusb   

Bus 003 Device 001: ID 0000:0000 

Bus 002 Device 002: ID 046d:c025 Logitech, Inc. MX500 Optical Mouse

Bus 002 Device 001: ID 0000:0000 

Bus 001 Device 002: ID 2001:3c00 D-Link Corp. [hex] DWL-G122 802.11g rev. B1 [ralink]                                                       

Bus 001 Device 001: ID 0000:0000

ender@jane ~ $                        

```

I'm using the latest kernel (gentoo-sources-2.6.14-r5).  I've been frustrated in my attempts to understand wireless networking under linux for some time, so something more substantial than a suggestion of where to start looking would be most appreciated.  If you've only got such a suggestion, though, I'll take what I can get.  Thank you.

----------

## dgaffuri

May you please post ifconfig -a output and /etc/resolv.conf? It seems that the wireless link works, except that it doen't report link quality, signal level and noise level. Which is the IP of your router?

----------

## Qylvaran

from ifconfig -a:

```
eth1      Link encap:Ethernet  HWaddr 00:13:46:97:B2:58       

          inet addr:192.168.0.105  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::213:46ff:fe97:b258/64 Scope:Link

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:17437 errors:0 dropped:275 overruns:0 frame:0

          TX packets:222 errors:0 dropped:0 overruns:0 carrier:0  

          collisions:0 txqueuelen:1000 

          RX bytes:5279586 (5.0 Mb)  TX bytes:9775 (9.5 Kb)
```

```
ender@jane ~ $ cat /etc/resolv.conf

# Generated by dhcpcd for interface eth0

domain charterpipeline.net

nameserver 192.168.0.1           

```

I'm using my normal network card right now, but it's connected to the same router, at 192.168.0.1 (a D-Link DI-624).

----------

## dgaffuri

And you can't ping 192.168.0.1 using wireless?

----------

## Qylvaran

Nope, I cannot.

----------

## dgaffuri

That's rather strange. Are you sure you're connecting to the right AP? May you please post

```
iwlist eth1 scan
```

output (run from root)?

----------

## Qylvaran

```
eth1      Scan completed :

          Cell 01 - Address: 00:11:95:48:E7:FE

                    ESSID:"default"

                    Protocol:IEEE 802.11bg

                    Mode:Master

                    Channel:6

                    Encryption key:on

                    Bit Rates:54 Mb/s

                    Extra: Rates (Mb/s): 1 2 5.5 9 11 6 12 18 24 36 48 54 

                    Quality=100/0  Signal level=-246 dBm  

                    Extra: Last beacon: 1044ms ago
```

----------

## jamapii

I just noticed something in the iwlist output. On my system, it says Mode: Managed. Either you are in Master mode, i.e. the laptop is trying to be an access point, or the iwlist output isn't well-defined (you never know). Did you never try the Gentoo-specific way for WLAN setup? This will do all the necessary things like that.

------------------------

I had similar problems with ndiswrapper. At some time it started working for no apparent reason. (after I tried a GUI configuration software)

I just put in /etc/conf.d/net

```
config_default=( "192.168.0.150/24" )

key_default=( "open 00-00-00..." )

routes_wlan0=( "default via 192.168.0.1" )
```

then /etc/init.d/net.wlan0 start

Maybe the driver doesn't really work. When you manage to bring it up (ifconfig wlan0 up), you can send some pings and check the TX: ... RX: ... lines in ifconfig output to try to find out where the packets get lost.

You can try disabling WEP, if possible.

You can make your WLAN secure and switch to wpa_supplicant if the router can do WPA.

In /etc/conf.d/net

```
modules=( "wpa_supplicant" )

config_default=( "192.168.0.150/24" )

routes_wlan0=( "default via 192.168.0.1" )
```

and make a /etc/wpa_supplicant.conf.

----------

## Qylvaran

Argh!  Now I can't even get the lights on the thing to light up anymore.  I think I'm suddenly less far along than I was yesterday.  So far I've been trying to get things working without writing anything into /etc/conf.d/net, since I wanted to make sure I could set everything correctly with iwconfig.  I tried putting the settings you mentioned into it, but it said it couldn't associate with an access point.  Iwlist still lists my router, but iwconfig says "Access Point: Not-Associated" no matter what I do.

Could you post a link to instructions for "the Gentoo-specific way for WLAN setup" please?  I can't find any such thing on gentoo.org.  Maybe I need to make a fresh start of it.

Also, I have set the card specifically to mode: managed, and sometimes mode: auto, but it still has mode: master in the iwlist readout.  I'm pretty sure it doesn't mean the laptop is trying to be an access point.

Finally, I do not have permission to change any of the settings on the router.  If it is determined that this wireless dongle won't work, however, I can take it back and get a different one.  If anyone has a tip on a miracle foolproof wireless adapter that works without even trying on gentoo, I'm all ears.

----------

## dgaffuri

It's the AP that's in master mode, not your card

```
~ # iwlist eth1 scan

eth1      Scan completed :

          Cell 01 - Address: 00:0D:88:61:AC:FE

                    ESSID:"essid"

                    Protocol:IEEE 802.11b

                    Mode:Master

                    Channel:7

                    Encryption key:on

                    Bit Rate:22 Mb/s

                    Extra: Rates (Mb/s): 1 2 5.5 11 22

                    Quality=75/100  Signal level=-54 dBm

                    Extra: Last beacon: 72ms ago
```

Can you test the dongle with the other os? Are you sure that the router is not filtering access by MAC address or something similar?

----------

## Qylvaran

Yep, it works on freaking windows.  Grr.

----------

## jamapii

 *Qylvaran wrote:*   

> Could you post a link to instructions for "the Gentoo-specific way for WLAN setup" please?  I can't find any such thing on gentoo.org.  Maybe I need to make a fresh start of it.
> 
> 

 

http://dev.gentoo.org/~uberlord/net-book/hb_part1_chap4.html

or try this in /etc/conf.d/net

config_default=( "dhcp" )

key_default=( "open 00-00-00..." ) # use your real key

routes_wlan0=( "default via 192.168.0.1" ) # you can probably leave this out

 *Quote:*   

> Also, I have set the card specifically to mode: managed, and sometimes mode: auto, but it still has mode: master in the iwlist readout.  I'm pretty sure it doesn't mean the laptop is trying to be an access point.

 

Then it's probably just my ndiswrapper driver that behaves weird.

----------

## Qylvaran

Weirdness.  I set my conf.d/net to this:

```
# Regardless of which DHCP client you prefer, you configure them the

# same way using one of following depending on which interface modules

# you're using.

config_eth0=( "dhcp" )

# For passing custom options to dhcpcd use something like the following.  This

# example reduces the timeout for retrieving an address from 60 seconds (the

# default) to 10 seconds.

dhcpcd_eth0="-t 10 -N"

modules=( "iwconfig" )

key_default="[1] 0000-0000-00 key [1] enc open"

preferred_aps=( "default" )

associate_order="forcepreferred"

channel_eth1="6"

config_default=( "dhcp" )

```

...and it worked, mostly.  I got the following:

```
jane ender # /etc/init.d/net.eth1 restart

 * Starting eth1                                          

 *   Configuring wireless network for eth1             

 *     eth1 connected to "default" at 00:11:95:48:E7:FE           

 *     in managed mode on channel 6 (WEP enabled - open)          

 *   Bringing up eth1                                    

 *     dhcp                                                               

 *       Running dhcpcd ...                                               [ !! ]
```

Then I tried adding routes_eth1=( "default via 192.168.0.1" ) to my config, and I got:

```
jane ender # /etc/init.d/net.eth1 restart                                       

 * Caching service dependencies ...                                       [ ok ]

 * Starting eth1                          

 *   Configuring wireless network for eth1                      

 *   Trying to force preferred in case they are hidden  

 *   Failed to associate with any preferred access points on eth1

 *   Couldn't associate with any access points on eth1   

 *   Failed to configure wireless for eth1                                [ !! ]
```

...so I tried to remove just the line I had added, and now I keep getting the same thing!  Is there something I need to redo when I mess things up like that?  How do I get dhcpcd to work properly once everything else does again?

By the way, thanks for the link.  It almost worked.  In case you're wondering, by the way, my laptop's about 7' from the router right now, in the same room.

----------

## jamapii

It's possible that dhcp won't work, even if everything else would. You can try a static ip:

config_default=( "192.168.0.105/24" )

Seeing that any subsequent try doesn't work, this may be a limitation of gentoo's init scripts. They might fail in all cases if they see a "half-initialized" device. You can try some iwconfig lines to disassociate or you can reboot.

Another possibility is that the driver doesn't really associate, even if it says so. That's what driverloader (the commercial alternative to ndiswrapper) did.

----------

## BlackLodge

Hello!

Only to be sure, can you show the output of route command? Because if you are associated, you have a valid IP and the ping to the AP doesn't work, it's maybe only a routing problem...

----------

## drjones69

Just a thought, your router (from iwlist output) has encryption turned on, but you iwconfig seems to have it turned off - have you definetly got the key set up in (I  think!) /etc/conf.d/wireless - the file is somewhere around there.

Also, try setting a static IP and netmask to match your router (ifconfig wlan0 etc), and once you can ping the router the only thing that could be wrong is the routes (post output of route, run as root) - I know they can be a pain, I'm tempted to go back to wired, but it's nice to have them working!

Sorry I can't be more help now as I'm as a work at the moment, will look into further when I get home.

Ryan

----------

## frenkel

rt2x00 driver is still experimental. Try the rt2500 driver (in portage also) first, if that one works, you know the rt2x00 driver isn't ready for you yet.

I even think the rt2x00 driver doesn't support encryption yet.

----------

## Qylvaran

Thanks for your help everyone (and I did try the rt2500 driver, didn't help), but I gave up.  Exchanged the DWL-G122 for a DWL-G650 and it works fine, no questions asked.

----------

