Plugged in and customized

I received my TonidoPlug after a 6 week wait post placing order. Tonidoplug is a low cost : 100$ + 30$ shipping to India + 560INR in duties, low power: of the order of 5W computer that runs Ubuntu. The first thing I set up on the plug was a static dhcp server. I wanted each device to have a fixed IP address that was centrally managed. The Tonido software that comes built-in with the plug computer sadly lacks a DHCP server module.

Not to be undone, I installed dhcp server via apt-get (this is ubuntu, after all) and set it up with a dhcpd.conf that looks like this:

TonidoPlug, an iPhone for size comparison and a Transcend storejet external hard drive connected to the plug via a powered USB hub to prevent hosing the 5W PSU of the plug.

TonidoPlug, an iPhone for size comparison and a Transcend storejet external hard drive connected to the plug via a powered USB hub to prevent hosing the 5W PSU of the plug.

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option domain-name-servers 192.168.1.1;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
}

host desktop {
hardware ethernet 00:XX:XX:XX:XX:XX;
fixed-address 192.168.XX.XX;
}
host laptop {
hardware ethernet 00:XX:XX:XX:XX:XX;
fixed-address 192.168.XX.XX;
}

host phone {
hardware ethernet 00:XX:XX:XX:XX:XX;
fixed-address 192.168.XX.XX;
}

All the TonidoPlug features on its front is an ethernet and an USB port. The iPhone on it is for size comparison.

All the TonidoPlug features on its front is an ethernet and an USB port. The iPhone on it is for size comparison.

My BSNL model has a propensity to lose the PPP connection to the DSL server, which requires its reboot. I wrote a small script to check the connection  by pinging Google and rebooting the modem if ping fails.

#!/usr/bin/python

# To do important stuff
import os

# To log all my actions
import logging
import logging.config

# Init the logger
LOG_FILENAME = ‘/path/to/modemlog’

# Set up a specific logger with our desired output level
logger = logging.getLogger(‘ModemLogger’)
logger.setLevel(logging.DEBUG)

# Add the log message handler to the logger
handler = logging.handlers.RotatingFileHandler(
LOG_FILENAME, maxBytes=2048, backupCount=3)

# This is the format of the log
formatter = logging.Formatter(“%(asctime)s – %(name)s – %(levelname)s – %(message)s”)

# Set the formatter
handler.setFormatter(formatter)

# Set the handler
logger.addHandler(handler)

# Actual operation! Ping and see!
result = os.system(“ping -c 4 www.google.co.in”)

if result != 0:
#Ping not working, reset the router
os.system(“/usr/bin/curl -u admin:password 192.168.1.1/rebootinfo.cgi”)
logger.error(“Ping not working, router reset”)
else:
logger.info(“Ping check passed.”)

Of course, this meant I had to install curl, which I installed with apt-get. I then proceeded to add this script to the crontab so that the router connection would be checked every 15 minutes.

Top view of the TonidoPlug. It's rear only features a power connector. You could either directly connect it to a power socket or use the extension power cable.

Top view of the TonidoPlug. It's rear only features a power connector. You could either directly connect it to a power socket or use the extension power cable.

# m h  dom mon dow   command
0,15,30,45 * * * * /path/to/scripts/check_connection.py

The TonidoPlug provides a very nice redirection service via tonidoid.com. I am therefore able to access the plug from anywhere as long as the Internet connection to the plug is functioning. However, I thought the ability to ssh into the plug from elsewhere would be nice. Therefore I poked holes in my router’s NAT. I didn’t want to get another dynamic DNS service, so I wrote another small script that would ping a specific location on this site, which would then record the IP address of the place it was pinged from. I added this script to the plug’s crontab.

# m h  dom mon dow   command
0,15,30,45 * * * * /path/to/scripts/update_ip.py

Now I had a way to get the Plug’s external IP from my personal, albeit lame, dynamic dns service 🙂

The next problem I had was with the hard disk shutting down due to inactivity after 10 minutes. So I wrote another small script to append to a dummy file on the hard disk every 9 minutes (except once an hour at 6 minutes).

# m h  dom mon dow   command
0,9,18,27,36,45,54 * * * * /path/to/scripts/keephddalive.py

Isometric view :)

Isometric view :)

Now I’ve been running the plug computer and the disk for a couple of days. Using the built in torrent client to boost my share ratio in some sites where I need it!

The plug, being a device with no moving parts, is totally soundless. This is ideal when you plan to leave it on all the time. It also gets merely warm to touch after a few days of continuous operation. The transcend external hard disk is pretty quiet too.

I haven’t gone into the main feature of the product, that is the Tonido Software. This is what allows you to manage the device from anywhere with an internet connection. I’ll try and write about my use of it some other time. For now you’ll have to be satisfied with a few screenshots 🙂

The log in screen

The log in screen

The things you can do with the Tonido software

The things you can do with the Tonido software

General interface with the navigation on left

General interface with the navigation on left

The built in torrent client

The built in torrent client

Enabling and disabling built-in applications, there is also a app-store, though not much is there in it yet.

Enabling and disabling built-in applications, there is also a app-store, though not much is there in it yet.

The admin and statistics application

The admin and statistics application

Activating an application, the web dialog box

Activating an application, the web dialog box

Activating an app, the please wait widget

Activating an app, the please wait widget

Comment using facebook

4 thoughts on “Plugged in and customized

  1. Neat li’l write-up.

    Some Qs I have,

    1. The BSNL router/modem hang – It’s a workaround what ou have done right? Why not solve the real problem?
    2. HDD inactivity shut-off: Again, there should be a way to shut it off right? or, power-on-wake or something should exist right?

  2. Pingback: RajeshGoli.com» A rails iPhone webapp

  3. hey I was wondering whether I could use the project “Banna” by Mr. Rajasheker? Its available on ur website.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please leave these two fields as-is: