# wireless networking where to start?

## ALF__

Hello!

ive been using gentoo for many years and i always seem to get things working either by google or some fiddling,

Something i dont seem to get is wireless networking. i have no idea were to start, and every guide seem to point i different directions.

I have the wireless card installed, and it shows up properly with iwconfig as wlp2s14f2u1.

Now i have tried with wpa_supplicant to get things to work, but there seem to be 10 config files that should work together, every guide says different things, and i have no idea were to start.

wpa_gui dont work for some odd reason, i just get an empty window, probably because i dont use kde, i use fluxbox.

i have downloaded both wpa_Supplicant, wicd and wireless-tools.

What should i do, and where do i start?

----------

## khayyam

 *ALF__ wrote:*   

> What should i do, and where do i start?

 

ALF__ ... well, there are basically three or four things involved, the kernel driver and kernel 802.11 networking layer, openrc/netifrc (or some other tool that manages starting and stoping the connection), wpa_supplicant as the 802.11 supplication client, and (possibly) a dhcp client for aquiring an IP address.

Here are some configuration examples and checks ... some of these are dependent on what card is in use, and what your use case is ... without further details I can only guess ...

Assuming the driver for the wireless card is in kernel, and enabled, the following is an example of whats required for the 802.11 networking (NL80211 ... 'netlink') 

```
# egrep '(WEXT|(MAC|CFG|NL)80211)' /usr/src/linux/.config

CONFIG_WEXT_CORE=y

CONFIG_WEXT_PROC=y

CONFIG_CFG80211=m

# CONFIG_NL80211_TESTMODE is not set

# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set

# CONFIG_CFG80211_REG_DEBUG is not set

CONFIG_CFG80211_DEFAULT_PS=y

# CONFIG_CFG80211_INTERNAL_REGDB is not set

CONFIG_CFG80211_WEXT=y

CONFIG_MAC80211=m

CONFIG_MAC80211_HAS_RC=y

CONFIG_MAC80211_RC_MINSTREL=y

CONFIG_MAC80211_RC_MINSTREL_HT=y

CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y

CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"

# CONFIG_MAC80211_MESH is not set

CONFIG_MAC80211_LEDS=y

# CONFIG_MAC80211_MESSAGE_TRACING is not set

# CONFIG_MAC80211_DEBUG_MENU is not set

# CONFIG_MAC80211_HWSIM is not set
```

The above is for an Atheros chipset, it should however be fairly similar for others drivers using NL80211. The only option here that isn't generally enabled (if, say, you're using genkernel) is CFG80211_WEXT (the WEXT compatibility layer) this should be enabled if you want/need to use tools (like those from the wireless-tools package) that use the old WEXT (wireless extentions).

Next, openrc/netifrc is configure via the files in /etc/conf.d and /etc/init.d

/etc/conf.d/net

```
modules_wlp2s14f2u1="wpa_supplicant dhcpcd"

wpa_supplicant_wlp2s14f2u1="-Dnl80211 -qq"

config_wlp2s14f2u1="dhcp"

#enable_ipv6_wlp2s14f2u1="false"
```

That should be all that's needed ... but other options such as dns, or dhcpcd, configuration can be added.

A typical wpa_supplicant.conf will look something like the following:

/etc/wpa_supplicant/wpa_supplicant.conf

```
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel

update_config=1

network={

    ssid="AP_NAME" # the AP's 'ESSID'

    proto=RSN # or WPA ... dependent on what the AP supports

    key_mgmt=WPA-PSK

    psk="your psk here"

}
```

Again, this is the basics for wpa, for 802.1x supplication, or wep, then other/differing configuration is required.

You can find out what the AP supports with the following:

```
# awk '{RS="Cell"}/AP_NAME/' <(iwlist wlp2s14f2u1 scan)
```

Link the interface to net.lo

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

Once the above is in place then it should be possible to start the service ... you might also add it to the default runlevel to have it start at boot.

```
# /etc/init.d/net.wlp2s14f2u1 start

# rc-update add net.wlp2s14f2u1 default

# wpa_cli status
```

If the wpa supplication with the AP fails for some reason then wpa_supplicant can be made to provide a debug (-d) log ('-dd' or '-ddd' for more verbose logging). Note, comment the above line and replace it with the following:

/etc/conf.d/net

```
wpa_supplicant_wlp2s14f2u1="-Dnl80211 -d -f /var/log/wpa_supplicant.log"
```

If you have issues then pastbin the log and post the output of of the above scan ... if you have any further questions then just ask.

best ... khay

----------

## druggo

what init system are you using ? openrc or systemd ?

----------

## khayyam

 *druggo wrote:*   

> what init system are you using ? openrc or systemd ?

 

druggo ... by this thread it would seem openrc.

best ... khay

----------

## ALF__

Hi guys.

Thanks for all your help. 

I managed to get this to work.

It seems like i had everything right, but it wasnt possible to start wicd by it self without adding it to default runtime. So i added it to default, and then wicd-curses worked, and with that it worked straight away.

If you guys could just clarify something for me. Is wpa_supplicant needed for wicd to work? or are they just overlapping each other?

Firstly i thought that wpa_supplicant was some driver for the encryption? If it is not, i could just remove it?

----------

## NeddySeagoon

ALF__,

wlp2s14f2u1 tells that your WiFi is USB.

In addition to the things khayyam listed, USB devices often but not always need firmware.

lsusb will list the Vendor and Device IDs of your chipset,  that info will help us to help you.

----------

## khayyam

 *ALF__ wrote:*   

> If you guys could just clarify something for me. Is wpa_supplicant needed for wicd to work? or are they just overlapping each other?

 

ALF__ ... wpa_supplicant is required for any WPA supplication, so any network tool (like wicd) that provides wpa will use wpa_supplicant.

 *ALF__ wrote:*   

> Firstly i thought that wpa_supplicant was some driver for the encryption? If it is not, i could just remove it?

 

No, wpa_supplicant is a WPA and 802.1x supplicant, there is no other method of wpa supplication, so you need it.

best ... khay

----------

## cwr

FWIW, a command line invocation of wpa_supplicant is:

```

#!/bin/bash

# Connect using wpa_supplicant running in a terminal.

date

ifconfig eth0 down

(sleep 10 && dhclient wlan0) &

wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -f/var/log/wpa.log -dd -t

# eof

```

(The script doesn't return - it stays running until you hit ^C or close the terminal.)

A typical conf script woulld be:

```

# /etc/wpa_supplicant/wpa_supplicant.conf

# The below line must 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

# Allow tools to update configuration.

#update_config=1

# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers

# Use wpa_passphrase to produce the hex string.

network={

  ssid="COINS"

  psk="wildebeest thunder across the lonely tennis-court"

  #psk=ac2f12127f77a7db8947d31b7864726e039c20965efe0b11270be86a96a09827

  # The higher the priority the sooner we are matched

  priority=5

}

```

----------

## ALF__

 *khayyam wrote:*   

>  *ALF__ wrote:*   If you guys could just clarify something for me. Is wpa_supplicant needed for wicd to work? or are they just overlapping each other? 
> 
> ALF__ ... wpa_supplicant is required for any WPA supplication, so any network tool (like wicd) that provides wpa will use wpa_supplicant.
> 
>  *ALF__ wrote:*   Firstly i thought that wpa_supplicant was some driver for the encryption? If it is not, i could just remove it? 
> ...

 

Hello! Okey, thank you, then i leave it be  :Smile: 

It works fine, and wicd-curses works like a charm.

As always, thank you guys for all your help. This time i was more close to the solution than i thought   :Shocked: 

----------

