Time based access control with iptables, cron and at

Until today I handled scheduled internet access for my daughters devices via my Apple AirPort Extreme that is configured as a bridge between my wired and my wireless network at home.

This setup has worked flawlessly for quite some time. There is one catch to this set up though. Each time I want to make an exception to the time based internet access rules I need to reconfigure and restart the AirPort Extreme. The restart takes a minute or two during which there is no wireless network for anyone at home. I guess that you can relate to the sheer panic that occurs in our home during that time.

The router/firewall/server/etc that I run at home is a Ubuntu 16.04 box running on a physical machine with two network cards. This machine now handles the time based internet access.

I decided to use iptables, cron and at in a small shell script, that you can find at the end of this article, since they are all proven tools that I am familiar with.
Continue reading “Time based access control with iptables, cron and at”