# Wireless PCI card networking problems... [SUCCESS]

## Remillard

Howdy,

I'm still working on this.  I finally got to a point where I wanted to try to bring up the interface.  I'm using the "Wireless... Gentoo Way" scripts.

My configuration

eth0 -- Hardline 10/100 Ethernet (compiled into kernel)

eth1 -- Wireless card Netgear WG311 - madwifi drivers

Currently I get:

```
[1921][root@gopher:/etc/init.d]$ ./net.eth1 start

 * Bringing eth1 up...

 * Failed to bring eth1 up

```

which doesn't tell me much.  

The modules are installed AFAIK...

```
[1925][root@gopher:/etc/init.d]$ modprobe --list ath*

/lib/modules/2.6.3-rc2-mm1/net/ath_pci.ko

/lib/modules/2.6.3-rc2-mm1/net/ath_hal.ko

```

And here is my /etc/conf.d/net file contents.  The ESSID key has been obfuscated:

```
# /etc/conf.d/net:

# Global config file for net.* rc-scripts

# This is basically the ifconfig argument without the ifconfig $iface

#

#iface_eth0="192.168.0.13 broadcast 192.168.0.255 netmask 255.255.255.0"

#iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"

# For DHCP set iface_eth? to "dhcp"

# For passing options to dhcpcd use dhcpcd_eth?

#

# Hardline 10/100 Ethernet

iface_eth0="dhcp"

#dhcpcd_eth0="..."

# Atheros based Wireless Card

iface_eth1="dhcp"

#dhcpcd_eth1="..."

##############################################################################

#                             Wireless settings                              #

##############################################################################

# Hard code an ESSID to an interface

# This needs to be done when the driver doesn't support scanning

# Set to "any" to connect to any ESSID

# This may work for drivers that don't support scanning but you need automatic AP association

wireless_essid_eth1="100acrewoods"

# Set the mode of the interface. Managed is default

wireles_mode_eth1="Managed"

# Setup any other config commands. This is basically the iwconfig argument

# without the iwconfig $iface

#wireless_config_eth0=""

# Set private driver ioctls. This is basically the iwpriv argument without

# the iwpriv $iface

#wireless_priv_eth0="mode 3"

# Some drivers need to scan in Ad-Hoc mode

# After scan, the mode is reset to the one defined above

wireless_scan_mode_eth1="Ad-Hoc"

# We define various timeouts here

#wireless_sleep_scan_eth0="1"

#wireless_sleep_associate_eth0="5"

# Below you can define private ioctls to run before and after scanning

# Format is the same as the wireless_priv above

# This is needed for the HostAP drivers

#wireless_priv_scan_pre_eth0="host_roaming 2"

#wireless_priv_scan_post_eth0="host_roaming 0"

# Define a WEP key per ESSID

# IMPORTANT: any characters that are NOT in a_z A_Z 0_9 should be

# replaced with the _ character. For example #123 becomes _123

# wireless_key takes the same parameters as the key function in iwconfig

# You can also set iface, dhcpcd and gateway options per ESSID

# If they aren't set then the defaults for the interface are used

# IMPORTANT: don't set an interface for wireless gateway - just use an IP address

# The below examples use ESSID - change it to yours.

# You can't use "any" for an ESSID here

#wireless_key_ESSID="restricted 1234-1234-1234-1234-1234-1234-56"

wireless_key_100acrewoods="1234abcdef"

# or you can use strings. Passphrase IS NOT supported

#wireless_key_ESSID="s:foobar"

# You can also override the interace settings here - even provide

# a nameserver/domain per ESSID

#wireless_iface_ESSID="dhcp"

#wireless_dhcpcd_ESSID="..."

#wireless_gateway_ESSID="192.168.0.1"

#wireless_nameserver_LTLnet=""

#wireless_domain_LTLnet=""

# This lists the preferred ESSIDs to connect to in order

# ESSID's can contain any characters here as they must match the broadcast

# ESSID exactly

# Seperate the ESSIDs with tabs - NOT spaces

# If the first ESSID isn't found then it moves onto the next

# If this isn't defined then it connects to the first one found

#wireless_preferred="ESSID1     ESSID2  ESSID3  ESSID4"

##############################################################################

#                            End Wireless Settings                           #

##############################################################################

# For adding aliases to a interface

#

#alias_eth0="192.168.0.3 192.168.0.4"

# NB:  The next is only used for aliases.

#

# To add a custom netmask/broadcast address to created aliases,

# uncomment and change accordingly.  Leave commented to assign

# defaults for that interface.

#

#broadcast_eth0="192.168.0.255 192.168.0.255"

#netmask_eth0="255.255.255.0 255.255.255.0"

# For setting the default gateway

#

#gateway="eth0/192.168.0.1"

```

