LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-14-2006, 10:20 AM   #1
2Gnu
Senior Member
 
Registered: Jan 2002
Location: Southern California
Distribution: Slackware
Posts: 1,880

Rep: Reputation: 51
Automating WPA_Supplicant with ath0


Slackware 11.0, using the latest rc.inet1 and rc.wireless scripts.

I've set up WPA with an Atheros card, as chronicled here: http://www.linuxquestions.org/questi...d.php?t=492269

I'm trying to get the interface, ath0, to authenticate on boot but it's not happening. At present, running /etc/rc.d/rc.inet1 start (or ath0 start) manually displays the MAC address of my wired NIC (not connected) and times out. On boot, I get errors waiting for DHCD broadcast.

Running these two commands works fine:
Code:
/usr/local/bin/wpa_supplicant -B -c /etc/wpa_supplicant.conf -i ath0 -D madwifi
/sbin/dhcpcd ath0
My /etc/rc.d/rc.wireless.conf file looks like this:

Code:
case "$ADDRESS" in

*,*,*,*)

MODE="Managed"
# Added to call wpa_supplicant
WPA="y"
WPA_OPTIONS="-i ath0"
WPADRIVER="madwifi"
WPACONF=/etc/wpa_supplicant.conf

   ;;
esac
I've looked through the scripts to see how to deal with "athx" vs. "ethx" but I'm in way over my head. Any ideas, please?
 
Old 10-14-2006, 10:30 AM   #2
Fluxx
Member
 
Registered: Aug 2005
Location: Bavaria, Germany
Distribution: Slackware (Current)
Posts: 225

Rep: Reputation: 30
Because I use several wifi pcmcia cards for testing I start a netgear wg511t (atheros chip ar5212, madwifi version 0.9.2, wpa_supplicant version 0.5.5 compiled against madwifi 0.9.2) with a short script :

Code:
#!/bin/bash
/sbin/ifconfig eth0 down
killall wpa_supplicant > /dev/null 2>&1
/sbin/rmmod ath_pci
/sbin/modprobe ath_pci countrycode=0
/sbin/iwpriv ath0 mode 3
/sbin/iwpriv ath0 turbo 1
/usr/local/sbin/wpa_supplicant -iath0 -c/etc/wpa_supplicant.conf -B -Dwext
/sbin/iwconfig ath0 channel 11 essid "my_essid"
/sbin/iwconfig ath0 channel 11 mode managed
/sbin/iwconfig ath0 rts 1401 frag 1400
/sbin/ifconfig ath0 my_IP up
/sbin/route add default gateway my_router_IP
/sbin/iwconfig ath0 txpower 1 rate 108M auto
In my /etc/rc.d/rc.local I added these lines to start this script if the netgear card is inserted:

Code:
if lspci | grep Atheros > /dev/null ; then
   sh /root/wpaath &
fi
This works fine for me, the other option with /etc/rc.d/rc.wireless.conf or /etc/rc.d/rc.inet1.conf is not useful for my purpose.

Fluxx.

Last edited by Fluxx; 10-14-2006 at 10:32 AM.
 
Old 10-14-2006, 11:43 AM   #3
2Gnu
Senior Member
 
Registered: Jan 2002
Location: Southern California
Distribution: Slackware
Posts: 1,880

Original Poster
Rep: Reputation: 51
Thanks for the reply and for sharing your approach. It's a fine option if I can't get the stock scripts to work - which, I'm assuming would be helpful to other Slack users with similar configs.
 
Old 10-14-2006, 01:34 PM   #4
Fluxx
Member
 
Registered: Aug 2005
Location: Bavaria, Germany
Distribution: Slackware (Current)
Posts: 225

Rep: Reputation: 30
Now I did it in your or let me say Slackware's way with /etc/rc.d/rc.inet1.conf and /etc/rc.d/rc.wireless.conf and /etc/rc.d/rc.wireless.

At first I made rc.wireless executable with

Code:
chmod +x /etc/rc.d/rc.wireless
Then I edited the /etc/rc.d/rc.inet1.conf in this way (because I need no eth0 I deleted the eth0 options. Here my rc.inet1.conf:

Code:
# /etc/rc.d/rc.inet1.conf
#
# This file contains the configuration settings for network interfaces.
# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").

# You can configure network interfaces other than eth0,eth1... by setting
# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
# or empty, it is assumed you're configuring eth<interface>.

# Several other parameters are available, the end of this file contains a
# comprehensive set of examples.

# =============================================================================

# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

# Default gateway IP address:
GATEWAY="192.168.178.1"

# Change this to "yes" for debugging output to stdout.  Unfortunately,
# /sbin/hotplug seems to disable stdout so you'll only see debugging output
# when rc.inet1 is called directly.
DEBUG_ETH_UP="no"

## Example config information for wlan0.  Uncomment the lines you need and fill
## in your info.  (You may not need all of these for your wireless network)
IFNAME[4]="ath0"
IPADDR[4]="xxx.xxx.xxx.xxx"
NETMASK[4]="255.255.255.0"
USE_DHCP[4]=""
GATEWAY="xxx.xxx.xxx.xxx"
WLAN_WPA[4]="wpa_supplicant"
WLAN_WPADRIVER[4]="wext"
Then I edited my /etc/rc.d/rc.wireless.conf in this way:

Code:
# Wireless LAN adapter configuration
#
# Theory of operation :
#
# The script attempts to match a block of settings to the specific wireless
# card inserted, the *first* block matching the card is used.
# The address format is "hwaddr", with * as a wildcard.
# 'hwaddr' is the unique MAC address identifier of the wireless card.
# The MAC address is usually printed on the card, or can be found via ifconfig.
# Some examples here use only half of the MAC address with a wildcard to
# match a whole family of cards...
#
# All the Wireless specific configuration is done through the Wireless
# Extensions, so we will just call 'iwconfig' with the right parameters
# defined below.
# Of course, you need to have iwconfig installled on your system.
# To download iwconfig, or for more info on Wireless Extensions :
#       http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html
#
# Note : you don't need to fill all parameters, leave them blank, in most
# cases the driver will initialise itself with sane defaults values or
# automatically figure out the value... And no drivers do support all
# possible settings...
#
# -- This is a modified '/etc/pcmcia/wireless.opts' script --
# -- I added sections for Prism/GT and Atheros based cards --
# --    (supported by the prism54 and madwifi drivers)     --
# --              16/sep/2004 * Eric Hameleers             --
#

VERBOSE=1

case "$HWADDR" in

## NOTE : Comment out the following five lines to activate the samples below ...
## --------- START SECTION TO REMOVE -----------
## Pick up any Access Point, should work on most 802.11 cards
*)
    ESSID="my_essid"
    ;;
