Friday, 27 December 2013

Raspberry WAP

Progress over the past day or so has been good, and I now have what most people think of as a home router.

If you're following along and building this with me, you should consider an ssh/puTTY session to work in so that you can copy/paste if you wish. First, login to the RPi and find out the IP address (in bold) of the ethernet interface, eth0:

eth0 Link encap:Ethernet HWaddr b8:27:eb:6a:c7:61
     inet addr: Bcast: 
     RX packets:6152 errors:0 dropped:0 overruns:0 frame:0 
     TX packets:511 errors:0 dropped:0 overruns:0 carrier:0 
     collisions:0 txqueuelen:1000 
     RX bytes:614474 (600.0 KiB) TX bytes:46934 (45.8 KiB)

If you're using a Mac or Linux, start a shell and simply type

ssh pi@

to complete your login. If you're using Windows, look into the puTTY tool.  

When I ordered the parts for the VantasticVideo Project I paid particular attention to the wifi adapter to ensure that it was capable of acting in client mode to connect to multiple wireless clients. The Newark store lists all Adafruit wifi adapters as being capable of this.

The following procedure is based on beginning at "Check Ethernet & Wifi". Each heading here matches the headings there, to make it easier to stay in sync. I've listed my files here to represent what worked for me. I've also assumed some familiarity with linux/unix, and that you have a general understanding of using a text editor such as nano or vi.

Install the Software

sudo apt-get update
sudo apt-get install hostapd isc-dhcp-server

This installs the access point server package and the dhcp IP address server. The download will ask you to confirm the download. You do. Note that the install may complain that something doesn't seem right and ask you to confirm that you want to proceed. You do.

Setup DHCP Server

The dhcp configuration file (/etc/dhcp/dhcpd.conf) gives some explanations as well as example configurations. Lines in the file that are comments (not used by the software) begin with "#". The documentation I followed lists quite a few things. Here are the pertinent pieces we need:

  1. uncomment the line #authoritative
  2. add the following text to the end of the file:
subnet netmask {
        option broadcast-address;
        option routers;
        default-lease-time 600;
        max-lease-time 7200;
        option domain-name "mobile";
        option domain-name-servers;
In addition, we need to edit /etc/default/isc-dhcp-server and update the line


to read


As a short explanation, we need to identify that this dhcp server is to be considered the authority for the networks it serves (only wlan0 in this case), specify a network to serve, including the address range to lease IP addresses from, the connection IP to the outside world, the lease duration and dns parameters. We'll look at dns as a last item in this post

Setup wlan0 for Static IP

The network interface information is kept in /etc/network/interfaces. We need to edit it to look like this:
auto lo

iface lo inet loopback

auto eth0
iface eth0 inet dhcp

allow hotplug wlan0

auto wlan0
iface wlan0 inet static

There is one additional line to add, later.

Configure Access Point

The access point information is kept in /etc/hostapd/hostapd.conf. We need to edit it to look like this:

Note that I've opted for an open network and commented out the wpa2 security. I suppose I could worry that someone could watch movies from this machine while travelling next to me at 120kph. But I won't.

We also need to update /etc/default/hostapd so that the line 



Configure Network Address Translation

The steps I took are exactly as given in the guide I followed (, so in the spirit of DRY (Don't Repeat Yourself), go look there. Note that the last edit necessary for /etc/network/interfaces is done here.

Update hostapd

Again, I followed the steps exactly as specified in the guide.

Finishing Up!

You guessed it - I followed the guide.

Connect and Test

This was the last step I followed. I have no desire to compile packages myself. Having done time compiling kernels to add new hard drives, I'm quite happy to stand on the shoulders of giants and (gratefully) use their handiwork.

At this point we have a functioning home gateway/router box. Take a device, connect it to VanNetwork and take a moment to revel in your accomplishment!

1 comment:

  1. So are there pics of the hardware install or do I have to come over with a growler to see it?