Search:  
Gentoo Wiki

Madwifi_Wireless_Access_Point


Merge-arrows.gifIt has been suggested that this article be Merged into one article with Wireless/Access point because this will not only work for devices using the MadWifi driver.    (Discuss)
Here is an image of the type of network this guide works for (without ethernet bridging)
Here is an image of the type of network this guide works for (without ethernet bridging)
.

Contents

Installation

emerge vanilla-sources (make sure /usr/src/linux links to whatever kernel you are using) and configure it as follows...

File: /usr/src/linux/.config/
   #CONFIG_MODVERSIONS is not set
   CONFIG_MODULES=y
   CONFIG_MODULE_UNLOAD=y
   CONFIG_KMOD=y
   CONFIG_NETDEVICES=y
   CONFIG_WIRELESS_EXT=y
   CONFIG_WLAN_80211=y
   CONFIG_SYSCTL=y
   CONFIG_CRYPTO=y
   CONFIG_CRYPTO_HMAC=y
   CONFIG_CRYPTO_AES=y
   CONFIG_BRIDGE=y          (optional)

Ethernet Setup

This article assumes you have eth0 connecting to the Internet, eth1 is a wired subnet and ath0 is a wireless subnet. See image above.

  options ath_pci autocreate=ap
  ifconfig ath0 down
  wlanconfig ath0 destroy
  wlanconfig ath0 create wlandev wifi0 wlanmode ap

There are two possible configurations that can occur here depending whether or not you want to do Ethernet bridging. Ethernet bridging allows you to combine your wired subnet and wireless subnet together into one subnet so you can copy files, stream video or music between a wired and wireless system and see all your computers in "My Network Place".

Without Ethernet Bridging

File: /etc/conf.d/net (baselayout 1.x)
   config_eth0=( "Enter your information here" )     (See /etc/conf.d/net.example)
   config_eth1=( "192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255" )
   config_ath0=( "192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255" )
   mode_ath0="Master"
   essid_ath0="MyNetwork"
File: /etc/conf.d/net (baselayout 2.x)
   config_eth0="Enter your information here"    (See /etc/conf.d/net.example)
   config_eth1="192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255"
   config_ath0="192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255"
   mode_ath0="Master"
   essid_ath0="MyNetwork"
File: /etc/conf.d/dhcpd
   DHCPD_IFACE="eth1 ath0"
File: /etc/dhcp/dhcpd.conf
   ddns-update-style none;
   authoritative;
   subnet 192.168.0.0 netmask 255.255.255.0 {
   range 192.168.0.75 192.168.0.100;
   option domain-name-servers 192.168.0.1;              (Make sure BIND is listening on this IP)
   option domain-name "hostname.domain.tld";
   option routers 192.168.0.1;
   option broadcast-address 192.168.0.255;
   default-lease-time 10000;
   max-lease-time 20000;
   }
   subnet 192.168.1.0 netmask 255.255.255.0 {
   range 192.168.1.75 192.168.1.100;
   option domain-name-servers 192.168.1.1;               (Make sure BIND is listening on this IP)
   option domain-name "hostname.domainn.tld";
   option routers 192.168.1.1;
   option broadcast-address 192.168.1.255;
   default-lease-time 10000;
   max-lease-time 20000;
   }

With Ethernet Bridging

File: /etc/conf.d/net (baselayout 1.x)
   config_eth0=( "Enter your information here" )     (See /etc/conf.d/net.example)
   config_eth1=( "null" )
   config_ath0=( "null" )
   bridge_br0=( "eth1" "ath0" )
   config_br0=( "192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255" )
   channel_ath0="1"
   mode_ath0="Master"
   essid_ath0="MyNetwork"
File: /etc/conf.d/net (baselayout 2.x)
   config_eth0="Enter your information here"     (See /etc/conf.d/net.example)
   config_eth1="null"
   config_ath0="null"
   bridge_br0="eth1 ath0"
   config_br0="192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255"
   channel_ath0="1"
   mode_ath0="Master"
   essid_ath0="MyNetwork"
File: /etc/conf.d/dhcpd
   DHCPD_IFACE="br0"
File: /etc/dhcp/dhcpd.conf
   ddns-update-style none;
   authoritative;
   subnet 192.168.0.0 netmask 255.255.255.0 {
   range 192.168.0.75 192.168.0.100;
   option domain-name-servers 192.168.0.1;               (Make sure BIND is listening on this IP)
   option domain-name "hostname.domain.tld";
   option routers 192.168.0.1;
   option broadcast-address 192.168.0.255;
   default-lease-time 10000;
   max-lease-time 20000;
   }

Configuration of Hostapd

I will make this simple, here is a configuration that just works for hostapd-0.4.9 and hostapd-0.5.10 (well it did for me anyways)

File: /etc/hostapd/hostapd.conf
   interface=ath0 
   #bridge=br0                          (optional, if you want bridging remove the #) 
   driver=madwifi 
   logger_syslog=-1 
   logger_syslog_level=2 
   logger_stdout=-1 
   logger_stdout_level=1 
   debug=0 
   dump_file=/tmp/hostapd.dump 
   ctrl_interface=/var/run/hostapd 
   ctrl_interface_group=0 
   ssid=MyNetwork 
   macaddr_acl=0 
   accept_mac_file=/etc/hostapd/hostapd.accept 
   deny_mac_file=/etc/hostapd/hostapd.deny 
   auth_algs=1 
   wpa=1 
   wpa_passphrase=Enter your Passphrase            
   wpa_key_mgmt=WPA-PSK 
   wpa_pairwise=TKIP CCMP
File: /etc/conf.d/hostapd
INTERFACES="ath0"

Finalize

Configure your startup scripts

rc-update add net.eth0 default
rc-update add net.eth1 default
rc-update add net.ath0 default
rc-update add net.br0 default               (optional)
rc-update add hostapd default

Here are some iptable rules you might use when doing Ethernet bridging

iptables -A INPUT -i br0 -p all -j ACCEPT
iptables -A FORWARD -i br0 -p all -j ACCEPT

That's it. Just reboot and you should be all set.

Retrieved from "http://www.gentoo-wiki.info/Madwifi_Wireless_Access_Point"

Last modified: Sun, 24 Aug 2008 09:30:00 +0000 Hits: 1,403