Madwifi Wireless Access Point
From Gentoo Linux Wiki
You can use madwifi to create a wireless access point. This article explains how.
Contents |
[edit] Installation
Configure your kernel as follows.
| Linux Kernel Configuration: Tree |
[*] Enable loadable module support ---> [*] Module unloading [ ] Module versioning support Device Drivers ---> [*] Network device support ---> Wireless LAN ---> [*] Wireless LAN (IEEE 802.11) [*] Networking support ---> [*] Wireless ---> [*] Wireless extensions Networking options ---> <*> 802.1d Ethernet Bridging (Optional) -*- Cryptographic API ---> <*> HMAC support <*> AES cipher algorithms You will need CONFIG_KMOD=y (Not sure where it is located in menuconfig) You will need CONFIG_SYSCTL=y (Not sure where it is located in menuconfig) |
Or if you prefer here is what your .config should look like.
| Linux Kernel Configuration: .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) |
You will need several packages: Atheros wireless drivers:
hostapd is required to run a WAP:
Services for your WAP (DHCP and DNS):
Make sure bind is listening on 192.168.0.1 and 192.168.1.1. If you are doing ethernet bridging then Bind only needs to be listening on 192.168.0.1
Optional: If you want to do ethernet bridging:
[edit] Ethernet Setup
This article assumes you have eth0 connecting to the Internet, eth1 is a wired subnet and ath0 is a wireless subnet.
Optional:
Load module:
Edit the following files:
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".
[edit] Without Ethernet Bridging
Edit the following files as shown...
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"
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"
DHCPD_IFACE="eth1 ath0"
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;
}
[edit] With Ethernet Bridging
Edit the following files as shown...
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"
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"
DHCPD_IFACE="br0"
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;
}
[edit] 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)
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
[edit] Services
Configure your startup scripts
Optional:
Here are some iptables rules you might use when doing Ethernet bridging
That's it. Just reboot and you should be all set.
[edit] Troubleshooting
Sometimes hostapd does not look for the right device, such as looking for wlan0 when you have ath0. Besides from setting things appropriately in /etc/hostapd/hostapd.conf, you will also have to edit /etc/conf.d/hostapd
INTERFACES="ath0"