No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

CHOICE Map Router

What is this?

This is a Node.js app that shows what devices are connected to a Raspberry Pi-based router by their hostname.

It also:

  • Creates a new Wi-Fi access point and can bridge an Internet connection from an existing router or modem.
  • Shows a notification when a device that hasn't been seen before connects to the router.
  • Provides the option to block a new device from connecting to the router, immediately or after some time has passed.
  • Persists what devices have been seen and what has been blocked between sessions.
  • Allows an icon to be assigned to a device to help people identify them.




  • Raspbian with Pixel (tested with version 2016-11-25, Download ZIP)
  • Node.js v6.9.4
  • Chromium


Prepare Raspberry Pi

  1. Install the screen.
  2. Copy Raspbian to a microSD card, insert into the Raspberry Pi and power on.
  3. Configure the orientation of the touch screen by running sudo nano /boot/config.txt and appending lcd_rotate=2. Reboot.
  4. Run sudo raspi-config to expand the filesystem, enable SSH and change the hostname to something like choice-router. Reboot.
  5. Run passwd to change the default password.
  6. Install latest updates with sudo apt-get update && sudo apt-get upgrade -y. Reboot.
  7. If required, install drivers for the USB Wi-Fi adaptor. The TP-LINK TL-WN823N was installed with these commands:
tar xzf install-wifi.tar.gz
sudo ./install-wifi
sudo reboot

Create Wi-Fi access point

  1. Install dependencies with sudo apt-get install hostapd isc-dhcp-server netatalk iptables-persistent -y. Note: iptables-persistent will prompt you twice. Answer "Yes" each time.
  2. Run sudo nano /etc/dhcp/dhcpd.conf.
  3. Comment out these lines:
option domain-name "";
option domain-name-servers,;
  1. Uncomment this line:
  1. Add these lines to the bottom of the file:
subnet netmask {
    option broadcast-address;
    option routers;
    default-lease-time 600;
    max-lease-time 7200;
    option domain-name "local";
    option domain-name-servers,;
  1. Save and exit.
  2. Run sudo nano /etc/default/isc-dhcp-server.
  3. Find INTERFACES="" and change it to INTERFACES="wlan0".
  4. Save this file and exit.
  5. Run sudo ifdown wlan0 to turn off the Wi-Fi adaptor.
  6. Run sudo nano /etc/network/interfaces.
  7. Replace the entire file with the following:
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
  1. Save and exit.
  2. Run sudo ifconfig wlan0
  3. Run sudo nano /etc/hostapd/hostapd.conf.
  4. Paste the following into the file. Change wpa_passphrase=XXXXXX to something else.
  1. Save and exit.
  2. Run sudo nano /etc/default/hostapd.
  3. Change #DAEMON_CONF="" to DAEMON_CONF="/etc/hostapd/hostapd.conf".
  4. Save and exit.
  5. Run sudo nano /etc/init.d/hostapd.
  6. Change DAEMON_CONF= to DAEMON_CONF=/etc/hostapd/hostapd.conf
  7. Save and exit.
  8. Run sudo nano /etc/sysctl.conf.
  9. At the bottom of the file add net.ipv4.ip_forward=1.
  10. Save and exit.
  11. Run the following commands:
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
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/rules.v4"
  1. Run sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf and check if the Wi-Fi access point has started. Press CTRL + C to exit this test.
  2. Run the following commands:
sudo service hostapd start
sudo service isc-dhcp-server start
sudo update-rc.d hostapd enable
sudo update-rc.d isc-dhcp-server enable
  1. Reboot.

Install Node.js

  1. Download Node.js with wget
  2. Extract it with tar -xvf node-v6.9.4-linux-armv7l.tar.gz.
  3. Move into the extracted folder with cd node-v6.9.4-linux-armv7l.
  4. Install Node.js with sudo cp -R * /usr/local/.
  5. Test the installation by running node -v && npm -v.

Install this app

  1. Clone this repository with git clone
  2. Move into the repository folder with cd map-router-app.
  3. Run npm install to download it's dependencies.
  4. Run cp router.db.empty router.db to create a blank database file.


  • The Wi-Fi access point should be immediately usable.
  • The app is started by running sudo node index.js inside the repository. It must be run as sudo allow device blocking to work.
  • The interface can be accessed in Chromium at http://localhost:3000.
  • The database file can be reset by running cp router.db.empty router.db again and can be edited on macOS with DB Browser for SQLite.
  • This file changes /etc/dhcp/dhcpd.conf to block devices and reads /var/lib/dhcp/dhcpd.leases to get hostnames.