# i have been away for a decade, what is wpa_supplicant?

## pwhitt

hi guys...

i'm getting my old laptop getto-ified, and in the time i've been away from the glory that is gentoo, wifi has become ubiquitous and for whatever ungodly reason it seems that the gentoo community is using some thing called wpa_supplicant to set up the wireless.

i have seen a million different mentions of wpa_supplicant (that's a hideous thing to call it, btw) but i have not found a simple primer for idiots like me.  i'm coming at this without even having my hardware setup yet.

i've got a broadcom DW1501 wireless half-mini in a dell e6410.  when i finally get the kernel to see it, and get it to start on bootup, i'm going to want to get an ip address via dhcp from my home router using a simple passphrase.

is there a walkthrough for a guy like me?

----------

## NeddySeagoon

pwhitt,

Its in the wireless section of the Gentoo Handbook.

First, you need the kernel driver for your DW1501.

----------

## pwhitt

neddyseagoon!  i recognize your login from so many past posts that helped me out.  wow!  thanks for sticking with it  :Smile: 

i thought i'd throw this question out too even without the driver.  i'm really looking for more of a "what is wpa_supplicant?" and an explanation of what it all does now.

i walked through that doc while running the latest minimal install image booted from USB.  it didn't quite work for me, but let's get to that when i'm ready.  hopefully in the near future i'll be posting these questions from linux, not having to boot back to windows, use my phone, or tablet.

you have no idea what a welcome sight your username is!

----------

## NeddySeagoon

pwhitt,

wpa_supplicant deals with finding a suitable wireless access point, associating and authenticating with it.

It does all the extra things that wifi needs over wired ethernet, so the standard wired tools just work.

wpa_supplicant supports lots of different crypto and authentication schemes.  Its predecessor, wireless-tools will only support WEP encryption.

WEP is as bad an no encryption.

----------

## pwhitt

hello neddy!

i'm actually posting this from within links, and with no cable dangling from the back of my machine.  so i did something right - thanks for help getting this far!

now, help me understand this - i have followed the linked guide above, several times...  but i have to do something stupid to get online via wireless.  what's that, you wonder?

i run wpa_supplicant, and it barfs into my terminal, then just sits there.  it seemd like it was waiting for something - i don't know what.  i called wpa_supplicant with the arguments pointing to the conf file i made per the guide...  which calls for dhcp on my wan, so all should be OK...  right?

if i suspend wpa_supplicant, then bg it, then run dhcpcd wlp3s0b1 (or whatever my card is) guess what?

i get an address and everything is great.

so - what part of the guide am i not seeing?  i swear i've gone through this a few times, i'm obviously missing something.

on a previous install, i went through some network setup that was supposed to start my wireless on bootup, but that didn't work either...  i know i still need to add networking to my default runlevel, but what do i need to do so that when wpa_supplicant starts, it runs dhcpcd on my interface?

i've checked the conf file - it's spelled out, dhcp, and i'm using the name from ifconfig -a, not wlan0 - and afterall, wpa_supplicant is able to connect when i start dhcp.

anyway - thanks for the help - this is great!

now i just need to get gpm working - or better yet, xorg and fluxbox...  all in time.

----------

## charles17

 *pwhitt wrote:*   

> so - what part of the guide am i not seeing?  i swear i've gone through this a few times, i'm obviously missing something.

 

See https://wiki.gentoo.org/wiki/Wpa_supplicant and https://wiki.archlinux.org/index.php/WPA_supplicant#Connecting_with_wpa_cli

----------

## toralf

 *Quote:*   

> i have been away for a decade, what is wpa_supplicant?

 What let me wonder since when we do have WLAN  :Very Happy: 

----------

## NeddySeagoon

pwhitt,

You don't need to run wpa_supplicant yourself.  The startup scripts will do that for you.

The order of events for WiFi is wpa_supplicant is called by the startup script, because you have net.<WiFi> in the default runlevel.

This deals with association and authentication.  The normal wired routines take over and set up the IP address, routing table, namserver and so on.

From my netbook.

```
modules="wpa_supplicant iproute2"

wpa_supplicant_wlan0="-Dnl80211" 
```

No interfaces are named as I get dhcpcd for free, whenever an unnamed interface is brought up.

```
ctrl_interface_group=0

ctrl_interface=/var/run/wpa_supplicant

ap_scan=1

# 2.4GHz band

network={

        priority=50

        key_mgmt=WPA-PSK

        mode=0

        psk="Very_Sekrit_Pass_Phrase24 "

        ssid="RadioNet24"

}

# 5.0 GHz band

network={

        priority=50

        key_mgmt=WPA-PSK

        mode=0

        psk="Very_Sekrit_Pass_Phrase5"

        ssid="RadioNet5"

}
```

```
...

lrwxrwxrwx 1 root root     6 Jan  3 11:53 net.eth0 -> net.lo

-rwxr-xr-x 1 root root 17824 Oct 25 18:51 net.lo

lrwxrwxrwx 1 root root     6 Jan  3 11:54 net.usb0 -> net.lo

lrwxrwxrwx 1 root root     6 Jul  4  2015 net.wlan0 -> net.lo

...

```

When I do 

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

the system runs wpa_supplicant, then dhcpcd and gets me a wireless link.

Neither dhcpcd, nor  wpa_supplicant are in any runlevel. 

```
$ ls -R /etc/runlevels/

/etc/runlevels/:

battery  boot  default  nonetwork  shutdown  single  sysinit

/etc/runlevels/battery:

acpid  alsasound  dbus  gpm  local  metalog  ntp-client  ntpd  sshd  udev-postmount  xdm

/etc/runlevels/boot:

binfmt       fsck               hwclock     loopback  net.lo  swap       termencoding    urandom

bootmisc     hibernate-cleanup  keymaps     modules   procfs  swapfiles  tmpfiles.setup

consolefont  hostname           localmount  mtab      root    sysctl     tmpfilesd.boot

/etc/runlevels/default:

acpid  alsasound  dbus  gpm  local  metalog  ntp-client  ntpd  sshd

/etc/runlevels/nonetwork:

local

/etc/runlevels/shutdown:

killprocs  mount-ro  savecache

/etc/runlevels/single:

/etc/runlevels/sysinit:

devfs  dmesg  sysfs  tmpfiles.dev  tmpfilesd.sysinit  udev  udev-mount  udev-trigger

```

----------

## UberLord

 *NeddySeagoon wrote:*   

> 
> 
> ```
> modules="wpa_supplicant iproute2"
> 
> ...

 

Do you even need that?

I'm pretty sure I made wpa_supplicant a default module for wireless interfaces and iproute2 the default on Linux (but this may I have changed as I've not used netifrc for a really long time ...)

For sure you don't need to tell wpa_supplicant which driver to use as it's defaulted to nl80211 on Linux for years now ....

BTW, work is in progress to get wpa_supplicant to auto start as well (by itself now that the dhcpcd hook is gone)

Here is the patch I submitted upstream a while ago:

http://lists.infradead.org/pipermail/hostap/2016-February/034923.html

----------

## NeddySeagoon

UberLord,

That's been there a long time now. Since early 2009 at least.

I may have tweaked the -D entry more recently though.

I think you are right about iproute2 being the default but over the years I've learned that defaults get changed and I don't always notice until its too late.

Then something breaks.

----------

## pwhitt

so for the record, i'm getting on my network on boot now, but not in a manner that compares nicely with anything i've seen here.

i actually had to comment out every line in my /etc/conf.d/net.  if i did not, i got a message about Dn180211 being an unknown driver.  odd, considering that the commandline that worked for me included the -Dn180211 argument.

in either case, i'm happily online w/ my laptop, but am not certain how.  i'd like to add that following the many guides google led me to did not solve my problem, i just happened to luck into some set of configs and happenstance that did...  i'd still love to see a comprehensive set of documentation that explains how a novice would deal with this.  all things considered, i am certainly not a novice, and i found nothing that led me through the steps to get me wirelessly online - it was luck.

----------

## charles17

 *pwhitt wrote:*   

> so for the record, i'm getting on my network on boot now, but not in a manner that compares nicely with anything i've seen here.
> 
> i actually had to comment out every line in my /etc/conf.d/net.  if i did not, i got a message about Dn180211 being an unknown driver.  odd, considering that the commandline that worked for me included the -Dn180211 argument.

 -Dnl80211 (lower case L)

----------

## pwhitt

i can't believe i did that...

i know no one will believe it, but it's an L in my configs.  i was jumping through hoops trying to transcribe things to and from my tablet - which is bad enough because it autocorrects everything.  so screwing it up in this post isn't surprising.

anyway - on my laptop i actually copied the driver argument from some help text or a man page - can't remember what, but it looked ambiguous enough that even changed it back and forth to see.

in the end, my conf.d/net file is literally, completely commented out.  it may as well be blank.

----------

