Skip to content
/ pinc Public

A network connection conditioner for a handful of low-end devices in my home office

License

Notifications You must be signed in to change notification settings

phuedx/pinc

Repository files navigation

Pi Network Conditioner

An animated gif is worth a thousand words

What?

Pi Network Conditioner (PiNC) is an application I made to help me quickly throttle the network connections of a number of mobile devices that're all connected to a Raspberry Pi wireless access point. The application runs on the Raspberry Pi, creating and deleting traffic control (TC) queuing disciplines and filters to manage round-trip time (RTT) and bandwidth for each device.

Why?

I work with the Reading Web née Mobile Web team at the Wikimedia Foundation (WMF). The Reading deparment recently had an internal discussion about around how we might better understand users with low-end devices connected to low-bandwidth, unstable mobile networks, somewhat inspired by Cade Metz's "Facebook Workers Ditch iPhones in Push for World Conquest". During the discussion @dr0ptp4kt mentioned that at the WMF offices in San Francisco there's a wireless network that throttles the network connections of all connected devices to a 2G connection, or thereabouts. I, however, nearly always work in London.

How?

PiNC works by assigning traffic from the device to one of a set of pre-defined "network throttling profiles". Each profile is a combination of two TC queuing disciplines (qdiscs): a Token Bucket Filter qdisc that limits the rate at which packets are sent; and a netem qdisc that delays each packet before it is sent.

When a device has its network throttling profile changed, a TC filter is created that matches packets from the device's IPv4 address and assigns them to a "flow" that corresponds to the profiles's first qdisc.

Getting Started

First and foremost you'll need a Raspberry Pi wireless access point. Download a Raspbian Jessie Lite image and write it to an SD card; then follow Lady Ada's "Setting up a Raspberry Pi as a WiFi access point" tutorial, which not only tells you how but how to debug common issues as well.

Both the PiNC service and UI are written in JavaScript. You'll need to download and install Node.js. Fortunately, the latest stable release of Node.js (LTS) is available to download as pre-built ARMv6, ARMv7, or ARMv8 binaries. If you're using a Raspberry Pi 1 Model A, Model A+, Model B, or Raspberry Pi Zero, then you should grab the ARMv6 binaries; whereas if, like me, you're using a Raspberry Pi 2 Model B, then you should download the ARMv7 binaries.

Now that you've got your Raspberry Pi all set up, you can install, setup, and run PiNC on it with the following commands:

git clone https://github.com/phuedx/pinc.git
cd pinc
./script/bootstrap
./script/setup
./script/server

Resources

I've referred to the following while piecing together PiNC:

Feedback

Your thoughts and comments are, of course, always welcome. In descending order of responsiveness, you can:

Shout-outs

I wouldn't have built PiNC without @joakin's support and couldn't have without his initial review.

License

PiNC is MIT-licensed.

About

A network connection conditioner for a handful of low-end devices in my home office

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published