## ---------- END SECTION TO REMOVE ------------


# Here are a few examples with a few Wireless LANs supported...
# The matching is done on the first 3 bytes of the MAC address

# Multiband Atheros based 802.11a/b/g universal NIC cards
*)
    INFO="Multiband Atheros based 802.11a/b/g universal NIC"
    # ESSID (extended network name) : My Network, any
    ESSID="my_essid"
    # Operation mode : Ad-Hoc, Managed, Master, Repeater, Secondary, auto
    MODE="Managed"
    # Frequency or channel : 1, 2, 3 (channel) ; 2.422G, 2.46G (frequency)
    CHANNEL="2"
    # Bit rate : auto, 1M, 11M,54M
    RATE="auto"
    ;;
esac
My /etc/wpa_supplicant.conf:

Code:
# WPA-PSK/TKIP

ctrl_interface=/var/run/wpa_supplicant

network={
        ssid="my_essid"
        scan_ssid=1
        key_mgmt=WPA-PSK WPA-EAP
        proto=WPA RSN
        pairwise=CCMP
        group=CCMP
        psk="my_key"
}
I use WPA2, therefore the proto=WPA RSN.

ath0 is started during boot process and available after booting, wpa_supplicant is running and everything works fine.

Fluxx.
 
Old 10-15-2006, 02:53 PM   #5
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by 2Gnu
My /etc/rc.d/rc.wireless.conf file looks like this:

Code:
case "$ADDRESS" in

*,*,*,*)

MODE="Managed"
# Added to call wpa_supplicant
WPA="y"
WPA_OPTIONS="-i ath0"
WPADRIVER="madwifi"
WPACONF=/etc/wpa_supplicant.conf

   ;;
esac
Try
Code:
case "$ADDRESS" in

*,*,*,*)

MODE="Managed"
# Added to call wpa_supplicant
WPA="wpa_supplicant"
WPADRIVER="madwifi"
WPACONF=/etc/wpa_supplicant.conf

   ;;
esac
And what dies the section for your ath0 interface in /etc/rc.d/rc.inet1.conf look like?

Eric
 
Old 10-15-2006, 11:05 PM   #6
2Gnu
Senior Member
 
Registered: Jan 2002
Location: Southern California
Distribution: Slackware
Posts: 1,880

Original Poster
Rep: Reputation: 51
Here's /etc/rc.d/rc.inet1.conf after trying Fluxx's suggestions:

Code:
## Example config information for wlan0.  Uncomment the lines you need and fill
## in your info.  (You may not need all of these for your wireless network)
IFNAME[4]="ath0"
IPADDR[4]=""
NETMASK[4]="255.255.255.0"
USE_DHCP[4]="yes"
GATEWAY="192.168.1.1"
WLAN_WPA[4]="wpa_supplicant"
WLAN_WPADRIVER[4]="madwifi"
I assume I'd take out the last two lines if I modify my wireless.conf as you noted?

I'm also getting a message on boot that wpa_supplicant is already running, so it takes extra time to auth. I tried adding killall wpa_supplicant to rc.6, but that was a blind hack. Your rc.wireless script looks like it should deal with terminating wpa_supplicant if I get the conf file right. True?

Many thanks to both of you for the replies.
 
Old 10-16-2006, 03:30 AM   #7
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
True.

Also. If you use DHCP, don't set NETMASK and GATEWAY. You can indeed leave the WLAN_XXX parameters out of the rc.inet1.conf file if you add the associated XXX parameters in rc.wireless.conf.
Code:
IFNAME[4]="ath0"
IPADDR[4]=""
NETMASK[4]=""
USE_DHCP[4]="yes"
GATEWAY=""
should do it, then.

Eric
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Madwifi, ath0 not there. bleck Slackware 7 06-12-2006 01:36 AM
ath0: not found ......??? dejavu_01 Slackware 7 05-13-2006 03:58 PM
ath0 is not present icpsvt Linux - Wireless Networking 1 10-18-2004 02:24 AM
Cannot configure ath0 TheRepublican Linux - Wireless Networking 1 04-17-2004 08:08 PM
Configure ath0 -- help please!! Vincent_Vega Linux - Wireless Networking 5 02-20-2004 08:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration