Creating Captive Portal with Tornado and Raspberry Pi

Aniket Maithani (~aniket)




Aim of the workshop

  • The aim of the workshop is to give insights about on how to create Captive Portal using Tornado and Raspberry Pi. This workshop will cover the following aspects.
  • Creating open hotspot using Python and HostAPD
  • Configuring HostAPD on Raspberry Pi
  • DHCP Configuration and Management
  • Creating Basic App using tornado
  • System Process and Runnables
  • Hands on Raspberry Pi

What is a Captive Portal ?

  • A captive portal is a Web page that the user of a public-access network is obliged to view and interact with before access is granted. Captive portals are typically used by business centers, airports, hotel lobbies, coffee shops, and other venues that offer free Wi-Fi hot spots for Internet users.

Advantages of Captive Portal

Captive Portals allow for the separation and segregation of guest traffic. This has tons of security benefits including keeping un-trusted users away from confidential resources through network access control policies.

  • These portals provide data accounting based on time, date and user. This is a standard feature in guest access. Future access to logs will facilitate administrators to find out certain users and their actions in a corporate network.
  • A landing page will serve as a means of identifying your brand as well as a way to boost your marketing message. Companies can take advantage of the virtually limitless potential that captive portals possess to raise brand awareness by utilizing its less obvious abilities.
  • Providing free internet services doesn’t mean that you're always providing secure internet service. An accepted usage policy (AUP) on your active portal ensures that users understand just that.
  • Some users of a free public wireless network may repeatedly connect, using the network on an almost continuous basis for bandwidth hogging activities like downloading music, videos, or other large files. For them you can provide ample bandwidth throttling.


  • Tornado is a Python web framework and asynchronous networking library. By using non-blocking network I/O, Tornado can scale to tens of thousands of open connections, making it ideal for long polling, Web-Sockets, and other applications that require a long-lived connection to each user.

Insight into IPTABLES

  • iptables is a user-space application program that allows a system administrator to configure the tables provided by the Linux kernel firewall (implemented as different Netfilter modules) and the chains and rules it stores.

  • Besides the obvious situations where you might imagine this would be useful, such as blocking long lists of "bad" hosts without worry of killing system resources or causing network congestion, IP sets also open up new ways of approaching certain aspects of firewall design and simplify many configuration scenarios.

  • IPSET : IP sets are a framework inside the Linux kernel, which can be administered by the ipset utility. Depending on the type, an IP set may store IP addresses, networks, (TCP/UDP) port numbers, MAC addresses, interface names or combinations of them in a way, which ensures lightning speed when matching an entry against a set.


Pre-requisite for this talk

  • Basic Idea of IPSET and IPTABLES in Linux
  • Basic Idea of Tornado [If not! then don't worry you can check out sample from here.
  • Audience can bring their own Rasberry Pi (If they have one) else they can use their own Linux Machine for this workshop.
  • For people using their own laptop make sure you have Ubuntu 13.xx + installed on your system
  • And finally Hunger for Knowledge!

Content URLs:

  • [Basic]
  • Code : will be updated soon.

Speaker Info:

My name is Aniket Maithani. I'll keep this short

  • Works @Radiowalla Network Pvt. Ltd
  • Handles Development & Dev-Ops
  • B.Tech (CS&E) graduate from Amity University, Noida (UP)
  • Loves to travel
  • Blog during free time
  • Cricket Lover
  • "CHAI" addict
  • Plays Guitar too!

Section: Network Programming
Type: Workshops
Target Audience: Advanced
Last Updated:


Please upload your presentation for review by the Pycon India Team.


Gourav Chawla (~Gouravchawla)

@Gouravchawla :

Here's the link.

Regards Aniket

Aniket Maithani (~aniket)

Hey Aniket,

Can we have this talk in one of PyDelhi's or Bangpypers upcoming events?

This would help you prepare and reviewers get a idea of your event.


Akshay Arora (~akshayaurora)

@Akshay : Yea sure.

Aniket Maithani (~aniket)

As per the reviewers comment the presentation has been updated. :)

The codebase will be shared in a couple of days. If you want I can do a webcast of this and update the link here for reviewers ease.

Aniket Maithani (~aniket)

Login to add a new comment.