# wpa_supplicant - HOWTO?

## indietrash

how do you actually use wpa_supplicant?

I have emerged it and edited /etc/wpa_supplicant/wpa_supplicant.conf like so:

```
# 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=wheel

# Let wpa_supplicant take care of scanning and AP selection

ap_scan=1

network={

   ssid="Kaninslakt"

   #psk="mypassphrase

   psk=mypassphrase

}

network={

  ssid="HiN"

  key_mgmt=NONE

}
```

and /etc/conf.d/net like so:

```
wpa_supplicant_wlan0="-Diwlagn"
```

but what now? how do I use this?

----------

## noice

you have to configure /etc/conf.d/net..

it's mine: (i don't use dhcp)

```
config_wlan0=( "192.168.1.7 netmask 255.255.255.0" )

routes_wlan0=( "default via 192.168.1.1" )

modules_wlan0=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"

```

and

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

----------

## d2_racing

For a dhcp connection :

```

#WPA_SUPPLICANT

modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"

config_wlan0=( "dhcp" )

```

----------

## pappy_mcfae

wpa_supplicant_wlan0="-Diwlagn"is incorrect. There is only one way to setup wpa_supplicant in /etc/conf.d/net: 

```
wpa_supplicant_wlan0="-Dwext"
```

. 

Any other interface declaration will fail!

Blessed be!

Pappy

----------

## indietrash

 *d2_racing wrote:*   

> For a dhcp connection :
> 
> ```
> 
> #WPA_SUPPLICANT
> ...

 

where does this go? in /etc/conf.d/net? and how do I use any of it? as in - how do I proceed to get my wlan0 interface on net?

----------

## bonzai.it

 *indietrash wrote:*   

> where does this go? in /etc/conf.d/net? and how do I use any of it? as in - how do I proceed to get my wlan0 interface on net?

 

Have yoo looked at this http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=4? It explains everything...

But if you use a DE my advice is networkmanager http://www.gentoo-wiki.info/NetworkManager: it's so handy.

----------

## indietrash

that doesn't really explain anything. it's a horrible document.

I don't use a desktop environment, but Network Manager is desktop environment independent.. I absolutely despise Network Manager. it has never given me anything but trouble. I'll give it a go though, and see if it serves me better now than it has done in the past.

----------

## bloedie

Hi.

Did you tried out the package 

wireless-tools

http://en.gentoo-wiki.com/wiki/Wireless_Networking

I like this very much.

Cu.

Bloedie

----------

## indietrash

wireless-tools don't do wpa.

----------

## noice

 *indietrash wrote:*   

>  *d2_racing wrote:*   For a dhcp connection :
> 
> ```
> 
> #WPA_SUPPLICANT
> ...

 

```
dhcpcd wlan0
```

----------

## bonzai.it

 *indietrash wrote:*   

> where does this go? in /etc/conf.d/net? and how do I use any of it? as in - how do I proceed to get my wlan0 interface on net?

 

As stated in the orrible document   :Very Happy:  you should add some general config info in /etc/init,d/net as those d2_racing provide you then set specific ESSID settings in /etc/wpa_supplicant/wpa_supplicant.conf.

 *indietrash wrote:*   

> 
> 
> ```
> network={
> 
> ...

 

This should work with WPA

----------

## d2_racing

Before we do the setup, we should check if his wireless card can find something  :Razz: 

```

# ifconfig -a

# iwconfig

# iwlist scan

```

----------

## pigeon768

```
pigeon@eee ~ $ 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 :]!).

pigeon@eee ~ $ sudo grep -v psk /etc/wpa_supplicant/wpa_supplicant.conf|grep -v \#

network={

   ssid="leave_me_alone"

   key_mgmt=WPA-PSK

   priority=10

}

network={

   key_mgmt=NONE

   priority=-9999999

}

pigeon@eee ~ $ 
```

 There is, of course, a 'psk=<64 character hex passphrase>' line, but I chose not to share it. As you can see, my /etc/conf.d/net file is completely blank. You don't need it if you're using dhcp to get an ip address. You just need to ensure that /etc/init.d/net.wlan0 exists and is a symlink to /etc/init.d/net.lo

Note that you will either have: 

```
psk="up to 63 character [a-zA-Z0-9] passphrase"

