Some Bits: Nelson's log

9 posts about tomato

OpenWRT second impressions

I’ve been running OpenWRT for a few days now. I like it. I also don’t like it. I’m going to keep running it, and will probably install it on any new routers in the future.

The part I like is it feels like a “real Unix”. I trust that it’s going to do its job right, or if it doesn’t I have access to look inside and figure out what went wrong. Tomato has always been opaque, and if it rebooted itself or didn’t do something I wanted I felt powerless to understand or fix it. With OpenWRT it’s all just a Linux distro.

The part I’m on the fence about is that it’s “real Unix”. In particular, that it’s super complicated. The ipchains have some 100+ rules in them, which really are defining about seven “zones”, which really are 4 physical interfaces and maybe 6 aliased interfaces. It’s great that the system is so flexible, but then it also makes even simple things hard.

vnstatThe part I don’t like is that it’s a “real Unix”, complete with that awful lack of usability. You can configure everything but you also have to configure everything. That’s a grand old Unix tradition, see also: Linux-on-the-desktop. As an example, I’d like a simple counter of bandwidth used per month. There’s none installed by default. But here’s a list of 17 tools that might do it. Only a few of those have Web UIs, and only ~half of them are installable via the package manager. And none do precisely what I want, the best I could find is something that churns out hideous 1990s-style gd images. Of course I could build my own, it’s Unix! But I don’t want to build my own.

I think there’s a need for a new router firmware, a nicely packaged distribution based on top of OpenWRT. Take the stock OpenWRT and add the packages that ordinary home router users need. Maybe write / package a few other things, like the monthly bandwidth monitor I would like. Then stick them all together with a nice GUI that ordinary technical savvy people can use, not just Linux/networking experts. Tomato is the model for this, the core Tomato firmware was a beautiful, well documented product. Tomato-on-OpenWRT would be terrific. It all seems doable, OpenWRT is a strong foundation. The only thing I’m not sure about is how hard it’d be to build the web UI. Luci is pretty flexible as a foundation, I think what I’m describing could just be a skin and set of Luci apps. But not sure.

Wireless ethernet bridge success

Frankenstein network success! I managed to turn an old Linksys WRT54GL into a wireless ethernet bridge. It was remarkably difficult. Despite a long history the WRT54GL seems end of life to me, a lot of the hacker firmwares don’t really support it well anymore.

The goal here is to bridge my new fast Internet access from the tree 200 feet away to my house. The router up there works great but right now I don’t have a wire into my house, so only wireless devices with good antennae can use it. A wireless ethernet bridge is perfect for that; it turns that old WRT54GL into what looks like an ethernet switch connected to the router via a magic wireless wire. In theory. Note the WRT54GL is doing very little else in this configuration: no routing, no DHCP, no DNS, etc. It’s acting more like a layer 2 ethernet/wifi device than a layer 3+ Internet device.

The big problem I had was trying to make this work with Tomato/Shibby firmware. It supports ethernet bridging but has some weird and spooky restrictions around WPA2 and bridging mode. I never could get it to connect on the wireless link, probably because of that authentication mismatch.

So back to good ol’ DD-WRT, a 2009 build named dd-wrt.v24_mini_wrt54g.bin. Downloaded that, followed some instructions, and bridging was working in just a few minutes.

I’m grateful I understand arp; there’s no way to debug or reason about what a bridge is doing without it. The Tomato firmware doesn’t even really present the arp data to you very clearly, you have to ssh in and run the arp binary to see it.

So now I have 4 ethernet ports with fast internet inside my house. Albeit as a temporary setup. How do I get the rest of the network using it? I can just plug the switch for the wired devices into the bridge and it should all work, now DHCPed and routed by the temporary router up by the tree. The problem is I have a couple of wifi-only devices in the house with antennae too weak to reach the tree. So I could repurpose a third router and turn it into an access point for the tree network, that’d be the “right” way to do it permanently. But I want to be able to undo this all and so not screw up that third router, the one that’s my current normal (slow Internet) router.

