Wireless-Router.png

Contents


Introduction

Network-wireless-tango.png

This tutorial provides a simple (or almost simple) experience as base for setting up a wireless access point using a PC equiped with an 802.11a or 802.11b/g WiFi card and, of course, Slackware-Linux.

Bill of materials (in this experience ;) )

Notebook
HP Pavilion dv5000
CPU AMD Sempron(tm) Processor 3300+
RAM 1GiB
WLAN BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller
Software
Linux 2.6.33.4-smp
Slackware 13.1.0
hostapd v0.7.3
Network configuration
eth0 192.168.0.1/24, with Internet access
wlan0 192.168.1.123/24 as wireless Access Point


Testing wireless card capability

iw list

Wiphy phy0
        Band 1:
                Frequencies:
                        * 2412 MHz [1] (20.0 dBm)
                        * 2417 MHz [2] (20.0 dBm)
                        * 2422 MHz [3] (20.0 dBm)
                        * 2427 MHz [4] (20.0 dBm)
                        * 2432 MHz [5] (20.0 dBm)
                        * 2437 MHz [6] (20.0 dBm)
                        * 2442 MHz [7] (20.0 dBm)
                        ...
                Bitrates:
                        * 1.0 Mbps
                        ...
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
        max # scan SSIDs: 4
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * WDS
                 * monitor
                 * mesh point

In Supported interface modes: * AP ... ok!

Install and configure hostapd

To set our wireless card as AP we will use hostapd, a user space daemon for access point and authentication servers. Hostapd releases and other tools are here: hostap.epitest.fi.

I've installed hostapd v.0.7.3, the SBo slackbuild is out of date, you can use this: File:Hostapd.slackbuild.tar.gz (hostapd-0.7.3 slackbuild rev.2, with 802.11n support). Unpack and do:

su
cd hostapd.slackbuild
./hostapd.SlackBuild
installpkg /tmp/hostapd-0.7.3-i486-1_SBo.tgz

Parameters I've set in /etc/hostapd/hostapd.conf:

 interface=wlan0
 ssid=myAP
 hw_mode=g
 channel=6
 driver=nl80211
 wpa=1
 wpa_passphrase=mypassword

Install and configure DHCP service

Many wireless clients needs DHCP to get network configuration, so we must install dhcpd service (available only in network 192.168.1.0/24 wlan0, in this example). This is a suitable /etc/dhcpd.conf

ddns-update-style none;
default-lease-time -1;
max-lease-time 7200;
not-authoritative;
#
# default gateway
option routers 192.168.1.123;
#
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option domain-name-servers 208.67.222.222;
 
#
subnet 192.168.1.0 netmask 255.255.255.0
{
 next-server 192.168.1.1;
 
 range dynamic-bootp 192.168.1.128 192.168.1.248;
 option host-name "Wifi";
 
 group customIP
 {
  host pc-01  { hardware ethernet 00:11:22:33:44:55 ; fixed-address 192.168.1.11 ; }
 }
}

If service script is missing in your Slackware installation, use this /etc/rc.d/rc.dhcpd:

#!/bin/sh
#
# /etc/rc.d/rc.dhcpd
#
# Start/stop/restart the DHCP server.
#
# To make DHCP daemon start automatically at boot, make this
# file executable:  chmod 755 /etc/rc.d/rc.dhcpd
#
 
case "$1" in
   'start')
      /usr/sbin/dhcpd ;;
   'stop')
      killall -s 9 dhcpd ;;
   'restart')
      killall -s 9 dhcpd
      /usr/sbin/dhcpd  ;;
   *)
      echo "usage $0 start|stop|restart" ;;
esac

Starting Access Point script

wlan_startAP.sh

#!/bin/sh
 
WLAN_DEV="wlan0"
WLAN_IP="192.168.1.123"
 
modprobe b43 qos=0
 
ifconfig $WLAN_DEV $WLAN_IP
iwconfig $WLAN_DEV txpower 20dBm
 
echo 1 > /proc/sys/net/ipv4/ip_forward
touch /var/lock/subsys/local
modprobe ip_nat_ftp
modprobe ip_conntrack_ftp
iptables -t nat -A POSTROUTING -s $WLAN_IP/24 -d 0/0 -o eth0 -j MASQUERADE
 
/etc/rc.d/rc.hostapd start
 
/etc/rc.d/rc.dhcpd restart 2> /dev/null

The card needs firmware to work as AP

output of dmesg when hostapd starts:

b43 ssb0:0: firmware: requesting b43/ucode5.fw
b43 ssb0:0: firmware: requesting b43/pcm5.fw
b43 ssb0:0: firmware: requesting b43/b0g0initvals5.fw
b43 ssb0:0: firmware: requesting b43/b0g0bsinitvals5.fw
b43-phy0: Loading firmware version 508.154 (2009-08-18 00:58:22)

Device firmware installation

To get and install firmware a reference guide is here: linuxwireless.org

As noted in linuxwireless.org site, often the firmware extracted from the binary driver is copyrighted by the manifacturing company and cannot be redistributed in this form. You must download the specific driver for your wireless card and use tools as b43-fwcutter (b43-tools). This works in case of the BCM4318 chipset:

tar -xjf broadcom-wl-5.10.144.3.tar.bz2
b43-fwcutter --unsupported broadcom-wl-5.10.144.3/linux/wl_apsta.o
cp -Rv b43 /lib/firmware/

Results and notes

Wireless-Router.png


This realization has shown exceptional results: the radio range is similar to a true access point device, the system is also very stable with high performance with multiple clients connected.



Other wireless cards tested

Wireless adapter Standards tested Driver Notes
Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01) 802.11g b43, ath9k
ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter (USB) 802.11g/n rt2800usb, mac80211 short range
ID 1737:0079 Linksys WUSB600N v2 Dual-Band Wireless-N Network Adapter [Ralink RT3572] 802.11a/g cfg80211, rt2800usb work only with kernel 3+

Zoros 17:41, 2 February 2012 (CET)

Retrieved from "http://www.zoros.org/wiki/index.php?title=Using_your_Slackware_Linux_box_as_wireless_AP"