Is there anyway to get the net.eth1 script to spit out more verbose information about what did and did not work?  I did make one change to the script, in the need section I removed the dependency on pcmcia as this is not a laptop and does not have a pcmcia card in it.

Any ideas?  Anything obviously wrong for the WG311 PCI card?  My wife would really like me to get this working, but so far I've got bupkis.

Regards,

Remillard

----------

## froke

Since you have already edited the init.d script, why not add some echo commands in select locations to see where the script failed?

You will see lines like 

```
eend ${retval} "Failed to bring ${IFACE} up"
```

I changed these to read

```
eend ${retval} "Error x:  Failed to bring ${IFACE} up"
```

Where x = 1,2,3... so i can then pinpoint the part of the script that failed.

Good luck.

----------

## Remillard

Thanks, I'll give that a shot.  Mostly I haven't edited it because it didn't look like pure scripting language to me and I was not familiar with the commands and syntax.  I'll try adding that bit you had in there and see what happens.

Regards,

Remillard

----------

## froke

The script is in Gentoo's runscript syntax (hence the first line #!/sbin/runscript.  Do a `runscript | less` if you want to learn more.

----------

## Remillard

Alrighty, I got this response:

```

[1057][root@gopher:/etc/init.d]$ ./net.eth1 start

 * Bringing eth1 up...

 * Error 3:  Failed to bring eth1 up

```

And this particular section has to do with the dhcp configuration:

```

else

  # Check that eth0 was not brough up by the kernel ...

  if [ "${status_IFACE}" != "up" ]

  then

   /sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE} >/dev/null || {

      retval=$?

      eend ${retval} "Error 3:  Failed to bring ${IFACE} up"

      return ${retval}

  fi

```

Am I going to get anything useful if I take out the /dev/null bit?  Maybe it will give me more information?  I guess it can't hurt to try  :Smile: . [EDIT: This didn't do anything, so I've got to find more debug output.]

Regards,

Remillard

----------

## froke

You may want to comb through your /var/log/messages and `dmesg` to look for debug information.  Make sure that the correct modules are being binded to the card.

----------

## UberLord

Have you

1) Configured Wireless in your kernel?

2) Emerged wireless-tools against your kernel with wireless extensions?

From the output it shows that no wireless extensions are available.

BTW, there's a typo in your conf.d/net script (which was in mine which has just been updated   :Embarassed:  )

Look for 

```
wireles_mode_eth1="Managed
```

and change it to 

```
wireless_mode_eth1="Managed
```

----------

## Remillard

Thanks.  I fixed the typo, and found that I had NOT emerged wireless-tools so I did that.  Still cannot bring it up, so I'm digging into the kernel config.  I'm relatively sure I put in wireless, but perhaps it's a module not in the kernel.  I also might have not put it in, thinking the madwifi drivers would be what I needed.

Still plugging away at it.

Remillard

----------

## UberLord

Easy way to find out after installing the wireless tools

```
iwconfig
```

That should tell you if any loaded modules have wireless extensions working

----------

## Remillard

Okay, I think something is at least close now.  iwconfig produced the following results:

```

ath0      IEEE 802.11  ESSID:""

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

          Bit Rate:0kb/s   Tx-Power:off   Sensitivity=0/3

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off

          Link Quality:0/94  Signal level:-95 dBm  Noise level:-95 dBm

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

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

```

So I'm guessing it's found the card here... or is it?  The access point number is all 0's, and I'm not sure what I'm looking for here.

Does it matter which order the madwifi drivers are insmodded in?  I did ath_hal, wlan, and then ath_pci last.

Regards,

Remillard

----------

## froke

So it looks like your card is recognized by the drivers, but the reason for the all zeros (and the empty essid) is that the card has not associated with the access point.  Once the card is associated, then the name of the access point will be the essid and the mac address of the access point will replace all those zeros

----------

## Remillard

Okay, I'm using iwconfig now to just do this from the command line one configuration command at a time.  I turned off the router/access point key for the moment just to make things easier initially.

So I have some questions:

In the /etc/conf.d/net file, everything is defined as eth1 for the wireless (at least that's what I've got it as.)  When I run iwconfig, it says that the interface name is ath0.  Which should I use?  I'm leaning towards ath0 because that's what iwconfig seems to recognize, but I'm not sure.

