You are not logged in.

#1 2012-03-14 20:24:19

OakRaider4Life
Member
Registered: 2012-02-08
Posts: 98

netcfg on WPA2

I'm trying to connect to a WPA2-PSK AES connection via netcfg, which I would prefer to function as the network daemon, but when connecting to the network it fails out with, "DHCP IP lease attempt failed"

This fail out happens not only with netcfg running as a daemon, but also when I attempt to execute "netcfg [profile]" as well as executing "netcfg2 [profile]"

Below I've included the network profile I'm attempting to load from /etc/network.d. My ESSID is a simple all letters string with mixed upper and lower case letters and my key is a simple 11 letter string with no special characters.

Thank you in advance for any help!

CONNECTION='wireless'
DESCRIPTION='Home network'
INTERFACE='wlan0'
SECURITY='wpa'
ESSID='[ESSID]'
KEY='[key]'
IP='dhcp'

Offline

#2 2012-03-14 21:39:03

doragasu
Member
Registered: 2012-03-03
Posts: 152

Re: netcfg on WPA2

How did you generate the key?

Offline

#3 2012-03-14 23:53:40

David Batson
Member
Registered: 2011-10-13
Posts: 640

Re: netcfg on WPA2

I use wpa_supplicant with netcfg.  See following for more info.  To generate the key, you need to use wpa_passphrase as described in the link.

https://wiki.archlinux.org/index.php/WPA_supplicant

Offline

#4 2012-03-15 10:05:26

Alber
Member
From: Spain - España
Registered: 2011-11-11
Posts: 227

Re: netcfg on WPA2

I'm using WPA2-Personal. My files are the like the next:

wpa_supplicant.conf:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
network={
       ssid="mywireless"
       proto=RSN
       key_mgmt=WPA-PSK
       pairwise=CCMP TKIP
       group=CCMP TKIP
       psk=#######
}

And then use wireless-wpa-config (in /etc/network.d/examples/) as base to create a file to use with netcfg in /etc/network.d/

HomeNetwork
CONNECTION='wireless'
DESCRIPTION='A wpa_supplicant configuration based wireless connection'
INTERFACE='wlan0'
SECURITY='wpa-config'
WPA_CONF='/etc/wpa_supplicant.conf'
IP='dhcp'

And finally use netcfg in terminal
netcfg HomeNetwork


I think all is in the archwiki.

Last edited by Alber (2012-03-15 10:09:21)


Because not all of us are native English speakers, try no to use slang or abbreviations, thank you.

Offline

#5 2012-03-15 10:28:58

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: netcfg on WPA2

Can you establish your WiFi connection manually? Does it work properly then?


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#6 2012-03-16 17:23:27

OakRaider4Life
Member
Registered: 2012-02-08
Posts: 98

Re: netcfg on WPA2

So I've managed to narrow down my problem. My issue is that dhcpcd was not running at the time I was attempting to connect. Simply starting dhcpcd and then attempting to connect yields success. To answer all the questions about my wpa_supplicant.conf, I did successfully connect to the network before having this problem with the default network daemon using wpa_supplicant (although I had to manually activate dhcpcd each time) and did attempt to connect through net cfg with a wpa_supplicant based profile. Now that I identified this problem however, I cannot get dhcpcd to start at boot, even when adding it to my daemons array (and yes, I added it to the daemons array prior to net-profiles).

Offline

#7 2012-03-16 17:50:28

endeavor
Member
Registered: 2011-10-28
Posts: 9

Re: netcfg on WPA2

OakRaider4Life wrote:

So I've managed to narrow down my problem. My issue is that dhcpcd was not running at the time I was attempting to connect. Simply starting dhcpcd and then attempting to connect yields success. To answer all the questions about my wpa_supplicant.conf, I did successfully connect to the network before having this problem with the default network daemon using wpa_supplicant (although I had to manually activate dhcpcd each time) and did attempt to connect through net cfg with a wpa_supplicant based profile. Now that I identified this problem however, I cannot get dhcpcd to start at boot, even when adding it to my daemons array (and yes, I added it to the daemons array prior to net-profiles).

I have similar problems from time to time. What I normally do is set:

