# wireless nOOb

## Buzz-cp

Following this, and this, and searching around and reading here is what I've done so far:

Plugged in USB wifi adapter.  Observe dmesg shows it coming up with no errors.

decided to use wireless-tools:

```
# emerge net-wireless/wireless-tools
```

See it's wlan0 using iwconfig. Edited /etc/conf.d/net with these:

```
key_myAP="s:my_asci_key"

preferred_aps=( "myAP" )
```

then add init scripts:

```
# ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0

# rc-update add wlan.0 default
```

Doesn't come up on ifconfig....hmmm.  Try rebooting.  Got some error messages passed by, one of them about firmware, so I do this:

```
# emerge net-wireless/zd1211-firmware

# modprobe zd1211rw

```

And then...

```
# gentoo-server init.d # /etc/init.d/net.wlan0 --verbose start 

 * Starting wlan0

 *   Loading networking modules for wlan0

 *     modules: apipa arping ccwgroup macchanger macnet rename iwconfig essidnet iptunnel ifconfig system dhcpcd ip6to4

 *       iwconfig provides wireless

 *       ifconfig provides interface

 *       dhcpcd provides dhcp

 *   Configuring wlan0 for MAC address [removed]  ...                                                                        [ ok ]

 *   Configuring wireless network for wlan0

 *   Scanning for access points

 *     Found "myAP" at MAC_Address (managed, encrypted)

 *     Found "neighbor's AP" at MAC_Address (managed, encrypted)

 *     Found "other neighbor's AP" at MAC_Address (managed, encrypted)

Error for wireless request "Set Encode" (8B2A) :

    SET failed on device wlan0 ; Invalid argument.

 *   wlan0 does not support setting keys

 *   or the parameter "mac_key_myAP" or "key_myAP" is incorrect

 *   Trying to force preferred in case they are hidden

 *   Failed to associate with any preferred access points on wlan0

 *   Couldn't associate with any access points on wlan0

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

Read something about adding this to /etc/conf.d/net:

```
associate_order_wlan0="forcepreferred"
```

...but didn't help when I try again /etc/init.d/wlan.0 start

So feeling very noobish here.

<--- i.e.  :Very Happy: 

----------

## cach0rr0

if you're open to it, would suggest going with wpa_supplicant and wicd instead of wireless-tools

I do hate to give the answer of "instead of me telling you to fix things, how about doing it another way!"

But i think honestly that's going to be the easiest way to get things sorted. 

As well wireless-tools cannot do WPA if i recall correctly (someone else jump in here if im wrong)

so...yeah, first thing i have people do when wireless is acting up

```

cat /proc/net/wireless

```

if the interface shows up, the kernel bits are correct for the device

then

```

ifconfig <device> up

```

where of course <device> is ascertained in the first step (e.g. wlan0, ath0, eth1)

then check dmesg. If it doesnt upchuck errors about needing firmware, you are good to go with everything but the configuration portion

and of course rather than actually having to configure it yourself, snag wpa_supplicant and wicd, and the rest should be fairly straightforward as you have an intuitive UI to get you through  :Razz: 

----------

## d2_racing

Hi, can you post this :

```

# ifconfig -a

# iwconfig

# lsusb

# lspci -v

# cat /etc/conf.d/net

```

----------

## Buzz-cp

 *d2_racing wrote:*   

> Hi, can you post this :
> 
> ```
> 
> # ifconfig -a
> ...

 

I am away from my machine now, so I will have to post this output later.

After going through some things in response to cach0rr0, I decided to switch to wpa_supplicant.  It seemed to work and establish a connection to my AP, based on the output of ifconfig -a, although I did not have an IP.  I guess this is because I have a wired connection.  I thought this would work:

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

# /etc/init.d/net.wlan0 restart

# dhcpd wlan0
```

..does not seem to give me an IP.  I am just confused how to switch from wired (eth0) to wireless (wlan0).  I have used wicd on other machines, and like it.  I see wicd can run from the command line, but it looks like it mainly uses X and thus requires some USE flags which are disabled for my machine*.  I tried to make this machine pretty basic--no X, simply running as a file server. I just want to make the wireless work on the machine, so I can put it any location in my house and forget it.

Thanks,

Buzz

* have you figured out I'm new to gentoo  :Very Happy: 

----------

## cach0rr0

so you can get away with no wicd, and just do wpa_supplicant

just need the requisite bits in wpa_supplicant.conf (and /etc/conf.d/net, but we'll get to that)

/etc/wpa_supplicant.conf for me is:

```

network={

               ssid="gallipoli"

               scan_ssid=1

               key_mgmt=WPA-PSK

               psk="mys7r0n6p5k"

}

```

can test it with:

```
screen wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
```

then

```
dhclient
```

of course you can use whichever dhcp client you like, that one is from:

```

laptop02 ~ # equery belongs dhclient

[ Searching for file(s) dhclient in *... ]

net-misc/dhcp-3.1.2_p1 (/sbin/dhclient)

net-misc/dhcp-3.1.2_p1 (/var/lib/dhclient)

