Installing Madwifi on Red Hat Enterprise Linux and Fedora

Packages

You can find RPMs at ATrpms for all non-EOL'd Fedora releases (FC5, FC6 and F7 currently) and Red Hat Enterprise Linux 3, 4 and 5.

Install the RPM file madwifi-*.i386.rpm (or x86_64 respectively) plus the RPM kernel module packages (kmdl) appropriate for your kernel version and architecture, madwifi-kmdl-*.rpm and madwifi-hal-kmdl-*.rpm.

Use uname -r to determine which kmdl you need to download. If you use a depsolver like smart/yum/apt, all you have to do is point it to ATrpms and use

yum install madwifi madwifi-kmdl-`uname -r`

Replace yum with smart or apt as appropriate. Note that you will have to install a new pair of madwifi*-kmdl packages for each kernel update, as most depsolvers aren't yet capable to automate this. For yum there is a yum-plugin-kmdl which already automatically does that for you.

You can also find packages at the Livna repository. Just do "yum install kmod-madwifi" (FC5 or later).

With these RPMs installed, just plug in the wireless card and go.

Old Notes

Automatically creating ath0 with madwifi-ng

After madwifi-ng r1407

To automatically create a station mode interface called ath0, you must have the following lines in /etc/modprobe.conf:

alias ath0 ath_pci
options ath_pci autocreate=sta

Replace sta with your type of VAP. See UserDocs/autocreate for more information.

Before madwifi-ng r1407

To automatically create a station mode interface called ath0, add the following lines to /etc/modprobe.conf:

install ath0 /sbin/modprobe ath_pci; /usr/bin/wlanconfig ath0 create wlandev wifi0 wlanmode sta
remove ath0 /usr/bin/wlanconfig ath0 destroy; /sbin/modprobe -r ath_pci

Other places where wlanconfig might be installed (for instance, if you didn't use the rpm installer) are /usr/local/bin and /sbin. Please edit the above path as appropreate.

If you've run previous versions of the driver, you'll also need to change the line reading:

alias ath0 ath_pci

To:

alias wifi0 ath_pci

If you haven't used any madwifi-old code, you shouldn't need to do this, as Kudzu will do it for you.

RedHat? init script

Bob Glamm sent this /etc/init.d/wireless script to the mailing list. It was written for RedHat? 7.2, but may well work with other versions.

There are actually two parts: 1) The startup/shutdown script itself. This script sources /etc/sysconfig/network-scripts/ifcfg-ath0-{location}, and {location} can be specified as an extra parameter to the startup script. E.g.:

# this references ifcfg-ath0-home
/etc/init.d/wireless start home
# this references ifcfg-ath0-work-division-b
/etc/init.d/wireless start work-division-b
# this references ifcfg-ath0-$DEFAULT_LOCATION (see wireless script)
/etc/init.d/wireless start

The startup/shutdown script loads/unloads kernel modules and configures/unconfigures the ath0 interface, based on the parameters in the {location} file.

2) The ifcfg-ath0-{location} file has some extra parameters to set up networking. Example:

BROADCAST=192.168.0.255
IPADDR=192.168.0.20
NETMASK=255.255.255.0
NETWORK=192.168.0.0
GATEWAY=192.168.0.1
SSID="My Home Wireless Network"   # SSID for structured network
WEPKEY=00110022003300440055006600 # fake, naturally
WIRELESS_CARD_MODE=1              # sets a/b/g mode ('a' for me)
WIRELESS_TURBO_MODE=1             # sets turbo mode (yes for 'a')
WIRELESS_RATE=12M                 # sets rate

Other entries (ONBOOT, DEVICE, BOOTPROTO) are ignored by the wireless script.

The scripts only deal with ath0 (although this could probably be rectified fairly easily). Also, none of this integrates with any specific distribution - you could probably take the “. /etc/init.d/functions” line out of the script (which is RedHat? specific IIRC) and have it work anywhere. Also, in the start() function there is a card detection algorithm that could be improved (it queries the old /proc/pci for a specific PCI device ID, which may or may not match your card).

ifcfg-ath0

This is Patrick Pichon’s ifcfg-ath0 (for Fedora Core 2/3/4).

# Atheros Communications, Inc.|AR5212 802.11abg NIC
DEVICE=ath0
ONBOOT=no
BOOTPROTO=dhcp
TYPE=wireless
ESSID="my access point essid"
KEY=xxxxx-xxxx-xxxx
MODE=Managed
RATE=auto
IWPRIV="authmode 2"

IWPRIV=“authmode 2”is used to enable “shared key”

You can eventually store the keys into /etc/sysconfig/network-script/keys-ath0, in such you don’t need to have the KEY entry in ifcfg-ath0

KEY="[1] aabbccddeeffgghhiijjkkll key [2] mmnnooppqqrrssttuuvvww key [3] 11223344556677889900 key [4] 1a2z3e4r5t6y8u9i key [1]"

Fedora Core 5

March 25, 2006. Successfully enable Madwifi to work with Toshiba Portege 4010 with external DLink DWL-G650.

April 16, 2006. While the original version worked, I've added steps for clarity. Worked with a white-box laptop with a PCMCIA DLink DWL-G650

Added ATRPMS to Yum repo. (As root)

nano /etc/yum.repos.d/atrpms.repo

Add the Following Lines (if not already there)

[atrpms]
name=Fedora Core $releasever - $basearch - ATrpms
baseurl=http://dl.atrpms.net/fc$releasever-$basearch/atrpms/stable

Import the ATrpms GPG Key

rpm --import http://www.atrpms.net/RPM-GPG-KEY.atrpms

Download madwifi modules

yum install madwifi 

This should install three packages madwifi, madwifi-hal-kmdl, and madwifi-kmdl. Start Network Configuration to enable a new wifi profile for this card.

system-config-network

You should now see the ath0 (or applicable) interface under the hardware tab. Under the device tab, create a new profile. Choose Wireless Connection, Forward, select the new interface card, Forward, Leave mode as Mananged, choose Specified and enter in your SSID, enter in your WEP key starting with 0x (Zero and X, then your 26 digit WEP key), Forward choose your DHCP or Staic IP address type, Forward. Confirm your configuration and select Apply. Highlight the profile you just created and click Activate. Yes to save, and yes to activate. You should now be able to confirm your configuration and ip address with the following:

ifconfig

and

iwconfig

These steps are valid to get connected to an AP using WEP only.. next step.. WPA...

Fedora Core 4

Check the top of the page for ATrpms packages.

Generic instructions

This worked as of 11 Nov 2005:

A ".spec" file has been integrated into madwifi distribution under contrib folder. When you get the tar ball you just have to run

 rpmbuild --ta madwifi-trunk-rxxxx-YYYYMMDD.tar.gz 

In case you would like to build for a particular kernel version, you can specify the kernel version by doing

 rpmbuild --define "kernel 2.6.13.1532_FC4" -ta madwifi-trunk-rxxx....tar.gz

The command will build madwifi commands and madwifi module for the latest kernel installed on your system.

To install the kernel module, you will have to run the following command and the madwifi module will be installed for that particular kernel.

 sudo rpm -i madwifi-module-0.xxxx.YYYYMMDD-......rpm 

You will also install the commands by doing

 sudo rpm -Uvh madwifi-0.YYYYMMDD-y.rpm 

- Patrick Pichon

This worked as of 19 Jul 2005:

First, see UserDocs/GettingMadwifi

cd madwifi
make clean
make
sudo make install
modprobe ath_pci

and go from there.

- esteban

livna Package Instructions

(Note: At 14th March 2006, Livna was still using madwifi-old).

Make sure you have the latest kernel (ie yum update kernel)

reboot

Add livna to your yum update (create /etc/yum.repos.d/livna.repo) and add this to the blank text box:

[livna]
name=Fedora Core 4 - i386 - livna
baseurl=http://rpm.livna.org/fedora/4/i386/RPMS.lvn
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://rpm.livna.org/RPM-LIVNA-GPG-KEY

then type (as root): yum install kernel-module-madwifi-$(uname -r)

finanlly do:

modprobe ath_pci

You should then be able to add the wirless card in redhat->system tools->Internet Configuration Wizard . Just select Wireless connection and at the next page select "Atheros Communications Inc ...." Then enter the info for your wireless router (ssid and key). Save and you should be able to bring it up with either "ifconfig ath0 up" or through the gui "network" under redhat->system tools ->network by hitting the activate button.

This works as of January 2006 and kernel 2.6.14-1.1656_FC4smp (should work for 2.6.14-1.1656_FC4 too)

-Ben

Toshiba laptops

