A wireless access point with Raspberry Pi and the AWUS036NH USB adapter


The need for a new access point arose out of discontent with the Speedport W723V DSL router as provided by T-Online. De device tended to become less stable as more wireless devices got connected. The Wi-Fi connection froze several times a week, among other annoyances. Besides I wanted a highly configurable access point for use with wireless projects in and around the house.

Note that the procedure described here works for the AWUS036NH but not for the AWUS036H.

Connect the AWUS036 over a USB power hub to prevent it from draining the Raspberry Pi.

Install the required packages

We need to install some wireless utilities and a package to support the adapter firmware. The hostapd daemon is used for the actual hotspot. The dnsmasq daemon handles DNS and DHCP requests.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install rfkill zd1211­firmware hostapd hostap­utils iw dnsmasq

Verify if your device supports the required interface modes (the AWUS036NH should):

iw list

It should list ‘AP’, ‘managed’ and ‘monitor’ among others.

Configure the network interface

Edit /etc/network/interfaces to configure the wireless interface. It needs to be static. In the example below the ethernet interface has a static IP address too, so we can always find the Raspberry Pi at (outside the DHCP pool).


iface eth0 inet static
iface wlan0 inet static

Restart the interface after you have made a change:

sudo ifdown wlan0
sudo ifup wlan0

Configure hostapd

Edit hostapd.conf to look similar to this:



Insert your SSID and pick a channel that is supported by your hardware.

Start hostapd from the command line to test your configuration. Correct any reported errors.

sudo hostapd -d /etc/hostapd/hostapd.conf

To run hostapd as a service first make sure that /etc/default/hostapd contains the absolute path to your configuration file.


Now the daemon can be started and stopped as a service. It will also be started on system startup (ref. /etc/init.d/hostapd).

sudo service hostapd start
sudo service hostapd stop
sudo service hostapd restart

Restart the daemon after a configuration change. To enable WPA do something like this:



Configure dnsmasq

Edit /etc/dnsmasq.conf and make sure it contains the following (uncommented) lines:


Restart the dnsmasq service with this configuration:

sudo service dnsmasq restart

Activate IP forwarding and NAT

Enable IP forwarding in the proc filesystem:

sudo sh -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'

Append a rule to ‘nat’ in iptables:

iptables -t nat -A POSTROUTING -j MASQUERADE

Run on startup

This has already been configured for hostapd (see above). Now create the following script in /etc/init.d (modified from Pi-Point).


# Configure Wifi Access Point. 

# Provides:          WifiAP 
# Required­Start:    $remote_fs $syslog $time 
# Required­Stop:     $remote_fs $syslog $time 
# Should­Start:      $network $named slapd autofs ypbind nscd nslcd 
# Should­Stop:       $network $named slapd autofs ypbind nscd nslcd 
# Default­Start:     2 
# Default­Stop: 
# Short­Description: Wifi Access Point configuration 
# Description:       Sets forwarding, starts hostap, enables NAT in iptables 
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -j MASQUERADE
service dnsmasq restart

Make sure it’s executable:

chmod+x /etc/init.d/pipoint

Add the script to the startup sequence:

sudo update-rc.d pipoint start 99 2

2 thoughts on “A wireless access point with Raspberry Pi and the AWUS036NH USB adapter”

  1. Thanks for this walk through. I just followed it with pretty good success. But..

    My Cable modem needs to give the network router an address via DHCP, so your static eth0 address setup won’t work for me.

    The strange thing is, the pi will get a DHCP address from a 4-port router/wifi that the pi is supposed to replace. But it won’t get an address from the cable modem I want it to interface to.

    I tried running “dhcpcd eth0” and get this output. First, with the router in between the pi and the cable modem:

    dhcpcd[2971]: version 6.7.1 starting
    dhcpcd[2971]: all: IPv6 kernel autoconf disabled
    dhcpcd[2971]: eth0: adding address fe80::86d5:a0b1:bbc0:ade2
    dhcpcd[2971]: if_addaddress6: Operation not supported
    dhcpcd[2971]: DUID 00:01:00:01:1c:dd:60:61:b8:27:eb:6f:bc:21
    dhcpcd[2971]: eth0: IAID eb:6f:bc:21
    dhcpcd[2971]: eth0: rebinding lease of
    dhcpcd[2971]: eth0: changing route to
    dhcpcd[2971]: eth0: changing default route via
    dhcpcd[2976]: eth0: MTU set to 1492
    dhcpcd[2971]: forked to background, child pid 2989

    Now, with the pi connected to the cable modem:

    dhcpcd[2744]: version 6.7.1 starting
    dhcpcd[2744]: all: IPv6 kernel autoconf disabled
    dhcpcd[2744]: eth0: adding address fe80::86d5:a0b1:bbc0:ade2
    dhcpcd[2744]: if_addaddress6: Operation not supported
    dhcpcd[2744]: DUID 00:01:00:01:1c:dd:60:61:b8:27:eb:6f:bc:21
    dhcpcd[2744]: eth0: IAID eb:6f:bc:21
    dhcpcd[2744]: eth0: soliciting a DHCP lease
    dhcpcd[2744]: eth0: using IPv4LL address
    dhcpcd[2744]: eth0: adding route to
    dhcpcd[2744]: forked to background, child pid 2791

    Any ideas on how to debug this?

    Minor edit to your process: your “apt-get install install ..” you’ve duplicated “install.” Also, the hyphens you’re using don’t cut and paste correctly for some strange reason…

    Thanks for doing this! 🙂

  2. Thanks for your comments. The Pi gets an IP address from the router because the router responds to the DCHP request first. A static IP address shouldn’t be a problem as long as it is on the same subnet and outside the DHCP pool (192.168.0.i when connected to the router).

Comments are closed.