Thursday, June 28, 2012

Tomato, the Macintosh, and the Asus RT-N16

If like me you read Jeff's post, bought an Asus RT-N16 intending to run Tomato, realized that the way Jeff upgraded his firmware was by using the Windows-only manufacturer-supplied utility, and you only have a Mac handy—then this post is for you. Below are instructions for upgrading the router's firmware from the terminal, assembled from a few existing articles, and personally validated by me.

Pre-requisites: some comfort at the command line, some familiarity with firmware upgrades.

First of all:

  1. Download the appropriate Tomato USB firmware. You'll need a "Kernel 2.6 for MIPSR2 Routers" version; I used Ext build 54, and I've read that the VPN build works too. Either way you're going to end up with a file like tomato-K26USB-1.28.9054MIPSR2-beta-Ext.trx.
  2. From the menu bar icon, turn off the Wi-Fi on your Mac. We'll not be using that interface.
  3. Connect your Mac via ethernet cable to LAN Port 1 on the router.
  4. Turn the router on.

Now, to perform the upgrade, open Terminal.app or your preferred terminal.

1. Turn off your Mac's ethernet interface:

Isaacs-MacBook-Air:~ isaac$ sudo ipconfig set en0 NONE
Password:
Isaacs-MacBook-Air:~ isaac$

2. Reset the router's NVRAM: hold down the WPS button on the back of the router for 30 seconds. Still holding the button, unplug the router and wait for 30 more seconds. With the button still held down, plug in the router and wait 30 more seconds. Now release the button.

3. Now put the router in recovery mode: unplug it, and then plug back in again while holding the "Recovery" button.

4. Bring your Mac's ethernet interface up with a manually-configured address

Isaacs-MacBook-Air:~ isaac$ sudo ipconfig set en0 MANUAL 192.168.1.2
Isaacs-MacBook-Air:~ isaac$

5. Confirm that you can ping the router at 192.168.1.1:

Isaacs-MacBook-Air:~ isaac$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=64 time=0.053 ms
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.217 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.080 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.093 ms
^C
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.053/0.111/0.217/0.063 ms
Isaacs-MacBook-Air:~ isaac$

6. Upload the new firmware using tftp, and wait 90 seconds:

Isaacs-MacBook-Air:~ isaac$ tftp 192.168.1.1
> binary
> put tomato-K26USB-1.28.9054MIPSR2-beta-Ext.trx
6284824 bytes, 2.8 seconds
> q
Isaacs-MacBook-Air:~ isaac$ sleep 90
Isaacs-MacBook-Air:~ isaac$
(update 8/31/2014: some folks have reported their routers to take much longer than 90 seconds to install the newly uploaded firmware. If in doubt, or having problems, you may want to wait up to an hour or two)

7. Unplug the router, and plug it back in again with the WPS button held down. Hold for 30 seconds as the router boots up.

8. Swtich your Mac's ethernet to DHCP:

Isaacs-MacBook-Air:~ isaac$ sudo ipconfig set en0 DHCP
Password:
Isaacs-MacBook-Air:~ isaac$

9. Open the configuration page at http://192.198.1.1/ (username admin, password admin) and change the admin password.

10. Enjoy Tomato!

Wednesday, June 27, 2012

One thing I find rewarding

I've been realizing this recently:

It's honestly a privilege.

My first job after my post-grad was in 1996, writing software for use by pharmaceutical companies doing animal testing. I joined an investment bank in London a year later—one of the few people, I suspect, actually to move to higher moral ground in joining the financial sector. Since then I've worked at a tiny London startup, an enormous US telco, a small specialized software product company, Google, and now Twitter.

At every single place along the way I've met great people. There are folks I'm still in touch with, and happily so, from all of these places. I love learning things and I've learned a ton. I enjoy challenges and I've faced them everywhere I've worked, without exception.

Out of the set, though, only Twitter is all about a product I really love and it makes the hugest difference. It's a lot to compete with.

Friday, June 15, 2012

New Arrival

Unlike last time, this one was really pretty sudden.

Wendy had been having contractions for most of the evening but it didn't seem like anything was imminent. I even tweeted:

That was at 10.04pm.

At 11.15pm when we were going to bed, Wendy said she thought that she might actually be going into labor. I called ahead to the hospital, we asked our friend Matt to come over to watch Lux for the night, and we drove to the delivery ward. From this photo it looks like we were settled into our room about 40 minutes later:

