MadWifi is short for Multiband Atheros Driver for Wireless Fidelity. The MadWifi drivers provide support for a wide range of Atheros wireless network devices.
The driver works such that your wireless device will appear as a normal network interface in the system. Additionally there is support for the Wireless Extensions API. This allows you to configure most aspects of the device using common (wireless) network tools (ifconfig, iwconfig and friends).
For a list of devices known to be compatible with MadWifi, see the MadWifi compatibility page.
Make sure you have compiled your kernel with the following options (note that the location of options in your kernel may differ).
|Linux Kernel Configuration: Linux Kernel Configuration: MadWifi kernel options (before 2.6.22)|
Loadable module support [*] Enable loadable module support [*] Module unloading [*] Automatic kernel module loading Device Drivers [*] Networking support Wireless LAN (non-hamradio) ---> [*] Wireless LAN drivers (non-hamradio) & Wireless Extensions
|Linux Kernel Configuration: Linux Kernel Configuration: MadWifi kernel options (2.6.22 to 2.6.32)|
Loadable module support [*] Enable loadable module support [*] Module unloading [*] Automatic kernel module loading Networking Wireless [*] Wireless extensions: enabled
|Linux Kernel Configuration: Linux Kernel Configuration: MadWifi kernel options (2.6.33 and later)|
[*] Enable loadable module support ---> [*] Module unloading [*] Networking support ---> [*] Wireless ---> Device Drivers ---> [*] Network device support ---> [*] Wireless LAN ---> <M> Intel PRO/Wireless 2100 Network Connection ( 'or select as module another extension from the list needing WIRELESS_EXT')
Note: on kernel >= 2.6.33, you need absolutly to select a driver in the kernel (like Intel Wireless 2100) that need WIRELESS_EXT=y, even if you don't need this driver.After ensuring that you have fulfilled the MadWifi requirements, install the madwifi-ng package with:
The kernel module for modprobe is "ath_pci".
Using your Device as an Access Point
This is only about configuring your card to operate as an access point. See Wireless/Access point for information on NAT-forwarding, bridging and WEP/WPA encryption.
Your card will enter standard mode by default, but you need to bring the driver up in master mode. To accomplish this, you need to edit the module options. Note that the default behavior of etc-update will be to remove this customization, so remember to do what is necessary to keep your changes after re-emerging madwifi-ng (say, after a kernel compile).You will now need to run:
It's also possible to set the driver into master mode without needing to reload the module itself. This way, you have to take the interface down, destroy it, and rebuild it in the new mode, which goes by the name ap rather than master. Here's how it works:
You could also skip the 0 in the last command, as wlandev will choose the first available integer if none is supplied. The benefit of this tool seems to be that you can create an arbitrary number of virtual ath interfaces, which could presumably be used to service multiple separate LANs with different access control and/or features. In any case, once you've created the new device in mode 'ap' you should see it in the output from iwconfig and it should say Mode:Master.
Note that in all the rest of the configuration you should use the 'ath0' device, rather than 'wifi0' which appears to just be a container for the rest of the stuff.
If you get the error "Could not connect to kernel driver" (when trying to start hostapd) look in your hostapd.conf if you have enabled encryption because if you haven't, the interface isn't started correctly. For details, see the MadWifi ticket #552.
Installing from SourceIf you have installed MadWifi from portage, you should remove it first:
For information on different methods of obtaining MadWifi, see the MadWifi wiki article Getting MadWifi.If you choose to use Subversion, you will first need to install it with:
For instructions on installing MadWifi from source, see the MadWifi First Time How To.
You can also install MadWifi from source. The difference is that you'll have the most current development version including all bug fixes. However, installing the latest development version from source is generally unsupported and may be unstable.
You should generally only install from source if you know that there is support or features currently missing from the current versions in portage that you need.
You can skip this section if you have not installed MadWifi yet.Shutdown the interface (if available):
If the interface does not exist for you, do the following (repeat the lines for all MadWifi devices you have; ath1, etc.):Unload the module:
Obtaining the source codeIf you have installed MadWifi from portage, you should remove it first: You need a SVN client to obtain the source code. If you choose to use Subversion, you will first need to install it with: emerge -a subversion. Then checkout the current branch to /usr/src/madwifi:
For further information on different methods of obtaining MadWifi, see the MadWifi wiki article Getting MadWifi. Updating the source code to the current version
If you have already compiled MadWifi from source, go to the subdirectory "scripts" of the source code and execute the following:
To update to the current version of the source, type:
Now that you have the MadWifi code, you need to compile it. This can be done by typing:
This will install the driver by copying all of the modules, tools and man pages to the correct directories on your system:
Now we will load the MadWifi driver module into the running system:
If you have any problems with building the MadWifi driver, please refer to "BuildProblems" on the MadWifi wiki. For further instructions on installing MadWifi from source, see the MadWifi First Time How To.
If you have any problems with building MadWifi, please first refer to "BuildProblems" on the MadWifi wiki.
Broken Regulatory Domain
Some Atheros-based cards (in particular D-Link models such as the DWL-AG530) have the regulatory domain set wrong. The domain set for these cards will work with the vendor-specific Windows drivers, but not with generic Atheros drivers such as madwifi.
To check your card's regulatory domain, type the following with MadWifi loaded, replacing "wifi0" by the device name:
You should see output along the lines of:
dev.wifi0.regdomain = 18
If the regular domain is set to 18 (unknown, 0x12), you will need to fix it. Use these steps to patch the regdomain to 16 (FCC, 0x10): Make sure ath_pci is loaded: modprobe ath_pciRun lspci to find the card's memory address:
|Code: lspci -v|
0000:00:0a.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01) Subsystem: D-Link System Inc: Unknown device 3a14 Flags: bus master, medium devsel, latency 168, IRQ 169 Memory at ec100000 (32-bit, non-prefetchable) size=64K Capabilities: 44 Power Management version 2
The memory address shown above is 0xec100000.
Find the regdomain to set; 0x10 (16) is FCC.Run the ath_info utility from MadWifi, replacing address by an address such as 0xec100000 and regdomain by the new regdomain, such as 0x10:
The tool will ask for confirmation. Double check the value, and confirm. Reload the module.
If you ever want to undo this change, just run the command again with the old regdomain value.