个人工具

UbuntuHelp:WifiDocs/MasterMode

来自Ubuntu中文

跳转至: 导航, 搜索

Setting up a Wifi Adapter to support "master mode"

What we need for a wireless "base-station" or "access-point" is a wireless network card that does "master mode", which allows our Linux box to behave just like products from the likes of Linksys, Netgear & Belkin - later sections of this HOWTO should be pretty much the same whether you can find a 802.11a, 802.11b or g card that does master mode in Linux.

Purchasing WiFi adaptor

Select a card that supports "master mode". Be careful when buying a card for this project - WLAN cards documented as Linux-supported often become no longer available and it's not uncommon for manufacturers of wireless cards to sell completely different cards with a completely new chipset under the model number of a card that is already currently sold. I guess this saves them the trouble & expense of having new packaging & advertising printed, but it causes copious confusion for the Linux-loving enthusiast. Also look out for D-Link's evil naming conventions - the 3 different revisions of the DWL-520 are all different from the DWL-520+, which is different from the DWL-G520, which is different from the DWL-A520 and so on... when you throw into the mix the 8 different cards with "DWL" and "650" in their names it can give you a headache just trying to work out which one your supplier is listing, never mind installing the drivers. A good place to start looking for a compatible device is: http://linuxwireless.org/ A good chipset for pci adaptors is: Atheros chipsets http://madwifi.org/

Determine wifi adapter chipset

Doing a Google search on the manufactures part number usually gets results e.g. "Cnet CWP-854 chipset" should give you the result of ralink rt2561 or rt61. The other option is to plug the wifi adapter into a linux box and type the commands:

sudo lspci

for PCI adapters

sudo lsusb

for USB adapters

sudo iwconfig

Using these commands you should have enough clues to your wifi adapters chipset.

Test an adapter for "master mode"

To check if an adapter and driver can do master mode you can use a program called 'iwconfig'

sudo iwconfig

In the terminal window should list all available wireless interfaces. Assuming your adapter is connected and its drivers are loaded, try the following.

sudo iwconfig wlan1 mode master

Replace wlan1 with whatever Ubuntu is calling your adapter. If you don’t get an error you’re in business.

Adapter setup

Prism (HostAP)

Note that cards using these drivers are 11MBPS only. Jason Boxman provides quite an excellent description of these drivers: HostAP enables 802.11b access point functionality utilizing the secondary (STA) firmware of Intersil's Prism2, Prism2.5, or Prism3 chipsets for time sensitive tasks. All other functionality is handled via the driver, including WEP and passing frames off to a port authenticator, like FreeRADIUS. Presently, HostAP works with Intersil's Prism chipset and cards utilizing PCI and PC Card interfaces to the host system. (PLX bridging is also supported)

Atheros (Madwifi)

Atheros card setup for routing resource =

You have to install the Source to get the driver into Master mode for a WAP

  • For "ubuntu server edition" do the following
  • For other editions just enable restricted drivers
wget http://downloads.sourceforge.net/madwifi/madwifi-0.9.4.tar.gz 
tar -xvzf madwifi-0.9.4.tar.gz
cd madwifi-0.9.4
sudo apt-get install build-essential linux-headers-server 
sudo make
sudo make install
  1. Edit your kernel modules loaded at boot time:
sudo nano /etc/modprobe.d/madwifi

add this to make sure the wireless card goes into Master mode:

options ath_pci autocreate=ap

load the module without a reboot

sudo modprobe ath_pci

NDISwrapper

NDISwrapper cards are NOT SUITABLE for base-station use - they don't do master mode. NDISwrapper is basically a layer of interfacing glue to use Windows drivers with Linux, and so it denies access to some of the more interesting &/or esoteric functions of the wireless card (because NDIS has no programming interface for them, I guess). If you have a wireless card that you're currently using with NDISwrapper then it's possible that there are native drivers for it - I've seen quite a few posters to the Ubuntu forums suggesting using NDISwrapper with Ralink cards, for instance - but it's more likely that you'll have to bin it (or put it in your sister's Windows PC) and get a card with native drivers that interface properly with the kernel. NOTE: You can accomplish a similar goal with an Ad-Hoc network; this might help.

Prism54

I wanted a card that supported the Prism54 drivers, as they seemed to be about the most mature ones for "54G" wireless cards under Linux at the time I was looking - my Powerbook has Airport Extreme, Apple's name for 802.11g, so I might as well make use of it. I took a good look through the supported cards and decided upon the Allnet ALL0271. It seemed to be fairly well-recommended on the Prism54.org forums - there are too many short comments saying "worked for me" for me to post all the individual links, so do a search & read all the threads for yourself. You can order the ALL0271 from the US, from Germany or if you're in the UK, I actually bought a handful, so email me if you'd like to buy one. I also recently got one of these cards working on a friend's SuSE 9.1 box, although the process isn't as brain-dead as it is under Gentoo - portage & the ebuilds automate the process so well.

Ralink rt2400 / rt2500

As I see on the rt2x00 project page, the new branch rt2x00 beta drivers support master mode and all advanced features, but legacy rt2400, rt2500, rt2570, rt61 drivers do not, but I have no way to test such setup. For more details on this driver see the project homepage.

Broadcom 43xx cards (bcm43xx.ko)

Broadcom cards support master mode using the reverse-engineered kernel driver. You need to enable (or make as a module) the Softmac wireless extensions and BCM43xx wireless driver.

Realtek RTL8180 cards (rtl8180-sa2400 project)

Master mode is working correctly together with promiscuous mode. Supports WEP open encryption and possibly TKIP/CCMP(not tested). Supports only 1/2/5.5/11M modes.

Texas Instruments ACX100/ACX111

In cards based on this chip (ex. D-Link DWL-520+) master mode is not fully implemented (as of 2007-01-01 driver) and there are some different problems like sometimes no beacons are broadcasted and card can't be properly initiated. Supports 1/2/5.5/11M(b) and 22M(b+) modes.

Intel PRO/Wireless (ipwXXXX) series

For ipw2100/ipw2200, unfortunately there is no way to use them as AP, but this can be done for ipw3945 and ipw4965, maybe ipw2915 too, which are pretty good cards anyway, using fully open-source iwlwifi drivers, but it can't be done with old Intel drivers with closed microcode.

ZyDAS ZD1211

ZyDAS ZD1211 802.11b/g USB WLAN chipset Linux drivers Initially contributed by ZyDAS under the GPL license, the ZD1211 Linux driver is maintained by the open source community.. zd1211 chipset supports master mode, but the drivers built into Ubuntu for the zd1211 chipset do not. Luckily another set of drivers exist and they work with master mode. http://zd1211.wiki.sourceforge.net/VendorBasedDriver If you’re compiling and installing the zd1211 VendorBasedDriver for your wifi module (depending your chipset version) you may need to edit the Makefile to enable zd1211b mode. Also you’ll likely need to blacklist the driver built-in to the kernel to let the new VendorBasedDriver load instead.

sudo echo zd1211rw >> /etc/modprobe.d/blacklist  

Projects that require "Master Mode"