```

test that that works first and foremost - if you can associate, authenticate, and get an IP, all that's left is properly setting up /etc/conf.d/net

which others are well on their way to helping you with

----------

## mikegpitt

I also highly recommend using wpa_supplicant.  It makes things much easier.  Also, instead of messing with your wpa_supplicant.conf, you can use the wpa_gui program (that is part of the wpa_supplicant package) to configure your ap's.

----------

## cach0rr0

 *mikegpitt wrote:*   

> I also highly recommend using wpa_supplicant.  It makes things much easier.  Also, instead of messing with your wpa_supplicant.conf, you can use the wpa_gui program (that is part of the wpa_supplicant package) to configure your ap's.

 

he's looking to avoid X - I haven't used wpa_gui, but am assuming it requires X? or is it some curses based deal? 

the other bit with configuring wpa_supplicant.conf, is the wireless stuff can be automatically done when he reboots. 

Dunno, this is getting a bit outside of my comfort zone.

----------

## Buzz-cp

mikegpitt, I've got wpa_supplicant going now, thanks!

cach0rr0, OK I will check that out when I get home.  Also, your sig looks interesting; maybe I'll try that out.

Buzz

--

edit: grammar

----------

## mikegpitt

 *cach0rr0 wrote:*   

> he's looking to avoid X - I haven't used wpa_gui, but am assuming it requires X? or is it some curses based deal? 

 That's what happens when I read too quickly   :Embarassed:   Yes, wpa_gui requires X, and the qt api.

----------

## Buzz-cp

note: "MACADDRESS" = my hardware MAC address obv  :Smile: 

```
# screen wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

CTRL-EVENT-SCAN-RESULTS

Trying to associate with MACADDRESS(SSID='myAP' freq=2422 MHz)

ioctl[SIOCSIWENCODEEXT]: Invalid argument

Associated with MACADDRESS

CTRL-EVENT-CONNECTED - Connection to 00:17:3f:57:ba:d0 completed (auth) [id=0 id_str=]

```

```
# dhclient

Internet Systems Consortium DHCP Client V3.1.2p1-Gentoo

Copyright 2004-2009 Internet Systems Consortium.

All rights reserved.

For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/wlan0/MACADDRESS

Sending on   LPF/wlan0/MACADDRESS

Listening on LPF/eth0/MACADDRESS

Sending on   LPF/eth0/MACADDRESS

Sending on   Socket/fallback

DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3

DHCPREQUEST on eth0 to 255.255.255.255 port 67

DHCPACK from 192.168.2.1

bound to 192.168.2.12 -- renewal in 888727961 seconds.

```

hmm...

```
# ifconfig -a

eth0      Link encap:Ethernet  HWaddr MACADDRESS

          inet addr:192.168.2.12  Bcast:192.168.2.255  Mask:255.255.255.0

          inet6 addr: fe80::216:76ff:fe93:6d78/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1492  Metric:1

          RX packets:3513 errors:0 dropped:0 overruns:0 frame:0

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

          collisions:0 txqueuelen:1000

          RX bytes:306316 (299.1 KiB)  TX bytes:587561 (573.7 KiB)

wlan0     Link encap:Ethernet  MACADDRESS

          inet addr:169.254.111.253  Bcast:169.254.255.255  Mask:255.255.0.0

          inet6 addr: fe80::21c:dfff:fedd:5d49/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 B)  TX bytes:47350 (46.2 KiB)
```

^ left out lo and wmaster0.  What is with that wonky IP?  

k then

```
wlan0     IEEE 802.11bg  ESSID:"myAP"

          Mode:Managed  Frequency:2.422 GHz  Access Point: a MACADDRESS

          Bit Rate=1 Mb/s   Tx-Power=27 dBm

          Retry min limit:7   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off

          Link Quality=94/100  Signal level=94/100

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

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

^ left out lo eth0 and wmaster0

k 

```
# lsusb

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 002: ID 050d:705c Belkin Components F5D7050 v4000 Wireless Adapter

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

# lspci

00:00.0 Host bridge: Intel Corporation 82865G/PE/P DRAM Controller/Host-Hub Interface (rev 02)

00:02.0 VGA compatible controller: Intel Corporation 82865G Integrated Graphics Controller (rev 02)

00:1d.0 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #1 (rev 02)

00:1d.1 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #2 (rev 02)

00:1d.3 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #4 (rev 02)

00:1d.7 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller (rev 02)

00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev c2)

00:1f.0 ISA bridge: Intel Corporation 82801EB/ER (ICH5/ICH5R) LPC Interface Bridge (rev 02)

00:1f.1 IDE interface: Intel Corporation 82801EB/ER (ICH5/ICH5R) IDE Controller (rev 02)

00:1f.3 SMBus: Intel Corporation 82801EB/ER (ICH5/ICH5R) SMBus Controller (rev 02)

00:1f.5 Multimedia audio controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) AC'97 Audio Controller (rev 02)

01:01.0 Communication controller: Conexant HSF 56k Data/Fax Modem

01:08.0 Ethernet controller: Intel Corporation 82562EZ 10/100 Ethernet Controller (rev 02)

#cat /etc/conf.d/net

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

# Prefer iwconfig over wpa_supplicant

# Prefer wpa_supplicant over wireless-tools

modules=( "wpa_supplicant" )

# It's important that we tell wpa_supplicant which driver we should

# be using as it's not very good at guessing yet

wpa_supplicant_wlan0="-Dwext"
```

----------