Well, I too have FC4 and am running the AR5212 802.11abg NIC (rev 01) in a Toshiba laptop. I used the rpms from atrpms.net and they worked fine. The only thing is I couldn’t get the card to grab an IP. After trying the GUI Internet Wizard (and editing ifcfg-ath0 for hours and pulling my hair out) I ran across a post (http://linux.seindal.dk/item23.html) where a guy says to do these commands:

ifconfig ath0 up
iwconfig ath0 mode managed
iwconfig ath0 nick "Netgear"
iwconfig ath0 channel 9
iwconfig ath0 key "hexvalue" (without 0x prefix)
iwconfig ath0 essid "your ssid"
dhclient

This worked instantly!

-kevin

Thanks Kevin. This just worked for me too Sept 15, 2005 with an Airlink AWLH4030 Wireless Super G PCI Adapter recently purchased. Used a hex 128 bit key. Had to reboot though and rerun the commands via a script. Working on the rc.local or such. Running Fedora Core 4 (FC4) 2.6.12-1.1447_FC4 kernel. Thanks alot. Finally no more cables.

Fedora Core 1

Check the top of the page for ATrpms packages.

I did the build and install on an older FC1. Couple of items

  • I turned off the crypto check in the make file - could not get past this check on my core. It doesn't seem to effect the running of the drivers?
  • I ended up rebooting and kudzu picked up the hardware change.
  • Once I configured the device to use DHCP (through kudzu - DOS like interface that appears on startup) everything worked fine.
  • Have wep and specific essid working fine.
  • Driver works great...the network setup feels faster than the windows version.

Cheers - Tom

IBM/Lenovo Thinkpad laptops

If you're using a Thinkpad X40 or T40, see Eric Raymond's Fedora Core on Thinkpad X40 Customization HOWTO for step-by-step setup instructions.

Network Manager

When using madwifi from CVS (20/09/2005) (old code only'''), the link drops frequently when using NetworkManager. One should configure NetworkManager to “Never Search” (right-click NetworkManager icon). That way, only beaconed SSIDs show up, but the link is stable. Please note I’ve also applied the following patch that is meant to fix WPA:

http://article.gmane.org/gmane.linux.drivers.madwifi.devel/1275

-Dennis Wagelaar

Fedora Core 5 (from source)

To install the latest madwifi:

become root:

su -

Fix modprobe.conf:

vi modprobe.conf

and add this line:

alias ath0 ath_pci

go to /root:

cd

(so you don't scatter sh*t all around)

check your kernel version:

uname -a

download and install the kernel headers:

yum install kernel-devel-{kernel-version}

- download the latest madwifi tarball , untar it, cd to its root directory

tar -xzf madwifi-{madwifi-version}-tar.gz
cd madwifi-{madwifi-version}
make KERNELPATH=/usr/src/kernels/{kernel-version}
make install

now you can try it:

modprobe ath_pci

if all goes well, you can create the device ath0:

cd /etc/sysconfig/networking/devices
vi ifcfg-ath0

enter this (managed mode, dhcp):

DEVICE=ath0
BOOTPROTO=dhcp
ONBOOT=yes
DHCP_HOSTNAME=
IPADDR=
DOMAIN=
NETMASK=
HWADDR=
USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Wireless
ESSID=yournetworkid
CHANNEL=1
MODE=Managed
RATE=Auto


then do

vi keys-ath0

and enter:

KEY=mywapkey

then do

cd ..
cp devices/ifcfg-ath0 profiles
cp devices/keys-ath0 profiles

you're done.

For ad-hoc connections

Do everything as above, except enter "Mode=Ad-Hoc" in ifcfg-ath0

Then change modprobe.conf:

vi modprobe.conf

you should have this line:

alias ath0 ath_pci

add this line:

options ath_pci autocreate=adhoc

For two or more cards with different modes

vi modprobe.conf

remove all lines like "alias ath# ath_pci"

Then enter:

install ath_pci /sbin/modprobe --ignore-install ath_pci ; /usr/local/bin/wlanconfig ath0 destroy ; /usr/local/bin/wlanconfig ath0 create wlandev wifi0 wlanmode ; \
                                                          /usr/local/bin/wlanconfig ath1 destroy ; /usr/local/bin/wlanconfig ath1 create wlandev wifi1 wlanmode ; \
                                                          ...etc

Piero de Salvia ()

For two or more cards with different modes 2

I never got Piero de Salvias solution to work so this is what I did.

Instead of putting the config into modprobe.conf I put it in a file called /etc/modprobe.d/madwifi

vi /etc/modprobe.d/madwifi

On my system it got this contents:

alias wifi0 ath_pci
alias wifi1 ath_pci
options ath_pci autocreate=none

Next thing I did was to create an init script

vi /etc/rc.d/init.d/wifinet

The wifinet script have this contents

#!/bin/bash

/usr/bin/wlanconfig ath create wlandev wifi0 wlanmode ap
/usr/bin/wlanconfig ath create wlandev wifi1 wlanmode sta
/sbin/iwconfig ath0 essid "net2" channel 5
/sbin/iwconfig ath1 essid "net1" channel 9 ap 00:A0:C5:CC:DE:68
/sbin/iwpriv ath0 hide_ssid 1
/sbin/iwpriv ath0 maccmd 3
/sbin/iwpriv ath0 maccmd 1
/sbin/iwpriv ath0 addmac 00:12:79:3E:4F:B5
/sbin/iwpriv ath0 addmac 00:18:DE:9E:75:64
/sbin/ifconfig ath0 192.168.3.1 netmask 255.255.255.0 up
/sbin/ifconfig ath1 192.168.1.2 netmask 255.255.255.0 up
/sbin/route add default gw 192.168.1.1

Johan Söderberg ()

Attachments