# std wireless setup [self solved]

## idella4

This is my first ever post in this sub forum.  I thought my wired network card developed a fault, but it in fact is not.

So I still have eth0 to plug into the network, but I spent half the day trying to get the wireless network card configured.

Having started this, I would rather like the wireless card to work as it did in the gentoo of the past.

I first did this about 2 -3 years ago without a problem.  I found a gentoo wiki doc that outlined it using wpa_supplicant, so I did it all again.

It just doesn't work.  I followed the wiki instructions.

I happen to have another post in another forum and from that post I got some instructions on hos to get it to connect.

These instructions were intended for the other distro, but the wpa_supplicant package isn't gentoo specific so I ran it in gentoo.

It half works, actually making a connection, but it's in a constant state of flux.

First, the /etc/conf.d/net which is slightly edited but follows the lead from the gentoo wiki.

```

idella@genny ~ $ 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 :]!).

dns_domain_lo=homenetwork

config_wlan0=( "dhcp" )

bridge_virbr0="eth0"

config_virbr0=("dhcp")

#config_eth0=("null")

##config_eth0=( "dhcp" )

#bridge_br0="eth0"

#config_br0=("dhcp")

#

#config_eth0=("null")

# 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="-Dmadwifi"

#wpa_supplicant_wlan0="ath_pci"

#iwconfig_wlan0="mode managed"

```

Now the wiki cites wpa_supplicant_wlan0 as wpa_supplicant_eth0, which is odd.  eth0 is the interface for a wired network card.

The only other config required is for /etc/wpa_supplicant/wpa_supplicant.conf;

```

idella@genny ~ $ cat /etc/wpa_supplicant/wpa_supplicant.conf

# The below line not be changed otherwise we refuse to work

ctrl_interface=/var/run/wpa_supplicant

# Ensure that only root can read the WPA configuration

ctrl_interface_group=0

# Let wpa_supplicant take care of scanning and AP selection

ap_scan=1

# Only WPA-PSK is used. Any valid cipher combination is accepted

network={

  ssid="delaney"

  scan_ssid=1

  proto=WPA

  key_mgmt=WPA-PSK

  pairwise=CCMP TKIP

# group=CCMP TKIP WEP104 WEP40

  psk="e235485512"

  priority=5

}

```

If I'm unclear about anything it's WPA bs WEP.  

The wireless network card passphrase is in fact a WPA type, so there should not be a problem.

It has major hassles with the scanning.  dmesg is really helpful.

```

idella@genny ~ $ sudo grep wlan0 /var/log/dmesg

Password:

```

Nothing.  There is a little gui tool that has turned up called wpa_gui.  It's utterly impotent.  

It lists nothing present.  Tell it to scan and it doesn't.  It connects to nothing.

Now, here are the steps I was given that managed to kickstart it once.  

 *Quote:*   

> 
> 
> Say my network is called scott and my password is toracat. (It's late, I don't feel creative) 
> 
> (This part can be done as normal user)
> ...

 

idella@genny ~ $ ls /etc/sysconfig/wpa_supplicant

This is centos specific.

So,

```

idella@genny ~ $ sudo ifconfig wlan0 up

idella@genny /usr/src/linux-2.6.31-gentoo-r6 $ sudo iwlist wlan0 scanwlan0     Scan completed :                                           

          Cell 01 - Address: 94:44:52:81:31:E0                       

                    Channel:6                                        

                    Frequency:2.437 GHz (Channel 6)                  

                    Quality=20/70  Signal level=-90 dBm              

                    Encryption key:on                                

                    ESSID:"QSNetwork1"                               

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s

                              24 Mb/s; 36 Mb/s; 54 Mb/s                 

                    Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s          

                    Mode:Master                                         

                    Extra:tsf=00000009ea14cdd8                          

                    Extra: Last beacon: 503ms ago                       

                    IE: Unknown: 000A51534E6574776F726B31               

                    IE: Unknown: 010882848B962430486C                   

                    IE: Unknown: 030106                                 

                    IE: Unknown: 2A0104                                 

                    IE: Unknown: 2F0104                                 

                    IE: IEEE 802.11i/WPA2 Version 1                     

                        Group Cipher : TKIP                             

                        Pairwise Ciphers (2) : CCMP TKIP                

                        Authentication Suites (1) : PSK                 

                    IE: Unknown: 32040C121860                           

                    IE: Unknown: 2D1A7E181BFFFF000001000000000000000000000000000000000000

                    IE: Unknown: 3D1606051B00000000000000000000000000000000000000        

                    IE: Unknown: DD090010180201F4050000                                  

                    IE: WPA Version 1                                                    

                        Group Cipher : TKIP                                              

                        Pairwise Ciphers (2) : CCMP TKIP                                 

                        Authentication Suites (1) : PSK                                  

                    IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00    

                    IE: Unknown: DD1E00904C337E181BFFFF000001000000000000000000000000000000000000                                                                                         

                    IE: Unknown: DD1A00904C3406051B00000000000000000000000000000000000000    

          Cell 02 - Address: 00:1F:C6:5C:3F:CD                                               

                    Channel:11                                                               

                    Frequency:2.462 GHz (Channel 11)                                         

                    Quality=20/70  Signal level=-90 dBm                                      

                    Encryption key:on                                                        

                    ESSID:"delaney"                                                          

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s                     

                              24 Mb/s; 36 Mb/s; 54 Mb/s                                      

                    Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s                               

                    Mode:Master                                                              

                    Extra:tsf=0000000297e1a68a                                               

                    Extra: Last beacon: 64ms ago                                             

                    IE: Unknown: 000764656C616E6579                                          

                    IE: Unknown: 010882848B962430486C                                        

                    IE: Unknown: 03010B                                                      

                    IE: Unknown: 2A0100                                                      

                    IE: Unknown: 2F0100                                                      

                    IE: Unknown: 32040C121860                                                

                    IE: Unknown: DD06001018020000                                            

                    IE: WPA Version 1                                                        

                        Group Cipher : TKIP                                                  

                        Pairwise Ciphers (1) : TKIP                                          

                        Authentication Suites (1) : PSK                                      

idella@genny ~ $ sudo wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant

confctrl_iface exists and seems to be in use - cannot override it                                

Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore                    

Failed to initialize control interface '/var/run/wpa_supplicant'.                            

You may have another wpa_supplicant process already running or the file was                  

left by an unclean termination of wpa_supplicant in which case you will need                 

to manually remove this file before starting wpa_supplicant again.                           

idella@genny ~ $ sudo rm /var/run/wpa_supplicant/wlan0

idella@genny ~ $ sudo wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf

Trying to associate with 00:1f:c6:5c:3f:cd (SSID='delaney' freq=2462 MHz)                    

Associated with 00:1f:c6:5c:3f:cd                                                            

CTRL-EVENT-DISCONNECTED bssid=00:1f:c6:5c:3f:cd reason=0                                     

ioctl[SIOCSIWENCODEEXT]: No such file or directory                                           

ioctl[SIOCSIWSCAN]: Device or resource busy                                                  

Failed to initiate AP scan.                                                                  

Associated with 00:1f:c6:5c:3f:cd                                                            

CTRL-EVENT-DISCONNECTED bssid=00:1f:c6:5c:3f:cd reason=0                                     

ioctl[SIOCSIWENCODEEXT]: No such file or directory                                           

ioctl[SIOCSIWSCAN]: Device or resource busy                                                  

Failed to initiate AP scan.                                                                  

Associated with 00:1f:c6:5c:3f:cd                                                            

CTRL-EVENT-DISCONNECTED bssid=00:1f:c6:5c:3f:cd reason=0                                     

ioctl[SIOCSIWENCODEEXT]: No such file or directory                                           

Associated with 00:1f:c6:5c:3f:cd                                                            

CTRL-EVENT-DISCONNECTED bssid=00:1f:c6:5c:3f:cd reason=0                                     

ioctl[SIOCSIWENCODEEXT]: No such file or directory                                           

Associated with 00:1f:c6:5c:3f:cd                                                            

CTRL-EVENT-DISCONNECTED bssid=00:1f:c6:5c:3f:cd reason=0                                     

ioctl[SIOCSIWENCODEEXT]: No such file or directory                                           

Associated with 00:1f:c6:5c:3f:cd                                                            

CTRL-EVENT-DISCONNECTED bssid=00:1f:c6:5c:3f:cd reason=0                                     

ioctl[SIOCSIWENCODEEXT]: No such file or directory                                           

ioctl[SIOCSIWSCAN]: Device or resource busy                                                  

Failed to initiate AP scan.                                                                  

Associated with 00:1f:c6:5c:3f:cd                                                            

Trying to associate with 00:1f:c6:5c:3f:cd (SSID='delaney' freq=2462 MHz)                    

CTRL-EVENT-DISCONNECTED bssid=00:1f:c6:5c:3f:cd reason=0                                     

ioctl[SIOCSIWENCODEEXT]: No such file or directory

Associated with 00:1f:c6:5c:3f:cd

```

here, it gets caught in an endless loop.  It needs to complete its tasks and stop.  In a separate bash tab,

```

idella@genny /usr/src/linux-2.6.31-gentoo-r6 $ sudo dhclient wlan0

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/00:11:95:e9:b2:b7

Sending on   LPF/wlan0/00:11:95:e9:b2:b7

Sending on   Socket/fallback            

DHCPREQUEST on wlan0 to 255.255.255.255 port 67

DHCPREQUEST on wlan0 to 255.255.255.255 port 67

DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6

DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10

DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15

receive_packet failed on wlan0: Network is down

DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14

send_packet: Network is down

DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 12

send_packet: Network is down

DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4

No DHCPOFFERS received.

Trying recorded lease 192.168.0.9

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.

--- 192.168.0.1 ping statistics ---

1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

No working leases in persistent database - sleeping.

idella@genny ~ $ sudo /etc/init.d/net.wlan0 restart

 * Bringing down interface wlan0

 *   Stopping dhclient on wlan0 ...                                                    [ ok ]

 * Bringing up interface wlan0

 *   /etc/conf.d/wireless is deprecated

 *   Please put all settings into /etc/conf.d/net

 *   Configuring wireless network for wlan0

 *   Connecting to "delaney" in managed mode (WEP Disabled) ...                        [ !! ]

 *   Failed to configure wireless for wlan0

 * ERROR: net.wlan0 failed to start

```

This time it doesn't help.  Fails all round.  What is wrong?  It looks to me the kernel isn't quite right.

Can't ignore this

ioctl[SIOCSIWENCODEEXT]: No such file or directory 

what it it???

ok, an edit.  I adjusted /etc/conf.d/net to

```

dns_domain_lo=homenetwork

config_wlan0=("dhcp")

config_eth0=("dhcp")

bridge_virbr0="eth0"

config_virbr0=("dhcp")

#config_eth0=("null")

##config_eth0=( "dhcp" )

#bridge_br0="eth0"

#config_br0=("dhcp")

#

#config_eth0=("null")

# 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="-Dmadwifi"

wpa_supplicant_wlan0="ath5k"

iwconfig_wlan0="mode managed"

```

The madwifi driver is actually ath_pci.  The kernel provides an atheros driver ath5k.  They both in fact work.  the line

wpa_supplicant_wlan0="-Dmadwifi"

puzzles me.  -Dmadwifi must be some generis term that refers to atheros drivers, 

so I replaced it for row with  the actual driver from the kernel ath5k.  This ath5k is employed by suse and works properly.

```

idella@genny /usr/src/linux-2.6.31-gentoo-r6 $ sudo ifconfig eth0 down

idella@genny ~ $ sudo wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf  [repeat end still ends in an endless loop]

idella@genny /usr/src/linux-2.6.31-gentoo-r6 $ sudo dhclient wlan0

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/00:11:95:e9:b2:b7

Sending on   LPF/wlan0/00:11:95:e9:b2:b7

Sending on   Socket/fallback

DHCPREQUEST on wlan0 to 255.255.255.255 port 67

DHCPREQUEST on wlan0 to 255.255.255.255 port 67

DHCPACK from 192.168.0.1

bound to 192.168.0.10 -- renewal in 1755 seconds.

```

so I am now connected and entering this text on wlan0

```

idella@genny /usr/src/linux-2.6.31-gentoo-r6 $ sudo ifconfig

Password:                                                   

eth0      Link encap:Ethernet  HWaddr 00:1f:c6:1a:ac:bd     

          inet addr:192.168.0.11  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::21f:c6ff:fe1a:acbd/64 Scope:Link             

          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1     

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

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

          collisions:0 txqueuelen:1000                                   

          RX bytes:2972301 (2.8 MiB)  TX bytes:1095697 (1.0 MiB)         

          Interrupt:28                                                   

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host     

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

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

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

          collisions:0 txqueuelen:0                             

          RX bytes:11718 (11.4 KiB)  TX bytes:11718 (11.4 KiB)  

virbr0    Link encap:Ethernet  HWaddr 00:1f:c6:1a:ac:bd  

          inet6 addr: fe80::21f:c6ff:fe1a:acbd/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 B)  TX bytes:580 (580.0 B)

virbr1    Link encap:Ethernet  HWaddr 4a:74:fe:7d:04:de

          inet addr:10.0.0.1  Bcast:10.255.255.255  Mask:255.0.0.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:11:95:e9:b2:b7

          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::211:95ff:fee9:b2b7/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:437893 (427.6 KiB)  TX bytes:177588 (173.4 KiB)

wmaster0  Link encap:UNSPEC  HWaddr 00-11-95-E9-B2-B7-6C-61-00-00-00-00-00-00-00-00

          UP RUNNING  MTU:0  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
```