So instead I’m considering plugging that house router’s WAN cable into the bridge. That should work with much less disruption to the rest of the house network and easy to undo. But it implies we’re doing double NAT for everything which is pretty gross.

Update: I went with the double NAT setup; basically changed my primary home router’s WAN connection from the old Internet link to get Internet via the bridge, which goes to another NAT router, and then the antenna. It may actually be triple NAT; I think the antenna hardware does NAT too. It’s gross but none of my client computers seem to care much. UPnP/NAT-PMP doesn’t seem to be working so no inbound connections, but I can live with that for now. I realized later the “right” setup is for the wireless ethernet bridge to be outside near the tree / antenna, then have my internal router get its WAN connection via that WiFi link. I think DD-WRT or Tomato can be bent to do that but the firmware all assumes your WAN link is coming in that ethernet port on the back. Too much hacking for a temporary thing.

One other thing to mention / option for making this work is WDS, a sort of bridge-like system for wifi networks. The key thing is it allows a device like my WRT54GL to both use the wifi interface as a client and also serve as a repeater / second access point serving that exact same wifi interface. Both Tomato and DD-WRT claim to support it, but it seems pretty spooky to me. Also lots of warnings online it’s not a well defined standard and compatibility is a problem.

I’ve spent a lot of time on a hack that’s only going to be used for a few days. The outside router is sitting in open air on top of a post! Good thing it doesn’t rain in California anymore.

OpenVPN in practice

My Tomato OpenVPN has served me well on this trip to India. Mostly using it to dodge the Taj Hotels’ hostile wifi, with random ports not routed and some porn filter that blocks any news site with embedded video as well as innocuous sites like reddit.com/r/mapporn.

Running the OpenVPN server on the HTTPS port was definitely the right choice.

It takes too long for Tunnelblick to negotiate a connection to my Tomato router’s OpenVPN server. Like 20+ seconds, often 30. Why isn’t it 1 second?

Setting this up on my home cable modem is a bit silly when I have a nice fast 100Mbit server in a colo. Need to learn to set up OpenVPN on Ubuntu. Now that I’ve done this with the Tomato server that seems easy.

Someone needs to make a privacy-only wrapper for OpenVPN, something just to set up VPN tunnels that route the whole Internet. The whole easy-rsa, cert management, etc process I’m doing now is way too complicated for the simple result I get.

Tomato router OpenVPN setup

Got inspired this morning and set up OpenVPN on my router so I can proxy my traffic through it when I’m traveling. I think I got it working.

My goal here is mostly to get a working network environment when on hostile hotel wifi. I don’t really care about encryption security, although that’d be nice, and I explicitly don’t want to bridge my network so it looks like I’m inside my house LAN. Purely a tunnel for working around badly configured public networks. I may still be better off just buying VPN tunneling via Cloak or something similar with a simple client and reliable servers, but I wanted to try it myself.

For my server, the Tomato firmware on my router has an OpenVPN server built in, under the “VPN Tunneling” tab. It’s just like all the other Linksys-derived open router firmwares, but is poorly documented. So I followed this DD-WRT guide for the basic outline of what to do and an article about Tomato for some specifics of what’s in the Tomato GUI. The OpenVPN docs look quite good too, but I didn’t use them.

Key configuration options I altered:

  • Basic: Start with WAN, TUN interface, TCP protocol. VPN subnet 192.168.23.0; I think this can be most any private use network but you want it to not conflict with whatever public network you might be on.
  • Advanced: do not push LAN to clients. Do direct clients to redirect Internet traffic. Respond to DNS and advertise it.

I’m not positive that TCP is the right thing. I did that because on a badly configured network TCP is more likely to work than UDP. But UDP is probably the right protocol to be using for tunnel traffic. It’s a shame you can’t easily just do both in the server config.

Generating keys is harder, you’re quickly in the morass of X.509 certs and OpenSSL. Fortunately the easy-rsa package automates most of this for you, creating your own certificate authority and keys and certificates for both server and clients (a big pile of .crt and .key files) Don’t forget to build-dh to set the crypto up, too, building dh2048.pem. Should build a key for each client, with an easily remembered name. ./build-key name

