My goal here is to make my laptop into a wireless access point — like a wireless router, but without buying an extra box. I'm running Debian Linux. My laptop is connected to the internet by LAN. The first challenge is to find a wireless card that can do Master mode (that is, can work as an access point). Only a few drivers supporr this (see http://linuxwireless.org/en/users/Drivers). After searching, I found a USB wifi card that works — the NEC Aterm WL300NU-AG, which uses the carl9170 driver (see http://linuxwireless.org/en/users/Drivers/carl9170).
Two packages are needed: hostapd and udhcpd. Any DHCP server would work, and there are several alternatives to udhcpd. I haven't tested them, but dnsmasq and dhcp3-server were mentioned elsewhere.
# aptitude install -P hostapd # aptitude install -P udhcpd
The network card can't be placed in AP mode the old way, because the drivers don't support it. When I tried, it produced an error.
# iwconfig wlan1 mode Master
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Invalid argument.
The driver for this card can do AP mode, but only using hostapd. Here's my configuration for hostapd v0.7.3. I'm not using any encryption or security at the moment — this is an open access point.
/etc/hostapd/hostapd.conf: interface=wlan1 driver=nl80211 ssid=Openwifi channel=1 hw_mode=g ignore_broadcast_ssid=0 auth_algs=1 wpa=0 logger_syslog=-1 logger_syslog_level=2 debug=0

To make my wireless devices connect to the access point smoothly, I use udhcpd v1.18.5-1, a small DHCP server that's part of BusyBox. The below DNS addresses are for OpenDNS and Google Public DNS.
/etc/udhcpd.conf: start 192.168.0.10 end 192.168.0.50 max_leases 30 interface wlan1 option subnet 255.255.255.0 option domain local option lease 864000 option router 192.168.0.1 option dns 208.67.222.222 option dns 208.67.220.220 option dns 8.8.8.8 option dns 8.8.4.4
To start the services, use the following commands. These daemons log to /var/log/daemon.log.
# /etc/init.d/hostapd start # /etc/init.d/udhcpd start # ifconfig wlan1 inet 192.168.0.1
Check that the daemons are running without error and that the network interface is locally accessible.
# tail --lines=30 /var/log/daemon.log # ping 192.168.0.1
To get IP masquerading (routing) working, use the following commands. Note that eth0 is the internet-facing interface. Add the following lines to /etc/rc.local to run them at boot time.
# echo "1" > /proc/sys/net/ipv4/ip_forward # iptables -F # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
That's all there is — my access point is up and running. If everything is working, connect to the wireless access point using a second machine. If it doesn't appear to work, for a starting point, check the local network, the internet using IP addresses, and the internet using domain names.
# ping 192.168.0.1 # ping 8.8.8.8 # ping wikipedia.org















