# Wireless help

## lazE

So I've been trying to get wireless working with no luck. I have an wireless card with an atheros chipset, am using a Linksys router and am trying to set this up using wpa_supplicant.

Using the guide here I installed the correct versions of the madwifi driver and wpa_supplicant. I have wireless support built into my kernel.

 *Quote:*   

> 
> 
> CONFIG_NET_WIRELESS=y
> 
> CONFIG_NET_RADIO=y
> ...

 

My SSID is broadcast by my router and I am using 128-bit WEP encryption. Here is my wpa_supplicant.conf:

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

ap_scan=1

# Shared WEP key connection (no WPA, no IEEE 802.1X)

network={

        ssid="weewee"

        key_mgmt=NONE

        wep_key0=1A6AF43E9277333DC0BDFDC114

        wep_key1=F55CA1C1D77383F58378E82A67

        wep_key2=3B8017B05BF3DA617705A393B2

        wep_key3=6E33DEF9DE5C64880A2EBA0BBF

        wep_tx_keyidx=0

}

```

However, this is what I get when I try to start ath0:

 *Quote:*   

> 
> 
>  * Starting ath0
> 
>  *   Loading networking modules for ath0
> ...

 

And, here is my net file:

```

config_eth0=( "dhcp" )

modules=( "wpa_supplicant" )

wpa_supplicant_ath0="-Dmadwifi"

wpa_timeout_ath0=20

preup() {

         if [ "${IFACE}" == "ath0" ]; then

                 /sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta > /dev/null

                 return $?

         fi

         if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then

                 ewarn "No link on ${IFACE}, aborting configuration"

                 return 1

         fi

         return 0

 }

 predown() {

         if [ "${IFACE}" == "ath0" ]; then

                 killall wpa_supplicant

                 /sbin/wlanconfig ath0 destroy

                 return $?

         fi

         return 0

 }

```

I created net.ath0 as a link to lo. Is this correct? Also, where exactly do I set the channel for this network? The router is broadcasting it on channel 7 but, I havent specified that in any config files.

----------

## kinkos

FWIW, you do not really need to use wpa_supplicant to handle this.  If its a simple wep key (even with 128 bit encryption), you can configure /etc/conf.d/net to handle this.  Try simplifying the issue by removing the extra programs.  in other words, KISS (keep it simple stupid  :Razz: ).

Read /etc/conf.d/net.example for a more thorough explanation.

HTH

~kinkos

----------

## lazE

I took your advice and still no luck...I think I am missing some basic step here or something.

THis is my net file:

 *Quote:*   

> 
> 
> config_eth0=( "dhcp" )
> 
> config_ath0=( "dhcp" )
> ...

 

This is now what I see when I try to start net.ath0:

 *Quote:*   

> 
> 
>  * Starting ath0
> 
>  *   Loading networking modules for ath0
> ...

 

I desperately need this to work and would appreciate any help. Thanks in advance.

----------

## kinkos

 *lazE wrote:*   

> 
> 
>  *   Failed to configure wireless for ath0                                [ !! ]
> 
> 

 

Okay, the automatic configuration is failing.  Let's try it manually:

```

# ifconfig ath0 up

# iwconfig ath0 essid weewee

# iwconfig ath0 key 1A6AF43E9277333DC0BDFDC114

# iwconfig

```

After the last command, it will print out the configuration for ath0.  It should be in mode managed by default, and it should have your correct essid and key listed.  What is the MAC address of the associated access point?  It should be something other than 00:00:00:00:00:00.  After it associates (it may take it a while, hit iwconfig a few times), run dhcpcd

```

# dhcpcd -do ath0

```

The -o means do not take the interface down if it fails, and -d means debugging, namely, it will list your MAC and tell you what your ip address is if it receives one. (if it does not receive one, you will just see your MAC displayed).

Make sure you are using the correct encrytion key, a single char off sucks.

Also, if you control this access point, you might want to try disabling encryption just to test and see if you can connect that way.  If you are afraid it is unsecure, use MAC filtering while encryption is off.

HTH.

P.S., it may be unable to associate due to signal strength.  You may want to try using wavemon to see whats up

```

# emerge wavemon