How do I know when I've succeeded?  At the moment, I'm trying to set things up, and then run dhcpcd ath0 and see if it comes back faster than the 60 second timeout period, but I don't think it actually prints a success message either if it works, so it's a bit hard to tell.

Anyhow, I think that's about it for the moment.  Probably more questions to come as I work through this.

Regards,

Remillard

----------

## Remillard

Okay, I *think* something is working... 

This is a WG311 PCI Card.  I'm using madwifi drivers.

This is what iwconfig says:

```
$ iwconfig

eth0      no wireless extensions.

lo        no wireless extensions.

sit0      no wireless extensions.

ath0      IEEE 802.11g  ESSID:"100acrewoods"

          Mode:Managed  Frequency:2.462GHz  Access Point: 00:09:5B:6F:A3:0A

          Bit Rate:36Mb/s   Tx-Power:off   Sensitivity=0/3

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off

          Link Quality:44/94  Signal level:-51 dBm  Noise level:-95 dBm

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

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

So as far as I can tell, it says that there IS actually some sort of potential connection.  Tx-Power is off, but as far as I can tell, configurable Tx-Power is not something available on this card.

I can't seem to improve link quality by any real degree.  I expect this is due to the antenna sticking out the back end of the computer with power and crap all around it.  However, at the moment even 36 Mb/s is better than 0.  I can fine-tune it later.

At this point is where I am hoping that I can type dhcpcd ath0 and something will happen.  So far I have kept hitting the 60 second timeout.

Also, I had to specify the MAC address of the card.  Does anyone know if the WG311 will understand 'iwconfig ath0 ap any'?  Last time I did that, it set it to all F's (which may be a wildcard as far as I know.  I'm not entirely sure how the network layer uses the MAC hardware address.  If it's simply an AND operation against anything it finds, then any is probably okay.

EDIT:  I tried to set the access point to any (FF:FF:FF:FF:FF:FF) and my link quality dropped back down to 0.  

EDIT:  HOLY COW IT'S WORKING.

Regards,

Remillard

----------

## Catach

This sounds much like my own problem: i can't bring ath0 up.

I've also got a WG311 PCI card and am using the madwifi drivers. all drivers loaded correctly, and i just checked that i have the "Wireless LAN and Wireless Extensions" compiled into my kernel.

I get the same /etc/init.d/ath0 error:

```

 * Bringing ath0 up... 

 * Error 4:  Failed to bring ath0 up 

```

At the line

```

else 

  # Check that eth0 was not brough up by the kernel ... 

  if [ "${status_IFACE}" != "up" ] 

  then 

   /sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE} >/dev/null || { 

      retval=$? 

      eend ${retval} "Error 4:  Failed to bring ${IFACE} up" 

      return ${retval} 

  fi 

```

I've got more of a problem when i run iwconfig though:

```

lo        no wireless extensions. 

```

And thats it, no eth0, ath0 or sit0 stuff.

I also ran lspci but the only thing that looked like a Wireless card was:

```

00:0c.0 Network Controller: Texas Instruments: Unknown Device 9066

```

I've looked at the end of /var/log/messages and have something interesting:

```

dhcpcd[4646]: dhcpStart: ioctl SIOCGIFHWADDR: no such device

rc-scripts: Error 4: Failed to bring ath0 up.

dhcpcd[4700]: dhcpStart: ioctl SIOCGIFHWADDR: no such device

rc-scripts: Error 4: Failed to bring ath0 up.

```

I'm guessing my two attempts to bring ath0 up. I tried editing /etc/conf.d/net to use a preset IP address:

```

iface_ath0="192.168.0.13 broadcast ... etc ..."

```

and got some errors that look like that /var/log/messages stuff:

```

* Bringing ath0 up...

SIOCSIFADDR: No Such Device

ath0: Unknown Interface: no such device

SIOCSIFBRADDR: No Such Device

ath0: unknown Interface: No such device

SIOCSIFNETMASK: No Such Device

* Error 3: Failed to bring ath0 up

```

those 3 allcaps variables i'm guess are my IP address, broadcast address and net mask respectively as i set them in /etc/conf.d/net, but I dont know about this 'No such device' thing.

It's not a hardware problem as i can use the same card and Access Point from within windows easily (The AP is accepting my MAC address already). I'm going to search through dhcpd stuff in the mean time, if you guys can help that'd be great.

----------

