Ansible playbook for a raspi wireless router running Debian/Raspbian
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
roles/main
ansible.cfg
hosts.local
playbook.yml
readme.markdown

readme.markdown

RASPBERRY PI WIFI ROUTER

Use your raspberry pi to provide wifi to your home! It can be a higher up-front investment than a normal router, but in the long-term your only expense should be buying new wifi adapters as new technologies come out.

I've been running my own wifi router for 2.5 years now. The first version was based on a beagleboard-xM and ran ArchLinux. But I find a Raspberry Pi with Raspbian to be much more stable.

PARTS LIST

  • Raspberry Pi 2 Model B - $35
  • You'll need a case and power supply for the Raspberry Pi as wel
  • Alfa AWUS051NH for 2.5Ghz network - $50
  • Alfa AWUS052NH for high speed 5Ghz network - $50
  • Samsung 64GB PRO Class 10 Micro SDXC for super fast IO - $60
  • Sabrent USB 3 hub HB-W4U3 - $25
  • Short ethernet cable to connect to your cable modem

FEATURES

  • Software: tmux, git, vim, hostapd, dnsmasq, nodejs, php5, nginx, vnstat, rtorrent
  • Two wifi networks: 2.5Ghz and 5Ghz
  • dnsmasq acts as DHCP server and local DNS cache so you can blackhole facebook or other domains easily
  • iptables firewall rules allow incoming torrent connections, but blocks all other incoming traffic
  • Ethernet port configured to use Google's nameservers, overriding your ISP's settings

INSTALLATION

Copy Rasbian image to you memory card

dd bs=4M if=./rasbian.img of=/dev/mmcblk0

Adjust the partitions on your card using GNU parted.

Copy this git repo to your memory card

Install memory card in your Raspberry Pi. Hook up a keyboard, monitor, USB hub and wifi adapters and boot it up!

Set up your locale and keyboard

sudo dpkg-reconfigure locales
sudo dpkg-reconfigure keyboard-configuration

Update the software before you proceed.

sudo apt-get update
sudo apt-get upgrade

Mount your home directory if you created another one during partitioning with parted.

Install ansible

sudo apt-get install ansible

Configure your wifi network names and passwords. Edit conf files in roles/main/templates/hostapd/.

Bootstrap! Tell ansible to use a local connection instead of trying SSH.

ansible-playbook ./playbook.yml -i hosts.local -c local

Success and profit?

TODO

  • Use ansible vars for: hostname, wifi network names, wifi passwords,

NOTES

dpkg-reconfigure locales en-US.UTF8

dpkg-reconfigure keyboard-configuration US 105 key

  • manually mount home directory?
  • make sure /home/pi is user id 1000?

http://unix.stackexchange.com/questions/128439/good-detailed-explanation-of-etc-network-interfaces-syntax/128662#128662

https://lists.debian.org/debian-boot/2007/07/msg00375.html

http://www.shallowsky.com/linux/networkSchemes.html#hotpluggable

http://unix.stackexchange.com/questions/192671/what-is-a-hotplug-event-from-the-interface

https://wiki.debian.org/NetworkConfiguration