um, hi

Pretty much straight away the hospital staff confirmed that they were going to do a c-section and get our baby out. They paged the relevant people and started preparing, and by about 2am we were going into the operating room:

current status

Boy, don't things go quickly from there! At about half past two we met our new family member:

Baby!
and here she is, ten hours old:
@thesprouut
Hand

Lux met her the very next day. She was, and is, transfixed:

@thebeean meets @thesprouut
as well as so very gentle:
@thebeean meets @thesprouut

Wendy and the baby both made amazing recoveries and were discharged from hospital two days ahead of schedule. Born 2.33am PDT on 12 June 2012, weighing 7½lbs, we're thrilled to welcome Cecilia Hepworth to the world and to our home.

See a few more photos here.

Tuesday, June 05, 2012

An RFC 1912 mea culpa

This blog's been powered by Blogger for over a decade. That takes it back to a short while even before Blogger was acquired by Google (Blogger founder @ev would later found Twitter, where I work). Back in 2002 I was using FTP to host it myself, and had this splash page:

isaachepworth.com, 2002

In 2003 I upgraded to a zeitgeisty orange

isaachepworth.com, 2003
but continuing the square photos motif.

This design stuck until Spring 2006, when I applied for a job at Google. At that point I switched to a more conservative look (yeah, whatever), ultimately settling on the current theme "Minima" (by coincidence created by Doug Bowman, currently Design Director at Twitter).

isaach.com, 2012

Not until 2010, though, did I switch off FTP publishing to my own host—and move to a fully Google-hosted setup with my custom isaach.com domain. That's when the trouble started.

Thing is, I took a few liberties with DNS. To use a custom domain with Blogger you need to CNAME your custom domain to ghs.google.com (which in turn CNAMEs to ghs.l.google.com). It makes a lot of sense that it would work this way, of course it does, but the snag is that DNS doesn't support a CNAME record in the root of a domain (RFC 1912, §2.4, "A CNAME record is not allowed to coexist with any other data", and of course you need your SOA and NS records in the root).

The net is that you can't run a Blogger-hosted blog in the root of a domain, eg. at isaach.com. It's really that simple.

What you can do, though, is ignore this fact and use a DNS provider which allows you to violate the RFC. Hello, zoneedit!

However, be warned. If you go this route then here's what will happen:

  • in the beginning everything will work just fine;
  • over time you'll hear about some people having intermittent troubles reaching your site;
  • you'll blame things on user or configuration error;
  • you'll build pagerank and inbound links to permalinks in your root domain;
  • gradually you'll hear more and more that people can't reach your blog;
  • eventually you'll investigate and identify the issue;
  • you'll spend a weekend futzing with nameservers;
  • you'll curse yourself while configuring permanent redirects from rootdomain.com/x/y/z to blog.rootdomain.com/x/y/z; and
  • you'll write a blog post cautioning others.

My advice, then, writing now at blog.isaach.com: don't mess with the RFCs, even if it seems like you can get away with it.

Friday, June 01, 2012

Beta SF Neighborhoods

Often I've found myself somewhere familiar in San Francisco, thinking "is this technically Mission or Noe or Castro?" — or somewhere completely unfamiliar, thinking "I wonder what neighborhood this is".

So I made this thing. It's an iPhone app which tells you where in San Francisco you are. This is me, at home:

Home

It doesn't show you a map, or tell you the history of the neighborhood, or link to Wikipedia, or provide droll stereotypes or give you vital stats like population or elevation or weather. It just tells you what neighborhood you're currently in—and how far you are from the closest adjacent neighborhood. That's it.

I say "iPhone app" and I mean that in the same sense that Steve Jobs did in 2007 when he announced that the iPhone would support third-party apps. It's a web page.

Add it as a bookmark to the home screen, though, and it's pretty app-like. It works like this

It's barely even a beta; more of a steel thread. But hey, have at it: visit isaa.ch/sf on your iPhone, and add a bookmark to your home screen.

Some limitations, even within the admittedly narrow feature scope:

  • you pretty much have to be in San Francisco for it to be of any use;
  • if you're not in San Francisco then not only will it be no use but the distance calculation (which depends on a pretty rough and ready approximation from spherical to planar geometry) will become less accurate the further you are away; and
  • error cases aren't handled terribly gracefully.

That said, I use it myself all the time and find it useful. Next steps are probably factoring the code into something sane and putting it on Github. Don't hold your breath.