How can I use my card as an access point?

NOTE: because a station VAP is created by default, wlanconfig will fail to create an AP VAP (for MadWifi releases >1407) unless the parameter 'autocreate=none' is passed when loading the ath_pci module. See http://madwifi.org/wiki/UserDocs/autocreate for details.

To create an interface (called ath0) as an access point, issue the command:

wlanconfig ath0 create wlandev wifi0 wlanmode ap

If you're using MadWifi-Old, use this instruction instead:

  iwconfig ath0 mode Master

This will allow clients to see your network and associate with it. To do anything useful beyond having network access to just the machine with the wireless NIC, you will need to set up some sort of routing, most likely install a DHCP server on the router, etc.


If you want the box to behave like a commercial AP, bridging the wireless and wired networks:

Under Debian (or Ubuntu, etc.), this can be accomplished almost entirely within /etc/network/interfaces, which gives Debian systems a standardized way to setup network interfaces. Ensure that bridging is available in the kernel (either modules or builtin), then use something like the following in your /etc/network/interfaces:

# Bring up ath0 with the correct wifi settings
# "manual" causes it to bring up the interface without TCP/IP (which will be setup on the bridge interface br0)
auto ath0
iface ath0 inet manual
    # ensure ath0 is down (never fails because of "true")
    pre-up wlanconfig ath0 destroy || true
    # set up the ath0 device in AP mode before bringing up the interface (unless you're using AutoCreate)
    pre-up wlanconfig ath0 create wlandev wifi0 wlanmode ap
    # remove the ath0 device when bringing the interface down
    post-down wlanconfig ath0 destroy
    # set master mode, channel, and the essid
    wireless-mode master
    wireless-channel 11
    wireless-essid YourESSID
    # IF you use WEP, put the key here:
    #wireless-key 1234-1234-1234-1234

# Bring up the bridge device, br0
# Using DHCP to assign an IP, etc. may work as well,
#  but this illustrates setting up a static IP for the interface.
# The IP will be accessible from both the wired and wireless sides of the network.
auto br0
iface br0 inet static
    # Assign your IP address, subnet and mask, broadcast address, and default gateway
    address 192.168.0.[x]
    network 192.168.0.0
    netmask 255.255.255.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    # Bridge eth0 and ath0 with br0.
    bridge_ports eth0 ath0

# You do *not* need a separate entry for eth0 in this file, because you are not configuring it
# or bringing it up as a separate interface at all.  Mentioning it in the bridge_ports directive
# is enough.

I am successfully using this setup to bridge my wired and wireless networks, along with hostapd for WPA authentication.


Without bridging: Here's another method where you just add the info to /etc/networks/interfaces. I'm using this on ubuntu. I haven't figured out where to stick the 802.1g switch, but this gets the access point up, and brings it up at boot time:

iface ath0 inet static
        address 10.42.2.1
        netmask 255.255.255.0
        broadcast 10.42.2.255
        wireless-essid your_essid
        wireless-mode master
        wireless-key 1223-1234-1234-1234 # well, not really, use yours.

In Madwifi-Old:

Matt Jarvis sent the following info on how to use madwifi as an access point. This should please quite a lot of people:

Hi Matt

I was reading your faq and noticed you don’t have a section on how to use madwifi as an access point. Here are the necessary steps, I use this currently and it works although I am struggling with ath_hal_wait timeouts which causes throughput in 802.11g to be poor. Hopefully someone will fix something in the driver soon to improve performance. For 802.11b access points, the hostap driver is a much more mature solution, and has a massive feature set for this kind of application, just find a card with a Prism2 chipset and away you go. However, if you need 802.11g then madwifi is your only option.

Make sure you have bridging turned on in the kernel, either as a module or built in, install bridge-utils (packages are available for many distros, or just roll your own from the sources).

#Set the card in master mode
iwconfig ath0 mode master
#Create the bridge
brctl addbr br0
brctl addif br0 ath0
brctl addif br0 eth0
ifconfig ath0 0.0.0.0
ifconfig eth0 0.0.0.0
ifconfig br0 192.168.0.1

The bridge should now be up, test by pinging another machine on either side. Pings may take a few seconds to work, as the bridge has to work out which side each ip address is on.

If you can ping both the wired and wireless subnets then the bridge is working, and you are now functioning as an access point. This is an extremely insecure configuration, anyone who can connect to your access point is fully integrated into your network, so use additional security, encryption and authentication of some kind. MAC addresses can be spoofed, but MAC based authentication is at least a protection against casual scanners.

Also, Matt (Jarvis) has discovered that the e100 driver (for ethernet cards) does not interact well with the bridging code. A single packet crossing the bridge is enough to cause a kernel panic (he has only tested this with 2.4.22 kernels, but suspects that it may be the case for the whole 2.4 series). To get around this, use the eepro100 driver, which normally manages to work fine.