or

psk=64 character [0-9a-fA-F] passphrase
```

 Note the quotes.

----------

## d2_racing

Are you sure that you don't need to tell net.lo that you actually use wpa_supplicant instead of iwconfig ?

----------

## sera

 *d2_racing wrote:*   

> Are you sure that you don't need to tell net.lo that you actually use wpa_supplicant instead of iwconfig ?

 

If you do not install net-wireless/wireless-tools this might just work. Maybe the default order changed as well but I have no baselayout1 system with wlan anymore to test this.

----------

## d2_racing

Ok, but the best way is to actually configure it inside /etc/conf.d/net instead of hoping that the script will handle it.

----------

## sera

 *d2_racing wrote:*   

> Ok, but the best way is to actually configure it inside /etc/conf.d/net instead of hoping that the script will handle it.

 

We have seen many examples where an old "more configured" xorg.conf or hal policy broke things. I tend to only edit config files if necessary and only by the minimum required to get things working. I guess everyone has to decide this on his own.

----------

## pigeon768

 *sera wrote:*   

>  *d2_racing wrote:*   Are you sure that you don't need to tell net.lo that you actually use wpa_supplicant instead of iwconfig ? If you do not install net-wireless/wireless-tools this might just work. Maybe the default order changed as well but I have no baselayout1 system with wlan anymore to test this.

  

```
pigeon@eee ~ $ eix wireless-tools;cat /etc/conf.d/net;sudo ifconfig

[I] net-wireless/wireless-tools

     Available versions:  29 [M](~)30_pre6 [M](~)30_pre7 [M](~)30_pre8 {linguas_cs linguas_fr multicall nls}

     Installed versions:  29(12:39:18 10/11/09)(nls -multicall)

     Homepage:            http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html

     Description:         A collection of tools to configure IEEE 802.11 wireless LAN cards

# 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 :]!).

eth0      Link encap:Ethernet  HWaddr 00:23:54:45:57:85  

          UP BROADCAST 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:1

          collisions:0 txqueuelen:1000 

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

          Interrupt:27 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

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

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

          collisions:0 txqueuelen:0 

          RX bytes:1111864 (1.0 MiB)  TX bytes:1111864 (1.0 MiB)

ra0       Link encap:Ethernet  HWaddr 00:22:43:25:a3:fb  

          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:2739010260 (2.5 GiB)  TX bytes:261753746 (249.6 MiB)

          Interrupt:19 

pigeon@eee ~ $ 
```

 You do not need /etc/conf.d/net even if wireless-tools is installed. If you have installed wpa_supplicant, openrc assumes you intend to use it. And yes, I'm sure, because that's how my system is set up. Note that I'm using baselayout-2. I have no idea if the same setup would work in baselayout-1, but I'd be surprised if it didn't. I don't ever remember having to configure /etc/conf.d/net except for systems with a static IPs.

indietrash - does it work? If it doesn't, what error message does it give?

----------

## sera

With baselayout2 /etc/conf.d/net together with /etc/init.d/net.lo shouldn't be used anymore as they both got deprecated with the newest openrc release. Also the now deprecated net.lo script for baselayout2 differs from the one for baselayout1.

The most complete resource for new style networking I've seen so far is located at http://www.gentoo-quebec.org/wiki/index.php/500-Entretien:Migration_vers_openrc_0.5.x_Gentoo It's in French so.

----------

## pappy_mcfae

You can find the english version here. I wrote it, Gentoo Quebec translated and edited it.

Blessed be!

Pappy

----------

## sera

 *pappy_mcfae wrote:*   

> You can find the english version here. I wrote it, Gentoo Quebec translated and edited it.
> 
> Blessed be!
> 
> Pappy

 

This thread contains a lot of things which are wrong or just badly formulated. Also it is missing a few things and splits the needed info to get a grasp of the concept over the hole thread.

Better use a translatinon by google of the document at gentoo-quebec.

----------

## d2_racing

And if the translation is not great, I can help you with that  :Razz: 

----------

