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:192.168.2.244 Bcast:192.168.2.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 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@192.168.2.244 |
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 http://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/ 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.
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:- uncomment the line #authoritative
- add the following text to the end of the file:
In addition, we need to edit /etc/default/isc-dhcp-server and update the line
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.20 192.168.1.50;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "mobile";
option domain-name-servers 192.168.1.1;
}
INTERFACES=""
to read
INTERFACES="wlan0"
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 address 192.168.1.1 netmask 255.255.255.0 |
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:
interface=wlan0 driver=rtl871xdrv ssid=VanNetwork hw_mode=g channel=6 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 #wpa=2 #wpa_passphrase=Raspberry #wpa_key_mgmt=WPA-PSK #wpa_pairwise=TKIP #rsn_pairwise=CCMP |
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
#DAEMON_CONF=""
reads
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Configure Network Address Translation
The steps I took are exactly as given in the guide I followed (http://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software), 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!
So are there pics of the hardware install or do I have to come over with a growler to see it?
ReplyDelete