```

this package will display signal strength, SNR, and the currently associated AP, current IP, and other fun stuff.

----------

## lazE

Looks like we may be getting somewhere...I found two problems  :Very Happy: 

For starters, for some reason I had to create the ath0 device first with the command:

```

wlanconfig ath0 create wlandev wifi0 wlanmode sta

```

I feel that step should not have been necessary...I didnt have to do this before my last reboot although its possible that the device had already been created from playing with wpa_supplicant.

Secondly, after running the sequence of commands you gave me with this was the output of iwconfig:

 *Quote:*   

> 
> 
> lo        no wireless extensions.
> 
> eth0      no wireless extensions.
> ...

 

Running dhcpcd gave me no debug output at all. It seems like it cant find the AP but, my windows boxes have no problems so I know the router is doing what its supposed to be doing.

Any ideas?

----------

## lazE

Also, I am not sure if this is relelvant but, these are the modules that load at boot:

 *Quote:*   

> 
> 
> ath_pci                87368  -
> 
> ath_rate_onoe           6384  -
> ...

 

Those look like they make sense except for the ath_rate_onoe. I have no idea what that module is or why it is loading.

----------

## kinkos

 *lazE wrote:*   

> for some reason I had to create the ath0 device first with the command:
> 
> ```
> 
> wlanconfig ath0 create wlandev wifi0 wlanmode sta
> ...

  I quite agree.  I've used several different wireless cards, built-in, USB, PCMCIA, and NONE of them needed to be manually created.  I know you said it uses the Atheros chipset, but what sort of wireless card is this?  Model # if possible.

 *lazE wrote:*   

> 
> 
> Secondly, after running the sequence of commands you gave me with this was the output of iwconfig:
> 
>  *Quote:*   
> ...

 Thats interesting.  It's not accepting the encryption key (see how its listed as "off"?).  Try going through the steps i gave you, but check the output of dmesg before and after the one with the key.

 *lazE wrote:*   

> 
> 
> Running dhcpcd gave me no debug output at all. It seems like it cant find the AP but, my windows boxes have no problems so I know the router is doing what its supposed to be doing.
> 
> Any ideas?

 dhcpcd output _nothing_ ?  what version are you running? "dhcpcd -v".

 *lazE wrote:*   

> 
> 
> Also, I am not sure if this is relelvant but, these are the modules that load at boot:
> 
>  *Quote:*   
> ...

 

Unfortunately, I have never actually used an atheros chipset device before, so i'm just trying general debugging.  Could you please post the exact wireless card you are using?

~kinkos

----------

## lazE

Relevant output from lspci:

 *Quote:*   

> 
> 
> 0a:05.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)
> 
> 

 

Running version 2 of dhcpcd.

Relevant output from dmesg before I do anything:

 *Quote:*   

> 
> 
> ath_hal: 0.9.16.3 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413, DFS)
> 
> wlan: 0.8.4.2 (Atheros/multi-bss)
> ...

 

So it's seeing it but for some reason, its not creating the device...

Alright, dmesg doesnt give any new information after running any of the commands to bring it up manually or after running dhcpcd. I think the problem here is that the device isnt being automatically created.

All I need to do is add some modules to be auto-loaded and create a symlink to net.lo in /etc/init.d, yes?

----------

## lazE

Ok, turns out you do need to create the device manually when using madwifi so, that step is actually correct.

It looks like its just not seeing the AP. Can wavemon be used to scan for available wireless networks?

----------

## kinkos

I'm not really familiar with this card; hopefully someone with similar hardware can help you better.

 *lazE wrote:*   

> Can wavemon be used to scan for available wireless networks?

 Not exactly.  this command will list all networks within reach of your card, though:

```

# iwlist ath0 scan

```

HTH.

----------

## lazE

Well, this does indeed appear to be the problem. The access point is not being seen by my card.

Rather than start a new post, Ill wait awhile to see if anyone has any ideas about what might be preventing my atheros card from seeing the access point.

Thanks for you help, kinkos.

----------

## bryanb

Hi,

Out of curiosity, what baselayout are you using?

I had my wireless configured the same your initial post (although I was using wpa not wep), and all of a sudden it ceased to worked with the same symptoms.  I then noticed that although I had accidentally downgraded my baselayout (yes, I know - dumb).  What had happened was that I had my pakage.keywords requiring a specific version of baselayout for which the ebuild had been removed, so portage chose the lastest stable version.  Upgrading to > 1.12.0_pre13-r1, fixed my problems (hooray!).