For the MacOS client I’m using TunnelBlick. It seems surprisingly good and usable for open source software, I’m curious why folks prefer the commercial Viscosity. Installation was mostly straightforward. The wrinkle is you need a .ovpn file to configure the client. Happily, TunnelBlick will generate a template for you; just alter a few parameters like the VPN server name. You also need to copy a client key over, one of the ones you generated with easy-rsa.

For the iOS client I’m trying OpenVPN Connect, which I think is the only realistic option. It seems to work. The process of configuring the client and keys is pretty ugly, the only one that really would work for me was using iTunes file sync to copy stuff to the client.

It all seems to work. It’s a bit hard to test since I’m inside the network I’m then tunneling through, but I could verify that the clients connected and were given addresses in the VPN network block. I need to go to another network to verify it’s really tunneling traffic right.

Shame the usability on this stuff isn’t better. It suffers from crypto-nerd security-over-usability disease. OpenSSH nailed the whole “generate crypto automatically” thing years ago, since these certs are only self-signed all the authentication and naming stuff should be ignorable. Would also be nice if the OVPN file contained the key material as well so you just had a single file to install. Even a zip file would be better.

Bad default QoS settings in Tomato/Shibby

I had a problem with the QoS settings in my new router firmware where file downloads weren’t using the full network bandwidth. Even if nothing else was trying to use the network, I was being limited to about 2/3 capacity. Finally figured out the cause: the default Inboumd Rates classified “WWW” and a bunch of other stuff to max out at 60%. I don’t think that’s an appropriate setting for home installations. The QoS should be there to give all TCP flows fair scheduling and, ideally, give important traffic higher priority. Bandwidth reservation is sort of a last resort.

The problem is the Tomato/Shibby QoS settings are very complicated. The key thing are the rate limits in the QoS/Basic Settings page, particularly Inbound for traffic coming into the router from the Internet. Here’s where I ended up:

Screen Shot 2014-05-24 at 7.53.07 AM

That setting says “all traffic classified as Service should use between 5% and 100% of the bandwidth”. The default setting for WWW was “20% to 60%” or something, or maybe that was FileXfer. Anyway, didn’t make sense. Frankly I think all of these could just be 0–100 and it’d work fine, if I understand correctly the router will still give higher classes more priority.

The other half of this is the classification and that’s gotten quite complex with 43 rules! They mostly seem reasonable to me, services like DNS and NTP are given highest “Service” priority. There’s some crazy Layer 7 classifier picking out applications like Youtube, irc, flash video, and a bunch of games. Sadly no L7 classifier for League of Legends, although given that’s UDP I’m not even sure the QoS settings can do that much.

I added some TCP rules to give my Roku device Media classification. Seems to work, I was able to reliably stream high quality video off Twitch using 25% of my bandwidth while 4 other TCP flows were downloading at max possible rate from an NNTP server.

The Tomato “View Graphs” pie charts are really useful, the pie charts for Bandwidth Distribution show current classification and flows. “Zoom graphs” is useful, it shows unused bandwidth as a white wedge.

 

Using Tomato to make a wireless access point

I need a second wireless access point in my house, to deal with crappy wifi signal strength through lathe-and-plaster walls. I’m using an ASUS-RT16N running Tomato/Shibby to do this.

There’s a bunch of ways to string together wireless networks. There’s wifi repeaters (no wires), ethernet bridges, WDS, blah blah. This system is acting as a wireless access point; its whole job is to accept traffic on a wifi network and then share it to a wired ethernet.

In a nutshell, the configuration is to plug the house ethernet into one of the LAN ports on the router (not the WAN!). Then disable the WAN interface entirely in Tomato, and statically configure the router to a specific IP address on your wired network. Then set up the WAN as you’d want.

Here’s some details from Toastman. It looks a little different with the Shibby build, the LAN configuration is now hidden in this complicated bridge thing. But the idea is the same. One hint I picked up from elsewhere is to also go into the Administration thing and change the skin / color of the UI, just so you don’t get it confused with your main router.