This leaves idella@genny ~ $ sudo wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf

stuck in an endless loop which is wrong.  I would like to be able to exlcude eth0 from boot and have 

the gentoo scripts and wpa_supplicant bring up wlan0 in the gentoo way.

----------

## idella4

normally I edit my post rather than answer it, but this qualifies.

BTW thanks for your help 

this google search lead to this post  and and this post  and this bug  which lead to emerging updating openrc.

This lead to 

```

idella@genny /usr/src $ uname -a

Linux genny 2.6.31-gentoo-r6 #4 SMP Tue Jul 20 05:30:44 WST 2010 i686 Intel(R) Core(TM)2 Duo CPU E6550 @ 2.33GHz GenuineIntel GNU/Linux

idella@genny /usr/src $ sudo ifconfig wlan0 up

idella@genny /usr/src $ sudo iwlist wlan0 scan

wlan0     Scan completed :                    

          Cell 01 - Address: 94:44:52:81:31:E0

                    Channel:6                 

                    Frequency:2.437 GHz (Channel 6)

                    Quality=21/70  Signal level=-89 dBm

                    Encryption key:on

                    ESSID:"QSNetwork1"

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s

                              24 Mb/s; 36 Mb/s; 54 Mb/s

                    Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s

                    Mode:Master

                    Extra:tsf=0000001c9db77f2b

                    Extra: Last beacon: 452ms ago

                    IE: Unknown: 000A51534E6574776F726B31

                    IE: Unknown: 010882848B962430486C

                    IE: Unknown: 030106

                    IE: Unknown: 2A0104

                    IE: Unknown: 2F0104

                    IE: IEEE 802.11i/WPA2 Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (2) : CCMP TKIP

                        Authentication Suites (1) : PSK

                    IE: Unknown: 32040C121860

                    IE: Unknown: 2D1A7E181BFFFF000001000000000000000000000000000000000000

                    IE: Unknown: 3D1606051F00000000000000000000000000000000000000

                    IE: Unknown: DD090010180202F4050000

                    IE: WPA Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (2) : CCMP TKIP

                        Authentication Suites (1) : PSK

                    IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00

                    IE: Unknown: DD1E00904C337E181BFFFF000001000000000000000000000000000000000000

                    IE: Unknown: DD1A00904C3406051F00000000000000000000000000000000000000

idella@genny /usr/src $ sudo ifconfig                                                          

Password:                                                                                      

eth0      Link encap:Ethernet  HWaddr 00:1f:c6:1a:ac:bd                                        

          inet addr:192.168.0.19  Bcast:192.168.0.255  Mask:255.255.255.0                      

          inet6 addr: fe80::21f:c6ff:fe1a:acbd/64 Scope:Link                                   

          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1                           

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

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

          collisions:0 txqueuelen:1000                                                         

          RX bytes:804355 (785.5 KiB)  TX bytes:230990 (225.5 KiB)                             

          Interrupt:28 Base address:0x8000                                                     

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host     

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

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

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

          collisions:0 txqueuelen:0                            

          RX bytes:2821 (2.7 KiB)  TX bytes:2821 (2.7 KiB)     

virbr0    Link encap:Ethernet  HWaddr 00:1f:c6:1a:ac:bd  

          inet6 addr: fe80::21f:c6ff:fe1a:acbd/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:0                           

          RX bytes:0 (0.0 B)  TX bytes:580 (580.0 B)          

virbr1    Link encap:Ethernet  HWaddr de:3e:4a:12:81:12  

          inet addr:10.0.0.1  Bcast:10.255.255.255  Mask:255.0.0.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1      

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

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

          collisions:0 txqueuelen:0                               

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)                  

wlan0     Link encap:Ethernet  HWaddr 00:11:95:e9:b2:b7  

          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::211:95ff:fee9:b2b7/64 Scope:Link             

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1             

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

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

          collisions:0 txqueuelen:1000                                   

          RX bytes:1907857 (1.8 MiB)  TX bytes:787583 (769.1 KiB)        

wmaster0  Link encap:UNSPEC  HWaddr 00-11-95-E9-B2-B7-6C-61-00-00-00-00-00-00-00-00  

          UP RUNNING  MTU:0  Metric:1                                                

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

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

          collisions:0 txqueuelen:1000                                               

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B) 

```

In other words, in the gentoo way, I solved it.

----------