Hope this helps...

----------

## 96140

Unfortunately, if you're using wpa_supplicant, you have to configure your WiFi router to broadcast the SSID. Make sure this is enabled. I remember that I'd originally intended to have a very secure home network with WPA and a "hidden" SSID, but though the Windows machines were able to use WPA with a non-broadcast SSID, it seems that the same capability does not exist in Linux, at least not if you're using wpa_supplicant.

Since you're only using WEP, if you absolutely cannot get wpa_supplicant to work, you do have iwconfig available as an alternative. See the networking section in the Installation Handbook for more information.

(Also, be sure to post the model of your Atheros card; I have a D-Link DWL-G650 pcmcia card that works perfectly with wpa_supplicant for both WEP and WPA networks).

----------

## kinkos

 *nightmorph wrote:*   

> I'd originally intended to have a very secure home network with WPA and a "hidden" SSID

 

OTOH, if you are using such a secure network, you likely aren't going to be switching networks very often (which is what wpa_supplicant does well).  In your case, a simple shell script works VERY well, using iwconfig just as you suggested.  wpa_supplicant is good, for example, at my Uni, where we have a seperate 802.1x network for each building, each with broadcasted SSID.  Running a new script while walking between buildings can be a pain, which is where wpa_supplicant really shines.

Each tool has its use and circumstance.  Just as you suggested, if lazE is using a hidden SSID, he should use a shell script with iwconfig.

@lazE: ifyou need an example of a sorta foolproof script, i can pull one off my gentoo laptop. I wrote one to help me at Uni for when i switch between wired/wirless frequently, makes starting up wireless easier without having to worry if dhcp/wpa_supplicant are currently running (which might produce errors, etc).

HTH.

----------

## bommee

Any luck with this thread?  I am experiencing much the same problem...or at least eerily similar.  I can get my wireless to connect without encryption but that isn't going to suffice.  Here are the details:

From lspci

```
00:0a.0 Ethernet controller: Linksys, A Division of Cisco Systems WMP11v4 802.11b PCI card
```

From ndiswrapper -l

```
Installed ndis drivers:

lsipnds driver present, hardware present
```

From lsmod

```
Module                  Size  Used by

ndiswrapper           164564  0
```

From iwconfig

```
wlan0     IEEE 802.11b  ESSID:off/any

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

          Bit Rate:1 Mb/s   Tx-Power:17 dBm

          RTS thr:2347 B   Fragment thr:2346 B

          Encryption key:off

          Power Management:off

          Link Quality:100/100  Signal level:56/154  Noise level:0/154

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

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

If I run iwconfig wlan0 essid <essid> key <64bit wep key> iwconfig is unchanged and from dmesg I get

```
ndiswrapper (set_essid:58): setting essid failed (00010003)

ndiswrapper (set_essid:58): setting essid failed (00010003)
```

As I have said I can get a connection without encryption so I have tripple checked the keys I have used etc.  I can connect using Windows using WEP and the keys I am trying.  If it matters I am using 64bit encryption.  

What else can I tell you...here are the versions I am using:

net-wireless/wireless-tools-28_pre10

net-wireless/ndiswrapper-1.2-r1

Hope someone can illuminate this for me...it is consuming far too much time right now.

----------

## zambizzi

 *kinkos wrote:*   

>  *lazE wrote:*   
> 
>  *   Failed to configure wireless for ath0                                [ !! ]
> 
>  
> ...

 

This worked flawlessly for me, what *exactly* do I need to put in /etc/conf.d/net to make this run on boot-up?  I've tried several combinations and can't seem to get it right.

----------

## kinkos

 *zambizzi wrote:*   

> 
> 
> This worked flawlessly for me, what *exactly* do I need to put in /etc/conf.d/net to make this run on boot-up?  I've tried several combinations and can't seem to get it right.

 

To be honest, i've _never_ had luck getting wireless to work correctly with the /etc/conf.d/net.  I usually throw those commands in a bash script and run it myself whenever i'm in range of wireless.

note: another benefit of the script is if you happen to boot up out of range of your wireless network, you won't get a hang followed by nasty errors when it fails to associate and dhcp.

Good luck on the file, i use "what works"  :Smile: 

----------

