Atheros Ath5k Wireless Access Point

From Gentoo Linux Wiki

Jump to: navigation, search
Note: This configuration works with kernel 2.6.29.x or newer. If you are using an older kernel follow this guide


Contents

[edit] Kernel Configuration

Configure your kernel as follows.

Linux Kernel Configuration: Tree
[*] Enable loadable module support  --->
 [*]   Module unloading
 [ ]   Module versioning support

[*] Networking support  --->
 [*]   Wireless  --->
  [*]   Wireless extensions
  -*-   Improved wireless configuration API
  <*>   Generic IEEE 802.11 Networking Stack (mac80211)
  Networking options  --->
  <*> 802.1d Ethernet Bridging     (Optional)

Device Drivers  --->
 [*] Network device support  --->
  Wireless LAN  --->
   [*] Wireless LAN (IEEE 802.11)
   <*>   Atheros 5xxx wireless cards support

-*- Cryptographic API  --->
 <*>   HMAC support
 <*>   AES cipher algorithms

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_NETDEVICES=y
CONFIG_WIRELESS_EXT=y
CONFIG_WLAN_80211=y
CONFIG_SYSCTL=y
CONFIG_CRYPTO=y
CONFIG_MAC80211=y
CONFIG_ATH5K=y
CONFIG_CFG80211=y
CONFIG_CRYPTO_HMAC=y
CONFIG_CRYPTO_AES=y
CONFIG_BRIDGE=y          (optional)

Kernels 2.6.29.x and 2.6.30.x have the AP (Access Point) code but it is not activated yet so we must activate it before building the kernel. Add "BIT(NL80211_IFTYPE_AP) |" without the quotes to base.c as shown below.

File: /usr/src/linux-<yourversion>/drivers/net/wireless/ath5k/base.c
           hw->wiphy->interface_modes =
                BIT(NL80211_IFTYPE_STATION) |
                BIT(NL80211_IFTYPE_ADHOC) |
                BIT(NL80211_IFTYPE_AP) |
                BIT(NL80211_IFTYPE_MESH_POINT);

[edit] Needed Software

hostapd is required to run a WAP (Wireless Access Point):

emerge -a hostapd

Services for your WAP (DHCP and DNS):

emerge -a dhcp bind

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:

emerge -a bridge-utils

[edit] Ethernet Setup

This article assumes you have eth0 connecting to the Internet, eth1 is a wired subnet and wlan0 is a wireless subnet.

cd /etc/init.d
ln -s net.lo net.eth0
ln -s net.lo net.eth1

Optional:

ln -s net.lo net.br0

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...

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_wlan0=( "192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255" )
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_wlan0="192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255"
File: /etc/conf.d/dhcpd
DHCPD_IFACE="eth1 wlan0"
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;
}

[edit] With Ethernet Bridging

Edit the following files as shown...

File: /etc/conf.d/net (baselayout 1.x)
config_eth0=( "Enter your information here" )     (See /etc/conf.d/net.example)
config_eth1=( "null" )
config_wlan0=( "null" )
bridge_br0=( "eth1" "wlan0" )
config_br0=( "192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255" )
File: /etc/conf.d/net (baselayout 2.x)
config_eth0="Enter your information here"     (See /etc/conf.d/net.example)
config_eth1="null"
config_wlan0="null"
bridge_br0="eth1 wlan0"
config_br0="192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255"

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;
}

[edit] Configuration of Hostapd

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

File: /etc/hostapd/hostapd.conf
interface=wlan0
#bridge=br0                         (optional, if you want bridging remove the #)
driver=nl80211
ssid=MyNetwork
channel=1
wpa=3
wpa_passphrase=Your passphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
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
accept_mac_file=/etc/hostapd/hostapd.accept
deny_mac_file=/etc/hostapd/hostapd.deny
auth_algs=1
File: /etc/conf.d/hostapd
INTERFACES="br0 eth0 eth1"

[edit] Services

Configure your startup scripts

rc-update add net.eth0 default rc-update add net.eth1 default rc-update add hostapd default

Optional:

rc-update add net.br0 default

Here are some iptables 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.

Personal tools
In other languages