IP='static'

I allow netcfg to connect to wireless, and then follow it up with "dhcpcd wlan0" afterwards. Hopefully this works for you.

Offline

#8 2012-03-16 17:51:51

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: netcfg on WPA2

If you use net-auto-wireless, then you shouldn't need to start dhcpcd yourself (I don't have it in my daemons). Instead, it gets started by that daemon (eventually, it's a few scripts into the hierarchy) if needed - if specified in the network profile.

See here: https://wiki.archlinux.org/index.php/Ne … o-wireless

For example, here's my daemons array:

DAEMONS=(syslog-ng acpid dbus sensors @net-auto-wireless @net-auto-wired @netfs @laptop-mode @cupsd @crond @alsa @adsuck

"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#9 2012-03-16 18:03:31

Alber
Member
From: Spain - España
Registered: 2011-11-11
Posts: 227

Re: netcfg on WPA2

Before netcfg I used:
          wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf -d
         dhcpcd wlan0
As you tell. But now just:
        netcfg HomeNetwork

I remember I had problems chosing one from /etc/network.d/examples
     wireless-wpa don't work, I needed wireless-wpa-config.

But your problem could be another. I don't know.

Last edited by Alber (2012-03-16 18:04:51)


Because not all of us are native English speakers, try no to use slang or abbreviations, thank you.

Offline

#10 2012-03-16 18:54:31

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: netcfg on WPA2

I have to say I found it far easier as well to point netcfg to wpa_supplicant rather than having the encryption part handled by netcfg itself. That also allows for more flexibility when you change your key, and it allows for easier debugging (where you'd want to authenticate, then acquire an IP).


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#11 2012-03-16 19:10:36

OakRaider4Life
Member
Registered: 2012-02-08
Posts: 98

Re: netcfg on WPA2

skanky wrote:

If you use net-auto-wireless, then you shouldn't need to start dhcpcd yourself (I don't have it in my daemons). Instead, it gets started by that daemon (eventually, it's a few scripts into the hierarchy) if needed - if specified in the network profile.

See here: https://wiki.archlinux.org/index.php/Ne … o-wireless

For example, here's my daemons array:

DAEMONS=(syslog-ng acpid dbus sensors @net-auto-wireless @net-auto-wired @netfs @laptop-mode @cupsd @crond @alsa @adsuck

Your advice raised an interesting point. I tried starting only net-auto-wireless and removing the net-profiles daemon as you suggested, but dhcpcd would still not start. So I checked out the rc.d script for went and checked out the rc.d script for net-auto-wireless (included below) and what I found was that it doesn't start dhcpcd (Don't know whether that particular script is supposed to, but all I know is that neither netcfg or network automatically starts dhcp for me). So I added dhcpcd to the startup part of the script (where it's commented out below), and this has been so far my only working solution for starting dhcpcd at boot. Not ideal, but does the job.

. /etc/rc.conf
. /etc/rc.d/functions
. /usr/lib/network/globals
. /etc/conf.d/netcfg

if [[ ! -x /usr/sbin/wpa_actiond ]]; then
   echo "Please install 'wpa_actiond' to use net-auto-wireless"
   exit 1
fi

if [ -z "${WIRELESS_INTERFACE}" ]; then
    echo "No interface name set. Add to /etc/conf.d/netcfg a line"
    echo "  WIRELESS_INTERFACE=\"your_interface\""
    exit 1
fi

case "$1" in
    start)
        if ! ck_daemon net-auto-wireless; then
            exit_stderr "net-auto-wireless has already been started: try \"/etc/rc.d/net-auto-wireless restart\""
        fi
        # Ensure any device renaming has occurred as intended
        for daemon in "${DAEMONS[@]}"; do
            if [[ "$daemon" = "${daemon#!}" && "$daemon" = "net-rename" ]]; then
                if ck_daemon net-rename; then
                    /etc/rc.d/net-rename start
                fi
            fi
        done
        #dhcpcd
        stat_busy "Starting netcfg auto-wireless mode for interface ${WIRELESS_INTERFACE}"
        /usr/bin/netcfg-wpa_actiond "${WIRELESS_INTERFACE}" >/dev/null
        if [ $? -eq 0 ]; then
            add_daemon net-auto-wireless
            stat_done
        else
            stat_fail
        fi
        ;;
    stop)
        if ! ck_daemon net-auto-wireless; then
            stat_busy "Stopping netcfg auto-wireless mode for interface ${WIRELESS_INTERFACE}"
            /usr/bin/netcfg-wpa_actiond stop "${WIRELESS_INTERFACE}" >/dev/null
            if [ $? -eq 0 ]; then
                rm_daemon net-auto-wireless
                stat_done
            else
                stat_fail
            fi
        fi
        ;;
    restart)
        "$0" stop
        sleep 1
        "$0" start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac
exit 0
# vim: ft=sh ts=4 et sw=4:

Offline

#12 2012-03-16 19:13:12

OakRaider4Life
Member
Registered: 2012-02-08
Posts: 98

Re: netcfg on WPA2

.:B:. wrote:

I have to say I found it far easier as well to point netcfg to wpa_supplicant rather than having the encryption part handled by netcfg itself. That also allows for more flexibility when you change your key, and it allows for easier debugging (where you'd want to authenticate, then acquire an IP).

Authentication isn't my problem though. Leasing my IP address from the dhcp server is, and more particularly, that none of my network daemons will automatically start dhcpcd.

Offline

#13 2012-03-16 20:20:21

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: netcfg on WPA2

Well, you can pass DHCP options to netcfg as well. If it works manually, then the problem might lie with netcfg.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#14 2012-03-16 22:21:44

David Batson
Member
Registered: 2011-10-13
Posts: 640

Re: netcfg on WPA2

As an example, I have the following in /etc/rc.conf

# DHCP example
interface=eth0
address=
netmask=
gateway=

interface=wlan0
address=
netmask=
broadcast=
gateway=

as per...
https://wiki.archlinux.org/index.php/Co … at_booting

I also have the following for my wireless setup:

CONNECTION='wireless'
DESCRIPTION='A simple WPA encrypted wireless connection'
INTERFACE='wlan0'
SECURITY='wpa'
ESSID='myqwestxxxx'
KEY='{alot of letters and numbers}'
IP='dhcp' 
# Uncomment this if your ssid is hidden
#HIDDEN=yes

DHCPCD starts when needed for me.

Offline

#15 2012-03-17 20:58:26

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: netcfg on WPA2

OakRaider4Life wrote:
skanky wrote:

If you use net-auto-wireless, then you shouldn't need to start dhcpcd yourself (I don't have it in my daemons). Instead, it gets started by that daemon (eventually, it's a few scripts into the hierarchy) if needed - if specified in the network profile.

See here: https://wiki.archlinux.org/index.php/Ne … o-wireless

For example, here's my daemons array:

DAEMONS=(syslog-ng acpid dbus sensors @net-auto-wireless @net-auto-wired @netfs @laptop-mode @cupsd @crond @alsa @adsuck

Your advice raised an interesting point. I tried starting only net-auto-wireless and removing the net-profiles daemon as you suggested, but dhcpcd would still not start. So I checked out the rc.d script for went and checked out the rc.d script for net-auto-wireless (included below) and what I found was that it doesn't start dhcpcd (Don't know whether that particular script is supposed to, but all I know is that neither netcfg or network automatically starts dhcp for me). So I added dhcpcd to the startup part of the script (where it's commented out below), and this has been so far my only working solution for starting dhcpcd at boot. Not ideal, but does the job.

It's /usr/bin/netcfg-wpa_actiond-action that actually starts it, and that's called form netcfg-wpa_actiond.
The relevant line is inside an if statement - so you may be able to track down the issue by tracing the relevant parameters.

However, using net-auto-wirless starts dhcpcd when I use it, so there must be something different in the set-ups.
I'm using the wireless-wpa-configsection profile definition in my netcfg set-up. When I set my machine up, only configsection was supported (I think), so there may be some issues using non configsection profiles. It's probably worth a try at the very least.

Edit: just realised David Batson isn't using configsection either, so my last bit is probably a red herring.

Last edited by skanky (2012-03-17 21:00:07)


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

Board footer

Powered by FluxBB