Tomato on the ASUS RT-AC66U

I thought I had the router thing all figured out and then I decided I wanted 5GHz wifi so I bought an ASUS RT-AC66U. At $180 ASUS still isn’t managing to ship working firmware, although it is better than it used to be. Seems to be based on a reskinned Tomato version that’s not entirely awful. I did have a few problems though; unreasonable sluggishness if I’m running BitTorrent, and the DNS server seemed to simply block occasionally until some unrelated TCP download on my network completed. Stupid.

I thought I’d try something new so I went with the Merlin’s Tower firmware. It’s a lightly patched stock ASUS firmware, fixing a few bugs and adding a few features. It kind of worked, but I still had the sluggishness and DNS problems and it made me sad. For some reason I’ve never liked DD-WRT. So today I’m going back to my favorite, Tomato.

Except Tomato is a mess. The original release is no longer updated, without any notice on the site. Tomato-USB is also abandoned, as is Toastman’s versions. The best bet seems to be Tomato Shibby. Don’t be put off by the Polish language and awful site design, the guy’s serious and is doing a good job on firmware development.

In the end I found this guide to firmware updating helpful, along with these instructions for using tftp instead of ASUS’ proprietary firmware flasher. Once I found the right firmware version it mostly worked. Although man it takes a long time to boot, like 60+ seconds.

Configured more or less like the last one. One bug in the Shibby firmware; first time it boots it doesn’t recognize the 5GHz wireless adapter. You have to reboot it once. Details in this video.

Had to choose yet another DDNS service. I used dyndns for years, sad they finally left the valuable free market. Hover still has no DDNS support either. And couldn’t figure out how to use ASUS’ own service from Tomato. I used this guide (possibly spam) to find my way to freedns.afraid.org which is kind of neat and has thousands of hostnames to choose from. I settled on us.to. There’s a bit of magic where you have to grab the “token” out of freedns’ wget script to configure Tomato.

I should give up on this consumer stuff entirely and buy a serious router. At $180 for the ASUS gear it’s not exactly a bargain. Next project is to add a second access point upstairs, fortunately I have lots of ethernet drops.

Tomato (Toastman) router config

Here’s some of the config I give my Tomato (Toastman flavor) router:

Basic / Network: DHCP is 192.168.0.2 - 192.168.0.63. Lease 1440. Wireless is WPA2 Personal security, Encryption is TKIP/AES. Wifi is currently auto channel, 20MHz wide. 40MHz is an interesting 802.11n option I’ll play with later.

Advanced / DHCP/DNS: I have “Use internal DNS” checked on. Not sure if this is wise, particularly since I can’t figure out how to override what DNS servers the router uses (presumably the ISP’s advertised on DHCP?) I mostly tell my computers to use Google DNS anyway, so maybe this doesn’t matter.

Advanced / Firewall: respond to ICMP ping. Not responding to ping is just stupid; it offers no meaningful security and makes diagnostics harder.

Port Forwarding / UPnP/NAT-PMP: enable both UPnP and NAT-PMP

QoS: enable QoS, this is the best feature of all of Tomato. It makes things work well if you can estimate your bandwidth limits. Note that “Outbound” refers to upload speed, packets leaving your house and going to the Internet. That’s the slow side on a DSL line. Also I turn on prioritize ACK packets (why isn’t this on by default?!)

Administration / Admin Access: enable SSH at startup. (No remote access, of course.) Save my SSH key.

Administration / Bandwidth Monitoring: enable, save to JFFS every 24 hours. Screw it if it’s not recommended.

Administration / IP Traffic Monitoring: enable, save to JFFS every 24 hours.

Administration / JFFS: enable, format.

Some settings to do once the router is installed:

Basic / Network: is 40Mhz channels wise?

Basic / DDNS: this is very useful, I’ve been using dyndns.com for years and it works great via Tomato.

Basic / DHCP/ARP/BW: another useful option, give static IP addresses to known computers.

Advanced / Conntrack: the default Toastman timeouts for NAT tracking seem awfully short, we’ll see how that works.

Advanced / Wireless: Transmit power was only 17 mW on this router. My old WRT54GL defaulted to 42mW. These may or may not be directly comparable numbers. Some discussion on this setting is here and here, no one seems to have any idea what they’re talking about.

Update I tried changing this from 17mW to 100mW and saw no measurable difference in RSSI on my laptop, or throughput, or anything. I only tested with a laptop very near the router already enjoying -55dBm (as measured via the Mac’s Wi-Fi diagnostics). So if the setting is most useful for distance I wouldn’t notice it. I left it back at 17mW. I am a bit peeved that my 802.11n laptop can only do 10mbits/sec to an 802.11g Mac Mini, despite a theoretical 54mbits/sec connection. Update 2: getting 22mbits/sec now, after rebooting the Mac Mini. Now it’s in 802.11n mode as well. But all on a mixed mode 2.4GHz network and with 20MHz wide bands.

Port Forwarding / Basic: haven’t set this up yet. I’m discouraged that it’s displaying an error “iptables-restore: line 39 failed”

QoS: check caps for the live network and set in place

QOS / Classification: Toastman has enabled a bunch of service classes. Would be nice to check if they are reasonable.

USB and NAS / FTP server: enable on LAN only. (Geez!)

Administration / Logging: remote log to syslog, particularly DHCP traffic. Big help for narrowing down problems.

Update 2: someone named “vibe666” commented “I saw your post about your router and that you are using TKIP/AES.  drop TKIP and just use AES on it’s own as TKIP is both a) not very secure, and b) pretty much obsolete anyway, and c) likely to be slowing down your wifi speeds overall to keep (potential) backwards compatibility with stuff almost nobody has anyway. :)”

Router notes

The Internet router continues to be the most important computer in a house. It’s also the most likely to be garbage. For a long time I’ve done well with Tomato firmware on a WRT54GL, but that config is starting to get long in the tooth. Tomato hasn’t been updated in a couple of years, the WRT56GL doesn’t do 802.11n, and in general the world has moved on.

After some research I settled on what I think is the new consensus setup, confirmed in part by Jeff Atwood’s suggestions.

Router hardware: ASUS RT-N16. It’s the popular hacker router now and at $80, a reasonable price. The big drawback is it’s 2.4GHz only, no 5.0GHz. I don’t much care about 5GHz. If I did, I’d consider an ASUS RT-N66U instead. But that’s $160 and at that price you start wanting a real PC, not a router appliance. My understanding is 802.11n will work on 2.4GHz co-existing with 802.11g and 802.11b, albeit at reduced performance.

Router software: a TomatoUSB variant, the Toastman builds. TomatoUSB is the continuation of Tomato but it itself stopped seeing development about a year ago. Toastman has picked up the mantle. The key feature he added that I need is per-IP bandwidth monitoring. Another popular choice is Tomato by Shibby, an alternate TomatoUSB variant. It looks good too. (Aside: it’s a shame none of these firmwares are nicely packaged. Half of what made Tomato so good is it was a very professional release with a great manual and UI. Very unusual for fan-produced hackerware.)

Toastman releases a zillion different builds. The one I picked was tomato-K26USB-1.28.7500.4MIPSR2Toastman-RT-Ext. Note the file is hosted at some ghetto download service you have to register for free with. Ugh.

First installation is a challenge; the stock ASUS firmware doesn’t like the build and ASUS’ software to reflash a router is Windows only. These TFTP instructions seem reasonable and mostly worked on my Mac. The weird thing is the ping to the router sort of failed before the tftp; first 10 packets didn’t come back. I just left the ping running and the tftp magically worked.

After the tftp there’s no visible sign anything’s going to work. So I held my breath and rebooted, and there’s a stock Tomato/Toastman router. Hooray! Next blog post will be about configuration options; there’s a lot. The default config is reasonable except there’s a typo in the DHCP range and some dumb things like an FTP server running on the WAN port.