Raspberry Pi
The scope of this article is the installation steps taken to produce a local area network using a RaspberryPi 3, running Raspbian Jessy Lite, with a bridged internet connection via an Ethernet cable to facilitate both the Hackers & Designers workshops around basic Unix and program skills for designers, and the Frankenstein Bot workshop by Constant.
Code blocks that begin with "$" denote terminal, command line instructions, all other code blocks denote configuration files and/or program source code.
In all locations where "vi" is used, feel free to use another text editor of your choice (ex. nano).
Setting up the network
These instructions are taken largely from here, but are reiterated in the case article disappears from the internet.
We need to tell dhcpcd to ignore the wlan0 interface.
$ sudo vi /etc/dhcpcd.conf
Add the following line to the bottom of the file:
denyinterfaces wlan0
wlan0 will need a static ip address.
$ sudo vi /etc/network/interfaces
The file should contain, everything else can be commented out or deleted:
auto lo iface lo inet loopback allow-hotplug eth0 iface eth0 inet dhcp allow-hotplug wlan0 iface wlan0 inet static address 10.1.1.1 netmask 255.255.255.0 network 10.1.1.0 broadcast 10.1.1.255
Install hostapd, and configure it.
$ sudo apt-get install hostapd
$ sudo vi /etc/hostapd/hostapd.conf
interface=wlan0 driver=nl80211 ssid=Hackers & Designers hw_mode=g channel=6 ieee80211n=1 wmm_enabled=1 ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40] macaddr_acl=0 ignore_broadcast_ssid=0
$ sudo vi /etc/default/hostapd
Uncomment and set the following value:
DAEMON_CONF="/etc/hostapd/hostapd.conf
Install and configure dnsmasq.
$ sudo apt-get install dnsmasq
interface=wlan0 listen-address=10.1.1.1 bind-interfaces server=8.8.8.8 domain-needed bogus-priv dhcp-range=10.1.1.50,10.1.1.250,12h
For the purposes of the Frankenstein "hovel" bot, also uncomment:
log-queries log-dhcp
Setup IPv4 forwarding.
$ sudo vi /etc/sysctl.conf
Uncomment the following line.
net.ipv4.ip_forward=1
Execute the following.
$ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE $ sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT $ sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT $ sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
To ensure the forwarding persists beyond restarts.
$ sudo vi /etc/rc.local
Add the following line before exit(0).
iptables-restore < /etc/iptables.ipv4.nat
Restart and verify the network is working.
$ sudo reboot
Frankenstein Bots (IRC)
The Frankenstein bot project requires an IRC server. I use UnrealIRCd for this.
Install ssl.
$ sudo apt-get install libssl-dev
Download UnrealIRCd, for example (but maybe check the versions etc.).
$ wget 'https://www.unrealircd.org/unrealircd4/unrealircd-4.0.4.tar.gz'
Untar, change directory.
$ tar -zxf unrealircd-4.0.4.tar.gz $ cd unrealircd-4.0.4/
Configure.
$ ./Config
It will ask a lot of questions, I accepted all the defaults.
Build, Install.
$ make $ make install
Start.
$ cd ~/unrealircd $ ./unrealircd start
It may complain you need to create a configuration file. You can find how to do that here