Some Bits: Nelson's log

202 posts about networking

Linux: Multihoming and ARP lies

TIL Linux follows the weak host model of multi-homing. If a Linux machine has more than one network adapter and more than one IP address, it assumes all the addresses belong to the one Linux machine and will gladly accept IP traffic on all those interfaces.

Big surprise to me! I always thought multihoming worked on a per-device notion. In the typical case every interface has its own device name, a MAC address for the device, and an IP address for the device. Nope! A device may get packets sent to it for IP addresses it doesn’t own.

The term “weak model” come from RFC 1122, from 1989. This is not a new idea!

The Linux behavior is on purpose, supposedly because it makes it more likely you can reach a host in case things are a bit wonky. It’s also configurable: if you set arp_ignore to 1 it will “reply only if the target IP address is local address configured on the incoming interface”

WiFi vs Ethernet

I ran into this problem when I gave my Linux desktop a WiFi connection on my LAN in addition to the usual ethernet. For simplicity, let’s say the ethernet is on 192.168.3.10 and the wifi is on .11. Packets go out via the ethernet on .10 because that interface has a higher priority in the routing table. But other devices replying with packets for .10 may send them on the WiFi rather than the ethernet.

Why? Because Linux lies. If an ARP request shows up saying “who has .10 the WiFi adapter will proudly say “I do I do!” injecting its MAC address in everyone else’s ARP cache, despite the adapter not being configured for that address. And packets that show up on the WiFi for .10 will be accepted by the Linux device that’s configured to receive packets on .11. Crazy.

I guess it’s been like this all the time and I haven’t noticed. It seems to cause a practical problem right away though, any machine with both wired and wireless interfaces is randomly using the WiFi without meaning to. I think that’d be a big problem for docked laptops! Maybe no-one notices.

The fact I’ve gone 20+ years without knowing this suggests it may not cause that many problems. Still confusing to me.

Rewiring my network (gear, tiedowns)

I cleaned up all the networking gear in my garage in Grass Valley and tied it all down to a nice little cart. It’s a little more complicated than the usual because I have two separate ISPs and two routers. (The second is a backup, but available all the time on the same LAN.)

The main layout here is networking boxes on the top shelf, A/C power connections on the bottom, and various PoE, USB, and proprietary DC power cables going from bottom to top. Everything comes in and out of the patch panel at back left.

Hardware

The main connection is Starlink plugged into a brand-new Ubiquiti UX7 router with a Ubiquiti Lite-8-PoE switch. That’s the Starlink power supply with the red PoE cable at right, it goes to a dish on the roof. The Ubiquiti boxes are the two white boxes top middle and their USB power supplies at back bottom.

The backup connection is my local WISP. The router is a the blue box at left, an OpenWRT One. There’s a PoE module for the antenna on the bottom. That cable goes to a 400 foot run with a coupler in it before it gets to the antenna in a tree, it’s a miracle it works.

The big black box in lower middle is a Cyberpower UPS. It has a white power strip plugged into the battery backup side.

Tie-downs and physical layout

This is the first time I’ve ever intentionally organized this much network gear. I’m glad I did it!

The patch panel is at upper left, the black box. That was Claude’s idea. It’s a goofy little thing that takes regular keystone jacks in the back instead of a punchdown. It’s basically six couplers in a block, entirely passive. I like it! Makes it much simpler to understand the organization of everything that comes in and out of the network.

All of the boxes are velcro-tied to the wire shelves. This isn’t very good, they slide around and twist and generally aren’t very esccure.

All of the power cables are bundled and zip-tied. The network cables are not. I left them free. I also chose not to tie any cables at all to the wire shelves. I was originally but it seems unnecessary, and you can’t run right angles with any of these wires anyway.

Ubiquiti router swap: backup restore

I’m upgrading my home router hardware. I’m not sure Unifi has a clear path for doing this at home scale, it’s a bit tricky.

The path I’ve chosen is to configure the new router by restoring a backup from the old one, then swapping the hardware. Simple enough as long as you’re careful to not put both devices on the ethernet at the same time. Otherwise they’ll both try to use the same IP and both be serving DHCP). The one real wrinkle is Wi-Fi, when you restore to the new device it will have Wi-Fi turned on with your SSID and unless you have a Faraday cage you can’t easily isolate it. I just chose to live with it for the minute or two until I could get in and pause the WiFi.

However: UnifiOS has a serious flaw. You can’t restore from a backup for a site other than the Default site. See the notes here. I don’t know why but my old router was set up with some other site, Default was unconfigured with a stock 192.168.1.1 setup.

Claude to the rescue: it offered to edit the backup file after it was generated and swizzle in the Default site name. This worked fine. There’s one more wrinkle, the .unf backup file is encrypted but the password is well known. Claude just decrypted it, edited it, and re-encrypted it for me. What a bro. (No thanks to you, BC Yang.)

Anyway that all done and now my new router acts like the old one. It’s got the same LAN config, the same static routes, the same hostnames for MAC addresses, etc. Phew.

Another example of the kind of thing I could have figured out on my own but would have been several frustrating days of tinkering. Claude had it done in half an hour.

GV network reboot: Unifi meshing, Emporia power

I rebooted my network boxes in Grass Valley today and it was a bit rough, took nearly 8 minutes for everything to come back. I rebooted by pulling the power from all the passive switches and routers I care about, also the Starlink dish. It did all eventually come back correctly.

I gave Claude access to all the systems I could and had it do a postmortem. This is my own writeup of what I learned from talking to it.

WiFi mesh loop

When the network switches went down I left the Unifi WiFi access points back up. They were configured in mesh mode, so they started building a mesh network. When the network switches came back up that created a network loop and there was a brief mess as packets flooded everywhere. The APs detected the loop after 12 seconds and turned off meshing. I’ve since disabled meshing in the network config, I never want it.

Proxmox server reboot

My little Proxmox server rebooted itself. I’m not sure why. But I did hear a power relay click. The Proxmox server is plugged into an Emporia smart network switch, so my best guess is it decided to toggle the power for some unknown and unlogged reason. Maybe it reacted badly to the network loop or just being offline for awhile? I dunno, it’s a bad failure mode! Fortunately it did turn on again. This power switch and one other fell off the wireless network and then rejoined it. Three others were fine.

Small stuff

It took my Unifi Security Gateway 3 or more minutes to boot, that was a big delay.

With the USG down nothing was answering DHCP. That wouldn’t ordinarily matter but after unplugging and replugging the switches my Linux box wanted a new DHCP lease. NetworkManager only tried to get a DHCP lease for like 45 seconds and didn’t fall back to just using the old address it had (with a valid lease). Supposedly it will retry again in minutes, but by then I’d unplugged and replugged the ethernet cable forcing a new lease.

I had to put my phone in airplane mode and back to connect to WiFi. Other wireless devices were fine.

EN8811H firmware vs a dodgy cable

Summary: recent EN8811H firmware versions like 25062303 don’t work well on my flaky ethernet link. Firmware 24082302 works fine.

I have an OpenWRT One router which has a EN8811H chip running the 2.5GB port for the WAN connection. It works very well.

Or it did until I updated my OS from OpenWRT 24.10 to 25.12.6. Suddenly I was seeing 10% packet loss with ordinary pings and 80% or more with 1000 byte pings. Turns out the problem is a regression in EN8811H firmware 25062302 from the linux-firmware collection. The old firmware version 24082302 works with no packet loss. I can reproduce the problem easily. Loading the old firmware on top of the newer OpenWRT release (including its kernel and drivers) fixes the problem.

An important detail: this WAN port has a dodgy ethernet cable plugged into it. It’s a 350-400 foot run through a coupler, a PoE module, and then up a tree to a 10 year old WISP antenna in a tree. It’s good Cat5e cable but it’s too long and has too many connectors in the path. The antenna doesn’t even do gigabit ethernet, it’s limited to 100Mbit. If I plug the cable into a cheap Netgear passive switch, the switch downgrades the link to 10Mbit. It’s not a good ethernet link.

If this link had never worked with the router I wouldn’t have been surprised. But it worked fine with the older firmware. Something changed in the new firmware that makes it lose packets.

Claude thinks that it’s only a problem with received packets, not transmitted. I don’t fully trust this, I haven’t verified it with error reports from the other end of the link. Claude noted that it got replies to every ping so the ping requests arrived, just that some ping replies were corrupted.

Do I file a bug report?

I’m wondering if I can reasonably file a bug report. Even if I’d done all this diagnosis myself, I don’t know the linux-firmware community. And I am complaining about a failure on some marginal hardware. Mostly I’m worried because Claude did the real work here and while I can understand the result and I think it is correct, I’m not certain.

OTOH this does seem like a real regression and it’s pretty easy for me to reproduce and test it. If the engineers are at all interested it’d be easy for me to help them look into this further.

I tried having Claude read the firmware binaries to figure out what changed but it wasn’t able to make sense of the code.

BBR, Proxmox containers, and Starlink

I tried to sync a bunch of big data last night and only got 5MBytes/s despite 30MBytes/s being expected. The fix turned out to be enabling BBR congestion control on the Proxmox host and container I was syncing from.

In detail... I first learned about BBR congestion control three years ago. It’s an alternative TCP congestion control algorithm you enable on a server. It greatly improves performance for Starlink clients connecting to that server. Enabling BBR instantly boosted rsync performance from 5MB/s to 30MB/s for me: that is expected. It’s so extreme because of the high packet loss of Starlink. It’s probably the same for clients on cellular links.

To enable BBR in a container, the easiest way is just to enable BBR in the Proxmox host and then restart the container. On Proxmox:

# Load and enable BBR right now without reboot
modprobe tcp_bbr
sysctl -w net.ipv4.tcp_congestion_control=bbr

# Enable BBR on reboot
echo tcp_bbr >| /etc/modules-load.d/bbr.conf
echo 'net.ipv4.tcp_congestion_control = bbr' >| /etc/sysctl.d/90-bbr.conf

It is not necessary to explicitly enable BBR in containers. They will pick up the Proxmox host’s congestion control algorithm on restart. However any existing containers won’t switch immediately. You can run this in the container to switch without restarting:

sysctl -w net.ipv4.tcp_congestion_control=bbr

It is probably necessary to enable BBR in any VMs you have. I haven’t tested this but it must be this way since the VM has its own kernel and TCP/IP stack.

It is possible to have containers have different algorithms than the Proxmox server or each other. I didn’t test this but Claude Code was telling me I needed to load the modules in the Proxmox server and then set net.ipv4.tcp_allowed_congestion_control= reno cubic bbr. After than containers can choose their own algorithm.

(Claude Code was a big help in diagnosing and fixing this problem. I understand all the commands above and tested them myself.)

I continue to wonder why BBR isn’t the default on Linux. Apparently it can cause contention problems if every server isn’t using BBR. Also so much server traffic these days is QUIC and it has its own congestion control. The TCP setting doesn’t matter to a lot of servers.

Death to Tailscale MagicDNS

It took several years but I finally disabled Tailscale MagicDNS. It just caused too many problems. It broke Proxmox containers. It broke private DNS on my Android phone. It broke all sorts of stuff. I don’t want tailscale to mess with DNS.

I’ve replaced it with tailscale-cloudflare-dnssync. This is a simple Python program that uses Tailscale and Cloudflare APIs to read your entire tailnet’s list of hostnames and create DNS records. There’s a zillion versions of this kind of script, including some that support other DNS services. This one works fine for me. I’ve set it up to run daily but since the Tailscape IP assignments are static, the DNS records aren’t going to change much.

I also set up my local resolver to search the subdomain I put all the tailnet hosts in. So I can use short hostnames like sfrouter instead of FQDNs like sfrouter.tailscale.example.com.

The downside of this new setup is now all my tailnet hostnames are out there in a public DNS list somewhere. They all point to private unroutable IP addresses, so there’s very little someone can do with that info. But now someone could figure out with some DNS queries that I have, say, a PiKVM and then try to attack it somehow. Then again I remember when AXFR was still a supported DNS query, and a very useful one at that! It just doesn’t seem that big a worry for me.

MagicDNS was always a kludge. Tailscale would basically try to intercept your system’s DNS resolvers and insert its own at 100.100.100.100. Its primary feature I used was to serve address records for hostname.your-tailnet.ts.net. (These aren’t real DNS records, they were only visible to you from their special nameserver). Over time it has grown a lot of other complex features, none of which I want. And it caused all sorts of problems. Good riddance.

As a bonus I think this will make it easier for me to get working SSL certificates for my tailscale names. There’s some way to do that with MagicDNS but I never figured it out.

Starlink handoff latency

Starlink has a core design of changing to new satellites potentially every 15 seconds, exactly at 12, 27, 42, 57 seconds into the minute. Globally. Weird, huh?

That pattern shows up in this ping tool. The yellow smears occur every 15 seconds and indicate brief periods of higher latency, like 200ms instead of 30ms. I’m surprised this is every 15 seconds, I thought the dish mostly stayed locked on one satellite for a few minutes at a time.

Slow network: rebooted switches

Boring post for my own notes. My Internet got slow about 3 days ago, from the usual 100-400Mbps down to an average of 10-80Mbps. There was no increase in packet loss or latency. Rebooting the switches fixed it.

No idea what went wrong. The problem started 2026-04-03 11:00Z, or about 3 in the morning here when Starlink sometimes reboots itself for a firmware update. So that was my first guess for the problem. I rebooted my router and Starlink and the problem persisted.

Then I rebooted the simple unmanaged switches in my network. That fixed it. Real mystery, that. If I was stuck at 100Mbps I’d understand it was a link speed problem. If I had a lot of packet loss I’d blame a flaky switch or cable. But 40Mbps? No packet loss? No idea.

Well one guess. My original round Starlink dish has some weird behavior about its ethernet port. I have it plugged into a switch rather than directly to my router because that helped stabilize it. So maybe Starlink rebooted itself and something went wrong with the link and only rebooting that switch fixed it? Total guess here.

My real concern was Starlink throttling. They’ve added various cheaper metered plans lately. I’m on Residential Max so that shouldn’t apply to me.

Easy Porkbun DDNS

I’m liking Porkbun as my registar. One nice thing: they have an API and formal DDNS support. And good docs. However their recommended DNS client is some absurd persistent process which runs a web server. Give me a break! I’m using mietzen’s porkbun-ddns instead. It’s a simple Python client that you can easily run from cron. Seems to work fine. The configuration is a bit of a PITA but once it’s set up it runs with no hassle.

Starlink latency got worse, then better

Interesting change in my Starlink performance August 30 - September 7. The jitter on latency went significantly up, as did max latency and average. I think the packet loss also went up a bit but I’m less certain.

This change was noticed by other users, particularly gamers. Some users also reported seeing higher speeds in this interval: I don’t think I did.

Picking random days...

2025-09-02: average latency 30ms, packet loss 0.09%
2025-09-11: average latency 27ms, packet loss 0.06%

But the big thing is how the blue line jumps around so much more in those days. I don’t have a numerical measure of standard deviation but you can eyeball it.

Overall I’d prefer more predictable latency and less pocket loss even if it costs a little throughput. Starlink regularly exceeds the 100 Mbps I think of as “good enough” but I sure wish the transport was a little more reliable and predictable.

New registrar, DNS transfer notes

I’m working towards establishing one of my domain names as my new primary email address. As part of that, I decided to finally move all my domain names from Hover over to a new registrar. Hover is OK but not great and hasn’t modernized their platforms in the way I’d like.

I’m testing out Porkbun as my new registar. Namecheap is also in consideration. I asked on Mastodon and these two seemed the most popular. Gandi used to be more popular but got bought and their prices were jacked way up.

Porkbun has a nice documentation page on transferring DNS without downtime. The challenge is if your domain’s whois records use your old registrar (Hover) as your DNS server. The transfer takes some unknown time to go through, several days. But the moment it goes through the old registrar will probably stop serving DNS queries, so your domain stops working until the new registrar can get in there and publish new info.

Anyway, the key is to do all the transfer on Porkbun except the authorization key part. Then set up DNS records at Porkbun. Then edit the whois records on the old registrar (Hover) to point to Porkbun’s nameservers. Then finally unlock the domain and give Porkbun the authorization key to let it go through.

I neglected to do these steps in this order and by the time I went to edit the whois at Hover I got “Registry error, domain’s nameservers not updated [Object status prohibits operation] (Code 405)”. ChatGPT claims this error is actually from Verisign, presumably a lock put in place while the transfer is underway.

Fortunately the domain I’m trying this on isn’t really used so it’s no big deal if it breaks for a bit.

I pretty much immediately got email from Hover saying that a transfer was requested and that I didn’t have to do anything to allow it, just wait five days. Notably absent is any button to press to expedite the transfer faster.

Update

The transfer went through 5 days and about 6 hours later. Hover still shows I own it in their list, but Porkbun has it in their system. The whois record is updated to Porkbun. The domain registration was extended another year.

The whois still points to Hover’s DNS servers. Happily those still work, they didn’t turn off service immediately when the domain transferred. I just updated to use Porkbun instead. That change was visible immediately on whois.com’s web interface and within a few minutes in my Linux CLI whois tool. dig +trace shows the new nameservers are being queried. I’m sure something is going to end up cached for awhile, it really would be better to change the DNS servers first. But at least it wasn’t an instant disaster because I forgot to do that before the transfer.

I was able to add a TXT record to my Porkbun DNS with a 60 second TTL. It was visible immediately from a DNS query. After I deleted it the deletion was visible immediately on a host without a cache. It did expire after a few minutes on my local Linux box where I had it cached but it may have taken longer than 60 seconds, I didn’t test fully. Anyway, I’ll say Porkbun DNS works, at least for the simple case.

Porkbun’s web whois has a form for contacting a domain owner. It actually works! Here’s the message I eventually got.

First, we are very sorry to bother you but someone has managed to jump through all of the required hoops in order to send you a message. As required by ICANN, we must allow someone to send a message to domain contacts via a web form. The person contacting you has validated their email address and passed a CAPTCHA proving that they are more than likely not a robot

Starlink latencies 2021-2025

I’ve been pinging 8.8.8.8 via Starlink for four years now. Here’s a graph of average and minimum ping times. The average this last week has been 29ms. The minimum I’ve ever seen is 14ms. This pings through to Google DNS and is generally 1-2ms slower than the Starlink diagnostic.

What really impresses me are the systemic improvements. Things were bad in 2022 and 2023 when they added too many customers in my area (Grass Valley, CA) but then they fixed that. And average latency keeps going down. There’s also been a couple of steps down in the minimum as they’ve improved some things.

(You’ll see some anomalies in my graph of very high latencies. That’s usually when something failed and I switched to my backup ISP.)

(this is a copy of a comment on Reddit)

GV LAN down to 100Mbit

so much depends
upon

an ethernet
cable

with its delicate
threads

and fragile
connectors


Something went wrong with my Internet connection on July 3: my Starlink speed tests never got above 80Mbit/s (it should often be 200+). I finally pinned it down to the ethernet on the path to the Starlink being at 100Mbit. These are old fashioned Netgear dumb switches and they are very good about being gigabit and negotiating to slower speeds if necessary.

I tried replugging the cables. I tried different ports. I even changed the switch on the Starlink end. The connection would start at gigabit then give up and drop to 100Mbit. Feels like a bad cable? But then magically after power cycling the new switch (it had been on for awhile) it started working. I really don’t think it’s the switch’s failure, I’d swapped switches! Maybe it’s a flaky connector and I just got lucky? Or maybe there’s some state kept in the switching network that I reset with the power cycle? Very confused.

Anyway, need to keep an eye on it. Flaky cables are bad news. This one will be expensive to replace, it’s a long run through an attic. One possibility is mice or heat damaged the cable.

Some graphs showing the problem

I don’t really have monitoring of my LAN. But I do have monitoring through two Internet connections at the other end of the flaky link, so I can infer something from them.

The speed test showing the Starlink degradation to 100Mbit. The last > 100 Mbit is 19:00 on July 3. But speeds are suspiciously slow that morning too, that may have just been a lucky hour. The last normal behavior is July 3 6AM.

Pings to 8.8.8.8 via Starlink. The packet loss red dots don’t tell a story. But that high latency until July 1 is kinda weird, I have no explanation for it. But there’s no obvious change. I zoomed in on just July 3 but it doesn’t show any problem.

Pings to 8.8.8.8 via Smarter Broadband, my WISP. This WAN link is a lot less reliable but note this pattern of the minimum latency increasing: that seems like it could be another indicator of the LAN change.

IPerf 3 tests

I tried running some tests with iperf3 after being on gigabit for an hour or two. Testing with a server on the OpenWRT router at the other end of the cable. UDP client tests with iperf3 -c 192.168.9.1 -u -b 1G (from my WSL host.)

With a full gigabit I get 22% packet loss: that’s bad! But that’s with the client sending a gigabit to the server. If I reverse the test with -R I get 0.036% packet loss but the server is only sending 713Mbits/sec. I suspect that’s a CPU limitation of the OpenWRT device. Tests of 700Mbit/sec UDP (sent from client) show 0.5% packet loss. 400Mbits/sec shows 0% packet loss.

I also did a TCP test and get about 930Mbits/sec over the link in both directions. I take this all as evidence the gigabit link is just fine right now.

Packet loss with new router

I think these notes are idiosyncratic to me and my local WISP, not a commentary on OpenWRT. But recording some notes for my reference.

I switched to an OpenWRT One for my backup Internet connection, a fixed wireless link from Smarter Broadband. Soon after switching link performance got a lot worse for about 9 days, going from 0.2% packet loss to 2.8% packet loss (pings to 8.8.8.8). Much higher latency too, particularly in the evenings. It’s better again but I’m still at 0.5% packet loss.

At first I suspected the new router was the problem, given the co-incidence. But the pattern looks exactly like congestion in my WISP. Also it’s gotten significantly better on its own. Maybe the router switch precipitated the problem though. I had to reboot my end of the wireless link. And IIRC their fixed wireless isn’t adaptive, it picks a channel and sticks with it when it turns on. Maybe I got unlucky.

Update (May 14): I’m blaming my WISP, not the router. It’s back to 0.257% packet loss.

OpenWrt One router

I just setup my OpenWrt One router. This is hardware purpose-built and labelled for OpenWrt by Banana Pi, a Chinese embedded system manufacturer. I bought mine back last November when they first were available on AliExpress. $97 delivered at the time, now costs more. Possibly much more thanks to the new Republican taxes.

I bought this to replace the Raspberry Pi 4 I’ve been using as a backup router. That’s worked OK but isn’t ideally suited: CPU is overpowered and the networking is underpowered (USB). The main improvement with this hardware should be proper WiFi with nice antennas although at the moment I’m not using the wireless. It’s a little weird that it has a 1GB ethernet port for LAN but 2.5GB for the WAN. Also it has an M.2 port hidden in it that’s not advertised.

It worked fine right out of the box. I went ahead and upgraded to 24.10.1, the latest main release. That mostly worked fine once I worked around some OpenWrt confusion. I initially installed a “snapshot release” but those don’t come with LuCI, the web interface. But I could still ssh so I reinstalled the official release via sysupgrade on the command line. One nice thing about this hardware is it has two full firmware sets. You normally use and boot the NAND firmware but there is also a second NOR firmware that’s a sort of failsafe you can manually select to boot from. (You can also flash the NOR firmware which means you might still be able to brick the device if you try hard enough.)

OpenWrt 24.10 was a major release, the first in over a year. A huge change is groundwork to replace their custom-built opkg package manager with Alpine’s apk. Which should be a big improvement in future development and maintenance. (It’s not live in 24.10 release, but is in the subsequent snapshots). Also lots of big changes like Linux 5.15 to 6.6. They support an impressive 2000 devices, it’s quite an ambitious open source product.

Not much more to say about OpenWrt or the One hardware, it seems to be doing the job. I’t’s’ve had my gripes with OpenWrt but it’s turned into quite a robust hacker-friendly router firmware. If I weren’t bought into the Ubiquiti ecosystem I’d use it for more than a backup.

BTW because of all the changes all the OpenWrt advice and docs are a little out of date. For instance a bunch of previous upgrade tools like sysupgrade and auc have been replaced by owut.

Final note, some packages I added to stock OpenWrt: openssh-sftp-server less bash curl nano joe. Also installed luci-app-statistics and did a one time “save” on the setup to get it started.

VPN services for Windows in 2025

With the recent anti-porn laws I know a few gentlemen in Texas and Florida with a newfound desire to use a VPN service. I don’t really use a VPN but would like to be of help, here’s what I learned. I’m keeping an eye towards simplicity for non-tech-savvy folks. This post is uncompensated, I am not selling VPNs or profiting in any way from what I’m writing here.

tl;dr: try Proton VPN for free.

Wirecutter recommends Proton VPN or Tunnelbear for free VPN and Mullvad, TunnelBear, or Proton VPN for commercial VPN. The other common VPN service I see recommended is NordVPN. I’d also consider Mozilla VPN, they are reselling Mullvad.

Avoid any other VPN service. Many of them are sleazy or scammy. A VPN gets to see all your Internet traffic and can profit from or subvert you in various awful ways. You must trust them.

If you use a VPN regularly you should expect to pay about $60/year for the service.

Of the reliable services, the main difference is their charging model and free service (if any). Proton VPN has a genuinely free tier you can try first with no payment details. NordVPN has a 30 day trial but you have to give payment details up front (and ask for a refund if you cancel.) Mullvad has no free trial but you only have to pay 5€ for one month to try it. TunnelBear has a 7 day free trial, not sure if it requires payment details to try.

Proton VPN, what’s the gotcha?

I was surprised Wirecutter recommended Proton VPN as an unlimited free service, I didn’t think any free VPN would be worth trying.

I set up Proton VPN on Windows and it seems to genuinely work. The installer has a bit of up-sell, installs of other Proton products. But you can opt-out. Also Proton’s a reputable company, the products they’re offering are reasonable.

The VPN is fast. I tested from my gigabit Sonic fiber and Cloudflare’s test got me up to 800Mbps / 600Mbps with zero packet loss and 31ms latency. Compare 900/800 and 5ms without the VPN. Honestly this result is very good, way better than I expected for a free service.

So what’s the catch? Wirecutter notes you can’t choose which country your egress is in. I was limited to US only. Fine for me but if your goal is to look like you’re in some other country to watch foreign TV, you’ll need to pay. I have to think there’s some other hidden limitations with the free service, I’d assume if I’m making heavy use of Proton VPN I’d end up paying for it.

Proton VPN seems to work via UDP Wireguard by default but has other protocol options. My connection ended up in Seattle at Datacamp (AS212238), with IP address 149.40.62.22. There’s some nice advanced features for split tunneling, DNS management, port forwarding, etc. All paid features.

Overall I’m impressed with Proton’s free service. Maybe there really is no major gotcha, it’s just an honest loss leader.

IPv6 for first time (Ubiquiti USG, Starlink)

I finally decided to enable IPv6 on my Starlink network. And it seems to work? Ran into a lot of confusion with Ubiquiti Unifi OS, maybe also my Windows client. Still tinkering but some notes. Highlights of things I learned:

  • Prefix Delegation Size: 56
  • Prefix Delegation ID: 1
  • Try an Android phone first as a test client
  • Reboot Windows before it will work with IPv6

The big question is: what’s going to break now that I’ve enabled this? I think all my devices are now magically IPv6 and I just can’t wait to find out what changes. I enabled this because Starlink’s CGNAT means I often get blamed as if I’m a bot, maybe the IPv6 sites will work better. Already anticipating Youtube TV or Netflix or something pitching a fit though.

Starlink ISP

Starlink operates DHCPv6 and hands out /56 addresses. These are rumored to be dynamic and changing at least occasionally: Starlink doesn’t promise fixed IPs for residential users. Given they move me between Seattle and Los Angeles POPs with some regularity I’m not entirely surprised they aren’t maintaining a dynamic routing infrastructure for all users. (There’s a business level service with static IPs.)

Starlink didn’t initially offer IPv6. And for awhile they did but had some problems with their DHCP implementation. Internet searches often find old out of date info. Starlink does now document they offer IPv6. Also more info in this FAQ.

Unifi OS router

I had a hell of a time making sense of what my Ubiquiti Security Gateway (USG-3P) was doing. Some notes.

USG Internet configuration

The first part is getting the USG router to talk to the IPv6 Internet. The main configuration for this is in Settings / Internet / Primary (WAN1). You have to set “Advanced” to “Manual” and then enable “DHCPv6”. Also you have to type in a “Prefix Delegation Size”. 56 works for Starlink and most ISPs, that means you get a /56 address allocation from DHCP. That’s a very large address space.

There’s no indication this configuration works when you do it. The Unifi web UI still shows “IPv6 Address” as blank. If you log in to the USG command line and run ip a or ip 6 a, nothing will show up, it looks like there is no IPv6 address assigned to eth0 (the WAN). Well not entirely: you’ll find an address like fe80::e263:daff:fec4:19ff/64 which is the link-local address, but not an routable Internet address.

The way I realized it was working was running grep dhcp6c /var/log/messages on the USG shell. That shows me a message about IA_PD prefix which contains the actual IPv6 lease assignment from Starlink. Yay! Starlink’s block seems to be 2605:59C0::/28, customers are getting a /56 block from there.

The other way I realized it was working was running ping6 2001:4860:4860::8888 in the USG shell to ping Google DNS via IPv6. Actual IPv6 packets! There’s a traceroute6 that is fun to try too.

The confusing thing is my router still has no IPv6 address assigned to the WAN. Apparently this is expected. ip route is no help for how things are working either. But ip -6 route does show a route for default via fe80::200:5eff:fe00:101. I presume that fe80 address identifies the Starlink dish or the ethernet port it’s plugged in to. I can’t ping6 it, maybe it doesn’t make sense to ping a link local address.

Anyway, the router is on the IPv6 Internet. Now what about the rest of my clients on my LAN?

USG LAN configuration

Once the router is talking to the IPv6 Internet, the other part is convincing the DHCP server the router is running to give out IPv6 addresses to clients. This setting is in Settings / Networks / Default. There’s an IPv6 button. You set the radio button to “Prefix Delegation” to enable it. You’re also forced to set a “Prefix Delegation ID”, a decimal number. I still have no idea what this really means but the number “1” seems to work. Update: this explanation seems right. I’m given a /56 block from the ISP but internally I’m using a /64 subset. The extra 8 bits are the prefix deligation ID: I chose 01. That probably explains why my IPv6 address block given by Starlink has a :de00 in it but my machines have :de01: in the address, the 01 I picked was ORed in.

Note there’s an “Advanced” box. I left that to Auto which means it does SLAAC address assignment which is the simple thing you probably want.

After this is configured there is no indication in the Unifi web UI that it worked. But clients doing DHCP will now get v6 addresses if they ask for them. See below for testing clients.

The part of IPv6 I don’t understand is exactly how exposed my network is. AFAICT every device on my LAN is now potentially globally routable with a unique IPv6 address. So what’s keeping me safe? I think the answer is the default IPv6 firewall rules that Ubiquiti has but I really ought to learn more about that. (Update: yes, default firewall rules are “allow inbound traffic associated with existing connections that were made outbound” followed by “drop everything else”. That’s similar to the implicit firewall of IPv4 NAT routing. This port scanner plausibly confirms that my LAN machines have all their inbound ports filtered.)

Client: Android

My Pixel phone seems to work with IPv6 with no effort at all. https://test-ipv6.com/ shows 10/10 everything working. Various “what is my IP” services all show an IPv6 address. All just happened automatically, no reboot or reconfiguration required. Sadly this was the last client I tried but I should have tried it first.

Client: Alpine Linux

I fired up a quick Alpine VM to manually test IPv6. The default installer doesn’t enable IPv6, you have to add it with iface eth0 inet6 auto to the networking config. But doing that everything else works flawlessly. I can ping Google DNS via IPv6. curl https://api6.ipify.org shows me my IPv6 address. Nice!

Client: Windows

So those two clients were easy. Unfortunately the very first client I tried was my Windows 11 desktop. Once I enabled IPv6 the networking interface picked up an IPv6 address via DHCP. Two of them actually, both in 2605:59c8. One of them actually works! From a DOS command line I can ping my router’s IPv6 address. And from the router I can ping6 the one working Windows address.

However nothing else worked. I couldn’t ping Google DNS via IPv6. The browser test at https://test-ipv6.com/ didn’t work, shows nothing at all. Neither did the test at https://whatismyv6.com/.

I finally gave up and rebooted. And presto, now IPv6 is working fully on my Windows machine.

Client: Ubuntu 23.04 VM

An existing workhorse Linux box I had just started working fine on IPv6, no reconfiguration required. May have not started working until I happened to reboot it.

Client: Proxmox Virtual Environment

My Proxmox server does not seem to have IPv6 enabled by default. The docs indicate IPv6 is supported so it’s probably something with how I configured the server with a static IPv4 address at setup. Guest VMs can access IPv6 no problem (see above), not sure about containers. The default bridge (vmbr0) has some IPv6 stuff I didn’t configure so it probably won’t work. Actually a little confused, since that bridge is also used for the VM networking.

Starlink adds an NTP server

This is very cool: Starlink’s dish now has an NTP server serving GPS time. That should be highly accurate. If they implemented it right, it’s going to be your best source of time short of specialty hardware you installed yourself. Certainly better than anything you’ll get from the Internet. See discussion here.

The server advertises itself as stratum 1. Thta’s a bold promise of high accuracy but is appropriate for a GPS receiver. It also means most NTP clients will prefer it as the time source to anything from the Internet. Which seems right to me.

(FWIW, I’ve synced hosts with chrony for years now over Starlink using the default Ubuntu pool config. Despite the high jitter Chrony does a good job synchronizing, it estimates it’s got accurate time to within 2ms despite 50ms of root delay. )

I added the server a few minutes ago and my machine is already syncing to it. Will update new stats after it has run awhile.

Update 1

3 hours later and it’s definitely running nicely. Here’s a graph of root mean square offset, a measure of clock accuracy. Over the last month, setting clocks over Starlink Internet with the Ubuntu pool got me an RMS of about 275µs ... Now it’s more like 100 µs since using Starlink. Here’s a graph of the last 24 hours, the line is where I switched to Starlink’s clock.

Honestly I’m surprised at how well chronyc synced time over Starlink Internet. The servers are all 40-80ms away varying every few minutes, a huge amount of jitter. I think chronyc has special algorithms to estimate that kind of thing.

Also impressed with how Starlink has improved. A year ago, before the latency improvements, my RMS averaged 427µs. Here’s a graph of the RMS for the last two years, mostly on Starlink ISP.

Honestly all this stuff is astonishingly good timekeeping. 1ms accuracy with consumer parts and slightly wonky Internet connections. It’s nice now to have access to GPS time though!

Update 2

running for about 24 hours now and doing well. One issue with Dishy as a time server is it often reboots around 3am. Mine rebooted last night and while Chrony coped it definitely threw off time accuracy. The offset went from under 100µs to fluctuating between -1ms and 2ms. The RMS had converged as low as 30µs (very impressive) but reset to 800µs after the 3am reboot. Oddly I don’t see any evidence Chrony gave up on syncing to the clock entirely, but the root delay to it stopped being a steady 2ms and spiked up to 4ms for a couple of hours after the reboot. All of this is well within the bounds of an NTP client to cope but is an example of how it’s not quite as good as having a fully dedicated GPS time receiver. OTOH it’s free!

Some stats after a few hours

chronyc> tracking
Reference ID    : C0A86401 (192.168.100.1)
Stratum         : 2
Ref time (UTC)  : Tue Sep 17 20:16:58 2024
System time     : 0.000011511 seconds slow of NTP time
Last offset     : +0.000012743 seconds
RMS offset      : 0.000090009 seconds
Frequency       : 30.078 ppm slow
Residual freq   : +0.000 ppm
Skew            : 0.121 ppm
Root delay      : 0.001979256 seconds
Root dispersion : 0.002787174 seconds
Update interval : 512.1 seconds
Leap status     : Normal
chronyc> sourcestats
Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
==============================================================================
alphyn.canonical.com       48  28   13h     -0.020      0.111  +2013us  3097us
prod-ntp-3.ntp1.ps5.cano>  55  28   15h     -0.080      0.080    +66us  2833us
prod-ntp-4.ntp1.ps5.cano>  18   8  293m     +0.090      0.651  +2919us  3553us
prod-ntp-5.ntp4.ps5.cano>  64  30   18h     -0.053      0.069   +946us  2962us
ntp3.radio-sunshine.org    64  35   18h     -0.082      0.054  -2298us  2382us
rn5.quickhost.hk           18   8  310m     +0.075      0.326  +2550us  1875us
LAX.CALTICK.NET            34  22  569m     +0.051      0.100   +934us  1678us
time.cloudflare.com        24  17  413m     +0.103      0.153  +1269us  1407us
192.168.100.1              15  10  103m     +0.000      0.118   +173ns   167us

Persistent connections failing: tn3270 and TradeStation

I have a weird networking problem with persistent sessions that I think may be related to Starlink but I’m not sure. Informed troubleshooting advice welcome.

My partner uses a Windows machine running a couple of particular network apps. One is the TradeStation app, a commercial program that gets constant updates of stock prices, many times a second. Another is Host on Demand, a clunky Java app that provides tn3270 terminal sessions. It’s a little like ssh or telnet but its own thing.

The problem is both applications mostly work but their connections break many times a day. They reconnect immediately but it’s manual and disruptive. The TradeStation connection should be long lived and with frequent traffic. Host on Demand sessions are mostly idle although we have configured keep-alives.

FWIW my own computers don’t see any problems, but I don’t use that software. I run long-lived ssh connections all the time and they’re fine. I just tested with netcat and can keep a TCP connection open for over twenty hours to a server sending a short message every 15 seconds. So I don’t have a general problem with persistent connections.

Here’s the kicker: the disconnects only happen in the house with Starlink. He also uses the same software in a place with a fiber ISP that has no problems. Both places have a Ubiquiti router I configured, nothing unusual. Sometimes he uses a VPN with Starlink and still sees disconnects but fewer of them. This makes me think it’s something special about Starlink that’s causing the issue.

My first thought was our IP address changing on Starlink but that only happens every couple of days, not many times a day. A second thought is maybe whatever session state Starlink’s CGNAT is keeping is expiring? But my ssh sessions are fine. Maybe Starlink has something special to protect ssh but not other long lived sessions? Seems unlikely.

Another possible theory is he’s connected via WiFi in the problem house. The WiFi is quite reliable, Unifi characterizes it as 100% excellent and it’s less than 1 packet lost in 10,000 when pinging the LAN. But I can’t fully rule it out.

Welcome any informed ideas on how to figure out what’s going wrong. I’m not certain it’s actually Starlink to blame here. I wish I knew more about the apps that are failing and why they may be different from my ssh or netcat. I’ve tried using a packet sniffer but didn’t see anything clearly wrong.

Reddit discussion

I posted this on Reddit and got almost no engagement. One reply that suggested some TN3270 alternatives and one good idea, which is to run the netcat client on the Windows machine and see if it works.

WSL2, DNS tunneling, and .local names

Just copying the text of a post I made to Reddit. Long story short: if you want .local domain names to work in WSL2, you may have to turn off DNS tunneling.

Query

I’ve got several Linux boxes on my LAN running avahi-daemon. I can connect to machine.local fine on most of my LAN, including my Windows desktop in a web browser or DOS shell. However, my WSL2 system cannot connect to machine.local, it seems unable to resolve mDNS at all.

I tried finding an answer and found several years’ worth of advice, some conflicting. The root cause seems to be WSL2’s complicated networking setup interfering with multicast. Unfortunately I don’t really understand WSL2’s network setup. Is there some easy way to get mDNS resolving working?

Comment I wrote with solution

Setting dnsTunneling to false makes .local names work. I had to restart the WSL2 system as well.

DNS tunneling is described here and the configuration file is described here. There’s also this bug report on GitHub.

Before the change my WSL2 had 10.255.255.254 as the nameserver in the resolv.conf, now it has 172.31.0.1. DNS tunneling is relatively new (from Windows 11 22H2) and “is aimed to improve compatibility with VPNs, and other complex networking set ups”. So maybe turning it off causes other problems. But basic DNS and Tailscale’s Magic DNS are both still working for me and now .local names work too, so I’m happy.

Linux network interfaces can have more than one IP address

Had to re-learn this. Normally a network interface in Linux has a single IP address. But there’s nothing stopping you from adding several.

Adding a second address is as simple as running something like ip addr add 192.168.3.254/24 dev eth0.

Here’s a config I just set up in Alpine in /etc/network/interfaces. Not sure what the netplan equivalent looks like.

auto eth0
iface eth0 inet static
        address 192.168.9.5/24
        gateway 192.168.9.1
        hostname $(hostname)

auto eth0:0
iface eth0:0 inet static
        address 192.168.3.254/24

More details in this Reddit post where I originally tried to make it much more complicated.

The yearly Ubiquiti UnifiOS disaster

About once a year my Ubiquiti routers give me trouble. I’ve long since stopped asking anything complicated of them like reliable failover or a VPN. I just want it routing packets. This week’s problem is my Unifi Dream Machine, my router/access point in San Francisco. I installed in in late 2020 and to its credit haven’t thought much about it since. Including not doing software updates. (Oops).

Yesterday I tried to upgrade it from version 1.0.10. It went badly, I ended up having to factory reset and rebuild the network configuration from memory. Some notes on that:

Being safer next time

First, how to prevent the mess I found myself in. The main problem is I had no backup of the Network application config. I did have one for the UDM console itself but that doesn’t contain the useful network stuff like wifi SSID, subnet, port forwarding, ... I should have made a backup before doing anything. Modern Unifi systems are backing up to the cloud, maybe automatically, but mine was so old I think I had to have done a manual backup and downloaded it. By the time I thought to do that it was too late.

What went wrong

The update process sucked. It wanted to upgrade itself like six times as it hauled itself forward through versions. Each update took at least 5 minutes, one said it’d take 20 and was more like 45. Each time the Internet connection would go down for a few seconds, twice. Mostly though it looked like things were working.

Until I got to UnifiOS v4.0.6, the current version. That time when it booted the “Network” app that’s most of what I really care about never started. Just spinning, hung in starting. I logged in via ssh to see what was up and couldn’t really figure it out. The mongod was spinning around 100% CPU though. Why Ubiqiuti chose such a weird and unreliable database for this simple application is beyond me.

The Internet is full of advice on how to manually repair corrupted Unifi mongo databases. But I decided to cut my losses and do a factory reset. The appliance said it had a full cloud backup, should be easy right? ha, joke’s on me. That was just a backup of the host OS itself, not the network. After the reset and restore the network was default settings.

I had no network backup. I’m a little confused; the updated Network 8.2.93 app has a manual backup option that downloads a file, but then implies the cloud backup of the console should cover the network too. That didn’t work for me, maybe because the crucial update failed? I was able to do one manual backup of 8.2.93 after configuration. A second one never completed. A third fails immediately. That does not inspire confidence. After a reboot a backup worked.

(I also can’t figure out how to backup the network config on a self-hosted Unifi linux environment running Network 8.0.7. The backup button does not appear under Settings > System. A comment I read online suggests this may be a user permissions problem but I can visually inspect all the settings I want to back up so that seems wrong or dumb. I was finally able to make a backup using the managed utility at https://unifi.ui.com/. I also saw a hint monthly backups were happening and being stored locally, not synced to cloud.)

Rebuilding the network

So I rebuilt the network. Over the years I’ve learned my lesson and keep the router as simple as possible. But I use the non-default 192.168.0.* subnet. Also am forwarding ports for ssh, web servers, tailscale, plex, and syncthing. There’s a lot of fun looking other settings for things like the WiFi radio I didn’t touch.

I had to re-adopt my UAP-AC-Pro access point. In theory my restore for the UDM should have taken care of that. Getting the impression that backup did absolutely nothing useful. At least that’s relatively simple since there’s no significant device configuration. Hold down the reset button on the hardware, then click the “Adopt” button in the webapp.

Some observations

Complaints and disaster aside the latest Network webapp on the UDM is pretty snappy. The old bugs where you’d change something in the config and it wouldn’t take until a reboot seem gone. The app shows lots of interesting things like a visualization of how all your wifi clients are doing. There’s also a neat NetMan mobile app for more wifi testing.

The Unifi network webapp itself is some overgrown dynamic Javascript architecture where page loads aren’t really page loads. It’s perfectly possible to click the “Dashboard” button and see a working new dashboard page even though the router is actually down. Just old data and no immediate confirmation that the router is even up. Really bad choice for a router, as snappy as it may be.

The Dynamic DNS configuration for Afraid has you storing your account password in plaintext. Afraid has long-had a token based authentication mechanism they should be using instead.

By default port 443 is captured by the router itself to get to its own admin page. That’s probably secure, and I think but am not certain it’s not available over the Internet by default. Also you can port forward 443 somewhere else on your LAN if you need. Ubiquiti has a whole remote management API with mobile apps and stuff you’re supposed to use instead of the web server. It’s pretty nice, TBH.

Starlink, from LA to Seattle

Starlink has moved me back to Seattle, some two years after June 2022 when Starlink moved my POP from Seattle to Los Angeles. I’m in Grass Valley, CA somewhere inbetween. In the very early days back in January 2022 I was at a POP near Winters, CA; I think that went away when SpaceX consolidated ground operations. Anyway, now my packets go through Seattle again.

The move has hurt bandwidth enormously. Download speeds of 10-70Mbps (average 22), compare 110-267 (average 128) two weeks ago in LA. Those numbers from my hourly Ookla speedtests (graph below), confirmed with a manual browser speed test and a simple remote file copy from my own server. Something is wrong.

UPDATE: these bandwidth reports were wrong. My router had dropped the WAN port down to 100Mbit, I think I have a loose cable. I wiggled the cable and got back to gigabit and my first download test was 220Mbps. Starlink and Seattle are just fine, this is user error. (I should have realized this: the switch to Seattle was around 2023-05-30 22:00 but I was getting fast downloads until 2023-05-31 22:00, a day later.)

Latency and packet loss seem fine though, just the same as before the move. Using Starlink’s gRPC stats my Seattle latency is 25-55ms, mean of 35ms. Drops are very low. Compare 23-93ms, mean of 38ms for an LA period two weeks ago. Starlink’s measured packet drops are about the same, total of 148 (LA) vs 177 (Seattle).

IRTT latency and packet loss monitoring

Unfortunately my own IRTT stats of are no longer valid, or at least no longer the same thing. I’m measuring round trips to a server I run in LA in the same datacenter as the LAX Starlink POP or very very close to it. So that used to be a test of basically Starlink’s infrastructure. Now my latency is much higher because the packets have to go over the terrestrial Internet from Seattle to LA.

I could set up a new IRTT server in Seattle but I will probably just drop the IRTT monitoring project instead. It’s been quite helpful and I’ve learned a lot from it but I don’t know that I’ll learn much new going forward. I’ll keep it running for now, it’s harmless and maybe will be interesting. I turned off my monitoring.

Starlink: fewer obstructions? Not really.

Interesting change in Starlink: fewer reported Obstructions starting around April 29. But it looks like they just fixed a bug where outages from Reboots were being called Obstructions.

Outages

Here’s a graph of obstruction outages for the last 90 days. It’s a graph of the gRPC outage stats from Dishy, the same thing the mobile app shows.

Sure looks like an improvement! In the past week I’ve had 7.4s obstructions and about 6 minutes of total outages. In a week a month ago I had 176s of obstructions and 386s of total outages.

Unfortunately this improvement seems to just be a recategorization. One cause of Starlink outages is rebooting for firmware upgrades, around 30 seconds a few times a week at 3am. Last month those outages were sometimes categorized as “obstructions”. Now they’re properly marked as “booting”. Here’s a week from last month showing these 3am false “obstructions”: in the most recent graph these now show as “booting”.

Here’s a graph of all the outage types for 90 days all together. You can see the red booting is more common than before.

Packet loss

Unfortunately this lowering of obstructions doesn’t seem to be affecting overall packet loss. Below is a graph of Starlink’s own stats on “drops” for 90 days followed by my own IRTT monitoring which also shows dropped packets.

No clear change, so maybe things aren’t really better. No visible change in the graph and doing the math, last week I had 0.63% packet loss and a week a month ago had 0.50% packet loss. Packet loss might have even gotten worse but I wouldn’t read too much into that without closer look.

Starlink bandwidth over 3+ years

I was surprised in my last post about how I was getting 25 Mbps upload speeds. So that had me looking again at my bandwidth tests since I got Starlink. These are tested with the Ookla Speedtest CLI tool. They are a test of my house’s network connection, so occasionally speeds are slower than real because I’m using the network or I’ve temporarily failed over to my backup ISP (not Starlink). But overall these reflect Starlink performance.

Fine grained graph

The main trend that interest me is in 2023 and 2024, the steady improvement of speeds. Particularly upload speed. This is a great trend to see in your ISP!

It’s also interesting to see those halcyon days of 2021 before Starlink got heavily subscribed. That’s a suggestion of what the maximum radio throughput service is. Service was worse then: more outages, higher latency, more variability. But download bandwidth was same-ish for a lot of this period. Upload has definitely gone up.

Monthly average

The graph above is some fine-grained reporting interval that Grafana selected, probably a few hours per point. The graph below is an average of every 30 days. The same trend is more clearly visible but of course it doesn’t capture the variance.

Starlink 7 days stats April 2024

This blog post contains screenshots of my monitoring dashboards for my residential Starlink node in Grass Valley, CA. Bottom line: the service is quite good these days.

  • Average speeds: 150Mbps down / 25Mbps up
  • Average latency: 36ms
  • Average packet loss: 0.6%

I do a lot of careful client-side monitoring. Used to pay more attention when the service was new and had some problems. But since January 2023 it’s worked very well for me, when their major over-capacity problem was solved at least for my area. And it got better in January 2024 when they started to improve latency. Mostly now I don’t pay attention to it very closely because it works fine.

The downsides are the median packet loss is high enough to matter. And performance is variable, it gets noticeably worse in evenings presumably because of congestion. But it’s pretty good always. FWIW I think Starlink’s behavior is more like a cellular ISP than wired or geosync satellite. Better quality in general than overloaded American cellular but similarly unpredictable packet loss and jitter.

I still have my dashboards and monitors running and they give very detailed client-side views of performance. Here’s screenshots of my 4 separate dashboards, all data for the last week (April 22 to 29). I think this week was mostly unremarkable and typical. First couple are basic ISP monitoring; the other two are more specific and unique to me or Starlink.

FWIW I have a gen 1 Dishy with ordinary residential service.

Ookla speed tests

This graph shows results from hourly speedtests using Ookla’s command line tool. Main results:

  • highly variable download and upload speeds with a mean of 150Mbps down and 25Mbps up.
  • few hours under 20 Mbps download speed

Compared to the old days, overall speeds are better. I used to be more like 100 / 15. Even better, the “hours under 20 Mbps” is greatly improved; that used to be 8 or more hours a day.

ICMP Ping tests

Using telegraf to send 5 pings every 15s to 8.8.8.8 and measure round trip time and packet loss. See below for the better IRTT tests showing similar data; starting here because pings are familiar to everyone.

  • average latency around 36ms
  • 0.58% mean packet loss
  • fairly stable throughout the day but there’s some visible daily pattern

IRTT latency tests

These are much more detailed results using the IRTT tool to test latency and packet loss with UDP packets to a server I run in a datacenter at or very near the Starlink LA POP.

  • 0.61% mean packet loss
  • 36ms mean latency.
  • Several incidents a day of 20% or more packet loss. (You see this pattern in applications too; the network goes away for a few seconds).
  • Clear pattern of higher packet loss during evenings. 30 minute average gets as bad as 2% or so occasionally.

Starlink monitoring

Starlink’s own monitoring data, using their gRPC endpoint to pull data from the dish.

  • two 30s+ outages around 3am. these seem to be related to firmware upgrades
  • 36ms mean latency
  • 0.6% “obstruction fraction”. It’s unclear what the dish reports as obstructions; at least some of it is packet loss unrelated to my antenna. I have a very clear but not 100% perfect view where Dishy is pointed.

Starlink latency improvement

Interesting trend here; starting around the first of the year the latency of my Starlink connection has gone down, as measured by IRTT pings to a server I run at BlueVPS in LA very close to my Starlink’s terrestrial egress.

IRTT latency measurement

I think this effect is real. Comparing the week starting 2023-12-11 to the week starting 2024-01-08, the mean went from 47ms to 39ms. That’s 8ms or almost 20%! I think worst case performance is better too, I can’t quite quantify it but the 99% is a lot less spikey and the maximums are lower. (See graphs at bottom) Looking at data for a year this is a major new change; it was steady at about 47ms for a whole year.

Update: a tweet from the SpaceX CEO: “Significant improvements have been made to @Starlink latency (ping) & many more to come. Target is <20ms.” Guess that confirms what I observed.

I don’t see any corresponding change in packet loss. Averaged about 0.56% packet loss in both weeks.

I don’t have a good way to guess why this might have improved. There’s basically no measureable latency between the first hop I can see after Starlink and my monitoring host at LABlue; I’ve always assumed they’re in the same datacenter. My memory is it was never more than 2-3ms at most.

There’s a similar effect visible in Starlink’s own reported latency number (from the gRPC debug data). That should rule out any question of my IRTT monitoring, Starlink’s own numbers show the same pattern.

Starlink gRPC latency

A simple explanation is improvements to Starlink itself. Either they’ve lowered the latency of their infrastructure or they have more capacity and so my packets are getting buffered less. Possibly the improved 95% performance suggests less buffering but I wouldn’t bet heavily on that guess.

Interesting that it’s a downward trend over a week, not a drop in one day. That suggests it’s maybe a gradual change in capacity rather than a step function change in routing setup.

Here’s detailed graphs of before and after.

Before, 2023-12-11
After, 2024-01-08

And a graph of a whole year:

(For completeness, I should note I changed my IRTT monitoring setup around December 10 when I migrated the server from a physical machine to a virtual machine inside Proxmox. But this change clearly post-dates it. Also if anything the virtualization should cause more latency or packet loss although I’ve seen no evidence of that.

Ubiquiti routers: garbage bandwidth stats

My Ubiquiti routers continue to vex me, Unifi OS has lots of problems. My latest complaint is it’s not even able to give me a basic accounting of how much bandwidth each device (IP address) on my LAN is using.

For instance, here’s what I think is a graph of the last month’s traffic for my Playstation. I downloaded a 60GB game on Nov 17. I also probably downloaded at least one other > 30GB game that month but I’m not positive.

In upper right it says 66.7GB download for the month. That is a plausible number but I think is low But then in the graph it shows an average of 0.8Mbps for the day of November 17. Also plausible? 0.8*86400 = 69GB. In the graph tooltip it says “Total Traffic” (for the day) is 9GB. That doesn’t agree with the graph data! And then in the chart below it says “All Traffic: 6GB” for the whole month. On a different screen for the device it says “Traffic Activity: 1.66GB”. It’s like they’re picking random numbers.

The displays are utter nonsense. This problem has been going on for years. (Before, they didn’t even have any traffic stats.) I’m not the only one complaining: see here or here or here or any of these.

Unifi also has a more ambitious “Traffic Identification” display where they try to show you bandwidth by application: Youtube, etc. Doing that reliably is hard, I would expect some inaccuracy. But counting by device IP should be really simple. Failing that makes me wonder what else is wrong in the router that is less visible. (BTW, that screenshot above may actually be what it thinks for my whole network, although in context it doesn’t seem to be. If I explicitly choose PS5 I get another graph that shows that same 1.66GB total and otherwise obviously wrong small numbers.)

Every time I see a product fail this badly I always wonder, do the engineers who work there give a shit? Do they use their own software?

Global Starlink outage for hours

There was a major outage yesterday across all of the Starlink ISP. Mine went down at 4:38pm California time. I don’t know when it came back (I swapped to my backup Internet.) This article says Starlink acknowledged the problem via a tweet at 5:33pm and that it was fixed at 6:33pm. So that’s two hours, with an hour to acknowledge the problem. Comcastic!

Starlink has no public monitoring page, no online status. There’s nowhere to go to find out what’s happening. Hour late tweets are not sufficient. DownDetector was surprisingly useful but all that does is count how many people are clicking a button that says “something is wrong”. Better than nothing but it’d be nice if Starlink did something real.

I continue to be mostly happy with Starlink service, particularly since the improvement early this year. I respect the complexity of what they’re doing with a satellite network. But some aspects of the product are not very good, particularly customer contact. I’m just grateful I’ve never needed to do a real support request; the experiences reported on Reddit vary wildly.

What my phone was talking to

After setting up some monitoring I’ve got some data on a little over 2 days of Android phone activity. But I don’t really know what’s going on with my phone other than it’s a lot.

The phone is a Pixel Phone, nothing extraordinary, not used often. I do have a couple of background things running (Syncthing and GPSLogger). Mostly I’m curious why so many apps are sending network traffic every few hours. So I set up NextDNS and Netguard to learn more. Honestly, I didn’t learn much from this exercise. But here’s what I got.

NextDNS Analytics shows 18,000 queries, 35% of which were blocked for being trackers / ad related.

Top domains blocked were for Braze, Urban Airship, Optimizely, Crashlytics, Twilio Segment, and Google Analytics. Ie: all basic user surveillance, ordinary marketing bullshit.

Top unexplained domains allowed were Google SUPL (a location thing), federatedml-pa.googleapis.com, youtubei.googleapis.com, play.googleapis.com, and firebaseremoteconfig.googleapis.com. Guessing these are all related to Google services that are part of Android OS. (A whole lot of network connections go to 1e100.net addresses but all that tells me is they’re hosted by Google.)

Netguard is showing me a lot of my apps wake up and do a little network stuff every few hours, despite me not actively using them. For instance Amazon Music (which I haven’t used in weeks) wakes up once an hour and makes several network connections totalling 1-2MB. Once an hour! What the hell? I deleted that app.

Other apps seem to connect only once a day and some (like HSBC’s banking apps) don’t connect at all. Despite being apps I do use regularly. Presumably some are suppressed because Android identified them as unused and deprioritized them. I’ll note that many open source apps seem better behaved. And shout out to the apps that have “no Internet permission”, typically apps that don’t need them.

I have a theory that a lot of this sparse traffic is basic app telemetry. For instance it looks like Grindr is firing off requests to Crashlytics, Google Analytics, and Scorecard Research. (And also its own DNS-over-TLS queries once it figures out I’ve blocked those on the system level.) Remarkably the other gay dating app I have installed, Growlr, seems to make no queries at all when not used.

There’s an interesting splodge of queries at 2023-08-29T20:45. It’s plausible that’s when I unlocked my phone, I could imagine a bunch of apps taking advantage of the device waking up to phone home.

One last tool I tried is Google’s “Non-carrier data usage” report; that shows you app data usage for a month. But most of that is stuff I did on purpose, like reading a newspaper. Just about 20GB for a month. The first surprise on the list is Tapet, an app that makes random background images; that comes in at 172MB. I do use that app (and love it!) but none of its features are networked, so where’s the data going? I couldn’t figure it out, although their privacy policy suggests usage surveillance. Amazon Music is up there at 42MB. A blood pressure monitor app I barely use is at 39MB. Etc.

Bottom line, I didn’t learn much. Honestly trying to figure out what’s going on with these limited tools is difficult. Netguard has the ability to capture full traffic in PCAP files but trying to comb through those sounds like a nightmare, especially since it’s almost all SSL.

There’s definitely a cost to keeping old apps installed on your phone. Even if you never use them they still wake up and do stuff on the network.

Update: Android has some guidance on excessive mobile network usage in background. “Android vitals considers background network usage excessive when an app is sending and receiving a combined total of 50 MB per day while running in the background.” This page seems mostly concerned about battery consumption, not bandwidth.

Google APIs

One interesting bit of data from the DNS logs are various Google API queries. It’d be interesting to know what all of these services are; like what’s geller-pa?

228 crashlyticsreports-pa.googleapis.com
218 youtubei.googleapis.com
218 federatedml-pa.googleapis.com
180 play.googleapis.com
157 firebaseremoteconfig.googleapis.com
141 android.googleapis.com
130 firebaseinstallations.googleapis.com
114 play-fe.googleapis.com
107 androidattestationvalidation-pa.googleapis.com
100 googlehomefoyer-pa.googleapis.com
90 http://www.googleapis.com
79 notifications-pa.googleapis.com
76 android-context-data.googleapis.com
70 userlocation.googleapis.com
60 geller-pa.googleapis.com
39 telephonyspamprotect-pa.googleapis.com
37 translate-pa.googleapis.com
36 update.googleapis.com
36 paperwork-pa.googleapis.com
36 firestore.googleapis.com

Top Domains

And here’s the top domains overall by DNS queries (count is number of queries, not overall traffic).

588 sdk.iad-06.braze.com
548 device-api.urbanairship.com
400 logx.optimizely.com
386 firebase-settings.crashlytics.com
384 api.segment.io
377 ssl.google-analytics.com
265 supl.google.com
228 crashlyticsreports-pa.googleapis.com
218 youtubei.googleapis.com
218 federatedml-pa.googleapis.com
188 discovery-v6.syncthing.net
180 play.googleapis.com
172 googleads.g.doubleclick.net
157 firebaseremoteconfig.googleapis.com
154 app.rain-alarm.com
151 device-metrics-us.amazon.com
143 static.withings.com
141 discovery.syncthing.net
141 android.googleapis.com
140 g.whatsapp.net
136 meta.wikimedia.org
132 rest.locuslabs.com
131 prod.rudderstack.withings.net
130 firebaseinstallations.googleapis.com
129 clients4.google.com
128 remote-data.urbanairship.com
126 graph.facebook.com
122 slack.com
120 http://www.googletagmanager.com
120 api.pocketcasts.com
119 clients3.google.com
118 http://www.googleadservices.com
118 ad.doubleclick.net
117 msh.amazon.com
114 sb.scorecardresearch.com
114 play-fe.googleapis.com
114 discovery-v4.syncthing.net
111 i.ytimg.com
111 assets.adobedtm.com
111 api.amazon.com

What is my phone talking to?

Trying to figure out what all on the network my Android phone is doing. Two avenues.

One is using NextDNS as a private DNS server. I’ve been doing this for a year+ as an ad blocking measure. It provides logs and some high level analytics for DNS traffic. I don’t love messing with DNS but they did a great job on this service. NextDNS shows me info about where my phone is connecting to, but not specifically which app. Also it’s skewed a bit by caching since it’s only DNS queries, not network connections. Anyway it already got me to remove TikTok (I hadn’t used it in a month and it was making 3 queries a minute). I’ve also learned about braze.com, some surveillance system that is happily being blocked.

NextDNS analytics

The other is using NetGuard, an open source app firewall. It works by being a locally hosted VPN. It’s main use is to block network to individual apps (like, say, TikTok). But it has some auditing capabilities, albeit with awkward UI. I currently have it allowing all connections but displaying notifications for new ones. Which is pretty noisy but is giving me a view of what’s happening on my phone. Syncthing is sure chatty! And I’m wondering WTF Uber and WhatsApp are doing consuming data when I’m not using them (it should not be polling for notifications.) There’s also a detailed log view and it will even export PCAP if you really want to get into the data.

Product desire

What I really want is a per-app audit of network activity with drill-down to see details. But the main view is just a scoreboard. One row per app, sortable by bandwidth and # of connections and the like. Just a passive monitor, no filtering needed. I’ve wanted something like this for 20+ years on every computer and router I’ve owned and am always disappointed.

Starlink publishes performance maps

This is really great; Starlink is publishing performance metrics on a map. Download, upload, and latency. Per-state in the US, per-country in smaller places. “Metrics range from 20th to 80th percentile for the “Standard” service plan only, during local peak hours, and are refreshed monthly. Map coloring is based on the median for each metric”. That’s pretty useful and way better than I’ve seen any other ISP do.

Download speeds, darker is slower

In California they report 44–139 Mbps down, 8–17 up, and 39–52ms latency. That’s pretty well in line with what I measure (over the whole day, not just peak hours). My latency at 51ms is on the worse edge of that.

Not sure I can draw many conclusions from the map coloring. Some broad regional patterns, but nothing specific. The per-state binning is pretty coarse.

Starlink vs Hurricane Hilary

I’m wondering if Starlink service was affected by the hurricane? I’m in Grass Valley where we got some clouds but no significant rain. But my packets are routed through Los Angeles. I don’t know if that’s entirely in space or if they go to earth in some invisible relay closer to me, but LA is definitely where the packets first appear in traceroutes.

Anyway, coincidentally I noticed an unusual service degradation yesterday around 9am to 6pm, about when the storm was passing through. Sort of? It’s not exactly time-correlated but The effect was worst around 4pm. Hurricane Hilary passed closest to Los Angeles at just about that same time.

Honestly I thought it was congestion-related but the effect is much larger than usual. Packet loss went up to 4% (typically 1%), round trip time up to 100ms (typically 50ms). Speed tests don’t show anything obvious, maybe throughput is a little worse.

It’s plausible there’d be an effect. The satellites are well above any weather but I’ve seen rain fade impact signal quality in the past when I’ve had strong local storms. (By far the biggest risk of hurricanes is the wind and your local antenna mount.)

There’s a discussion of a related observation on Reddit.

Here’s a graph of the last two days.

Starlink detailed timings

Over on Reddit user panuvic is posting a series of interesting timing graphs from Starlink packets. Most recent post here. I have no idea who this is or what they’re doing but it’s very interesting. Some of their posts make it sound like they’re measuring with independent radio gear listening in on the transmissions.

Some things I noticed, using his graphs.

Above is a graph of round trip times over a few minutes. Handoffs to a new satellite are typically multiples of 15 seconds. What’s interesting is the highly variable latency between satellites, like 20-70ms. That’s way more time than can be accounted for by radio propagation delay and physical distance. Maybe it’s queueing, some satellites are busier than others?

This is handoffs for two different locations. The two graphs are synced in time. If you look closely, so are the handoffs. They both occur at the same second, despite being two completely different installs at different locations 2400 miles apart. Isn’t that strange? I’ve heard other people speculate that every Starlink dish in the world schedules handoffs at 12, 27, 42, and 57 seconds after the minute. That seems wild to me!

Graphs of latency measured asymmetrically; bottom graph is one way delay from the Internet to the customer, middle is one way from the customer to the Internet, and top is two way. What’s interesting here is the banding in the receive timings, it looks like 4 or 5ms jumps in latency. I’m wondering if that’s some sort of time division multiplexing in action. Miss your transmit window on the satellite and have to wait for the next one?

Starlink dropouts

Ever since I started using Starlink I noticed that sometimes it drops out for 100-1000ms, maybe a couple of times an hour? I used to think it was just my site (I have some very minor obstructions, well under 1%) but enough other folks complain online about it now that I think these microoutages are just a weakness of Starlink’s Internet service.

That’s a graph of 24 hours of outages data, as reported via Dishy’s gRPC. It’s the same thing Starlink shows textually in its “Outages” mobile app tab. From what I’ve read the “Obstructed” tag doesn’t necessarily mean obstructed; it’s a catch all for “unexplained outage”. This graph shows 59s of obstructed, 30s of no pings, 50s of no downlink, and 12s of “no schedule” which is Starlink’s semi-regular 4am outage.

All told it adds up to 151 seconds of outages, or 99.8% uptime. Over a month I measured 99.3% uptime.

Two nines isn’t very impressive for an ISP, in my opinion, although it’s within the parameters promised by Starlink. Maybe it is impressive for a wireless ISP though, or a satellite one. I hope it improves but it’s not awful now.

The main way I notice is if I’m playing an online game; I’ll get a lag spike until the game recovers. Fortunately the outages don’t break TCP connections, either the packet shows up eventually or else TCP retransmits fix it. It also causes problem with live video and audio streams, like a Zoom call. But it’s only a second or two every 30 minutes, not terrible. You won’t notice it at all with web browsing and it will hardly affect bulk download speeds.

I have no idea what’s going wrong but could imagine many explanations. One common theory that seems wrong is that Starlink drops out every time it hands off satellites. I don’t think that’s the case. It’s potentially doing a handoff every 15 seconds, and seems to be every 5-10 minutes in ordinary usage. It’d be intolerable if every time it did that the Internet went away for a quarter second. Actual performance is much better than that. (IIRC Dishy is able to track a primary satellite and a backup, which probably helps with a smooth handoff.)

Starlink 50 Mbit/s throttling

Not my own data, but a couple of Reddit threads (also) are users reporting being throttled to 50Mbps download after using a certain amount of bandwidth in a short time. I think I’ve seen this myself but haven’t tried to measure it. One user’s guess:

This is 100% a hard throttle that can be triggered at will and is repeatable. It slows entire starlink service down to 50mbit. Even if it’s middle of the night!!! It then resets after the hour and the cycle repeats as follows.
-Start download -download at 120 for 15 mins -drops to 50 for remaining 45 minutes -returns to full speed for 15 mins -drops to 50 for remaining 45 minutes.
Seems to be 1 hour cycles, 15 mins of full speed followed by the remaining 45 throttled.

A lot of folks are pointing out how clumsy this is, particularly at 2am when there’s spare capacity. I don’t think this explains the better performance I’ve been seeing since March. I think it was added newer and isn’t the most effective of measures they’re using. But I’m totally guessing here.

Update: I haven’t seen any evidence of this at my own site but I would have only noticed around June 12/13 when I did some big downloads. Diablo 4 downloaded 85GB at an average speed of 150Mbps, no evidence of throttling. (at 8am Tuesday the 13th, a quiet time). Some of the reports on Reddit have definitely looked like a 50Mbps cap, I believe them, but the reports aren’t consistent. Maybe it’s something they’re testing or only doing to some users.

Update 2: a Reddit thread of someone getting a response from Starlink Support (in Poland) saying they are throttled because they used too much data, over 1TB.

Starlink stays improved

A couple of months ago I noted that Starlink had recently improved during nightly congestion. Glad to say that trend has continued. It’s not gotten any better but it hasn’t gotten worse either. Even more important I’d say it’s “pretty good” now whereas before it was “really bad every evening”. I actually managed to watch a video stream over the Internet at 9pm last night, something I wasn’t able to do for the last year reliably.

Here’s a couple of graphs showing the change around April 1. I’m on residential service (ie, higher priority than best effort) Note there’s some bad data mid-march (I was on my backup ISP because of something unrelated).

This is my best measure; how many hours a day do I get under the advertised 20 Mbps download speed, based on an hourly Ookla speed test. Before the fix this was regularly 4+ hours a night, every night. Now it’s typically 1 or 2 hours. The nice thing about this measure is it highlights what I really care about, which is degraded service for part of the day.

And here’s a simple packet loss graph based on pings to 8.8.8.8. Before the fix I was averaging 1% packet loss for the whole day. Now it’s 0.5%. Still pretty high but not terrible. This doesn’t highlight the nightly congestion very well, I should do something showing “hours with over 1%” or something. Eyeballing a graph I have this steady 0.5% packet loss most of the day, it’s nothing like the bad old days of 5%+ packet loss in the evening.

This last graph is not useful, only including it for its obviousness. That’s average daily bandwidth (again, measured hourly at Ookla). The average may have gone up a tiny bit since the April improvement. But it’s not noticeable because the 3am periods of 250+Mbps swamp the hour or two of unacceptable 5Mbps service. Just an example where simplistic measures don’t capture what you care about.

I still don’t know what changed at Starlink. But my money is on them improving their traffic shaping and load balancing algorithms. It’s also possible this was a fix just for me, maybe I was incorrectly classified as a best effort customer and that got fixed? I have no reason to think that though. I think they improved their technology at the same time they dropped their soft data cap plan.

Starlink residential improvements

Starlink has changed their service plans, at least in the US. For once it’s a small improvement for me, specifically the drop of a 1TB soft data cap on residential plans. They also raised documented download speeds to 25-100Mbps (from 20-100) although upload speeds are now listed as 5-10Mbps (from 5-15). See the new service specification that I assume replaces the old one for details.

I wonder what changed that caused them to drop the soft data cap? I posted a month ago about a performance improvement during evening congestion; maybe they’ve improved their resource sharing enough they didn’t need a formal cap? Service is definitely improved for me, the change I documented a month ago has held steady.

Update: the “fair use policy” indicates they might still throttle only on terms less clear than the planned 1TB soft cap. So this seems a step backwards, not forwards.

If bandwidth patterns consistently exceed what is allocated to a typical residential user, Starlink may take network management measures, such as temporarily reducing a customer’s speeds, to prevent or mitigate congestion of the Services

Starlink improvements during evening congestion

After collecting a week+ of data I think Starlink’s service has genuinely improved for me in Grass Valley, CA (residential service). The ISP had gotten very congested in the evenings; 5% packet loss, speeds under 10Mbps, games and streaming video not working well. Really frustrating. I first noticed this in February 2022. But sometime in the past few weeks it got better.

Measuring the improvement

Some basic stats comparing the last week (Mar 31 - Apr 7) to a typical week in February (Feb 7 - 14):

  • Average packet loss around 9pm: 1% vs 4%
  • Average packet loss for a week: 0.5% vs 1%
  • Latency around 9pm: 53ms vs 65ms
  • Average latency for a week: 50ms vs 50ms
  • Hours of download under 20Mbps: 3 vs 16
  • Average download: 115Mbps vs 105Mbps
  • Min download: 7.5Mbps vs 0.9Mbps

They key pattern here is that worst-case performance during the evenings is much, much better. Packet loss is the biggest change: Starlink has gone from 4% (with peaks of 10%) to 1%. But that shows up also as improved latencies. And maybe improved download speeds although that’s harder to measure accurately; the “bad hours” statistic I list first seems real though.

It’s interesting that average performance over a whole week didn’t improve much, just the worst-case performance in the busy evenings.

Thoughts on what it means

I’m thrilled with the improvement; things had gotten so bad in the evenings I couldn’t reliably use the Internet. Great job, Starlink! And well timed; they just opened up the area to more customers, i was afraid it was going to get even worse. It might still get worse again, and I don’t love Starlink’s pattern of degrading service and increasing prices. But this change here is a real improvement.

So what changed? I don’t know. But my guess is they deployed a better traffic shaping system. So that individual users are getting fairer sharing than they used to. That would be nicely in-line with their announced plans to add soft data caps. They’ve supposedly been throttling best effort customers all along but I wonder if the initial implementation wasn’t as good as what I’m seeing this last week.

The other possible explanation is more capacity. But I think that’s unlikely. They’ve launched more satellites in the past two months but not enough to explain this change. I don’t think they increased their satellite link capacity (or did they?). It’s possible they improved the infrastructure on the ground between the station and the rest of the Internet, but I don’t see much evidence of that.

I don’t really know what changed, but as a customer of Starlink I’m very happy to see the improvement.

Some graphs

Here’s a graph of packet loss and latency over the week in February, from before the change. The peaks every evening are evidence of a congestion problem.

And here’s a graph of the same data for the last week. See how much smoother it is? What an improvement!

Notes on measurement

All data comes from my automated test setup. Download speeds come from an hourly Ookla speed test. Latency and packet loss come from IRTT, a ping-like tool. I think they’re both reasonably accurate measures but I’m just doing some simple testing with basic tools. These are all scripts and graphs I’ve set up myself, using Telegraf and Grafana for data collection and a cheap VPN server in LA for the other end of the IRTT testing. I also have a second measure of latency and packet loss from pings to Google DNS; it confirms this pattern.

Starlink; improved latency and packet loss during congestion?

Not positive about this, but I’m seeing evidence that Starlink has improved performance in the evening congestion. Back in February packet loss would go up to about 5% and latency would jump from 50ms to 70ms during the evening hours, particularly 7pm-9pm. Now it’s only going to 1.5% and latency is staying steady around 50ms. There’s maybe a small increase in packet loss and latency in the evening but nothing nearly as bad as before.

I might also be seeing an improvement in my hourly Ookla speed tests. Feb 17 I got 9.3Mbps and 1.5Mbps at the worst hours (9pm and 10pm). April 3 it was 30Mbps and 27Mbps. Speed tests are so random I’m not confident about this.

I’m in Grass Valley, CA with residential service. It’s a congested area. Testing with IRTT, a ping-like tool. if I had to guess I’d say this improvement is recent, like in the last week or two. I don’t have good data because we’ve had a lot of snow-related outages here.

Here’s snapshots of before and after, from 2pm to 2am on Feb 17 and Apr 3.

February 17
April 3

That’s latencies and packet loss. For download speed, here is a 90 day graph of number of hours a day under 20Mbps. (Ignore the big red block of 24 hours; that was my backup ISP). These past few days have been really good; 0! This data is noisy enough I don’t want to read too much trend into it.

Starlink as missile guidance

Interesting bit from a recent Economist article about Ukranian attack drones.

At an early stage the Ukrainians appeared to pin hopes for controlling drones behind Russian lines on Elon Musk’s Starlink satellites, which work at frequencies and in numbers that Russian systems struggle to jam. A naval-drone attack on Russia’s Black Sea fleet in October reportedly made good use of this gap. But Mr Musk, apparently worried about the escalatory effect of such moves, has stepped in where Russian technology proved unable to. Starlink now uses geofencing to block the use of its terminals—not only above Russian-occupied territory inside Ukraine, but also, according to a Ukrainian military intelligence source, over water and when the receiver is moving at speeds above 100km per hour. “You put it on a boat at sea and it will simply stop working,” he says. So Ukraine’s drone developers now use a range of other, more expensive communication systems, with multiple systems often on the same vehicle.

Starlink v1 vs. an inch of snow

Snowing in Grass Valley (again). Last two times it’s done this Ken had to switch us to our backup fixed wireless Internet. I wasn’t home to look at it. This time around I am home. I was able to confirm Dishy says it’s heating (in the mobile app, also alert_is_heating: True in the gRPC). But flaky connection that became progressively useless. Starlink’s not supposed to have this hard a time with snow but it sure seems to. I’m glad I have a backup.

Here’s some network diagnostic graphs, both from Starlink’s gRPC status and from my own IRTT ping tests. Starlink shows definite problems with a sort of random assortment of statuses that all boil down to “no signal”. My pings show much higher latencies and periods of very high packet loss. All consistent with “shit’s broke, yo.”

I can’t easily access the dish (it’s on the roof) so wasn’t able to try to brush snow off. Or get a good photo, but what I could do suggests there’s a layer of snow + ice maybe half the thickness of what’s on the roof. I’m guessing we’ve gotten an honest inch of snow here, two at the most. Note I have an O.G. round dish v1; no idea if the newer v2 ones handle snow better.

Update: an hour or two later and we’ve gotten a proper.. 4 inches? Not sure. I happened outside to see the dish pointing straight up (recovery mode) and then watch it tilt to its new normal position. And a bunch of water run off. So the melting is working. OTOH there was still a bit of snow there, so it’s not working very well. Or maybe the signal is being blocked by snow in the atmosphere?

Either way I recall this working better in last year’s snow.

Update 2: Starlink was working again when I tried it about 3 hours after I posted this. The snow had slowed down and the face of the dish was completely free of snow, so the melting did end up working. The obstruction log did show 1.48 hours of “No Schedule” though so it was truly out for quite awhile.

Nightly congestion: Starlink vs local WISP

I’ve complained a few times about Starlinks congestion. This past week we switched over to my local WISP (snow outage, then I’m not there to switch it back). Here’s IRTT measuring packet loss and latency, you can clearly see the change around March 4/5.

The WISP is also congested, I think probably worse than Starlink. During congestion it has lower packet loss but then higher latencies, and for longer periods of time. I assume that means the WISP is doing more buffering. My WISP connection is 2 radio links from the wired infrastructure (I think).

Tailscale key expiry

I had my first real problem with Tailscale. Not coincidentally, six months after first using and loving it. Tailscale expires keys every 180 days and you have to manually re-authenticate every single host. This is the first bad user experience I’ve had with Tailscale, the product is usually much friendlier.

I got no notice that this expiration was coming. And it’s potentially catastrophic; what if your host is unreachable except via Tailscale? (See below). I don’t use Tailscale a lot and I don’t have any proper monitoring. Maybe if I were paying closer attention I’d have known it was coming?

The rest of this note is a little ranty because I’m experiencing the indignation of a sharp corner on an otherwise very nicely designed product. Tailscale folks, I love your product. This part of it needs some attention. To be fair, key management and updates are a hard problem in all of software, Tailscale is not unusual.

How to update Tailscale key

Re-authenticating isn’t hard with the CLI: just run tailscale up --force-reauth. This gives you a URL that you load in a browser logged in to Tailscale’s management console. It’s a remarkably manual process. The Android GUI client is a little easier; you’re prompted to log in directly on the device itself.

But here’s the shit sandwich: “tailscale up --force-reauth currently involves bringing down the Tailscale connection and thus should not be done remotely over SSH or RDP.” Can confirm; I tried to update a remote host via ssh over Tailscale and the update hung before I saw the authentication URL. A terrible experience for a networking product whose major purpose is remote administration of machines. And the auth process is interactive, you can’t just fire it off in a cron job or something. (There’s a hint that maybe there’s a “Reauthenticate” option in the dashboard after a machine “has already signed a new authentication URL” but I no longer have an expired host to test that with.)

I do give the product team credit, they did think about the “what if I can’t access the host to update it?” problem. There’s a button you can press to temporarily enable an expired key (for 30 minutes), giving you access. You still have the “how do you update remotely” problem but at least you can get to the host.

There may be a better way to do all this; you can generate auth keys and automate using them. Maybe a more serious Tailscale deployment is managed that way, I haven’t looked into it. The default keys are a great user experience right until they expire.

Determining Tailscale key status

The software tools for detecting whether your Tailscale key is expired are not good. The best tool is the Machines dashboard; this does have a status line and you can filter for expired machines.

On a host with an expired key your first clue that something isn’t working is probably when you can’t access other hosts on the Tailnet. tailscale status reports a confusing message, “Health check: not connected to home DERP region 12. Logged out.”. If you try tailscale up it will prompt you to reauthenticate and afterwards tailscale status will keep showing you the auth URL until you reauth.

On a working connected host elsewhere on a tailnet tailscale status does not show you if another host has an expired key. The status shown is - which I think means “unknown”. It’s not offline or some special expired status. tailscale ping will report peer's node key has expired.

I could not find a way to see what machines were soon to be expired in the machine dashboard; the keys page doesn’t show the automatic keys that the default path uses. The command line tools don’t seem to tell you either, or at least I can’t find it. I guess you can periodically tailscale up --force-auth to refresh the keys but it’s up to you to know when to do that? Again, I assume using managed auth keys is the real solution for this.

Why expire at all?

I don’t quite understand why Tailscale expires host keys at all. There’s a general idea that expiring logins, etc is good security practice to solve various corner cases like a years-old server that gets recycled or is running an old insecure version. Sorta? But for that kind of thing I much prefer a system where an old auth token is only expired if it has not been used for awhile; expiring something that was trusted just minutes ago seems like a bad decision.

It’s possible to disable key expiration for specific hosts via the machines dashboard. The docs suggest this is for “trusted servers, subnet routers, or remote IoT devices that are hard to reach.” There’s no way to disable expiration for a whole tailnet; all you can do is set the expiration time from 1 to 180 days.

Windows update

This isn’t about key expiration really, but the Windows client still has no auto-updater. I was still running 1.30 with a security hole! They’re working on it (and recently changed the installer they use) but it doesn’t seem a high priority. Installing an update is easy enough but it really needs to be automatic.

Starlink: snow outage

We got a lot of snow in Grass Valley, maybe 12 inches? Starlink works well in snow in general; not much signal fade, even has a heater to melt snow. But it stopped working last night around 5:25pm, just as the snow was stopping. I don’t exactly know why or if the heater was engaged. But it fixed itself in the morning.

My monitoring shows the dish started reporting “no downlink”. After a couple of minutes of that the dish started reporting azimuth and altitude of 0/0. Exactly 0/0, so I think that’s an error state and not a real measurement. (Also 0 is the horizon?) We unplugged it from our monitoring system so I don’t have any further info. After we plugged it in again this morning it’s working normally. It’s 30°F outside and it does not say it’s heating itself; I imagine the system only heats when it detects signal degradation, not just that it’s cold.

Starlink: worse service, higher prices

Starlink has announced a $10 price hike ($15 for some), the second in less than a year. Meanwhile in that time service has significantly degraded: cutting speeds from 100 Mbps to 20 Mbps, adding a data cap, increasing packet loss and evening congestion, and an SLA that promises as much as 15 minutes of downtime a day. It’s all kind of dismal.

But it also is a successful product because for many in the US, including me, Starlink is the best option they have. Years of not investing in broadband infrastructure left many of us with no good Internet option. Starlink is truly better in many ways. The main mistake they made was wildly overpromising before launch. I’m glad the FCC figured out they couldn’t deliver before handing them $900M based on their promises.

Weirdly the company announced tiered pricing: $120/mo for customers in heavily subscribed areas, but a discount to $90 in sparse areas. On Reddit it looked like about 10% of customers got a discount, so this is basically a price hike for almost all of the US.

I fear the Starlink product is going to keep getting worse; they keep adding customers. They are adding satellite capacity too but it hasn’t been keeping up in the US. Meanwhile they have way more capacity than customers in most of the rest of the world. It’s a difficult business.

Ubiquiti, RFC3442, and Starlink routes

I’m still trying to find a solution for the problem I have with a router bug and Starlink. First, a meta commentary. A friend teased me for all this writing about Starlink and routers. Let me just say it sucks. Trying to understand a broken Internet connection without the means to really fix it is intensely frustrating. The router is a bit more in my control and I’ve come to the conclusion Ubiquiti’s newer routers just have bad software. Next time I work on this I’m going to try an OpenWRT router again, maybe the SmoothWAN variant with channel bonding.

I have a USG 3P router. Ubiquiti has a router bug where static routes don’t work with WAN failover. Starlink looks like a normal ISP gateway, with DHCP advertising a route to the internet. But it also has a special hidden route for 192.168.100.1 so you can access Dishy’s stats. The easy thing to do is add a static route. This works fine on the Ubiquiti router unless you have WAN failover enabled (a backup Internet). Then the static route breaks. This is a known bug discussed for many years now.

(An added complication; Starlink’s dish also listens at http://34.120.255.244/. Not sure why but I’d hoped maybe this would work even without a special route for it, since it’s a public IP address. No such luck.)

My reader Daniel Y wrote in to suggest an interesting fix: install this rfc3442-classless-routes script to run as a DHCP exit hook. Starlink advertises the extra routes via a DHCP option. Which Ubiquiti apparently ignores? It’s apparently necessary for some European ISPs, and it’d sure be handy for Starlink. This script will set them. As a side effect Daniel said this also fixed the other bug I was talking about, where the router just ignores the DHCP lease in certain scenarios. I worked around that bug by inserting an ethernet switch between Dishy and the router so the ethernet link stopped going down.

Anyway, I tried the RFC 3442 script and it didn’t work for me. I did some debugging... First, it looks like my USG 3P has the RFC3442 routes even without this script. Maybe Ubiquiti did implement it afterall? (Daniel has the older EdgeRouter, most discussion is about those.) Second, the script gets invoked in a way it doesn’t seem to be expecting; there’s no $reason environment variable set so it doesn’t work. I hacked around this and tried adding routes with ip route add like the script would and nothing worked.

It’s a weird failure. Here’s the routing table according to ip route or Ubiquiti’s show ip route

default via 100.64.0.1 dev eth0  proto zebra
10.33.1.0/24 dev eth2  proto kernel  scope link  src 10.33.1.31
34.120.255.244 dev eth0  scope link
100.64.0.0/10 dev eth0  proto kernel  scope link  src 100.103.201.245
127.0.0.0/8 dev lo  proto kernel  scope link  src 127.0.0.1
192.168.3.0/24 dev eth1  proto kernel  scope link  src 192.168.3.1
192.168.100.1 dev eth0  scope link

That sure looks good to me! So why can’t I reach 192.168.100.1? Even explicitly doing ping -I eth0 192.168.100.1 doesn’t work.

My suspicion, without evidence, is that failover on the USG 3P is implemented in some complicated way that totally bypasses normal IP routing. That the routing table I see there doesn’t work. That doesn’t explain why the explicit ping-through-an-interface also fails. Honestly it’s all just such a black box. A broken black box. Ugh.

Random other Ubiquiti bug: their UI only supports RSA ssh keys. Can’t use Ed25519 or the other newer key types. Crap like that makes me cranky.

Starlink and BBR congestion control

I improved my download throughput with a simple change, enabling TCP BBR on the server. This all from a tip from an online friend who I’ve been sharing technical Starlink info with, I’ve been learning a lot from him. There’s a guide here.

I didn’t test this very carefully but casually observing an rsync transfer at 8am, when Starlink is quiet... With the default cubic congestion algorithm the transfer was bouncing around between 5 MBytes/s and 12 MBps. After enabling BBR I got more like a steady 12 MBps. Eyeballing it, I got 2x the throughput! Could be coincidence though, Starlink performance is so variable. I should test more carefully with iperf3 -C but am too lazy.

Ubuntu 22.10 by default uses the cubic congestion algorithm, use sysctl net.ipv4.tcp_congestion_control to verify. Enabling BBR is as simple as running sysctl -w net.ipv4.tcp_congestion_control=bbr. This will load the tcp_bbr kernel module and enable it. You can edit /etc/sysctl.conf to make it permanent.

Worth noting BBR is a change you need to make on the high bandwidth sender, typically the server. It can’t hurt on the receiver but I don’t think it will help either. There doesn’t seem to be an easily installable BBR for Windows. But it’s very easy to enable on a Linux server!

The guide I linked also suggests using FQ queueing and considers TCP window scaling. I didn’t change those. FQ has a good reputation on a router device.

What is TCP BBR?

TCP congestion control is one of the more important parts of Internet magic that makes things work. Basically it detects when a network link is getting overloaded and slows down transmits, trying to find the optimal throughput. The details of how it does that are remarkably subtle and have changed over the years. I’ve often wondered if Starlink’s wildly variable throughput and ambient packet loss were bad for existing algorithms. Maybe so, and maybe BBR is better?

TCP BBR is a Google innovation dating to 2016 or so on its way to becoming an IETF standard. They reported a 4-14% improvement after deploying it on YouTube. An analysis here shows the improvements are not big for a high quality link but are enormous at 1.5% and 3% packet loss; that’s more like my Starlink situation. Classic TCP congestion control interpreted packet loss as a sign of congestion. But it could also just be a flaky wireless medium. A modern algorithm designed to do more subtle modelling of the connection could definitely improve things, particularly for a Starlink client with 1%+ packet loss, 100% jitter, and varying maximum throughput.

I didn’t do a deep dive into understanding all of TCP BBR. Geoff Huston has a great writeup. And there’s Neal Cardwell’s formal paper and this video about the paper. The gloss I got from looking at these is that BBR is explicitly building up a model of the link characteristics and testing to update or revalidate it frequently. That’s a good deal more complex than “react to lost packets by halving the rate”, the core of the classical algorithm. It’s no surprise that as computers have gotten better there’s more room for doing more sophisticated traffic shaping.

Starlink outages

Starlink has a nice outage report. I got the data off the dish via gRPC and have been logging it. It’s interesting. There sure are a lot of outages. The service description says “99% uptime” which is not a very ambitious goal; 1% downtime is nearly a quarter hour a day. In practice I have several minutes of outages a day, although some may be specific to my site.

That’s about 105 hours of outage data. Total of 11.7 minutes of outages, or about 99.8% uptime.

About 40% are attributed to obstructions; I do legitimately have a minor obstruction. But there’s something like 10 satellites in view of my house at all times now and in theory Starlink is supposed to switch away anticipating an obstruction. Not sure why that doesn’t just give me no obstructions in practice but I think the switching is not as robust as I’d like.

The other 60% are about half “No Pings” and half “No Downlink”: the mobile app calls these “Network Issue” and “No Signal Received”. I have no idea what causes these or how the dish knows that “No Signal” is not “Obstruction”. They all seem to be failures of the medium though.

My main question is whether these obstructions are legitimately obstructions and cutting down a tree would make a difference. A friend has an install with a full clear view and he tells me he still gets obstructions logged but “not often”.

The mobile app (wisely) divides up outages into categories: 0.1s+, 2s+, and 5s+., Even an 0.1s outage is noticeable to a video stream or gaming session but eh, it’s pretty minor. 2s+ is a significant problem. I didn’t measure how many of my outages were 2s+ but you can kind of eyeball it in the graph above.

Below is a screenshot from the mobile app’s outage log. I’ve highlighted two outages: a 15s “network issue” at 9:32am and an 8s “obstructed” at 9:48am. The second one terminated an open TCP session I had, I think the first one might have also. Both are accompanied by at least a little “no signal received”. My take on this is Starlink’s satellites failed entirely twice this morning, at least for several seconds.

ISP connection monitoring with IRTT

I’ve set up some new monitoring for my Starlink residential connection recently, using IRTT as a sort of very fancy ping tool to measure latency and packet loss. Here’s a couple of screenshots

24 hours
1 hour

IRTT is a carefully written round trip measurement tool. I have it set up to send a small UDP packet every 100ms to a server in an LA data center at 45.66.249.240, very near where my Starlink connection goes after the satellite hop. The IRTT server responds immediately with a reply and the software records the round trip time and packet loss. (It also records asymmetric delays and other things that I’m skipping over.) I do these requests for 58 seconds once a minute and record the results for the last minute in the graph above.

The top graph is for a full 24 hours. Packet loss first, then round trip time, and finally a graph of Starlink’s data traffic. From 13:00 to 15:00 I downloaded something big (a game from Playstation). You can also see the evening congestion around 18:00 to 22:00.

The bottom graph (in green) is also packet loss and RTT but for one specific hour, the busiest 19:00 to 20:00 hour. The third IPDV graph is more or less a measure of jitter in RTT.

Interpreting

So what does this all mean?

First I want to highlight a top line number: my average packet loss is 1.5% for the whole day. That’s horrible. My packet loss on a great fiber ISP like Sonic is essentially zero. Even at very quiet times like 5am, Starlink packet loss is still around 0.5%. I realize satellite radio is inherently unreliable but I’d have expected with enough capacity that retransmits in the link layer should paper over most of that. Then again Starlink reports an “obstruction fraction” of 0.6% with obstruction duration of about 800ms every 20 minutes. So maybe this is related to my particular site. At a busy time, like 19:00 to 20:00, I’m at 5% packet loss when some minutes at 10% or more. I can definitely feel those using the Internet, it’s not good.

Another thing to highlight is the jitter in round trip times. At the busy 19:00 hour it’s 44-86ms RTT with 10ms standard deviation. Note these are min/max based on averages over one minute; individual packets can take as long as 400ms to get a reply (or maybe more?) The quiet hour is surprisingly bad too, 33-75ms with 8ms SD. The per-packet variance isn’t as bad as during a busy hour but it’s still notable. (I don’t have great visualizations of this data, I should focus more on it.)

One big pattern is a jump in packet loss and round trip during my download around 13:00. This is expected for a typical Internet node. It’d be nice if some traffic shaping lowered the RTT hit from the download but that’s hard and this basic behavior is is pretty common for an ISP. I’m OK with that.

The second big pattern, and much more problematic, is the increase in packet loss and RTT during the evening hours even though I’m not using my link myself. This is the #1 evidence of Starlink’s congestion and is getting worse over the months by every measure. They are overselling their capacity.

More Work

So that’s some preliminary results. Lots more to do. As I said above, I should do more to characterize the extremes of behavior; the 400ms round trips, the strings of 15 lost packets in a row. Those are more important to user experience than hour-long averages; you notice when the video pauses or the game disconnects you.

IRTT also logs details on every single packet and I should do more with that information. Someone I’m chatting with has some very interesting visualizations showing millisecond-scale phenomena in the connection, including visible changes in latency when the connection hops to a new satellite. Neat stuff!

IRTT is a good tool but not ideally suited for continuous monitoring. It wants to run to completion and then produce a report of summary stats like average RTT. (I run it every minute; for 58 seconds to give the last run time to finish before the next starts.) I’d rather have something running continuously and reporting exponentially weighted moving averages or the like.

I should get more serious about measuring my obstructions; they are certainly the cause of some of the packet loss I see, but not much. The Starlink app shows a log of obstruction events but I haven’t figured out how to get at it in my own code, it must be in the gRPC data somewhere.

A Note on Correctness

Trying to measure this stuff in a consumer setting is difficult. I am not running a lab here. But I do try to get it right. Everything is wired ethernet. My network connection is mostly pretty quiet. I did this testing with three different servers, the data above is from the best one. (A second server in LA showed occasional transient packet loss spikes; I suspect the cheap VM I’m on gets deprived of network or CPU occasionally.)

BTW one nice thing about these tools is they don’t use a lot of bandwidth, like 6 Kbps each way. It’s a much nicer way to measure connection health than speed tests. And the continuous UDP stream seems a better measure of real application experience than ICMP pings.

My Starlink rotated

My Starlink dish moved itself in the past week or two. It was pointing due north, azimuth about 1-2° east of north according to old data. Now it’s visibly pointing a bit west and the software tells me it’s at -19.7°. It’s visible in the cool 3d view of obstructions in the mobile app, too. Elevation is currently 64.0; it used to be 65.

For the past month or two there’s been reports of dishes pointing themselves towards the oceans for coastal users. The speculation is they’re trying to squeeze out more capacity, getting folks who can to use previously unused bandwidth over the oceans. That seems like a good change to me!

The one downside is some folks report how they had a clear view to the north and now the dish is pointing itself straight at a tree. That seems avoidable, the firmware knows where obstructions are. Maybe they haven’t gotten to it yet. In my case the westerly view is actually a little better than due north; I have one tall tree in the north east that was obstructing about 1-2% of the view. Now it’s a little less although I can’t quite prove that out with numeric data. See the tiny smidge of red here; it used to be more.

More Starlink product failures

Been a bad month for Starlink.

The ISP service had a meltdown a week or two ago, see my previous blog posts. For a week+ there were a lot more dropouts. Then there was a 12 hour period of massive packet loss. My connection fixed itself 2023-01-22 at 22:40 (California time). My guess is they were doing experiments with traffic shaping that failed badly.

Starlink announced last fall they were imposing data caps in December. Then they pushed it back to February. Today, Jan 31, we learn it’s now “April at the earliest”. They don’t actually communicate these slipped deadlines to customers; the only way to learn about it is to read the terms of service document and see if they changed it.

A lot of Starlink v2 folks are finding their dishes are failing this winter. Best guess is it’s the cable connector at the antenna. (It’s a proprietary cable, costs $60-$100, and may not ship for a month+). There’s a lot of suspicion it’s related to dish heating in winter.

Starlink support has never been great but recently got much worse. I submitted a ticket complaining about service quality and it took 13 days to get a response. Lots of reports on the Reddit of a month+ without a response to things like “you said you shipped equipment and didn’t” or “the dish arrived but doesn’t work” or “I’ve been offline for 6 weeks now”. Here’s someone billed for service they haven’t received yet. Folks are starting to file FTC and FCC complaints; those do get a swift reply.

It’s just not going very well over at the Starlink division. It’s so frustrating. The service is an amazing engineering accomplishment. It worked great the first year until the company decided to sell to more customers than they have capacity for. Now it’s nearly unusable in the evenings. And all the execution around the product that you need in a consumer business is just terrible.

Not clear it’s going to improve either. From what I’ve seen they can only find a market in the US with our far-flung lousy Internet infrastructure. Other rich countries in Europe and Asia don’t need satellite Internet because local infrastructure is better. And the places that do need it, most customers can’t afford $100/mo for Internet. They have far too many customers for their capacity in the US and nowhere near enough customers where they have excess capacity. I wonder how much money they’re losing.

UDP metronome vs. Starlink

I created a custom tool for monitoring network connections. Here’s some notes on what I learned from it and what I plan next.

I wrote the tool in a couple of hours. It uses aioudp to send a UDP packet to a server every 100ms or so, the server reflects it back. This very vaguely mimics application traffic. I then log back whether the reply came back in order and how long it took. Data is sent to influx and graphed with Grafana. 1 second timeouts or packets out of order are marked as “errors”.

I left this running with the client behind Starlink and the server on my lightly loaded reliable machine in a datacenter. Quick and dirty and there’s some things I’d improve in the timing of packet sends (it only sends after it receives the last one, so slow RTT means fewer packets), but it got me some data pretty quick. However I’m going to stop running it because it’s kinda sloppy.

Going forward I am going to look at irtt for the network testing. It’s a ~5 year old program that does something similar with UDP to monitor connection latency. But written and tested much more carefully than mine. I haven’t dug into what all it can do but it seems to the task. This experiment made me realize it’s much more useful to graph anomalies and shifts in the general trend, not the basic sequence of successes you expect.

I was a little worried about this high frequency testing but the volume isn’t so bad. My data packets are about 20 bytes, so call it 50 bytes total for the packet (including headers) or 0.5 kbytes/sec or 43 megabytes a day. It’s negligible.

Starlink on a normal day

Here’s a graph of the data after a full day. For each slot I’m graphing the mean RTT and the max/min for the time interval. The scale here is about 1 minute a pixel, so there’s up to 600 packets being measured. Errors peak at about 10, or under 2% packet loss.

I like how this shows the daily congestion so clearly. The heavy line of mean RTT in the second graph is very clear; you can see the latency creep up from 100ms to 150ms in the busy times of day. The max/min also spreads significantly, showing the jitter. (Standard deviation just follows the same trend as mean.) The error rate graph at the top is also illuminating. Unfortunately I screwed up here because most errors are timeouts (1 second) and that delays my dumb code from sending another packet, so at 100% packet loss I’m only possibly getting 60 packets a minute through, not the 600 I intended.

For comparison here is a graph from ICMP pings in the same time interval. This shows roughly the same pattern of evening congestion, particularly in the packet loss red dots. But the picture with mean RTT isn’t nearly so clear. Not sure why that is but I think it’s because of my higher frequency sampling with the metronome; 600 a minute vs. 4 x 5 packets a minute with the pings.

One thing that’s instructive with this high frequency data is to graph every single packet. Here’s 1 minute worth of data representing 400-600 packets during a bad time when 11 of those packets got lost. You can see the spread of latencies is just all over. It should be 100ms but some packets are taking 4x as long.

Starlink’s bad day

I lucked out and got this monitoring running on 2023-01-22 when Starlink was having a bad day. I managed to capture the bad behavior and its fix pretty clearly.

You can see a radical change around 22:40 (22:41:27, precisely). Before then error rates were very high and latency was all over the map. Suddenly it smooths out; almost no lost packets, steady latency, and a lower minimum latency. Starlink changed something. FWIW here’s a closeup of the transition.

Starlink nearly unusable for real time apps

My Starlink connection has tipped over to being unusable for real time apps. It’s still OK for loading web pages although slower than the minimal 20 Mbps service level. But real time apps like gaming are completely broken right now. This is in addition to the weird DHCP problem I blogged about earlier today.

The main overriding problem with Starlink is still congestion. The service gets very slow every evening, bad enough I can’t reliably watch a single TV show on Amazon, Netflix, or Plex. They have oversold their capacity.

The new problem is some weird thing where the whole connection drops out for 1-2 seconds. Lots of reports on Reddit summarized here. It’s mostly gamers who notice this but it must affect video calls too. This feels like a new significant problem and it’s hard to guess what it might be.

I should add that Starlink’s support is terrible. Many folks on Reddit report going weeks with no response. To big simple things like “you said you shipped me hardware but it did not arrive” or “my service has been entirely offline for a week and I suspect my hardware is broken how do I get a replacement?”

Here’s some data monitoring. First a basic ping graph of the particularly bad last hour.

Look at that; 5% packet loss over an hour. Latencies all over the place from 50 to 200ms when it is working. Outages of minutes at a time. It’s not even prime time for congestion yet, still 5-6pm.

Today I wrote a new custom monitoring app I’m calling “metronome”. It sends a UDP packet to a server every 100ms. The server reflects it, the monitor measure round trip time. I wrote this to more closely monitor something like a game application; I don’t love using ICMP ping for connection monitoring. Also it’s nice to have something so high frequency. It’s still a little buggy but giving some useful results. Here’s a graph of that same hour; see those clusters of 200+ms? Ping to that server is about 100ms.

A change?

Edit: woke up this morning to 12 hours of data. Something changed abruptly at about 22:40 (local time); packet loss went way down both on my UDP metronome and my old reliable ping graph. There’s still a wide spread of jitter in the metronome but that slowly improves as it gets towards midnight and later, which is consistent with residential user congestion. The download speed graph at bottom (once an hour) confirms the usual nighttime congestion pattern.

Total guess here but I suspect Starlink is experimenting with traffic shaping algorithms and whatever they were doing before 22:40 was really not working. Either that or something was just broken. Glad to see basically no errors though. There’s no evidence of the 1-2 second microoutages I was seeing this last week. Need to try my game or something to confirm at an application level.

BTW this visualization is very sensitive to how I graph it in Grafana. The green graph at top is drawing max(rtt) every 200ms and leaving it blank / white if there’s no data (the jankiness before 22:40). My app logs data about every 100ms when the network is working, which results in a nice smooth green area after 22:40. I like this but it’s pretty slow & demanding on the graphing software. The usual Grafana graphs average on a time-scale appropriate level, like every 5s in this graph, but then all that averaging gives a very smooth picture that hides the packet loss and jitter. I need more direct visualizations of the variance. The error graph is one measure (it’s just a count of errors per time interval). I should try graphing the literal variance or SD.

Starlink vs Ubiquiti OS: outages with WAN failover

I’ve got a problem that’s recently gotten worse on my LAN. Starlink will stop working and my Ubiquiti router fails over to the backup. But then it never switches back even though it looks like Starlink is up. It appears to be a DHCP failure; my router can’t get an address for the Dishy interface.

Sometimes rebooting the router fixes it; that suggests it’s a UnifiOS problem. Sometimes I have to turn Dishy off for 10+ minutes and then it starts working again, suggesting it’s a Starlink problem. Or maybe it’s more complicated. Today when this happen I rebooted the router but not Dishy. It started working after a minute or three.

This problem has occurred off and on for two years but is now happening about once a day. Rebooting the router seems the best way to get it working again. But I think the problem has fixed itself at least once (after several hours). I may also have had to turn Dishy off entirely for awhile to get things working.

I know from other sources that Starlink’s ground infrastructure has some sort of reset that happens if Dishy is offline for a few minutes, so often unplugging for awhile fixes things. I also know DHCP has to go all the way through the satellite to the Starlink ground station, so if the network is overloaded it’s not as reliable. But this big failure happens at quiet times too, like just now at 7am.. Finally I know UnifiOS also has bugs in its failover system. So many bugs; I probably won’t buy another Ubiquiti product.

An idea for a fix.

I’m trying a fix right now, putting a Netgear ethernet switch between my router and the Dishy PoE injector. I’ve seen signs in the logs that maybe the ethernet link is failing. And coming back, but maybe that’s not working right? I’ve heard other folks suggest a switch may help smooth out problems.

DHCP Logs

I’ve got logs from the router. They are spammy so I’m narrowing in on just the DHCP part like this. grep DHCP *.1.log | grep -v eth1. Here’s what it looks like when things are going well:

2023-01-22T15:02:21,354 <30>Jan 22 07:02:21 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2023-01-22T15:02:21,440 <30>Jan 22 07:02:21 ubnt dhclient: DHCPACK from 100.64.0.1

2023-01-22T15:04:34,843 <30>Jan 22 07:04:34 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2023-01-22T15:04:34,918 <30>Jan 22 07:04:34 ubnt dhclient: DHCPACK from 100.64.0.1

2023-01-22T15:07:03,124 <30>Jan 22 07:07:03 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2023-01-22T15:07:03,208 <30>Jan 22 07:07:03 ubnt dhclient: DHCPACK from 100.64.0.1

Starlink leases are 5 minutes. So the router requests a new address from the 100.64.0.1 endpoint it knows about every 2.5 minutes and all is well.

Here’s what it looks like when it fails:

2023-01-22T15:07:03,124 <30>Jan 22 07:07:03 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2023-01-22T15:07:03,208 <30>Jan 22 07:07:03 ubnt dhclient: DHCPACK from 100.64.0.1

2023-01-22T15:08:37,364 <30>Jan 22 07:08:37 ubnt dhclient: DHCPRELEASE on eth0 to 100.64.0.1 port 67

2023-01-22T15:08:45,935 <30>Jan 22 07:08:45 ubnt dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
2023-01-22T15:08:45,988 <30>Jan 22 07:08:45 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2023-01-22T15:08:45,988 <30>Jan 22 07:08:45 ubnt dhclient: DHCPOFFER from 100.64.0.1

2023-01-22T15:08:52,524 <30>Jan 22 07:08:52 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67

2023-01-22T15:09:07,104 <30>Jan 22 07:09:07 ubnt dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
2023-01-22T15:09:07,171 <30>Jan 22 07:09:07 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2023-01-22T15:09:07,171 <30>Jan 22 07:09:07 ubnt dhclient: DHCPOFFER from 100.64.0.1

2023-01-22T15:09:14,163 <30>Jan 22 07:09:14 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67

2023-01-22T15:09:25,674 <30>Jan 22 07:09:25 ubnt dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
2023-01-22T15:09:25,766 <30>Jan 22 07:09:25 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2023-01-22T15:09:25,767 <30>Jan 22 07:09:25 ubnt dhclient: DHCPOFFER from 100.64.0.1

The log starts with one working exchange. Then 1.5 minutes later my router spontaneously sent a DHCPRELEASE out to Starlink. Um, why? After that my router starts DHCP from ground zero, broadcasting DHCPDISCOVER and DHCPREQUEST on the link to 255.255.255.255. It’s lost all DHCP state. It logs that it got a DHCPOFFER from 100.64.0.1 and that’s good, right? But apparently Ubiquiti didn’t like the offer or ignored it because it just tries again in a few seconds. It gets stuck in this state, sending DISCOVER several times a minute, getting offers, and never working.

Here’s what happens after I reboot the router. Starlink didn’t come back right away after the reboot but did start working pretty quickly, within a minute or so.

2023-01-22T16:10:58,089 <13>Jan 22 08:10:58 ubnt shutdown[3967]: shutting down for system reboot

2023-01-22T16:13:28,518 <86>Jan 22 08:13:01 ubnt sudo: pam_unix(sudo:session): session closed for user root
2023-01-22T16:13:28,567 <86>Jan 22 08:13:01 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/sh -c echo \"LAN\" >/sys/class/net/eth1/ifalias

...

2023-01-22T16:13:34,806 <30>Jan 22 08:13:08 ubnt dhclient: DHCPDISCOVER on eth2 to 255.255.255.255 port 67 interval 6
2023-01-22T16:13:34,809 <30>Jan 22 08:13:08 ubnt dhclient: DHCPREQUEST on eth2 to 255.255.255.255 port 67
2023-01-22T16:13:34,809 <30>Jan 22 08:13:08 ubnt dhclient: DHCPOFFER from 10.33.1.1
2023-01-22T16:13:34,811 <30>Jan 22 08:13:08 ubnt dhclient: DHCPACK from 10.33.1.1

2023-01-22T16:14:16,367 <30>Jan 22 08:13:49 ubnt dhclient: DHCPREQUEST on eth2 to 255.255.255.255 port 67
2023-01-22T16:14:16,381 <30>Jan 22 08:13:49 ubnt dhclient: DHCPACK from 10.33.1.1

2023-01-22T16:14:16,408 <30>Jan 22 08:13:49 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2023-01-22T16:14:16,470 <30>Jan 22 08:13:49 ubnt dhclient: DHCPACK from 100.64.0.1

2023-01-22T16:16:14,856 <30>Jan 22 08:16:14 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2023-01-22T16:16:14,912 <30>Jan 22 08:16:14 ubnt dhclient: DHCPACK from 100.64.0.1

So the system requests reboot at 08:10:58 and finally reboots at 08:13:01. 7 seconds later it makes a DHCP request on eth2; that’s my backup WAN. It works. No hint of anything on eth0, the primary WAN which Dishy is plugged into. Why? But it gets around to asking for eth0 at 08:13:49, 41 seconds later, and it works. Another routine request succeeds at 08:16:14. We’re back online with Starlink.

More logs

Those samples above are all logs filtered on “DHCP”, but maybe important stuff is hiding in the other log spam. Here’s more detailed logs of the failure around 07:08:37 when the mystery DHCPRELEASE happened. Still doing a bit of filtering egrep -v 'mcad|ipsec|pam_unix' *.1.log

2023-01-22T15:07:03,124 <30>Jan 22 07:07:03 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2023-01-22T15:07:03,208 <30>Jan 22 07:07:03 ubnt dhclient: DHCPACK from 100.64.0.1
2023-01-22T15:07:07,613 <30>Jan 22 07:07:07 ubnt dhclient: bound to 100.103.201.245 -- renewal in 115 seconds.

2023-01-22T15:08:35,284 <30>Jan 22 07:08:35 ubnt netplugd[3542]: eth0: state ACTIVE flags 0x00011043 UP,BROADCAST,RUNNING,MULTICAST,10000 -> 0x00001003 UP,BROADCAST,MULTICAST
2023-01-22T15:08:35,284 <190>Jan 22 07:08:35 ubnt zebra[753]: interface eth0 index 2 changed <UP,BROADCAST,MULTICAST>.
2023-01-22T15:08:35,284 <30>Jan 22 07:08:35 ubnt netplugd[25603]: /etc/netplug/netplug eth0 out -> pid 25603
2023-01-22T15:08:35,293 <5>Jan 22 07:08:35 ubnt kernel: eth0: Link down

2023-01-22T15:08:35,951 <181>Jan 22 07:08:35 ubnt wlb: wlb-wan_failover-eth0 wlb-wan_failover-eth0 reachability failed, failover
2023-01-22T15:08:35,951 <181>Jan 22 07:08:35 ubnt wlb: group wan_failover, interface eth0 going Inactive
2023-01-22T15:08:36,211 <181>Jan 22 07:08:36 ubnt wlb: group wan_failover, interface eth2 going Active
2023-01-22T15:08:36,258 <13>Jan 22 07:08:36 ubnt wan-event: [WAN Transition] eth0 to state inactive
2023-01-22T15:08:36,659 <13>Jan 22 07:08:36 ubnt wan-event: [WAN Transition] eth2 to state active
2023-01-22T15:08:36,671 <86>Jan 22 07:08:36 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/conntrack -F

2023-01-22T15:08:37,260 <86>Jan 22 07:08:37 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/sbin/dhclient -q -cf /var/run/dhclient_eth0.conf -pf /var/run/dhclient_eth0.pid -lf /var/run/dhclient_eth0.leases -r eth0
2023-01-22T15:08:37,324 <30>Jan 22 07:08:37 ubnt netplugd[3542]: eth0: state OUTING flags 0x00001003 UP,BROADCAST,MULTICAST -> 0x00011043 UP,BROADCAST,RUNNING,MULTICAST,10000
2023-01-22T15:08:37,324 <190>Jan 22 07:08:37 ubnt zebra[753]: interface eth0 index 2 changed <UP,BROADCAST,RUNNING,MULTICAST>.
2023-01-22T15:08:37,333 <5>Jan 22 07:08:37 ubnt kernel: eth0: 1000 Mbps Full duplex, port 0
2023-01-22T15:08:37,364 <30>Jan 22 07:08:37 ubnt dhclient: DHCPRELEASE on eth0 to 100.64.0.1 port 67

2023-01-22T15:08:38,875 <86>Jan 22 07:08:38 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/sbin/ip route add 0.0.0.0/0 via 100.64.0.1 table 201
2023-01-22T15:08:38,965 <86>Jan 22 07:08:38 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/sbin/ip route add blackhole 0.0.0.0/0 table 201 metric 256
2023-01-22T15:08:39,707 <30>Jan 22 07:08:39 ubnt ntpd[2874]: Deleting interface #36 eth0, 100.103.201.245#123, interface stats: received=58, sent=58, dropped=0, active_time=6861 secs
2023-01-22T15:08:39,708 <30>Jan 22 07:08:39 ubnt ntpd[2874]: 65.108.121.104 interface 100.103.201.245 -> (null)
2023-01-22T15:08:39,708 <30>Jan 22 07:08:39 ubnt ntpd[2874]: 205.206.70.42 interface 100.103.201.245 -> (null)
2023-01-22T15:08:39,708 <30>Jan 22 07:08:39 ubnt ntpd[2874]: 103.242.68.69 interface 100.103.201.245 -> (null)
2023-01-22T15:08:39,708 <30>Jan 22 07:08:39 ubnt ntpd[2874]: 144.76.76.107 interface 100.103.201.245 -> (null)

2023-01-22T15:08:41,079 <86>Jan 22 07:08:41 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/ubnt-add-connected.pl
2023-01-22T15:08:41,610 <86>Jan 22 07:08:41 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/rm -f /var/run/dhclient_eth0.pid
2023-01-22T15:08:42,643 <86>Jan 22 07:08:42 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/opt/vyatta/sbin/vyatta-interfaces.pl --dev eth0 --restore-ipv6
2023-01-22T15:08:44,308 <30>Jan 22 07:08:44 ubnt netplugd[3542]: eth0: state OUTING pid 25603 exited status 0
2023-01-22T15:08:44,309 <30>Jan 22 07:08:44 ubnt netplugd[25761]: /etc/netplug/netplug eth0 in -> pid 25761
2023-01-22T15:08:45,718 <86>Jan 22 07:08:45 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/sh -c /sbin/dhclient -q -nw -cf /var/run/dhclient_eth0.conf -pf /var/run/dhclient_eth0.pid  -lf /var/run/dhclient_eth0.leases eth0  2> /dev/null &
2023-01-22T15:08:45,935 <30>Jan 22 07:08:45 ubnt dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
2023-01-22T15:08:45,988 <30>Jan 22 07:08:45 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2023-01-22T15:08:45,988 <30>Jan 22 07:08:45 ubnt dhclient: DHCPOFFER from 100.64.0.1

I’ve put line breaks in logical groupings. Group 1 is a normal good DHCP exchange. Group 2 is 90 seconds later and looks like eth0 spontaneously went down. There’s nothing in the logs to explain why that might have happened. Group 3 is the failover system correctly realizing eth0 isn’t working and switching me to my backup WAN, eth2. Group 4 is eth0 coming back up just about 2 seconds after it went down. Note that the router sends the DHCPRELEASE at the end of this little group.

It then takes a good 7 seconds until the last group when the router sends a DHCPDISCOVER out the Dishy interface. Why so long? And even though it gets a DHCPOFFER reply immediately the router doesn’t seem to use it. And then we’re back to the logfile above; there’s no extra info in the extended logs to shed light on why it’s not accepting the offer.

So my guess of what’s going on based on these logs is..

  • Hardware gremlins cause eth0 to fail
  • The router correctly shuts down the eth0 interface and fails over
  • eth0 comes back up 2 seconds later
  • The router correctly releases the DHCP lease, then tries to get a new one
  • Starlink ?correctly? sends a DHCP offer as soon as asked
  • The router bugs out and fails to use the lease. It keeps trying several times a minute.
  • I have to reboot the router to fix it, or it magically fixes itself after minutes / hours.

These are all pretty rough guesses though. I’m poking at two black boxes with one crappy logfile as my only evidence. Anyway I put a switch in the path to maybe help defend against hardware gremlins. We’ll see. Update: so far so good, 7 days without a disconnect. OTOH the old setup used to go a week+ without a problem too so not certain. I’ve seen other failovers but nothing related to eth0 going down.

eth0 goes down a lot

I should note that eth0 seems to go down a lot; several times a day. But not every day? There’s a gap of a whole week where it never once went down, then another gap of a day+. Super weird. Anyway the DHCP failure doesn’t happen every single time eth0 goes down.

# grep -h 'eth0: Link down' *.1.log* | sort -n

2023-01-10T11:27:19,663 <5>Jan 10 03:27:19 ubnt kernel: eth0: Link down
2023-01-10T11:27:36,793 <5>Jan 10 03:27:36 ubnt kernel: eth0: Link down
2023-01-10T13:22:33,664 <5>Jan 10 05:22:33 ubnt kernel: eth0: Link down
2023-01-10T15:17:28,666 <5>Jan 10 07:17:28 ubnt kernel: eth0: Link down
2023-01-10T17:12:23,981 <5>Jan 10 09:12:23 ubnt kernel: eth0: Link down

2023-01-18T02:22:33,753 <5>Jan 17 18:22:33 ubnt kernel: eth0: Link down
2023-01-18T04:52:05,885 <5>Jan 17 20:52:05 ubnt kernel: eth0: Link down
2023-01-18T05:02:24,905 <5>Jan 17 21:02:24 ubnt kernel: eth0: Link down
2023-01-18T07:48:57,901 <5>Jan 17 23:48:57 ubnt kernel: eth0: Link down
2023-01-18T09:43:53,337 <5>Jan 18 01:43:53 ubnt kernel: eth0: Link down
2023-01-18T11:38:48,875 <5>Jan 18 03:38:48 ubnt kernel: eth0: Link down
2023-01-18T13:33:44,726 <5>Jan 18 05:33:44 ubnt kernel: eth0: Link down
2023-01-18T14:58:30,367 <5>Jan 18 06:58:30 ubnt kernel: eth0: Link down
2023-01-18T14:59:01,387 <5>Jan 18 06:59:01 ubnt kernel: eth0: Link down
2023-01-18T16:53:56,208 <5>Jan 18 08:53:56 ubnt kernel: eth0: Link down
2023-01-18T17:02:20,938 <5>Jan 18 09:02:20 ubnt kernel: eth0: Link down
2023-01-18T19:29:46,174 <5>Jan 18 11:29:46 ubnt kernel: eth0: Link down
2023-01-18T21:24:42,410 <5>Jan 18 13:24:42 ubnt kernel: eth0: Link down
2023-01-18T23:19:38,480 <5>Jan 18 15:19:38 ubnt kernel: eth0: Link down
2023-01-19T01:14:34,209 <5>Jan 18 17:14:34 ubnt kernel: eth0: Link down
2023-01-19T03:09:29,842 <5>Jan 18 19:09:29 ubnt kernel: eth0: Link down
2023-01-19T05:04:25,189 <5>Jan 18 21:04:25 ubnt kernel: eth0: Link down
2023-01-19T06:59:19,270 <5>Jan 18 22:59:19 ubnt kernel: eth0: Link down
2023-01-19T08:54:14,486 <5>Jan 19 00:54:14 ubnt kernel: eth0: Link down
2023-01-19T10:49:11,733 <5>Jan 19 02:49:11 ubnt kernel: eth0: Link down
2023-01-19T12:44:05,754 <5>Jan 19 04:44:05 ubnt kernel: eth0: Link down
2023-01-19T14:39:02,849 <5>Jan 19 06:39:02 ubnt kernel: eth0: Link down

2023-01-21T11:04:04,617 <5>Jan 21 03:04:04 ubnt kernel: eth0: Link down
2023-01-21T12:59:17,757 <5>Jan 21 04:59:17 ubnt kernel: eth0: Link down
2023-01-21T14:54:11,780 <5>Jan 21 06:54:11 ubnt kernel: eth0: Link down
2023-01-21T16:49:09,336 <5>Jan 21 08:49:09 ubnt kernel: eth0: Link down
2023-01-22T11:18:27,227 <5>Jan 22 03:18:27 ubnt kernel: eth0: Link down
2023-01-22T11:18:44,227 <5>Jan 22 03:18:44 ubnt kernel: eth0: Link down
2023-01-22T13:13:40,293 <5>Jan 22 05:13:40 ubnt kernel: eth0: Link down
2023-01-22T15:08:35,293 <5>Jan 22 07:08:35 ubnt kernel: eth0: Link down
2023-01-22T15:59:57,613 <5>Jan 22 07:59:57 ubnt kernel: eth0: Link down

Starlink’s bad hours

Starlink performance continues to degrade. They’ve gone from promising 100 Mbps to 50 Mbps to now 20 Mbps. And they can’t even deliver that.

I run a speed test every hour. Graphing the average for the day is misleading because the service runs very well at 3am, often 200 Mbps! What I care about is the bad hours which are pretty much every evening. To that end I have a new graph, a count of the number of hours where the download speed measured is under 20 Mbps.

Those two bad days around 11/19 are an anomaly; my router had failed over to my slower backup connection and didn’t switch back (a router bug). The rest of the data is good. For comparison, here are graphs of minimum daily bandwidth (ie: the worst hour) and average.

This is what an overloaded ISP looks like.

I have data going back almost two years. Not confident this is correct; I used to do more speedtests a day so my naive count means that numbers are overreported a year+ ago, particularly last December. Here’s a graph of 10 months which shows an increasing trend of bad hours. (I suspect 4 or 5 of the worst days here are during failover to backup.)

Starlink dishes reorienting

Starlink seems to be re-orienting dishes on the US coasts to point somewhat over the ocean.

Starlink’s dish has motors for self-orienting. Typically it’s pretty static; mine oriented once at startup and I don’t think moved for over a year. Due north or south seemed optimal.

But recently on Reddit a lot of people are reporting that their dishes are now pointing somewhat to the west or east. No reliable reports on how much. But the pattern looks like it’s US folks, and Dishy is now trying to get a view over the oceans. Presumably as a congestion avoidance mechanism; there should be more unused capacity out there. I can’t imagine it makes a huge difference but I don’t really know.

The problem is Dishy seems to be choosing a new orientation without regard to obstructions. Many reports that their install used to work fine and now is pointing at a tree and has outages. Some very annoyed folks who spent real money mounting the thing or removing trees. There’s no way to override where it points, either, short of breaking the motors. What’s weird is Dishy has a map of obstructions; it knows there’s a tree there. Maybe they’ll eventually get to optimizing with that data too.

I thought my own dish moved to point to the west. But now I’m not sure; I just measured with a compass and it may be pointing at 355 degrees instead of 0, but not much. Unfortunately I can’t access the Dishy diagnostic data at 192.168.100.100 because I can’t get my stupid Ubiquiti router to add the static route. There’s been a bug for years where static routes don’t work with WAN failover. But that static route used to at least work for a few hours, now it’s entirely broken.

Starlink terrible customer communications

I realized at some point my primary gripe with Starlink is how bad they are at communicating with customers. I actually like my service. It’s not delivering to the level they promise but it’s still pretty good and better than my other options. It’s a freakin’ technical marvel, too. I’d be a lot more understanding if they just communicated. But they are terrible at that; no proactive communication with customers, no information on the website, and famously no press department. It’s very hard to know what’s going on.

The latest snafu is the data caps. After announcing they’d go into effect in December, the rumor on Reddit is that they’ve changed the plan and now it’s February 2023. Several folks have reported emails saying as much. I never got one. I got an email Nov 4 saying the caps would go into effect in December. That’s it.

The cap announcement was botched. After a year+ of promising 100 Mbps service and no caps, suddenly they quietly updated the TOS on the site to indicate only 20 Mbps and a 1TB cap. No proactive communication. A week or two later they emailed The New Arrangement to us. Lower service promise, same price, take it or leave it. Then they had to email a bunch of people a second time to say “oh we made a mistake and we were wrong about your previous usage”. Oops.

Starlink’s website says literally nothing about IPv6 support. It doesn’t support it. Or at least, it hasn’t; but recently there’s evidence that a good chunk of Starlink customers now have IPv6 enabled. But absolutely not a whisper about it to the customers.

Customer support is notoriously awful. There’s no phone number or email address. You used to be able to submit a request in the mobile app reasonably easily. Now it’s apparently hidden behind you having to read a bunch of FAQ entries and then pressing a thumbs down “this doesn’t help me” before you’re allowed to make a request. Customers report very mixed results. Sometimes great instant service. Sometimes a week + before any reply and then the reply is low quality. Not for complicated questions, basic things like “why did you not ship my order?” or “my dish arrived dead on arrival”.

All this is basic “tell your customers what their service is” stuff. It’s remarkable how bad they’re failing at it. Not to mention anything forward-looking like plans for improved service in the future.

PS: I should add that I helped start a community list of firmware versions because there was zero info on software versions. Honestly all we can track is version IDs and dates released but at least it’s something.

Starlink performance last week: 5mbps

Just making a note of a recent performance graph.

Nothing new here, this congestion pattern has been happening for months. But it gets worse and worse. There’s some tiny hope that the new throttling system will help free up some bandwidth for me, at least until I myself am throttled. That was supposed to launch early December but now apparently is pushed back to February.

Starlink service degraded: 20Mbps, 1TB data cap

Ugly changes in the Terms of Service for Starlink: residential customers have been degraded to 20-100Mbps expected download (from 50-200). Uploads are now 5-15, down from 10-20. Latency has also crept up: 25-50ms now, not 20-40. And a new unwelcome feature, a 1TB / month soft data cap before speeds are further degraded.

Starlink sure has fallen a long way from “no data caps! great latency for gaming! 100+Mbps!”. OTOH this new service level is at least closer to what they actually deliver. Over the last 90 days I’ve been getting 90Mbps average download speed with nightly slowdowns to 10Mbps. Uploads of 6.6Mbps and latency 55ms.

TBH the data cap is not a disaster; the average American household uses 513GB / mo although 15% use 1TB or more. It’s a soft cap, you get degraded to 5-50Mbps if you go over (or you can buy more). And the 1TB cap is defined in terms of “peak hours” but then that’s 7am to 11pm, or the 16 hours people are awake. I can make good use of the uncapped hours though with automated downloads.

What I don’t like about caps is how opaque they are to users. Starlink has added a daily usage graph so you can at least see what you’re using. But there’s no way to see what is using your data. And ordinary users don’t have tools to manage data usage; there’s no good way to use less.

Starlink still hasn’t communicated anything to its customers, we only know about this change from a TOS update. It seems unlikely we’ll get any sort of price break, just expected to accept the degraded service. Update now there’s an email to customers over the cap. Also a link to their so-called “Fair Use Policy” which explains the throttling.

Update 2: they sure botched this rollout. They emailed customers whether they had been over cap in the past but told a bunch of people the wrong thing, so sent a second email correcting it. They also told business users they would be throttled to 1 Mbps; obvious nonsense, but again required a correction. And all that on top of the original, probably mistaken quiet non-announcement via a TOS update.

For the record: archive links for Oct 6 2022 (pre-cap) and Nov 4 2022 (with cap).

WiFi channel 13

I can’t figure out how to make my American equipment connect to WiFi channel 13.

I’m at a hotel with adequate WiFi in Innsbruck. My Pixel phone connects to WiFi no problem, but my Windows 10 laptop (EdiMax and Killer Wireless adapters) and my Samsung Tablet can’t. Ken’s iPhone, iPad, and Windows 10 laptop (IBM) all do connect.

I used a scanner on my phone to figure out that the only AP near me is using Channel 13. Which is not allowed for use in the US and thus is blocked on American equipment. Usually it’s a simple software block and should work if the device realizes it’s in Europe. I tend to turn off location stuff on my computers, which may be why it works for Ken and not me. But after an hour+ of trying various settings, new drivers, etc I can’t make it work on either device. What a dumb thing.

Most online advice I found was “change your AP not to use that channel”, which is not helpful. Some Windows 10 advice is to look at Advanced device driver Properties (not registry) for a “Country Region” setting. Neither of my adapters have that. Trying to change locale settings and time zones and stuff doesn’t work. Hilariously, my Samsung tablet tells me I have to connect to WiFi to change region. But I think that’s just about video DRM anyway.

Update: another hotel with excellent 2.4GHz wifi has Channel 12 closest to me. My phone connects no problem; the laptop refuses. Fortunately there’s also service on many other channels, crazy strong actually (-50 to -60 dBm). WiFiAnalyzer on my phone seems to have a bug; I can’t always see the other channels, maybe some filter logic problem. NirSoft’s WifiInfoView on my laptop shows lots of networks on channels 1-10. Nothing at all on 11 and 12 seems invisible to me.

Tailscale first impressions: very good

Goodness what a networking miracle. After years of failing to get VPN tunneling set up between two houses, I finally gave Tailscale a try. I thought it’d take me a few hours to get going. No: 10 minutes, tops, and I was VPNing from one house to another without regard for the NAT on one side and the Starlink double NAT on the other.

Never seen a complex networking software like this work so easily. The install experience is a dream; great clear docs, everything Just Works. Linux, Windows, Android, just install the thing, log in via Google with one click, done. I immediately could ping the new Tailscale IP address to reach my machine. There’s a great, easy to understand web console showing status of all your Tailscale hosts.

Behind the scenes it’s not magic so much as well-put-together parts. Wireguard is the underlying VPN protocol, making it easy to set up point to point tunnels. Some sophisticated NAT traversal (and relay servers) ensure everything can connect to each other. All the keys, negotiation, and naming is handled in a datastore Tailscale runs. You authenticate to Tailscale using one of many choices; Google is definitely very seamless.

The one thing I’m on the fence about with Tailscale is that it’s designed as a point-to-point VPN between hosts running Tailscale. That means that while I can access my Linux box behind NAT, I can’t access my thermostat on the same LAN directly like you’d normally expect with a router VPN. They do support full subnet routing via a Tailscale node, that seems like a big commercial feature for them, but it’s not the simple default setup. OTOH this P2P model will cover 90% of what I need to do and has some advantages aside.

I assume there’s no way to use Tailscale without trusting Tailscale itself; its software and service are in the middle. I’m fine with that but I wonder how that limits their sales to big companies. There is an open source alternative server that so far the Tailscale company has been friendly about.

Configuration

I didn’t really have to do any setup beyond install, but I did a couple of extra things.

I set up DNS aliases in a domain I own for all my hosts. Now I can connect to sfwin.ts.example.com instead of some opaque IP address. Tailscale has their own beta feature for DNS (MagicDNS) but it works by having your client machines use their DNS server instead of your own. That’s probably fine but I didn’t want to quite jump to that yet. MagicDNS will automatically add new Tailscale hosts to DNS records; I’ll have to do that manually.

I forwarded UDP port 41641 from my router to my Linux server in SF. This isn’t necessary, but I noticed that traffic between my two Linux boxes behind NAT routers was going via one of Tailscale’s relays, overhead I’d rather avoid. Tailscale does have a lot of NAT traversal, even simple UPnP would have worked, but this static forward is fine by me too. I’m not positive but I think it’s helped.

Kicking the tires

tailscale status is an invaluable command for seeing what’s going on with your peers. It prints basic status of your hosts with extra information for open links like idle, tx 820 rx 732 or active; direct 98.97.1.1:16227

tailscale ping has some tailscale-specific info. For instance this is what it looks like when I ping a host behind double NAT when the link was previously down. I’m not positive but I take this as evidence that the link first comes up via a relay in Seattle, then switches to direct connection after a few pings.

nelson @tt ~ 1 ❯ tailscale ping gvlin.ts.example.com
pong from gvlin (100.106.1.1) via DERP(sea) in 316ms
pong from gvlin (100.106.1.1) via DERP(sea) in 97ms
pong from gvlin (100.106.1.1) via DERP(sea) in 76ms
pong from gvlin (100.106.1.1) via 98.97.1.1:16227 in 224ms
nelson @tt ~ 3s ❯ tailscale ping gvlin.ts.example.com
pong from gvlin (100.106.1.1) via 98.97.1.1:16227 in 95ms

I’m curious about performance. For two hosts without Tailscale I could get about 360Mbps copying a stream of random numbers with a direct link (via ssh and rsync, so maybe some encryption involved). With tailscale I got maybe half that, 200Mbps, using 140% of CPU on the server and 80% of CPU on the client receiving the file. I did one try of a copy via a relay and maxed out at about 10Mbps; if that’s a real problem you can run your own relay server. I didn’t test packet loss or latency using iperf3 or the like, but I suspect it’s not much different than the underlying medium.

Tailscale hosts are getting addresses in the 100.64.0.0/10 block used for private networks. Boy I hope that never collides with Starlink’s use of this block! They also have IPv6 support but I’m not sure whether I’m likely to ever use those addresses.

One confusing thing; on Linux tailscale isn’t using the routing table for its VPN traffic. While there is a tailscale0 network device, there is no route shown in ip route for the 100.64.0.0/10 block. Instead it’s in the IP Tables, as iptables -S shows. I don’t really understand IP tables so I couldn’t decipher all the rules but it looks like there’s one blanket rule, not a specific rule for each destination host.

Tailscale links go down after just a little bit of disuse but come back up immediately when used. Latency for that first packet through is under one second.

Making my Windows machine part of Tailscale means the WSL Linux images running on it also can access the private VPN addresses. I believe WSL2 works entirely via forwarding through the host Windows networking, so that’s not a surprise.

Tailscale has some higher end authentication features, in particular a way to integrate ssh logins. I haven’t tried them. There’s also an alpha feature for collecting a list of “services” running on Tailscale nodes for easy access.

Mikrotik / RouterOS v6 thoughts

Playing with a new router every month is not a rewarding hobby.

I got my hands on a Mikrotik Hex S and tried it as my home router. It mostly worked fine but I couldn’t figure out how to get WAN failover to work. So I gave up on it for now.

Mostly was impressed with RouterOS as a basic router product for a prosumer. The UI is idiosyncratic and their OS approach is kind of old school. But the thing works. Also it’s relatively simple and transparent for simple things. And I like the simple command line / windows app / web UI trichotomy, they all work the same way. I was able to get a basic router up and running with no trouble. (It’s pretty sad that https for configuration doesn’t work; you can enable it but there’s SSL problems.)

The docs are a mess. Apparently there used to be a user-edited Wiki with many lovingly written detailed articles. That all got thrown over in favor of some official manufacturer docs. I’d applaud that investment but the execution is not great, many of the docs are read. It took me a long time to understand the gestalt of RouterOS, the concepts you need to understand to use it.

Version management is a mess too. I used RouterOS v6.48.6, the latest long term release. They put out a v7 beta months ago which was buggy, fair enough. Then they declared v7 stable. But apparently several major features look enabled but do not work? That’s the vibe I got reasearching. I stayed away from it. Which is too bad, because you need v7 for Wireguard which is one of the features I was looking for.

The other feature I needed is WAN failover. And after a couple hours’ research I gave up and decided I couldn’t do it in a way I was comfortable with. There’s no simple way to just enable it; all methods require manually configuring routes, etc. The official docs are confusing. This blog post was more helpful and details three methods of doing it, all with drawbacks. The thing that held me up is they all require hard-coding routes to specific gateway IP addresses. But ISP gateway IP addresses are dynamic, you can’t just hardcode them like that reliably. This discussion had a link to a script that looked like it might configure things with a funky script that pulls data from the DHCP subsystem. Maybe it even works, but that was a level of complication too far for me.

Folks like Mikrotik routers. And I can understand why, particularly a few years ago. Cheap but good hardware, a solid “real” OS, very powerful configurability. But in 2022 the software felt pretty retro and the moment I ran into something complicated it got idiosyncratic. Which brings me back to OpenWRT; if I’m going to hack, might as well at least hack on something that feels like a Unix system I understand. Anyway I’m back on Ubiquiti’s router for now, at least I know what their bugs are like.

My recent Starlink POPs and IP address changes

A thrilling list of my Starlink ISP’s point of presence, where my packets come out to the Internet. Looking at this because this past week a bunch of users including me have had a problem where their TCP sockets won’t stay open for more than a few minutes, breaking all sorts of stuff. Each date is when my IP address changed.

  • 2022-05-29: Seattle
  • 2022-06-01: Los Angeles
  • 2022-06-04: period of instability
  • 2022-06-04: LA
  • 2022-06-06: LA
  • 2022-06-07: instability
  • 2022-06-07: LA
  • 2022-06-10: LA
  • 2022-06-11: LA

I first noticed my TCP connection problem on 2022-06-07, about the time of that period of instability. It’s mostly been gone since 2022-06-08 but it came back at least a little bit today and is gone again.

The command to do this is

grep '^2022' homeip.log | fgrep -v '157.131' | fgrep -v 173.195 | uniq -c -f 2

Alternate routers

So I’m not happy with my Ubiquiti router and I had a bad experience with OpenWRT. What are other options? I’m considering three choices. My metric here: decent UI, small device that’s just a router (I have a separate Linux server). Must support dual WAN failover and Wireguard VPN tunnels.

Mikrotik and RouterOS. For years I’ve heard about these European routers as being a good product. RouterOS is said to be idiosyncratic but capable. They make a confusing variety of routers. The Hex S seems to be the leading small consumer product and $70 is a fantastic price. The RB4011 and RB5009 get lots of recommendations on Reddit, both at $220. The problem is you can’t really buy these in the US, either not at all or not at that price. Best I can find is like $110 for the Hex S shipped and from dodgy companies that either don’t have stock at all or are probably shipping from Europe.

Netgate and pfSense. The path not taken in routers, based on FreeBSD. Has a good reputation. Buying hardware from Netgate is clearly the path of least resistance. The Netgate 1100 is the small consumer product at $190. Also has flaky availability; Newegg and Amazon are like $230 and ship in a couple of weeks, which suggests “not in stock”. pfSense is nominally open source but I think is amd64 only, which rules out running on Raspberry Pi hardware. Note there’s a remarkable amount of sleaze around this company, the opnsense.com lawsuit and a scary-bad Wireguard implementation.

OPNsense. A fork of pfSense. There’s a company selling hardware but at about $800 entry level it’s clearly not for the home consumer market. A lot of enthusiasts seem to be buying mini PCs to run t his.

I don’t quite know why I’m so focussed on cost; I’ve certainly wasted many valuable hours farting around with failures. I guess I don’t have much faith that throwing $800 at it will actually get me a more reliable router. Also I just don’t have the needs that the higher end hardware is solving.

My best option is probably to order a Mikrotik Hex S and just wait for delivery. I wish I had any faith in the vendors who are selling it in the US.

Update: I got a Hex S from ispsupplies.com. They showed 1000 in stock on Saturday and I got it Thursday, at the list price of $69 plus $10 shipping. They’re already sold out! Note they are selling a unit labelled “tariffed” which I guess has something to do with Trump’s trade war with China but doesn’t seem to matter to me at all.

Starlink stats for a year

Some data from my automated monitoring. Speed is measured with an Ookla speed test every 15 minutes or (now) every hour: daily min, max, and average. Latency is measured with telegraf native pings to 8.8.8.8: daily min, average. Packet loss is the daily average percentage of ping packets lost. There’s some messy data here; sometimes my house fails over to a 12Mbps fixed wireless link which pollutes these measurements (but only a little). And there’s a suspiciously low bandwidth stretch in December and January that could well be a monitoring bug.

Download speeds
Latencies
Packet loss

Important to read these right. These are daily average statistics: the min/avg/max bandwidth for each day, the min/avg ping time for each day. Each latency measurement is actually several pings sent at once, so I’m taking the average of the average and the min of the min.

The primary pattern that jumps out here is the increase in latency starting in January. That coincides with when I got moved from a Northern California POP up to the Seattle POP (I think via a satellite relay near Winters, CA). Although note the change is gradual; this isn’t a one-off bump in path length. Another possible explanation is that’s the period Starlink started adding a lot more users and I’m seeing buffering.

The min bandwidth graph does not bear out my perception, which is that congestion is getting worse. It’s definitely getting slower every night. Below is a graph of average download speed for 15 minute samples over a week in January; the pattern now is about the same. But the minimum daily I’m getting is still in the 10-20Mbps range just like it’s always been.

OpenWRT (RPi4): giving up

I’m giving up on OpenWRT on my RPi4. I’ve spent the last few days getting it working and while it’s mostly good, I don’t trust it. I’m about to go out of town for awhile and I can’t leave my partner with a possibly flaky router, so I’m back to the Ubiquiti router. It’s buggy but I understand what the bugs are and can live with them. OpenWRT is very impressive and would probably work for me, but it requires more tinkering than I want to do. It does not spark joy in me.

The main problem with my OpenWRT setup is the mwan3 failover isn’t working for me. I got woken up by my alarm system loudly beeping, the stupid thing it does when there’s no Internet for a few hours. Starlink had gone down again. That’s not OpenWRTs fault, Dishy itself was out. But the mwan3 failover in OpenWRT didn’t work like it should have.

I could probably diagnose or fix this if I wanted to spend the time. The permission denied error in my logs is probably a good place to start. But I just don’t want to bother. (FWIW failover works if I disable one interface entirely. But that may just be Linux routing working, it has both WAN interfaces as routes. mwan3 is pinging interfaces and logging errors but I’ve never seen it actually mark one bad and switch.)

More generally there’s a bunch of rough edges in OpenWRT. The lack of persistent USB device naming is awkward, and potentially a source of a hard to diagnose problem in the future. The way package upgrades work (or don’t work) makes me nervous. I don’t trust that a full system upgrade will work when the time comes. I don’t like that I had to spend 5-10 hours reading docs and tinkering to get the things set up I want. All in all I want a router to just be an appliance, something I don’t spend time thinking about. OpenWRT is more of a firmware for hackers who want to be thinking about their routers.

I’ve said this before, I’d love something with the ease of use of the old Tomato firmware that’s based on OpenWRT. OpenWRT has improved a lot since 2015, LuCI is a very nice UI. Back then I got a comment that Gargoyle might fit the bill; I see that project is still getting updated, so maybe it’s worth a try. Also maybe my expectations are unreasonable. There’s lots of consumer routers out there that do a basic home LAN just fine, Starlink even gives you one. But I want more; I want multi-wan failover, I want VPN tunneling, I want detailed diagnostic data. It’s asking a lot.

Still I’m glad I spent the time with OpenWRT. I’d definitely reach for it again if I had specialist needs or was in a mindset to be more patient with the tinkering required. It’d also make a fantastic foundation for derived products. I think several commercial routers are sold with some variant of OpenWRT pre-loaded. Rumor has it Starlink’s own router is based on OpenWRT.

OpenWRT + Wireguard (RPi4)

My new, unrewarding hobby of router tinkering continues. This time setting up a Wireguard tunnel between my two houses. I want my two LANs 192.168.0.0/24 and 192.168.3.0/24 to talk to each other transparently via a VPN tunnel. I’d gotten this sorta working between Linux boxes inside the two LANs before but the routing never quite worked. Running a VPN tunnel directly on the router is one reason I’m now trying to set up this RPi4 with OpenWRT.

Long story short, it was very easy to get my OpenWRT router connecting as a client to a working Wireguard server on my other LAN’s Linux box. I can’t fully test this because I don’t have Wireguard setup on the other side’s router yet. But the tunnel seems to be working at least somewhat.

Note to self: my Ubiquiti router at the other house is set up to not answer pings. Ping is not a good test! Ssh is though.

Once again the OpenWRT docs for Wireguard are very good. The basics tell you how to install it including a LuCI interface and this client guide has some extra good info.

It boils down to the same way you set up Wireguard anywhere. Generate a key pair, configure the server to accept the new OpenWRT public key, configure the OpenWRT client to connect to the server and its public key, and you’ve got the tunnel up. It helps to log into the OpenWRT command line and run “wg show” and the like manually, but LuCI actually has a full UI for configuring and monitoring. Note that when you add the interface there’s a Wireguard-specific “Peers” tab you need to configure.

The one big gotcha is the “No Host Routes” option (aka nohostroute) as discussed here; it’s in Interfaces / General Settings. Without this OpenWRT will add a route specifically for the host endpoint specifically on one interface. This interacts poorly with a multi-WAN setup like mwan3. Setting nohostroute tells OpenWRT to not set an explicit route. There’s some concern that if you then configure all traffic on the router to go through the VPN link then Wireguard itself will try to also talk to the Wireguard server via the Wireguard interface, causing some sort of loop or recursion. Not a problem in my case.

In the Peers settings I went ahead and explicitly included Allowed IPs of 192.168.7.0/24 (my VPN endpoint subnet) and 192.168.0.0/24 (the LAN at the other end of the VPN). I’m not sure that’s necessary.

I’m confused about what to put in the Firewall Settings for the wireguard interface. This 2018 guide suggests creating a new zone and configuring rules for it. But then it says “This step is probably optional (you could just add the interface to the lan zone)” and I think that’s probably correct; in general I want to treat the other size of this VPN tunnel as part of my LAN. I definitely don’t want masquerading/NAT for it! I can’t really test this properly until I have a router on the other side set up doing Wireguard. I don’t understand modern Linux firewall rules very well.

All of this is complex and at the edge of my patience for dealing with stuff. OpenWRT and Wireguard are very powerful and flexible tools. More than once I found myself wishing there was some hand-holding simplification for me, a “just press this button to make it work” thing. But then I don’t know how common goals like mine are.

OpenWRT + RPi4: failover and load balancing

I have two ISPs; I want to use Starlink all the time unless it goes down, in which case I want to failover to my fixed wireless. OpenWRT supports this with the MWAN3 package along with load balancing and various forms of traffic-based routing. It’s flexible and a little complicated. The whole reason I am ditching my Ubiquiti router is their long standing bugs in their failover implementation; I’m hoping OpenWRT’s is more reliable.

The MWAN3 docs are excellent but do assume some networking knowledge. Long story short, it’s a set of scripts that implements load balancing and failover by manipulating Linux policy routing. Basically it pings the interfaces and adjusts the routing table appropriately if a connection goes down.

See also my previous post on OpenWRT + RPi4 with a single WAN.

Hardware and device names

I’m using a Raspberry Pi 4 as my router. I’ve purchased two TP-Link UE300 USB ethernet adapters for my WAN ports. They are plugged in to the two blue USB-3 ports. This means I’m going to have two actual hardware ethernet devices for the WAN, eth1 and eth2. (eth0 is the LAN which is the RPi’s on-board ethernet.) Some of the MWAN docs talk about VLANs and switches and devices named like eth1.0; no VLAN needed with the USB hardware.

Unfortunately as far as I can tell OpenWRT has no built-in provision for naming devices consistently. When I was plugging and unplugging things I would see one of my adapters go from being “eth1” to being “eth2” despite it always being plugged into the same port and the MAC address not changing. This is not good, it makes identifying which interface you want to use for what difficult. However I think as long as you don’t hotplug anything the device names are assigned consistently in order. If you look in dmesg there’s messages like these:

usb 2-1: New USB device found, idVendor=2357, idProduct=0601, bcdDevice=30.00
r8152 2-1:1.0 eth1: v1.10.11

USB 2-1 seems to be the name for the upper blue USB port. With two dongles plugged in, USB 2-1 seems to always get named eth1 and USB 2-2 always seems to get named eth2. All bets are off if you unplug and replug things afterwards though.

A better solution would be to name devices by the MAC address or some other (relatively) immutable property of the hardware. I found some notes on doing this online here, here, and here. That last one refers to the OpenWRT “Community Build” for RPi4 but that project looks a bit messy and there’s some drama going on with it so I haven’t tried it.

Anyway, after 5 reboots the device names have been stable so I’m going to stick with this. For my notes:
Starlink, usb 2-1, eth1, WAN1, 5C:A6:E6:AA:BC:9A
SmarterBrodband: usb 2-2, eth2, WAN2, 54:AF:97:5B:F9:63

One last note on naming; OpenWRT has a concept of “interface name” in Networking / Interfaces, a step of indirection from devices names. Ie, I have eth1 named “WAN1” in OpenWRT and a lot of other OpenWRT software uses WAN1 as the name. I ran into a problem because I named my interfaces WAN1/WAN2. The mwan3 scripts default to assuming these names are “wan” and “wanb” and I regret not using those names for simplicity.

Setting up the second ISP

Before you do anything with mwan3 you have to get the second ISP working in OpenWRT. This is as simple as adding it in Network / Interfaces. The “gateway metric” advanced setting is important; Linux will send packets to the gateway with the lowest metric. If two devices have the same metric (which is the default if you don’t edit it) I’m not sure what happens, it looks to only use one of them without mwan3 or some other load balancing configuration.

If you’re using luci-app-statistics this is a good time to go to Statistics / Setup and make sure you have graphs turned on for all of your network interfaces.

Installing and using MWAN3

This is as simple as opkg install mwan3 luci-app-mwan3 (or the LuCI equivalent). However the moment you install mwan3, mwan3 is going to start running and doing routing. The default config is reasonable, it tries to load balance on “wan” and “wanb”. But because I used “wan1” and “wan2” instead as my names nothing worked. Ironically I hadn’t even installed the LuCI interface yet, so without I had to edit config files by hand.

The config file is in /etc/config/mwan3. There is also a “mwan3” command line tool that is very helpful when tinkering.

The LuCI interface is in two places. Network / Load Balancing is where the config is done. Status / Load Balancing is the status page. (Some of the docs refer to an obsolete location for the status page.)

Configuring MWAN3

The docs are great so I won’t try to reproduce them. In summary though you describe interfaces, one per ISP connection. Then you define members which are statements like “wan-m1_m3 uses interface WAN1 with metric 1 and weight 3”. Members are combined into policies; the member that’s currently up and valid and has the lowest metric is the one the policy will use. If there’s two members with the same metric, it will load balance according to the weights. Metrics get combined into policies like “balanced” (use both wan and wanb) or “wan_wanb” (failover; use wanb only if wan is down). Finally you define a set of rules which say “traffic of this type gets sent out this policy”.

It’s a complicated and flexible system. The default config is to load balance the two connections with slightly unequal weights. I just edited the rules to use the “wan_wanb” policy instead of “balanced” to get strict failover behavior instead. (I also edited to accomodate my different naming convention but only for interfaces; I left mwan’s “wan” and “wanb” naming for members, policies, etc).

There’s a lot of subtle failover behavior you can configure, particularly in the interfaces section. That’s where you set things like ping intervals or how many pings have to fail before the interface is considered dead. I’ve left all the defaults in place other than changing the IP addresses it pings. The package uses the docs’ defaults except reliability is set to 2. I think that means the behavior is it tests every 10 seconds. A test is it pings each of 4 hosts once with a 4 second timeout; if 2 of the pings succeed then the test passes. If 5 tests fail in a row the link is considered dead. 5 successes and the link is alive again. There’s a complicated extra set of heuristics for “check_quality” but I believe those are disabled by default.

There’s also a global option to enable syslogging. Turning that on to “notice” gives a reasonable, non-spammy syslog of failed pings and failover.

Does it work?

Yes! So far so good. It all seems a bit complicated for basic failover but once I got going the configuration was really pretty simple.

One gotcha when testing; if you search Google for “what is my ip” it will helpfully show you your IP address. But this might be a little out of date; in some cases you can still have a browser connection open on the backup WAN interface even though new connections are being done on the primary WAN. I think curl http://api.ipify.org/ is a more reliable way to verify what your router is choosing at the moment.

Observed behavior on the testing is a bit more complicated than I thought. The syslog messages from mwan3track talk about a “score” that’s getting incremented faster than the 10 second interval I thought it had.

Basic failover seems to be functioning. I’ll know more in a day or two, I’m curious how well the default heuristic is going to work with Starlink’s “drop out for a few seconds” failure mode as well as the nightly congestion. The worst thing is if the router flaps over to failover mode too often, sometimes it’s better to wait out a transient failure. Will need some tuning no doubt.

I want to give a shout-out to both the LuCI mwan3 UI and the Wiki docs. They’re both quite understandable and nicely designed.

Update: failover didn’t work last night. Around 4am Starlink got a firmware update and rebooted itself. My monitoring tells me my house couldn’t ping 8.8.8.8 for about 4 minutes afterwards. Looking at the syslog it’s clear mwan3 was aware of the outage; it detects that the network lost carrier and talks about setting the link down, then up again in a few seconds. There’s talk about disabling the interface, etc. But there’s no logging about failed pings (which I would expect) and judging by my monitoring, it did not fail over to the backup. There’s also several log lines with errors in them like “netifd: WAN1 (10264): Command failed: Permission denied” which does not inspire confidence.

OpenWRT on Raspberry Pi 4

I’m fed up with my Ubiquiti routers. UnifiOS has a bunch of bugs related to WAN failover that have been there for a year+. Also a lot of mysterious behavior and some odd engineering problems. And still no official solution for Wireguard last I looked. So I want to switch (back) to OpenWRT for routing. I want three ethernet ports in the end; LAN, WAN, and backup WAN. I’m not using the WiFi on the RPi4 at all. I could, but I have hardware with better antennas.

These notes are a work in progress and are not a fully followable cookbook. It took me like 5 hours of tinkering in different orders to get this going. Don’t worry, it’s not normally that hard. Here are some other sources I found helpful for doing this: one, two, three.

Step 1: Hardware and device drivers

OpenWRT runs on all sorts of hardware but I’m going to do this with a Raspberry Pi 4. It’s way more powerful CPUs and RAM than a typical router. The networking is a bit weaker though. The RPi4 gives you one ethernet port on the PCIe bus and the rest have to be USB ports. The TP-Link UE300 is a commonly recommended USB adapter, it has an RTL-8053 which is well supported. My LAN will be on the on-board ethernet, the WAN links on USB. I think this setup is good enough to support gigabit throughput and is certainly good enough for Starlink’s max 200 Mbps. I’m told you can do traffic shaping and VPN stuff with very good speeds using the RPI4 CPU, but I haven’t tested it. (Few consumer routers can do gigabit Internet with these fancies.)

Another interesting hardware option is an RPi CM4 with a router board. That gives you two full Gigabit ethernet ports connected to the PCIe bus. A third option is to only have a single ethernet port and use VLAN tagging so the router can work in a “router on a stick” mode.

Step 2: Basic install

OpenWRT has pretty good docs for running on an RPi 4, I just followed them to get a basic system going. Note that the RPi 4 is way more powerful hardware than OpenWRT is normally aimed at, so some of the extreme things that OpenWRT does to save resources may not be necessary. Some folks recommend using ext4 as the filesystem instead of the compressed SquashFS. There’s also something about resizing the partition to use all the SD card storage. I didn’t bother.

Flash your SD card, then boot the router without the USB ethernet devices plugged in. (Or with, it doesn’t matter, but don’t plug in any WAN cables yet.) Plug a laptop ethernet into the on-board ethernet port. OpenWRT should come up and be serving DHCP on the ethernet. Point your laptop to http://192.168.1.1/ and you’re logged in to LuCI, the OpenWRT web interface. Note that OpenWRT will call this ethernet port eth0 and it will be bridged into br-lan.

Update May 2023: this HOWTO is more up to date than my notes. It uses OpenWRT’s firmware selector to prepare a download with the ethernet drivers you need in step 3.

Step 3: enabling your USB ethernet device

There’s one hard thing setting this up; OpenWRT doesn’t have the kernel drivers for USB ethernet installed by default. You need the kmod-mii, kmod-usb-net, and kmod-usb-net-rtl8152 opkg packages (IPK files) installed. No configuration needed, but you do have to install the packages. The problem is you’re not connected to the Internet to just install them.

You have several options for getting them installed. My choice was to manually download the needed packages from the OpenWRT repository to my laptop, then upload them via LuCI to the router. (You have to install them one at a time and click “Dismiss” manually on the install popup). It’s also possible to plug a WAN cable into the one working ethernet and get access to the router somehow (keyboard and screen? routing tricks?) to install them. I like the “2nd way” in the linked Reddit post; you make a custom OpenWRT image that included the necessary drivers.

Step 4: configuring the WAN

Now that there’s an ethernet device for the WAN you have to configure it. Do this in LuCI; go to Network / Interfaces and add an interface for eth1. Call it WAN and then go to firewall settings and put it in the WAN zone. This is a little mysterious but I think that’s all you have to do. I rebooted somewhere in here just to be sure that it was all working right.

Step 5: Improve OpenWRT

The blessing (and curse) of OpenWRT is it’s a very flexible Linux system and you can do a lot with it. A search for packages matching “luci-app-*” is a good way to see what’s available. Here’s some of what I’ve done.

Update the software lists and manually update each package one at a time. The updates aren’t exactly recommended but before I did that some new LuCI stuff I installed broke the old LuCI install until I updated it.

Install some quality of life packages: less, bash, curl, nano, mg (for me).

Install luci-app-statistics. You also have to enable this by going to Statistics / Setup and saving the config.

TODO / options

Some things I have not yet done but may get around to (and update this blog post if so)

Install mwan3 for failover. Done, see this post for my notes.

Install wireguard for a VPN. Done, see this post for my notes.

See if I can export monitoring stats somehow to my InfluxDB instance for plotting in Grafana.

Install luci-app-sqm for traffic shaping

My own notes

Some notes of interest to me only.

The network interfaces are:
LAN eth0/br-lan E4:5F:01:5F:AB:D8
WAN1 eth1 5C:A6:E6:AA:BC:9A
Wireless not enabled

System / logging / external system log server to my Linux server on the LAN

DHCP range: 192.168.3.2 - 192.168.3.199

Override DNS servers and use 8.8.8.8 and 8.8.4.4

Set a static route for Starlink for 192.168.100.1 / 255.255.255.255 on eth1.

Some static leases (all have a lease time of 86400)
gvl 94:c6:91:1e:c8:38: .75
printer 84:25:19:0e:7b:0b: .67
pvspi0 e4:5f:01:78:d7:f9: .140

Starlink DHCP vs UnifiOS

My Starlink connection will work for days, then get in a mode where every 5 minutes the connection will fail for 30 seconds before it comes back. Long story short it looks like Starlink has a problem where it’s not responding to DHCP address renewals sometime.

Complicating matters; this is a Ubiquiti USG-3P router running UnifiOS and I have a backup WAN configured. Ubiquiti’s backup WAN stuff is a bit flaky, and also the failover does tend to both hide connection problems (when it fails over) and cause some (the failover itself breaks existing sessions.)

I’ve opened a support ticket for this, TIK-213261-55007-82. And I got two replies!

Apr 12: our engineering team is aware of cases where customers are having WAN DHCP renewal issues and the 5 minute lease expires. Our DHCP server engineers are actively working on this and I did send a link to the blog post to the lead engineer, appreciate the write up. Apologies for the issues and please bear with us.

Apr 15: our network software team deployed two fixes last night to hopefully resolve the DHCP renew issue

I finally got some DHCP logging set up to understand what’s going on at the router when the problem happens. Details below, mostly for my own troubleshooting.

The USG-3P has three ethernet ports. They are

  • Starlink, the primary WAN: on eth0, typically at an IP like 100.74.162.37.
  • My LAN: on eth1, 192.168.3.1
  • SmarterBroadband, the backup WAN2: on eth2, 10.33.1.1

My understanding of the DHCP behavior is that when connected, Starlink gives out an IP address in the CGNAT block 100.64.0.0/10 with an expiration of 5 minutes. Ubiquiti’s DHCP client accepts this address and binds to it. It also renews it every 2.5 minutes, half the lease time. If the renewal doesn’t happen in that 2.5 minutes then the link is effectively dead, packets to it fail, and the WAN failover process starts. (DHCP clients are not allowed to keep using an address past the lease expiration!) I’m not certain how the DHCP request is answered by Starlink, but my guess is the DHCP request goes up to the satellite and down to a ground station in Seattle where Starlink answers it. My working theory is those DHCP requests aren’t getting answered.

Update: there are reports that Starlink is starting to serve 1 hour DHCP leases. (Later they say it went back to 5 minutes; maybe a temporary change?)

Observed

When things are going well, every 2-3 minutes there’s an entry like this in the log:

2022-04-09T20:30:07,108 <30>Apr  9 13:30:07 ubnt dhclient: bound to 100.74.162.37 -- renewal in 138 seconds.
2022-04-09T20:32:25,233 <30>Apr  9 13:32:25 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-09T20:32:25,292 <30>Apr  9 13:32:25 ubnt dhclient: DHCPACK from 100.64.0.1
2022-04-09T20:32:29,566 <30>Apr  9 13:32:29 ubnt dhclient: bound to 100.74.162.37 -- renewal in 142 seconds.

I believe this is an ordinary DHCP renewal process. The router has an address so it just sends a DHCPREQUEST to request the address again. The server answers back with a DHCPACK and everyone continues along.

When things are going badly, it looks like this:

2022-04-12T15:22:11,377 <30>Apr 12 08:22:11 ubnt dhclient: bound to 100.74.162.37 -- renewal in 117 seconds.
2022-04-12T15:24:08,373 <30>Apr 12 08:24:08 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:24:19,743 <30>Apr 12 08:24:12 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:24:20,862 <30>Apr 12 08:24:20 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:24:39,539 <30>Apr 12 08:24:27 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:24:47,472 <30>Apr 12 08:24:47 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:24:59,338 <30>Apr 12 08:24:57 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:25:07,502 <30>Apr 12 08:25:07 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:25:23,323 <30>Apr 12 08:25:23 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:25:43,693 <30>Apr 12 08:25:43 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:25:57,522 <30>Apr 12 08:25:57 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:26:12,669 <30>Apr 12 08:26:07 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:26:17,713 <30>Apr 12 08:26:17 ubnt dhclient: DHCPREQUEST on eth0 to 100.64.0.1 port 67
2022-04-12T15:26:28,982 <30>Apr 12 08:26:28 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2022-04-12T15:26:39,022 <30>Apr 12 08:26:39 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2022-04-12T15:26:56,422 <30>Apr 12 08:26:56 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2022-04-12T15:27:10,770 <30>Apr 12 08:27:10 ubnt dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
2022-04-12T15:27:10,835 <30>Apr 12 08:27:10 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2022-04-12T15:27:10,835 <30>Apr 12 08:27:10 ubnt dhclient: DHCPOFFER from 100.64.0.1
2022-04-12T15:27:10,910 <30>Apr 12 08:27:10 ubnt dhclient: DHCPACK from 100.64.0.1
2022-04-12T15:27:16,963 <30>Apr 12 08:27:16 ubnt dhclient: bound to 100.74.162.37 -- renewal in 134 seconds.

That sure looks to me like Starlink is just not answering the DHCP request. An abbreviated timeline:

  • 15:22:11,377: the router thinks it has a valid address. It should have an expiration of 300 seconds and therefore be renewed in 150 seconds. But it takes awhile for it to arrive, so the actual renewal is scheduled for 117 seconds. (This delay seems normal.) The router should send a DHCPREQUEST to renew the address at 15:24:08. The address will expire around 15:26:38 or maybe a little earlier.
  • 15:24:08,373: the router sends the first DHCPREQUEST to renew its address. It sends it to 100.64.0.1, presumably the IP address at the other end of the Starlink connection.
  • 15:24:08,373 to 15:26:17,713: the router hasn’t gotten a DHCPACK reply. So it keeps sending requests every 10-20 seconds.
  • 15:26:28,982 to 15:26:56,422: still no reply. Now the router starts sending DHCPREQUEST to 255.255.255.255. I think that’s likely because the 100.74.162.37 lease expired and so the router now has no idea what address is at the other end and it’s starting over with a broadcast.
  • 15:27:10,770: the router sends a DHCPDISCOVER. I’m not certain but I think this means the router has given up on the old address entirely and is starting over as if it has never heard of the network.
  • 15:27:10,835: the router receives a DHCPOFFER from Starlink. We’re back in contact! This took 65ms, or just about one round trip on the satellite link.
  • 15:27:10,835: the router sends a DHCPREQUEST, presumably securing the address it was just offered. (Note the log has the request coming before the offer, but I think the log messages just got swapped. They have the same millisecond timestamp.)
  • 15:27:10,910: the router receives a DHCPACK from Starlink, 75ms after the request. We’re connected again!
  • 15:27:16,963: the router logs that the IP address is bound. Not sure why this takes 6 seconds to announce, but that’s all happening inside UnifiOS.

I should note that in all 6 failures I’ve had this morning (once every 5 minutes), only one DHCPDISCOVER has been needed to get the connection going again. Each time one is sent it gets immediately answered. There’s a different kind of outage I’ve seen on previous days, where the router eventually does a DHCPDISCOVER and gets back the address 192.168.100.100 with a very short 5 second lease. That’s Dishy’s internal DHCP server answering with a local only address, a mode it gets into when it loses its link to Starlink’s ground station entirely. That’s a very old behavior I’ve discussed on this blog before. This every-5-minutes outage is relatively new, a few months old.

Interpretation

My interpretation of this is Starlink’s DHCP server has forgotten we had a lease. My router keeps trying to renew the lease with DHCPREQUEST and gets no answer. Finally the router starts over wtih a DHCPDISCOVER and Starlink responds immediately. That’s consistent with the satellite link basically working but Starlink’s DHCP server failing to renew my address. But I’m guessing here.

What I do know is it’s really annoying having your connection drop every 5 minutes. The WAN failover is kind of making things worse; it takes UnifiOS about 30 seconds to decide to failover. By the time it’s done that Starlink has come back up and so the router switches back to it. Basically every 5 minutes the network is down for about 30 seconds. Any TCP sessions with activity during the failover period get reset.

But the failover isn’t causing the problem, the lack of DHCP response is the real problem.

Updates / notes

A useful command for checking the logs for Starlink-related DHCP stuff

grep dhclient 192.168.3.1.log | grep -v eth2 | fgrep -v 10.33.1.1

Just saw a bizarre failure that I think must be a Unifi OS bug.

2022-04-12T23:54:16,623 <30>Apr 12 16:54:16 ubnt dhclient: bound to 100.74.162.37 -- renewal in 117 seconds.
2022-04-12T23:55:40,224 <86>Apr 12 16:55:40 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/sbin/dhclient -q -cf /var/run/dhclient_eth0.conf -pf /var/run/dhclient_eth0.pid -lf /var/run/dhclient_eth0.leases -r eth0
2022-04-12T23:55:40,292 <30>Apr 12 16:55:40 ubnt dhclient: DHCPRELEASE on eth0 to 100.64.0.1 port 67
2022-04-12T23:55:44,280 <86>Apr 12 16:55:44 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/rm -f /var/run/dhclient_eth0.pid
2022-04-12T23:55:48,006 <86>Apr 12 16:55:47 ubnt sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/sh -c /sbin/dhclient -q -nw -cf /var/run/dhclient_eth0.conf -pf /var/run/dhclient_eth0.pid  -lf /var/run/dhclient_eth0.leases eth0  2> /dev/null &
2022-04-12T23:55:48,213 <30>Apr 12 16:55:48 ubnt dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
2022-04-12T23:55:48,242 <30>Apr 12 16:55:48 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2022-04-12T23:55:48,242 <30>Apr 12 16:55:48 ubnt dhclient: DHCPOFFER from 100.64.0.1
2022-04-12T23:55:55,691 <30>Apr 12 16:55:55 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2022-04-12T23:56:04,640 <30>Apr 12 16:56:04 ubnt dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
2022-04-12T23:56:11,101 <30>Apr 12 16:56:11 ubnt dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 13
2022-04-12T23:56:11,164 <30>Apr 12 16:56:11 ubnt dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
2022-04-12T23:56:11,164 <30>Apr 12 16:56:11 ubnt dhclient: DHCPOFFER from 100.64.0.1
2022-04-12T23:56:11,219 <30>Apr 12 16:56:11 ubnt dhclient: DHCPACK from 100.64.0.1
2022-04-12T23:56:17,169 <30>Apr 12 16:56:17 ubnt dhclient: bound to 100.74.162.37 -- renewal in 134 seconds.

This looks like the router just decided to restart dhclient. And the first thing it did was a DHCPRELEASE, breaking my connection. I have no idea why the router did this but it looks like Starlink responded quickly to the requests the router was making.

Measuring ISP congestion without load tests

My Starlink seems congested in the evenings. What are some strategies for measuring the congestion? The simple one is to run a speed test, see below for details on that. But speed tests are wasteful. Is there some lower impact monitoring I can do? This post is a bunch of ideas and questions, no solution.

Update Nov 2023: I’m finding IRTT is pretty good. It’s a fancy ping. It does a good job measuring both latency and packet loss and it’s not hard to pick out the signal of evening congestion.

Pings

My first thought was just to measure ping latency and packet loss; if the ISP is congested then latencies go up (queueing) and packets start getting dropped. Pings are a lot less traffic than load tests and there’s a lot of software to do them. This sort of works but it’s pretty noisy and pretty far removed from what I really care about, which is “can I use the Internet to do stuff?”

It might be smarter ping / packet loss measurements could work. My existing ping is already a little clever; every 15 seconds Telegraf sends 5 ICMP pings at once and reports what percentage was lost and a latency distribution. Packet Loss Test has an interesting take on measuring latency and jitter with WebRTC (in the browser!). iperf’s bursts of UDP packets are also a good way of measuring instantaneous throughput and could be done without using too much bandwidth. Ping probing is an idea worth exploring.

A related idea I wrote up is using some sort of traceroute-like probing to not only detect congestion but guess where it’s happening in the network. I think this is probably impractical in the general case, but maybe a custom solution for Starlink’s infrastructure could be helpful.

Passive monitoring

My next thought was to measure TCP retransmits at the router for existing traffic as it goes by. They’re a primary cause of low bandwidth and a primary signal of congestion. This should be doable in theory with stateful packet inspection in the router but I’ve never seen any software that does it. Anyone know about it? I also think the resulting data might be pretty indirect.

The other solution would be to measure TCP retransmits at the client endpoint. This is easy in Linux, probably not hard in Windows, but probably impossible on, say, my Roku streaming video device. It sounds like a significant hassle.

Any passive monitoring has a problem that you aren’t really sure if the congestion is on your client end or some problem on the server end. Load testing services presumably solve this by being well provisioned. But I suspect in practice most of my TCP traffic is going to very well connected sites like Youtube or Cloudflare and any slowness is more likely on my end than theirs.

Load test results

Running load tests is certainly the easiest thing and I’ve been doing that for months. Here’s a week of running an Ookla speedtest every 15-60 minutes:

The average of 130 is great. But every evening it dips to well below 50 Mbps. Worst measured is around 10Mbps. This testing shows the congestion problem pretty well.

The problem is load tests are expensive: each one download 250 megabytes of data over about 20 seconds (when things are fast). When I was running 4 an hour the speed tests were a significant fraction of my overall daily bandwidth usage, maybe 30% or more. They were making the video streaming worse. I’ve cut that back to once an hour but it’s still a waste.

Community monitoring

One bad thing about load testing is that it’s selfish; only I get the results of all that wasted bandwidth. Starlink Status tries to do better, by collecting stats from many users and sharing them. It’s a great idea but the execution is a bit lacking.

What would be really great is if Starlink were transparent and published its own traffic and congestion stats. Then I could just look to see how they’re doing. A few independent users could run their own tests to verify they aren’t misleading people. It’d be cool but I’ve never heard of an ISP volunteering this kind of competitive data.

Home LAN disaster mystery

I truly b0rked my home network yesterday. It took more than an hour to fix. I still don’t understand what went wrong but I’m wondering if my ethernet switches got in a bad state.

It started when I tried swapping my Ubiquiti router out for an OpenWRT router. The new router was working OK, the whole network was fine. I installed a few packages to OpenWRT (including wireguard, unconfigured) and rebooted it and then my network was down. No DHCP, couldn’t even connect with a static IP, OK I figured OpenWRT somehow broke and so swapped back to the old Ubiquiti router.

That’s when the mystery started. Nothing worked with the old router plugged back in. Again no DHCP, static IPs not working. Lots of blinking lights on the switches though, suggesting maybe some networking was still happening. I tried power cycling the router and the switches in the path between my computer and the router. No luck.

So then I began a tedious process of getting the network working starting from the router. Unplugged everything but one laptop. Still no DHCP. But static IP worked. That’s when I learned the router’s DHCP server wasn’t running. It was before! Not sure if UnifiOS “lost” the DHCP server setting? The Unifi controller was offline but my understanding is the router should keep its last config, which should have included DHCP service. Weird. So that’s one mystery, why did my router stop doing DHCP?

Fortunately the minimal configuration UI on the router itself does let you turn DHCP on. Turning that on and I had one router working with one laptop. And soon after that, one switch plugged into the router. But the Unifi access point plugged into the switch still didn’t seem to be working; connecting via WiFi got no DHCP. Weird.

But it got weirder when I went to the second switch, the big one at the center of my LAN and plugged into the first switch near the router. Nothing plugged into it worked. The ethernet cable coming to that switch worked on the laptop, but plug that into the switch and then the laptop into the switch and boom, no working ethernet. I finally just replaced the switch entirely and suddenly everything started working. Including the Unifi access points.

Today I tested the suspect switch and it seems fine. Also the router seems fine. So that’s another mystery, why did this equipment look like it wasn’t working after rebooting a router and works fine today?

One possible explanation for all of this is that somehow my ethernet switching got in a bad state. And that state was somehow polluting the network so nothing was working. I don’t think this is a very good theory. The switches are simple unmanaged Netgear GS108s, pretty bulletproof. No persistent state at all and nearly stateless entirely. I did try power cycling the switches a few times to no effect.

There is a bit of state in ethernet switches though: the spanning tree protocol. Also some sort of memory of which ethernet devices are plugged in to which port. Could that somehow have gotten corrupted?

My network is pretty simple. There’s no physical loops in the network topology (other than that implied by wifi). I’m not using VLANs at all, although I do note OpenWRT has some default VLAN configuration that I don’t understand and didn’t alter. There’s a total of maybe 5 unmanaged switches and 60 devices.

Honestly I’m just speculating about magical explanations. I don’t really know. I do know I’m scared to try swapping routers again.

Update: I tried the OpenWRT router again and failed, although not as catastrophically. It worked fine on first setup, then I rebooted it to test it and suddenly not only did I not have Internet, but the router wasn’t answering anything at all. No idea what’s going on. One guess is installing the wireguard packages with opkg somehow caused a problem, even though I didn’t configure wireguard. It also looks like Starlink’s Dishy terminal is not immediately answering DHCP requests from the router the moment it asks, so that’s not great. That doesn’t explain why I couldn’t even talk to the router at all though.

Debugging a WiFi problem

Still tinkering with Raspberry Pis and my Sunpower PVS6 solar controller. I had it all set up with a new RPi Zero 2 W when I had a new problem; the WiFi was flaky. It kinda sorta mostly worked well enough, I could get the HTTP requests through to it usually. But ping was showing 40% or more packet loss with a latency of 200+ms. I have a very clean WiFi environment, that should be 0% loss and 2ms latency.

A whole lot of testing later and I established that the problem is some sort of interference on 2.4GHz Channel 1, but only in my garage near the Sunpower box. That corner also has all my other ethernet equipment, is where the generator and solar feeds come in, and where the utility power and electrical panel are. So a lot of wires. None of that stuff should interfere with 2401-2423Mhz and there are a lot of mysteries still.

Switching my access point to channel 3 (2411-2433Mhz) seems to solve the problem. Part of the root cause of my troubles is I’d pinned the WiFi channel in the garage to 1 a year or more ago, I forget why. I’ve now set it to auto. I’ve had experiences where it seemed to be working for a few hours at a time before, so I don’t fully trust it yet. Edit: after rebooting the AP went back from channel 3 to 1. So I’ve configured it to hardcode channel 3 instead of “auto”. Whatever the interference is, the Ubiquiti hardware isn’t detecting it.

The most useful thing I did in the end was get 2 access points and 3 clients and try moving them around every few hours to see what triggered the problem. I used telegraf to ping them once a minute or so (but see below) for long term monitoring, and then occasional command line pings once a second for short term testing. Over two days I was able to narrow the problem down to the one channel in the one location, but it’s not related specifically to any particular hardware.

Some things I learned:

  • wavemon is a helpful tool on Linux for showing WiFi status. so is /proc/net/status and learning all the arcane options to the iw command.
  • The UniFi dashboard has some decent stats of its own hidden away under “Air Stats” for each individual access point device.
  • WiFi has its own link layer retransmit; lots of those might account for higher latency. But I don’t know what timescale it is on: 1 ms? 500ms? You can see WiFi retransmits in wavemon as “failed” and in Air Stats as “retry”.
  • Despite all these diagnostics none of them really showed me evidence the link was bad. All the basic link quality reports were 90% or better. No ridiculous number of retries (although it is 16% at the access point.)
  • Linux machines, including RPis, need to be configured for the country for wifi to work at its best. Particularly important for 5GHz.
  • Even with a perfectly good 5GHz channel available an RPi4 might still choose 2.4GHz. I could not find a way to reliably coerce it to use 5GHz.
  • Raspberry Pis have a variety of low power optimizations that mean they may not respond well to a ping every minute when otherwise idle. My RPi4 regularly takes 100ms to answer the first ping, then is a solid 2ms after. My original RPi Rev B just misses pings entirely if nothing else is happening on it. The RPi Zero 2 W seems pretty solid but then I’ve got it doing other real computation. Anyway my once-a-minute ping was showing phantom errors where there were none. A once-a-second ping test worked better.
  • There’s a power saving mode in the RPi radio hardware itself you can turn off with iw.
  • Raspberry Pis may in general just not be very good at wifi.
  • Don’t use mDNS names for ping testing. The mDNS query itself may get lost to a flaky / low power Pi and you never find the host.
  • TCP retransmits hide a lot of sins. But it only works right until it doesn’t. When my WiFi link was bad about 5% of my requests wouldn’t get through at all.

WiFi on Linux: country registration (Raspberry Pi)

My Raspberry Pi 4 would not talk via 5GHz to my Ubiquiti Access Point. Turns out the problem is the AP was running on channel 157 (5785MHz, 80MHz wide) which is not a globally allowed WiFi channel. It is allowed in the United States. Ubuntu on RPi4 has no country configuration for the WiFi unless you set it explicitly. Setting it for US jurisdiction should fix it.

On Ubuntu the config file /etc/default/crda is where to set it. Note you have to set it to “US”; “us” does not work. On Raspberry PI OS it’s in raspi-config under Localisation options. It’s also configurable in the wpa_supplicant.conf file you create when setting up a headless RPi.

Once the system is running you can inspect the state of your current wifi config with the commands iw reg get and iw phy phy0 channels, see output below. There’s documentation on how this works here, here. The apt packages crda and wireless-regdb are also of interest, as is /lib/crda.

$ iw reg get
global
country 00: DFS-UNSET
        (2402 - 2472 @ 40), (N/A, 20), (N/A)
        (2457 - 2482 @ 20), (N/A, 20), (N/A), AUTO-BW, PASSIVE-SCAN
        (2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM, PASSIVE-SCAN
        (5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW, PASSIVE-SCAN
        (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW, PASSIVE-SCAN
        (5490 - 5730 @ 160), (N/A, 20), (0 ms), DFS, PASSIVE-SCAN
        (5735 - 5835 @ 80), (N/A, 20), (N/A), PASSIVE-SCAN
        (57240 - 63720 @ 2160), (N/A, 0), (N/A)

phy#0
country 99: DFS-UNSET
        (2402 - 2482 @ 40), (6, 20), (N/A)
        (2474 - 2494 @ 20), (6, 20), (N/A)
        (5140 - 5360 @ 160), (6, 20), (N/A)
        (5460 - 5860 @ 160), (6, 20), (N/A)

$ iw phy phy0 channels
Band 1:
        * 2412 MHz [1]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40+
        * 2417 MHz [2]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40+
        * 2422 MHz [3]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40+
        * 2427 MHz [4]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40+
        * 2432 MHz [5]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40- HT40+
        * 2437 MHz [6]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40- HT40+
        * 2442 MHz [7]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40- HT40+
        * 2447 MHz [8]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40- HT40+
        * 2452 MHz [9]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40- HT40+
        * 2457 MHz [10]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40-
        * 2462 MHz [11]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40-
        * 2467 MHz [12]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40-
        * 2472 MHz [13]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40-
        * 2484 MHz [14] (disabled)
Band 2:
        * 5170 MHz [34] (disabled)
        * 5180 MHz [36]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40+
        * 5190 MHz [38] (disabled)
        * 5200 MHz [40]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40-
        * 5210 MHz [42] (disabled)
        * 5220 MHz [44]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40+
        * 5230 MHz [46] (disabled)
        * 5240 MHz [48]
          Maximum TX power: 20.0 dBm
          Channel widths: 20MHz HT40-
        * 5260 MHz [52]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40+
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5280 MHz [56]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40-
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5300 MHz [60]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40+
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5320 MHz [64]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40-
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5500 MHz [100]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40+
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5520 MHz [104]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40-
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5540 MHz [108]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40+
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5560 MHz [112]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40-
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5580 MHz [116]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40+
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5600 MHz [120]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40-
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5620 MHz [124]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40+
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5640 MHz [128]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40-
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5660 MHz [132]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40+
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5680 MHz [136]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz HT40-
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5700 MHz [140]
          Maximum TX power: 20.0 dBm
          No IR
          Radar detection
          Channel widths: 20MHz
          DFS state: usable (for 726 sec)
          DFS CAC time: 0 ms
        * 5720 MHz [144] (disabled)
        * 5745 MHz [149] (disabled)
        * 5765 MHz [153] (disabled)
        * 5785 MHz [157] (disabled)
        * 5805 MHz [161] (disabled)
        * 5825 MHz [165] (disabled)

mDNS, hostname.local, and WSL2

Modern computers can often be reached by the DNS name hostname.local. This is implemented via Multicast DNS, mDNS, which originated in the early 2000s as part of the zeroconf work to make networked computers usable without manual configuration. Apple’s Bonjour was the first implementation of it I saw working widely. Linux machines tend to use Avahi. For Debain and Ubuntu systems apt install avahi-daemon is generally enough to get the system announcing its name.

The magic of multicast

It works via multicast. mDNS-aware name resolvers know that if a domain name ends in .local, the way to resolve it is to send a UDP multicast request to 224.0.0.251:5353 or and see if anyone answers. (There’s an IPv6 equivalent). Multicast generally propagates across your whole LAN; if a host sees a query for their own name it answers back to 224.0.0.251 (not the requester directly) with a DNS record. It’s not exactly standard DNS packets, some slight modifications in place, but the basics are the same.

It works great! As long as you have a reliable LAN. I’m using it on some Raspberry Pi devices with a flaky WiFi connection and that’s not a good experience.

As an aside, can I say how much I love multicast? Ethernet broadcast too, and even the less common anycast. Being able to send a packet to the local network without being exactly sure who the recipient is can be very useful in all sorts of applications. A lot of stuff we do like NTP would work better if it regularly used multicast. Unfortunately multicast over the routed public Internet is pretty much a dead-end technology; no one has ever figured out how to manage it scalably.

mDNS services

I mostly use mDNS myself for .local domain name resolution. But mDNS is a full service discovery framework. You can use it to ask for things like “is there a printer on the network?”

Avahi comes with a discovery tool to get a quick dump of services on the network.
avahi-browse --all --ignore-local --resolve --terminate
Here’s an example of the services my printer offers

+   eno1 IPv4 Samsung M267x 287x Series (SEC...)   _privet._tcp         local
+   eno1 IPv4 Samsung M267x 287x Series (SEC...)   _scanner._tcp        local
+   eno1 IPv4 Samsung M267x 287x Series (SEC...)   UNIX Printer         local
+   eno1 IPv4 Samsung M267x 287x Series (SEC...)   PDL Printer          local
+   eno1 IPv4 Samsung M267x 287x Series (SEC...)   Internet Printer     local
+   eno1 IPv4 Samsung M267x 287x Series (SEC...)   Web Site             local

On my LAN I have services for Sonos, Roku Airplay, the printer, my Samba fileshare, and some things Home Assistant has published.

I believe the service discovery is all implemented via mDNS queries, with some extra information placed in TXT records. It all looks fairly elaborate, RFC 6763 is one reference for how it works. Now I’m curious how carefully specified the metadata for things like printers are. Is there a clear standard or is it all freeform and customary publication?

WSL and mDNS

WSL2, Microsoft’s Linux VM for Windows, also supports .local domain names. It’s a little weird. My windows machine is named “Nelson-Win10”. On the rest of my network nelson-win10.local resolves to 192.168.3.114, the DHCP-assigned address for the host Windows system. Just like you’d expect. But inside a WSL2 shell it resolves to Nelson-Win10.mshome.net (172.27.48.1). That’s a private-use address and the domain name is something Microsoft has been doing for years as part of their Internet connection sharing stuff. This address is reachable from the host Windows system. It’s not accessible on the rest of my LAN because I don’t have routes for that subnet, I wonder if it would work if I added one? Anyway this is all a workaround for the fact that localhost doesn’t work very well (or at all) across the host Windows and WSL2). Honestly all the networking in WSL2 to the outside world is kind of confusing and maybe buggy. But hostname.local works on the Windows machine itself.

(Note that in a command shell on Windows itself, nelson-win10.local also works. It resolves to an IPv6 link local address in the fe80::/10 block.)

underscore DNS queries

Wanted to document this learning as more than some tweets.

The amazing Julia Evans launched Mess with DNS, a little sandbox where you can register some domain names and then see what queries their DNS server of record gets. Great tool for learning.

I learned something! When I did a single A query at home on Sonic.net using their DHCP servers, Mess With DNS sees six queries all at once

That seems like an awful lot. There’s several mysteries here, but the one I focussed on was that query for _.lily6.messwithdns.com. Underscores are generally understood to not be valid in domain names, although the underlying DNS protocols do seem to allow them in some places. But why would a query for a normal subdomain also produce a query for _?

A simple way to reproduce this is
$ dig @50.0.1.1 nelson.lily6.messwithdns.com a
That’s a different Sonic resolver than I use. It only results in two queries, not six, but it still generates that underscore query.

I put the question out on Twitter and on Hacker News and got two useful replies.

First, a reply from a product manager at Cloudflare who very kindly looked in his logs for similar queries and reported.

Over the last ~5 minutes I see ~12 queries per second on average (globally) to 1.1.1.1 for _.www.google.com and ~3 QPS for _.www.cloudflare.com - which is effectively noise.

So that’s interesting. Those queries do exist but they are not very common.

As for what causes them, the Hacker News discussion came through. Several folks all pointed out this is something Bind9 does with the “QNAME optimization” option turned on. One Sonic engineer even explicitly confirmed that was the DNS server they use and the source of the queries.

So what do they mean? QNAME Minimization is a privacy thing in recursive resolvers. If you’re querying foo.bar.example.com at some point you end up asking the .com root server for information. But there’s no need for them to see the whole domain name, so you just send the minimum you need (example.com, I believe.)

That still doesn’t explain the underscore. TBH I don’t really understand it. The Bind9 code is here but there’s few comments. However I was able to find the commit that added it and the comment says

qname minimization, even in relaxed mode, can fail on some very broken domains. In relaxed mode, instead of asking for “foo.bar NS” ask for “_.foo.bar A” to either get a delegation or NXDOMAIN. It will require more queries than regular mode for proper NXDOMAINs.

So that seems to be the answer. It’s not great that this workaround for “some very broken domains” ends up doubling the name server traffic for the rest of the Internet, but here we are.

For completeness, several people pointed to RFC 2782 or RFC 8552. (It’s one of first Google search results for “underscore dns”.) That RFC is about using _ to mangle some other tokens to not collide with domain names; they are used when querying things like _tcp or _udp. I’m pretty sure that’s not what’s going on here.

I’m grateful to have gotten replies from someone at CloudFlare, my ISP, and the author of the QNAME Minimization RFC. It’s nice to be able to get an answer from actual experts.

WireGuard: very simple setup

Now that Starlink is working reliably I want to bridge the network between my two houses to make it easier to share stuff across. I have an elaborate setup of ssh tunnels and autossh for NAT busting and it’s awful. A VPN would be better. Some notes on getting there, this is very WireGuard 101 stuff.

The SF network is at 192.168.0.0/24 and is on fast fiber. I have a NAT router but I completely control it so with port forwarding it’s easy to set up a server. The GV network is at 192.168.3.0/24 and is behind double NAT; my own and also Starlink’s carrier grade NAT. The latter prevents listening on sockets pretty much entirely, so running a server behind it is awful and even elaborate NAT traversal seems dicey.

At first I thought I wanted a full bridging setup so the two houses appear in the same place. But in retrospect I think that is a mistake. It’d be bad for Sonos, for instance, it seems to use LAN broadcast to discover its own stuff and I’d much rather it found the local server for music files than tried to use the VPN. Same goes for Plex video too. OTOH I would like some discovery-based things to work; Windows filesharing for sure. I don’t really understand what I need.

To start simple I decided just to create a basic tunnel on a new subnet (192.168.7.0/24) between Linux boxes in the two houses. Doesn’t really solve my problem but those tunnels could later be gateways for house traffic. I am ignoring my Ubiquiti routers entirely. Folks have gotten various VPN solutions working on that, including Wireguard, but I’m concerned at the longevity of any hackery solutions for doing that. Maybe later.

Anyway setting up a simple tunnel between two Linux boxes is easy. I used WireGuard for this, apparently the modern VPN solution. It really is a breeze both to install and to understand. I mostly used this guide with some consulting of this other guide. Note WireGuard itself doesn’t really have good docs. For instance I cannot find anywhere a man page style reference for the conf files that wg-quick uses, never could find a definition of exactly what “Address” or “Endpoint” means. It’s sort of clear from context and examples but...

Anyway following the guides it all basically just worked. Very simple too. Wireguard’s model is peer to peer; peers are identified by a public/private key pair (and an internal ID). Tunnels between peers then get created as needed and each end of the tunnel is given an IP address. The guides are written in terms of a client/server setup so I’ll use that language from now on.

The main gotcha I had is when I first set up the server in 192.168.0.0/24 I gave the Wireguard tunnel itself an IP address in the same subnet, 192.168.0.0/24. That’s definitely a bad idea; my Linux box decided to use that new route instead of the ethernet and I had to reboot it. That’s why I put the Wireguard tunnel in a new subnet (192.168.7.0/24) instead. The other gotcha is I set SaveConfig=true. It’s a neat idea; you configure the thing on the fly with the command line and then the config file is updated. But at the same time I was editing the config file to fix things and restarting WireGuard and my changes kept getting clobbered. Pick one or the other style of creating a config, don’t do both.

Anyway, now I have a working tunnel so my two Linux boxes can talk to each other. The next step is using this tunnel to do “other things” like mount Windows fileshares, etc. Still not sure how I’ll go about that.

Updates below

I’m going to keep updating this post as I hack more. I don’t feel like having the discipline to mark every update, so just expect stuff to be added over time.

I realize I don’t really know what I want from this VPN setup. I don’t want full bridging; I want some things like media servers to not be discovered over the WAN link. I do want a lot of transparency though. I’m going to start now by making sure every device in SF (192.168.0.0/24) can talk to every device in GV (192.168.3.0/24). I’ll worry about broadcasts and discovery later, if at all.

Several folks have asked “why not Tailscale”? That is probably an excellent answer; Tailscale is a nice VPN product built on top of WireGuard. I was under the impression it was client oriented, not network oriented, so you had to install Tailscale on every device. But that’s not really true; they have a “subnet router” capability that works for other devices. At this point I’m mostly not using it because I got WireGuard itself running OK and I want to tinker more.

Starting to think I should run Wireguard on my Ubiquiti boxes afterall. One of my routers is a Ubiquit Dream Machine which is sort of different software: here’s a port of Wireguard to Dream Machine.

Netcat for testing

I want to be able to test if packets get through but without the full round trip ICMP ping requires. That’s what netcat is for. On the server side; nc -klu 3333. On the client side, testing sending a packet: echo foo | nc -u 192.168.3.75 3333. Note the client netcat doesn’t hang up after sending the packet, it keeps the socket open looking for input.

Routing the subnet

The basic wireguard setup gets a tunnel going. You can ping the tunnel endpoint IP address (192.168.7.3). But not the “real” IP address of the machine at the other end (192.168.3.75). To add that, we need a route. Doing this manually is a mistake (wg-quick does this...) but it was the first thing I tried and half works, so I mention it here:

route add -net 192.168.3.0/24 gw 192.168.7.3 wg0

Doing that is enough to let UDP packets through. nc -u 192.168.3.75 3333 works! However traceroute (and presumably ping) fails with the mysterious message send: Required key not available. Turns out that’s an error message from Wireguard and in my case is caused because 192.168.3.0/24 is not one of the “Allowed IPs” in the peer definition for the Wireguard tunnel. Wireguard is blocking the traffic.

The solution is to add the subnet to AllowedIPs. AllowedIPs = 192.168.7.0/24, 192.168.3.0/24. Add that and restart and pings get through and get replies. Moreover there’s no need to manually add the route because wg-quick does it for you. “It infers all routes from the list of peers’ allowed IPs, and automatically adds them to the system routing table”. Nice! Long story short, to get a single machine on two different subnets talking to each other via Wireguard it’s sufficient to add each’s subnets to the other’s AllowedIPs.

Next step: get the rest of the LAN on each side to know to route traffic for the other subnet through Wireguard. I know this means adding a static route (probably in my router). I’m less clear what, if anything, I have to do to configure the Linux box to act as a router that forwards the packets for that destination. When searching for info on this I found a lot of advice about using IPTables masquerading for a NAT setup. Yuck, no!

Update: turns out basic routing just works already with no extra config. It may help that my Linux box which is the Wireguard endpoint already has IP Forwarding turned on. Anyway on my Windows box I just did route add 192.168.3.0 mask 255.255.255.0 192.168.0.65 and now my Windows machine can talk to the other end of the Wireguard endpoint on its “real” address 192.168.3.75. Can’t talk to anything else on the remote network though, but that’s because they don’t know a route back yet.

Of course I don’t want to manually have to add this route to everything! A better solution is not to set the route on my Windows desktop but instead add a static route to my Ubiquiti Dream Machine. It’s hidden under Settings / Advanced Features / Advanced Gateway Settings / Static Route. The Destination Network is 192.168.3.0/24, the next hop is 192.168.0.65, where the WireGuard endpoint is.

C:\Users\Nelson>tracert -d 192.168.3.75

Tracing route to 192.168.3.75 over a maximum of 30 hops

  1    <1 ms    <1 ms    <1 ms  192.168.0.1
  2    <1 ms    <1 ms    <1 ms  192.168.0.65
  3    60 ms    59 ms    59 ms  192.168.3.75

That’s it! Now everything on my 192.186.0.0/24 LAN can initiate connections to 192.168.3.75. Nothing else in 192.168.3.0/24 though because I haven’t added the route on that side yet. The big thing is my Windows box can now access the remote fileshare at \\192.168.3.75\. I doubt it will show up as discoverable but a direct connection works.

This is all working well enough now I’m close to needing to document the final setup and making it persistent. It may actually be persistent; I just did the systemctl enable command that gets wireguard to run at startup.

Starlink improvements

I’ve been running the TIG stack monitoring my Starlink connection for about 3 months now. I made a couple of posts to Reddit recently about the results of that. Bottom line: both latency and packet loss have improved significantly. Latency to 8.8.8.8 dropped from 44ms to 37ms average around July 15. And in the last month or so packet loss dropped from 2.1% to 0.6%.

Here’s a copy of the two reddit posts.

Latency improvement around July 15: 44ms to 37ms.

Noticed something interesting in my automated monitoring; my latency has improved. I’m measuring with pings to 8.8.8.8 every few seconds using Telegraf. The average has been about 44ms for a long time, dropped to about 42ms starting July 9, and starting July 15 dropped to 37ms.

It’s hard to accurately measure performance with a connection as variable as Starlink, but I have enough consistent data I think this is a real trend. Graph is here: https://i.imgur.com/fwuG2Yc.png

https://i.imgur.com/fwuG2Yc.png

I don’t know where latency improved. The changes in the graph don’t seem correlated to firmware updates. There’s no obvious change in bandwidth, although measuring that accurately is really hard. The latency improvement could well be in the terrestrial links between Starlink ground stations and Google DNS; that’s not very interesting. Or maybe it’s in the satellite network itself. No way of really figuring it out from here I think. But FWIW I’ll append a current MTR.

 Host                   Loss%   Snt   Last   Avg  Best  Wrst StDev 
 1. 192.168.3.233        0.0%   189    0.5   0.4   0.2   0.6   0.1 
 2. 136.22.110.161       0.0%   188   35.9  31.1  21.2  55.4   6.6 
 3. 142.250.163.162      0.5%   188   33.2  30.8  19.5 141.2  10.5 
 4. 108.170.242.225      0.0%   188   33.5  30.3  19.8  50.4   6.2 
 5. 108.170.236.61       0.0%   188   34.5  31.4  21.5  59.8   7.7 
 6. 8.8.8.8              0.0%   188   35.1  30.6  19.2  56.8   7.4

Packet loss improvement: 2.1% to 0.6% over three months

My packet loss has improved over the last three months: from about 2% to 0.6% by my measurement. Don’t get hung up on the absolute number but I think the improvement trend is real. See below for more numbers and the graph here: https://i.imgur.com/RCqI6mp.png

https://i.imgur.com/RCqI6mp.png

Nothing significant has changed at my site. What I’m seeing is consistent with what Starlink has been telling us: reliability should be improving as they fill out the constellation. My antenna is mounted on a roof in Grass Valley, CA with some minor tree obstructions. I’ve been hoping with more satellites that Starlink could work around the obstructions; there was a promise a few months ago of a firmware update to do that.

https://i.imgur.com/ju86o54.png

Anecdotally I’ve been using Starlink exclusively on my desktop computer for about 8 weeks now. It used to be annoying about 10 times a day to have to wait for 5-10 seconds for the network to respond again. Now it feels like 2 times a day. But that’s just perception, the numbers in my report say more.

Unfortunately I’m having a hard time getting a great graph of the trend but it should be visible in the graph linked above. I’m also seeing a similar trend in Dishy’s own reported drop rate. Here’s the average packet loss percentage from my pings along with Dishy’s average drop rate over 7 day periods starting at various times:

  • Week starting 5/1: 2.1% / 0.024
  • Week starting 6/1: 2.0% / 0.027
  • Week starting 7/1: 1.0% / 0.008
  • Week starting 7/13: 0.6% / 0.006

FWIW the same ping tests with my old fixed wireless WISP was about 1% packet loss. But those were just one-off lost packets. Starlink’s multi-second outages have been annoying. They’re getting better!

Appendix: my ping data comes from Telegraf’s ping plugin. I’ve got it configured to send 5 pings at a time, every second. As always, when measuring with ICMP ping all sorts of other things could explain changes in behavior. But in this case the ping data confirms my general perception and also Dishy’s own reported drop rate.

Obstruction improvement: 0.7% to 0.07% in the last month

The recent info email update got me looking closely at my obstruction reporting stats. Historically I’ve had about an 0.74% obstruction rate thanks to a few trees. In the last 7 days it’s been 0.070%, or 1/10th the rate. You can see the graph of Percent Obstructed here: https://i.imgur.com/tJmK04q.png. A second related graph is Seconds Obstructed: https://i.imgur.com/LjcQWvE.png

Note these are Dishy’s own reported numbers, similar to the graph you get in the app. This trend is entirely consistent with my own monitoring with pings. I think in the last month the planed “Connecting to the Best Satellite” has finally come to full usage.

(One in a series; I’ve recently posted other posts here on packet loss and latency improvements. I’d like to do one more post measuring lengths of outages, those 10 second failures we used to get. I think that’s also improved significantly but they haven’t gone away entirely.)

https://i.imgur.com/ygfFagX.png

A false bandwidth result

I noticed the following graph (that is false) of Speedtest by Ookla results showing bandwidth decreased around August 1.

I wrote a whole long ass exploration of why my Starlink bandwidth might have decreased. It’s all wrong! Turns out somehow Speedify got re-enabled on my server August 1, I don’t know how. And Speedify’s VPN servers typically cap out about 120 Mbps for me. That’s it, that’s why my bandwidth went down.

Unfortunately this invalidates all my network monitoring data from August 1 to August 6. Doesn’t invalidate any of the data posted above, that was all in July before this change. But I will need to remember going forward to ignore all the weird changes I started seeing August 1.

I’ve removed Speedify entirely from the Linux box.

Starlink Dishy: getting some deeper status

This blog post contains details on some hidden status method from Starlink’s user terminal, including what satellite it’s currently talking to.

I’ve been hacking around a bit with Dishy, the Starlink user satellite terminal. They provide some nice consumer tools for basic status: am I connected, what kind of bandwidth am I getting, a basic graph of history of outages. And a new feature, a fancy 2d map of where it thinks obstructions are (ie: the trees around you).

Behind the scenes Dishy implements a gRPC server with lots and lots of data. And happily the server supports reflection, so you can interrogate it for features. They keep adding new features! Mostly I’ve interacted with this using the starlink-grpc-tools package; it hides all the gRPC and just provides some command line programs for dumping data to CSV, InfluxDB, whatever. It’s quite nice! But it’s limited in that it only supports some of Dishy’s methods. There are others!

gRPC software

Ironically I have no experience working with gRPC. The hacking tool of choice seems to be grpcurl which lets you invoke methods via the command line. That’s a little low level so I am using grpcui which gives a simple web UI to gRPC servers that support reflection. There’s lots of other options for a tool like that btw.

So, what other gRPC methods are hiding in there?

dish_get_context

First try is a jackpot; dishGetContext. It mostly returns some stuff in other methods; device_info, obstructions, etc.

Update: lol that didn’t last long. Now when I call the method I get “PermissionDenied”, I think because of a firmware update. It was working on firmware a4908729. It’s now failing on firmware 4990ce8d.

But it also returns a bunch of information that looks to be about which satellite Dishy is currently talking to! It will tell me my cell ID (shouldn’t change?), a satellite ID, a gateway ID, and a “seconds to slot end”. It looks like Dishy swaps satellites every 15 seconds. The satellite IDs correlate pretty well with what a satellite tracker says. There’s also a “backup beam” that turns on sometimes after packet loss. It’s all super cool!

device_info	
id	ut01000000-00000000-000XXXXX
hardware_version	rev1_pre_production
software_version	990b956d-a7fc-4c9b-a3ab-c09a309ac425.uterm.release
country_code	US
utc_offset_s	-28799
obstruction_fraction	0.0064355433
obstruction_valid_s	178496
cell_id	1142511
pop_rack_id	38
seconds_to_slot_end	3.531043
device_state	
uptime_s	178780
initial_satellite_id	1186
initial_gateway_id	544
on_backup_beam	true

Here’s a quick little shell script to monitor cell, satellite, gateway, and also a ping to 8.8.8.8 once a second.

while :; do
  grpcurl -plaintext -d '{ "dishGetContext": {} }' 192.168.100.1:9200 SpaceX.API.Device.Device/Handle | 
    jq  '.dishGetContext|.cellId,.initialSatelliteId,.initialGatewayId,.onBackupBeam,.secondsToSlotEnd' | tr '\n' ' '; 
  ping -c 1 -W 1 8.8.8.8 | awk -F/ '/^rtt/ { print $5 }' ; 
  sleep 1;
done   

Unimplemented methods

I went through all the other methods in the gRPC stuff. I skipped the ones that starlink-grpc-tools already supports like “status”, etc. Sorry to anyone else but for me I already knew what those did.

Unfortunately all the other interesting looking methods I could find returned errors suggesting they aren’t implemented. get_next_id, get_location, a bunch of wifi_ methods I suspect are in the router (not Dishy).

dish_emc: Fast Switching

One last method looked interesting, dish_emc. That API call seems mostly to be about RF radio state; channels, modulation details, etc. But there’s a fast_switching flag. Maybe fast switching is a frequency thing. But my hope is that it’s related to a promised feature where Dishy predicts obstructions and switches to new satellites to avoid them. My real hope is that this feature isn’t yet turned on and turning it on will magically make my Internet better.

So I turned it on: "dish_emc":{"fast_switching": true}}. I did that today around 11am on 2021-06-27. It didn’t immediately break my Internet so.. good? I’ll check back in 24 hours to see if it had any change. It may amount to nothing though.

Update: after 24 hours I think making this API call did nothing. Either the API isn’t implemented at all, or fast_switching was already on, or it doesn’t make a difference whatever it does. My money is on the “not implemented at all”. Here’s a graph of drop rate; I made the change right about the middle of the time axis here.

dish_emc looks like it returns status data too. But calling it, all the results are 0 or false. Maybe it’s not implemented or has some lockout. Here’s the result from that set call:

is_test_device	false
uuid	
timestamp	0
state	
sky_search_state	
snr	0
seconds_until_schedule	0
snr_uptime	0
cplane_uptime	0
percent_scheduled	0
cplane_updates	0
downlink_throughput	0
uplink_throughput	0
connected	false
sys_uptime	0
gps_latitude	0
gps_longitude	0
gps_pdop	0
rf_mode	0
phi	0
theta	0
rx_channel	0
tx_channel	0
t_dbf_max	0
t_center	0
baseline_heating	0
additional_heating	0
total_heating	0
target_total_heating	0
auto_power_snow_melt_enabled	false
voltage	0
rx_beam_state	0
tx_beam_state	0
half_duplex_state	0
manual_tilt_enabled	false
tilt_angle	0
pll_tx_lock_detected	0
eirp_exceeded_threshold	false
eirp_scale_override	0
idle_override_enabled	false
theta_override_enabled	false
theta_override_value	0
phi_override_enabled	false
phi_override_value	0
rx_chan_override_value	0
tx_chan_override_value	0
sky_search_override_enabled	false
fast_switching_enabled	false
modulation_override_value	0
force_eirp_failure	false
force_pll_unlock	false
ut_ine_success	0
rf_ready	false

Starlink obstruction map

Sometime around June 3 Starlink pushed a handy new feature, a full map of obstructions in Dishy’s view. Previously it only told you about obstructions in each of 12 slices of the circle; now it’s got a two dimensional map.

That corresponds to what I expected; I have a tall tree to the Northeast. Not sure about the lesser blob to the north but presumably it’s a second tree. Unfortunately while these obstructions look small they really do affect my connection meaningfully. Dishy spends most of its time looking to the north so that side matters more.

FWIW the way this feature seems to work is a new gRPC endpoint in Dishy itself called dish_get_obstruction_map. The older 1752790c firmware doesn’t support it; I only started seeing the map when I upgraded to db6b5d22. That was release about June 3.

(Vaguely related; I maintain a crowdsourced list of Dishy firmware revisions.)

24 hours of Starlink ping performance

I finally got my TIG monitoring stuff to do a useful ping test of Starlink performance. See the graph below; it’s the result of sending 5 pings a second to 8.8.8.8 and measuring average response, packet loss, etc. I’m not positive but I believe the scale of this is 1 pixel = 60 seconds, or 60 samples. The way Grafana works, any time you see a red dot indicates there was some packet loss in that interval.

That’s an average of 45ms and 1.4% packet loss. 8.8.8.8 is just about next to the ground station at the other end of the satellite; if anything it responds faster to pings than the ground station that’s hop #2 on my traceroute.

Here’s a similar graph for the last 30 minutes, with 1 pixel = 1 second.

Within the 5 pings sent in one sample there’s not much variance in latency. But there is latency on the scale of minutes. Not sure if that’s me switching satellites, or me being buffered because of time division multiplexing, or what.

The really annoying thing is the packet loss, the red dots, particularly in an outage like at 18:30. Those correspond to real noticeable ISP outages of 5-20 seconds at a time. They seem to mostly happen when there are no satellites in view or when the only one is hiding behind a tree that’s in the way. That should get better as they add more satellites to the constellation.

45ms is pretty good for space based Internet! Sonic.net gets me 5ms on their fiber network, but they are astonishingly great. My fixed wireless WISP is more like 70ms.

ISP data usage pre-Starlink

Before I had Starlink, I was downloading about 175 GB a month via my WISP. My data cap is just about double that, 350 GB, although I’m not sure they enforce it. Note this isn’t really all the Internet I would like to use; because it’s only 12 Mbps and I have the cap in the back of my mind, I avoid making really big downloads and truck files in with a hard drive sometimes instead.

As you can see from the months of March and April my usage of the WISP is way down now that I have Starlink. No surprise; I’ve shifted my heaviest uses of traffic (game console, TV, my desktop) over to it.

I’m stuck paying for both ISPs for awhile; Starlink isn’t quite reliable enough.

Starlink bandwidth in practice

I’m downloading a big PS5 game right now (Returnal) which seems like a reasonable practical bandwidth test for Starlink. Here’s the router’s graph of throughput

Average: 123 Mbit/sec

So there you have it. An average of 120 Mbit/sec over 3 minutes, The graph shows throughput every 3 seconds so you can see the extreme variability; moment to moment the bandwidth swings between 20 Mbit/sec to 300 MBit/sec. Honestly I’m surprised TCP can cope with this kind of variance and converge to a reasonable speed! Other tests suggest there’s not a lot of buffering in Starlink’s infrastructure, so I don’t think that’s smoothing anything out.

Note the gap where bandwidth fell to zero at the start; that’s a legit failure and occurred several minutes after the download started.

And here’s a graph of the whole 56GB download period; average 160 Mbit/sec, took just about an hour. On my old 12 Mbit/sec WISP this would take about 13 hours (and possible cost me $1/GB in data overage fees).

161 Mbit/sec

OpenWRT vs Starlink: DHCP leases

Finally captured a rumored bug as it was happening. After Starlink Dishy resets itself, the home router can’t get a working Internet connection. (Note: this is not using Starlink’s router). Folks report various ways to fix it, often by plugging in Starlink’s router temporarily. I think resetting your home router alone is sufficient. Or even less intrusive; resetting the WAN port. Some folks on Reddit call this the “DHCP loop” behavior.

In summary; Dishy hands out a temporary IP address 192.168.100.100 with a very short DHCP lease. This seems to confuse routers which keep renewing the temporary address rather than getting a permanent 100.64.*.*/10 address.

Dishy behavior

Dishy is itself a DHCP server; it acts more or less similar to a cable modem. The reported behavior of Dishy is that right after it reboots and before its acquired satellites, the DHCP server hands out an address of 192.168.100.100 to any router that asks as a temporary address. Crucially, the DHCP lease on this is a tiny 5 seconds. It also has a gateway of 192.168.100.1 (Dishy itself) but this gateway doesn’t really work.

Once Dishy configures itself with Starlink it changes and instead gives out a semi-permanent CgNAT address like 100.71.6.46. It expects the router to switch to this new address, the published final gateway is something like 100.127.255.3. This DHCP lease is for 5 minutes.

Everything about what Dishy is doing makes sense to me and seems reasonable. The only slightly odd thing is the 5 second DHCP lease on the temporary, but presumably that’s set because Dishy knows it wants to swap the temporary address out quickly.

OpenWRT behavior

Unfortunately OpenWRT doesn’t react well to Dishy’s DHCP hijinx. In practice what happens is OpenWRT stays stuck at the old 192.168.100.100 address and never switches over. here’s a screenshot of the bad state in OpenWRT’s status panel:

I tried prying in to OpenWRT a little more closely to see what was going on. I’m fairly ignorant of how it works though, so didn’t get far.

The router is running a persistent process to maintain this DHCP lease:

udhcpc -p /var/run/udhcpc-eth0.pid -s /lib/netifd/dhcp.script -f -t 0 -i eth0 -x hostname:OpenWrt -C -O 121

That all looks normal enough. Unfortunately I wasn’t able to capture the DHCP traffic or otherwise debug the request/responses that were going on. However, syslogging was helpful:

Logs for normal operation, once every 2.5 minutes:
Apr 7 18:05:16 OpenWrt netifd: wan (1527): udhcpc: lease of 100.71.0.14 obtained, lease time 300
Apr 7 18:07:46 OpenWrt netifd: wan (1527): udhcpc: sending renew to 100.127.255.3

First DHCP success after router reboots:
Apr 7 18:15:15 OpenWrt netifd: wan (1527): udhcpc: sending select for 192.168.100.100
Apr 7 18:15:15 OpenWrt netifd: wan (1527): udhcpc: lease of 192.168.100.100 obtained, lease time 122
Apr 7 18:15:15 OpenWrt netifd: Interface ‘wan’ is now up

Afterwards, once a minute:
Apr 7 18:35:37 OpenWrt netifd: wan (1527): udhcpc: lease of 192.168.100.100 obtained, lease time 122
Apr 7 18:36:38 OpenWrt netifd: wan (1527): udhcpc: sending renew to 192.168.100.1

So here’s the weird thing. The router was given a lease of only 5 seconds. But it seems to be ignoring that and just blindly renewing the lease every minute, pretending it’s a 122 second lease. Worse it’s asking to renew the existing address and Dishy is gamely letting it. What we want is for the router to get a new address, not perpetually renew the old one.

I suspect all this buggy behavior is triggered by Dishy’s slightly odd short DHCP lease. But without digging in to OpenWRT’s code I don’t really know.

Update: the 122 seconds comes from Busybox/udhcpc’s code.

/* paranoia: must not be too small and not prone to overflows */
/* timeout > 60 - ensures at least one unicast renew attempt */
if (lease_seconds < 2 * 61)
	lease_seconds = 2 * 61;

I first tried to fix this by sending SIGUSR2 to udhcpc; that signals it to release the address. The release went through but OpenWRT wasn’t smart enough to then decide to get a new address. (Reading the udhcpc docs, I should not be surprised this did not work). I finally just clicked the “reset” button next to the WAN port in the OpenWRT UI; that caused it to fully reset the link and get a new working address via DHCP. And all is well.

Bottom line: something needs to convince OpenWRT to get a new IP address after Dishy is fully configured. That should be automatic but it’s not working. Manually forcing a new IP address fixes it.

Updates

Currently running busybox 1.30.1-6 (for udhcpc) and netifd 2021-01-09-753c351b-1.

Someone on Reddit with the same problem.

I posted to OpenWRT forums about the problem.

Starlink firmware revisions

Starlink doesn’t publish any sort of patch notes or update log. It’d be nice to have a community maintained list of firmware releases with whatever notes we can figure out.

Update: there’s now an editable spreadsheet of firmware revisions that should be updated in the future. The list below will not be updated.

See above; this data will go out of date.
4/1/2021   3912b4a3-9eaf-4f9e-81a3-18d8c837a26e.release
3/26/2021  b44f4294-6a78-4a57-b41c-5b613617086a.release
3/24/2021  bbd50ae9-da59-4f1d-b0e4-57c776b31ad1.release
3/22/2021  5f1ea9d9-7896-44da-821a-7a1ab07e78b9.release
3/21/2021  39d476b5-2102-44ec-bb7e-e526cc8f94f8.release
3/18/2021  d61f015c-556a-42b4-ac91-d8e41d157871.release
3/17/2021  19f05dfc-9d07-4989-b47f-87c8f87b0a25.release
3/09/2021  a8a9195a-8258-4dfc-8b5e-15f272cc2436.release
3/3/2021   848e54d2-015a-49cb-a814-34d7c5fc7e1a.release
2/19/2021  a95d0312-a6de-412e-9379-c6bee964f9e0.release Added mastNotNearVertical, slowEthernetSpeeds
2/15/2021  7db91a39-b61e-43fe-8bbe-ecb570197cae.release
2/9/2021   e68dfc80-fa1a-4fa4-9b21-d7ee2a918496.release
2/1/2021   3a1d5d0c-c93b-40b8-a884-021a9c1da1dc.release
1/24/2021  d9aff5fa-0334-49bc-b69d-b92a9c7871fa.release
1/9/2021   48b97eee-bda8-4593-b1d2-785ad4e493de.release (100 ms spikes gone)
12/19/2020 0a3e5881-1312-453f-9c97-8aa7fa2abb89.release
12/11/2020 e09928da-4e31-4040-a34e-61d38c10b37f.release
12/6/2020  5eb22757-5bc1-440f-ab64-9d5053986827.release
11/29/2020 37f8cd77-1e7c-47ea-b1a5-de99ebf16dee.release
11/23/2020 56d5e0aa-c1e8-4d25-aa65-dd8699aaaf62.release (SNR capped at 9)
11/20/2020 e2447448-74b0-42f7-b6c8-2bb5a608871a.release
11/10/2020 New version: ____758.release
11/?/2020  Old version: ____654.release
10/26/2020 ???

Sources:
https://www.reddit.com/r/Starlink/comments/lww8xx/starlink_firmware_update_on_332021/
https://www.reddit.com/r/Starlink/comments/m49cte/new_firmware_had_to_use_starlink_router_to/gqtbp7t/?utm_source=reddit&utm_medium=web2x&context=3
https://www.reddit.com/r/Starlink/comments/m8fpi3/starlink_version/grhaoa2/?utm_source=reddit&utm_medium=web2x&context=3

Starlink: router required?

Woke up this morning to my fancy new Starlink system not working. The culprit seems to have been the new firmware update. It applied but Dishy wasn’t working; lots of details in this Reddit post.

Annoyingly, the fix was to plug Dishy into Starlink’s router. It started working immediately. It’s still working, too, even though I plugged it back into my own router. (I haven’t tried rebooting Dishy yet.. I wonder if it will keep working?)

I sure hope Starlink doesn’t make their router mandatory. It’s really not suitable for anything other than the simplest home networks. It’s fixed at 192.168.1.*, has literally no configuration options other than the wifi password. I guess worst case I could put a second router in front of it and it’d be mostly harmless but it’ll add yet another layer of unnecessary NAT.

Update: a couple of Reddit commentors have said the real problem isn’t Dishy needing some magic config from the Starlink router, it’s that routers aren’t handling DHCP right. Read that linked post for a nice description of what Dishy is doing on startup. Before it’s got satellite lock it sends out the not-useful 192.168.100.100 IP address with a 5 second DHCP lease (very short!). Then it switches to a second IP useful 172.16.*.* IP address once it’s set up, with a 5 minute lease. The theory is some routers fail to update DHCP and switch to the new good address. I’m a little skeptical OpenWRT is doing something so dumb but since a couple of folks have offered it as an explanation I’d have to test it to be sure. Just have to wait for the next failure.

Ubuntu and Netplan: gotchas

I finally figured out a networking configuration problem on my Ubuntu 20.04 system.

In theory all Ubuntu systems since 2017 have been configured with Netplan. It’s some simplified high level configuration language that systemd applies. Like any Unix thing built after 1993 or so I reflexively hate it, I kinda miss the old days of /etc/interfaces and hacking stuff in /etc/rc.local. But I gotta admit Netplan is pretty good. When it works; the problem I’ve had is my config gets overridden.

The first problem is cloud-init, some thing that Ubuntu ships to configure “cloud servers” from yet other files. I believe default Ubuntu systems are configured via /etc/netplan/50-cloud-init but if you edit that file, joke’s on you; it gets rewritten by something else. The solution is to create a file /etc/cloud/cloud.cfg.d/99-custom-networking.cfg with the contents network: {config: disabled}. That will prevent cloud-init from rewriting your files.

Having done that you can either delete 50-cloud-init or replace it with your own stuff. Note that config files are additive; I ended up configuring my ethernet twice until removing the cloud-init file.

The bigger problem I ran into is that I had a dhcpcd installed, the package dhcpcd5. I don’t quite know why, it’s probably something I did manually. But if that’s installed it will override the netplan files. You can have dhcp4: no right there in your netplan file and dhcpcd will still override your static configuration. I fixed this by uninstalling dhcpcd. I think the modern systemd world uses dh-client anyway.

Once that’s done netplan seems to operate as it’s supposed to, without mysterious other things overriding my configuration.

Speedify and multipath

Trying to make my Starlink setup reliable enough to use regularly, I think I hit on a good consumer solution: Speedify. It’s a VPN service whose client on your desktop / laptop computer is smart enough to bond two Internet links. It can use extra links to boost speed or reliabilty or both. It seems to work. I’m using this to paper over Starlink’s unreliability. I imagine it’s particularly useful to bond crappy hotel wifi with a cellular hotspot (assuming you have two wifi adapters.)

Before I go on about Speedify I want to mention Multipath TCP. That’s a general technology for doing something similar. The Linux kernel has support and there’s various implementations but I can’t tell if any of them are really usable; a lot look like research projects. The emphasis on TCP is also a limitation, I’d like a redundancy solution for all IP not just TCP. Kind of a different problem though.

The main thing I know about Speedify is I was watching a Youtube video and had an open ssh session and unplugged my ethernet cable that connects me to Starlink. But the video never stopped and the ssh session stayed alive, presumably using the Wifi backup to my other ISP. That’s neat! Also speed tests show I’m getting the full speed of my Starlink, at least sometimes, so it’s not constrained to the lowest common denominator. So far I’ve lost 0.4% of pings to 8.8.8.8 over most of an hour; that’s better than I see using either ISP alone.

The Windows install experience is a dream. Installs smoothly, autodetects your links, sets it all up and you’re running on Speedify in seconds. There’s a free no-account-required option for initial testing, limited to 2GB. The UI is pretty slick too, with decent monitoring and configurability.

One drawback is that Speedify seems to require different actual network devices to bond. What I’d like to do is use a single ethernet adapter for both my ISPs and have Speedify bond two separate gateways. It doesn’t have the UI to do this. (Maybe there’s a way to set up a virtual ethernet device in Windows? Dunno.) I’m working around this by having plugged in a separate WiFi adapter that’s connected to one ISP, with the ethernet to the other. That works fine actually.

Another drawback is that Speedify is a VPN service terminated in a data center. In my case, Fremont CA. That adds latency. Also a bunch of video services like Netflix and Amazon now refuse to serve video to VPN datacenters because they’re so often used to work around country restrictions, etc. Speedify has a special “turn this off for video” feature, but of course video is exactly when you might most want to have Speedify. Finally some folks complain that Speedify makes their links slower than necessary. Speedify, for their part, says you should expect 200-300Mbps.

A final limitation is that Speedify doesn’t give a lot of control over what it’s doing. The user can choose the bonding mode: speed, streaming, or redundant mode. Speed and redundant seem to be two extremes: either maximize performance (but no redundancy) or maximize reliability. Streaming mode is a “smart” middle ground; it monitors each stream and decides when you need more redundancy. Mostly they’re talking about audio and video streams but the marketing copy mentions gaming, too, so presumably that’s also covered. There’s some more technical details here.

Here’s a couple of DSL reports speed tests. These aren’t the best I’ve seen; I’ve gotten 150/20 through Speedify, which is about the limit of my Starlink throughput. (Although I’d expected 50Mbps on the uplink, needs further testing.) I noticed on the download speed test it was only using the Starlink whereas on upload it saturated both my Starlink and my WISP. I think that makes sense. First, redundancy seems more important on the uplink than the downlink. Second, my upload was really limited during these tests and so the WiFi meaningfully could supplement it.

I wish they had a whole-network product! You can probably hack something up using their Linux support and a clever router, their product page indicates they indicate they’re sort of OK with you doing that but might charge you accordingly. That’s what got me interested more generally in multipath technologies for Linux; it’d be nice to have a router designed to do this. I think the easiest way forward with what Speedify has right now is to set up a Raspberry Pi with three ethernet ports; two for inputs from ISPs, one for output to a regular router. You might be throughput limited by USB speeds (for the extra ethernet ports) or encryption speed, but I’m not sure what the limit would be.

I’m really impressed with Speedify so far. I’ll probably sign up for a plan ($3 to $6 a month) for at least a year, to tide me over with Starlink. Gonna run out my free trial here first though.

Update: after most of a day of using it I bought a year of Speedify. $65 with the coupon DEAL10. It really does work as advertised. None of my sessions dropped; World of Warcraft, persistent TCP sockets, two hour idle ssh sessions all stayed open and working. Really solid.

I’m not positive the performance is great but I may be overanalyzing. I’m in Streaming mode and I should be getting at least my Starlink speed, if not better. In practice the speed tests tell me I get about 100/15. Peak is 190/22. Then again that’s just about the average Starlink performance now, so maybe it’s right. It seems pretty smart about using my slower WISP link a lot less but the backup has been there for me every time I needed it. Latency seems fairly variable too, seeing 20-80ms where I’d expect 20-50ms from Starlink. None of this is bad and compared to an unreliable link, it’s terrific. But it does make me think if Starlink gets to 100% reliability I may stop using Speedify.

Now I want a little 4 ethernet port Linux box to run as a Speedify bonding appliance in front of my router! That, or Speedify built right into a router. That should be doable in theory. For some reason Speedify has positioned itself as not a router; they’re real clear it’s a client product.

Update 2: OpenMPTCrouter looks like a plausible base for a roll-your-own alternative to Speedify.

Starlink monitoring and hacking notes

Some collected information and what I’m doing about monitoring Starlink / Dishy’s performance. Note most of this stuff works with just Dishy, not the Starlink-supplied router.

Some facts

  • Dishy listens at 192.168.100.1 on ports 22, 80, and 9200. ssh, http, and gRPC. It also uses port 9201 for a different flavor of gPRC HTTP (for Android?)
  • The mobile app works by fetching web pages and/or gRPC data from Dishy.
  • Starlink’s router does gRPC on port 9000 and is the preferred source for the mobile app. It implements the ping interface, the thing that tells you your Fortnite lag.
  • You can view the stats direct from Dishy in any browser at http://192.168.100.1/support/statistics
    Note you have to open the browser window to max width; it’s formatting for the screen size, not window size.
  • Another Dishy URL: http://192.168.100.1/support/debug

Docs

Software

  • pinginfoview: nice lightweight Windows tool for testing if the connection is down
  • Starlink gRPC tools: Python code for reading gRPC stats off Dishy
    This seems to give very complete data from Dishy, including the history of dropped packets
  • dishyworld: a working dashboard based on Prometheus and Grafana.
    Has ambitious goals of collecting data from many users.
  • starlink-cli: Go code for getting Starlink data. I think it’s the base for dishyworld?
    This seems to give less data than the Python library above, at least by default
  • Better than Nothing Web Interface: a PHP dashboard
  • Better than Nothing stats: a mockup of a planned Javascript dashboard, successor to above
  • Obstruction view. Takes the debug info from Dishy about obstructions and draws it. I know the mobile app can do this but I can’t figure out how to do it again!
My obstructions

Starlink gRPC tools

This Python library seems to give more useful output than the other command line tool I could find so I’m pursuing it.
The full list of commands:
status, obstruction_detail, alert_detail, usage, bulk_history
ping_drop, ping_run_length, ping_latency, ping_loaded_latency

Be sure to read the code / docs for detailed notes on what all the fields mean. There’s some surprisingly sophisticated analysis going on when it’s looking at data samples to, say, characterize the latency of the last 5 minutes.

Some useful examples:

$ python dish_grpc_text.py -v status
id:                    ut01000000-00000000-000353f7
hardware_version:      rev1_pre_production
software_version:      848e54d2-015a-49cb-a814-34d7c5fc7e1a.release
state:                 CONNECTED
uptime:                130100
snr:                   9.0
seconds_to_first_nonempty_slot: 0.0
pop_ping_drop_rate:    0.0625
downlink_throughput_bps: 9143.5830078125
uplink_throughput_bps: 4387.2421875
pop_ping_latency_ms:   29.5
Alerts bit field:      0
fraction_obstructed:   0.006759106181561947
currently_obstructed:  False
seconds_obstructed:    266.0

# Dropped pings over the last hour
$ python dish_grpc_text.py -v ping_drop
current counter:       130202
All samples:           43200
Valid samples:         43200
Parsed samples:        3600
Sample counter:        130202
Total ping drop:       48.06441651657224
Count of drop == 1:    26
Obstructed:            23
Obstructed ping drop:  19.7899159938097
Obstructed drop == 1:  19
Unscheduled:           0
Unscheduled ping drop: 0.0
Unscheduled drop == 1: 0

# Bandwidth used for last 5 minutes
$ python dish_grpc_text.py -v usage -s 300
current counter:       131151
All samples:           43200
Valid samples:         43200
Parsed samples:        300
Sample counter:        131151
Bytes downloaded:      1327843
Bytes uploaded:        813427

Some of the ping_drop statistics are confusing; this github issue has notes on what they mean. “Unscheduled drop == 1” seems to exactly correlate to the stats UI’s “No Satellites” display, and “Obstructed drop == 1” is the Obstructed count. It’s less clear to me how to reconstruct the beta downtime statistics.

Starlink for real, LAN notes

March 9 is the first day I use Starlink for real for a whole day from my desktop computer. I’m writing this blog post VIA SPACE.

I mounted Dishy on a J-mount that was already installed at my house. (An adventure in itself. Had to drill some holes in the mount’s pipe, then figure out how to lift Dishy up 15 feet on a ladder and place it in the mount. Then hold it in place, some 20 pounds, with one hand while trying to thread through the bolt with the other. I am not good at this kind of thing.)

After my ground experiments I was worried there’d be too many obstructions. Glad I tried it anyway; turns out to be fine. On the ground I think at worst it reported 1 hour of obstructions in 12 hours of operation and in general it was complaining things weren’t right. Up on the mount it’s reported 2-4 minutes of obstructions in 12 hours. That may still be unacceptable; if those 2-4 minutes are actual outages it will be quite disruptive. But it seems to be working well right now.

Optional Gateway setup

The network setup has been tricky. I got some good advice on Reddit about how to set up the Starlink as a secondary Internet gateway. I want most of my house to keep using my old ISP but have Starlink as an option on the LAN while I test it. Turns out to be relatively simple to set that up, the basic idea is to set up a router for the Starlink without DHCP and then manually choose to use that as your Internet gateway. But it does require a second router and some manual fiddling on the clients you want to use Starlink. Note the router Starlink sends you is not flexible enough to do this; you need something more hacker friendly. I’m using an old TP-Link Archer C7 running OpenWRT.

(Fun side fact; this old OpenWRT I have has a funky configuration on sshd. To talk to it I have to do this
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@192.168.3.233)

My regular LAN is 192.168.3.* with a router running on 3.1 serving DHCP in the range of 3.6-3.223. Dishy is plugged into the WAN port on a second router with DHCP and WiFi turned off. The router is configured with a static IP address of 192.168.3.233 and the LAN side of the router is plugged into the LAN ethernet switch with everything else. So other computers on my LAN work just like normal and are mostly unaware of the Starlink and its router. However if I want I can statically configure a machine to use 192.168.3.233 as its Internet gateway instead of the DHCP default of 192.168.3.1 and now it’ll be using Starlink. It’s a bit of a PITA; in most operating systems if you want to change any network parameters you have to go full static config. But that’s not too hard.

My current static config:
192.168.3.233: the Starlink router
192.168.3.230: my desktop PC
192.168.3.213: my phone

The first setup I had for Starlink was even simpler; I just used their router and gave it a different WiFi SSID. Didn’t plug it into the LAN at all. That meant any wireless device could choose to use Starlink in my house just by choosing the other SSID. But that doesn’t give my full LAN access. Handy hack, not a great long term solution. (I sure wish I could tell OpenWRT to run DHCP on the wireless network only, though.

A hilarious mistake the first time I set up the second router; the Starlink router had DHCPv6 turned on in a hidden setting I didn’t notice. All the Windows machines in the house noticed the new option and switched to IPv6 preferentially. Amazingly that all worked and all my PCs were suddenly about to talk to the IPv6 net via Starlink! Google worked great, but I think sites that were IPv4 only weren’t working in this Frankenstein configuration. I don’t normally use IPv6 ever.

The public address the rest of the Internet sees when I’m on Starlink is 206.214.236.64 at the moment. That’s a tiny little block that belongs to SpaceX: 206.214.236.64/27, or 32 addresses. Presumably they have more blocks?

I think I’m going to be living with this opt-in configuration for awhile. Right now I have to go statically configure every device I want to swap over; my desktop, my game console, my Roku... It’d be better if I had a smarter DHCP server that I could direct to give out a different gateway depending on who is asking. Pretty sure Ubiquiti’s DHCP server can’t do that, but I bet some Linux option is flexible enough.

Alternately I wonder if there’s a way to leverage VLANs to do this. Have one VLAN use one gateway, the other use the other. But I want my devices to all mostly be on the same LAN regardless, so that doesn’t make a lot of sense.

Static route for Dishy at 192.168.100.1

Dishy itself is set up kind of like a cable modem. It runs DHCP on its output port (the one plugged into the WAN) and is handing out an address like 100.65.6.117 with a big fat netmask of 255.192.0.0. Gateway is 100.127.255.0. Turns out that’s a reserved shared address space, a special IP block kind of like 10.* or 192.168.* but reserved specifically for the needs of carrier grade NAT. Yup, Starlink is CGNAT, in addition to your home NAT. (But see also IPv6).

Dishy also is listening on 192.168.100.1; that’s where all the diagnostic services live. (More on that later). That means it’s handy to set up a static route for that. Here’s how I set it up in OpenWRT on the Starlink router at 192.168.3.233 so that any device using that as its gateway could talk to Dishy.

Static route on OpenWRT

I tried adding a similar static route for 192.168.100.1 on my Ubiquiti main house router (with a gateway of 192.168.3.233). But while that route works locally on the Ubiquiti machine itself, nothing else in the house seemed to work right with it. Not sure what’s going on; packets for 192.168.*.* seem to be routed out my WAN interface and into my ISP! That’s not right and I have no idea why it’s happening.

On my Linux server I managed to connect directly to the Dishy diagnostics by doing this:

ip route add 192.168.3.0/24 dev eno1
ip route add 192.168.100.1/32 via 192.168.3.233

Weird I had to add the ethernet route for my subnet first! If I didn’t do that I got “Error: Nexthop has invalid gateway” because the routing table had no idea how to get to 192.168.3.233. This was the routing table my Linux box had before I touched it:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.3.1     0.0.0.0         UG    0      0        0 eno1
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0

If I read that right all packets out of the Linux box were sent to the router, even for other hosts on the same LAN. Ping timings confirm that. That’s unnecessary, right? Adding an interface route for the LAN seems the right thing. I didn’t make any of this permanent; doing so is going to require messing with Ubuntu’s hideous network config mess.

Performance

Overall speed is highly variable; sometimes I see 20 Mbps, sometimes I see 150 Mbps. I don’t have a good feel for what’s causing that yet, need to collect more data. Here’s a DSL reports speed test I ran just now. (Hilariously you have to lie and say you’re on a WISP; it refuses to believe something this low latency is satellite). Note the upload speed was 40Mbps for the first half of the test.

153 Mbps down, 15Mbps up

Latency is also very good, better than my ISP. I left a ping to 8.8.8.8 running for about 3 hours last evening and got these results”

N: 11482
Total: 406168.800000
Average: 35.374395
StdDev: 35.046247
Median: 30.800000
Min: 19.800000
Max: 2088.000000

However.. I sent 11758 ping packets and only got back 11482 responses. That’s 276 lost packets, or 2.3%, or about one a minute. That’s not great. Using my desktop interactively I’ve noticed a few small periods of the network not working, web page loads failing. The Starlink mobile app shows little outages in that period too. So that’s no good. I have yet to determine if TCP connections break in these outages or if they just get paused for a few seconds.

Update: see below about TCP connections. More testing reveals a packet loss of about 1-2% over long period of time. Compare 1.2% for my WISP during the busy evening when it’s congested. The difference with Starlink is when there’s an outage it’s typically like 5 seconds, not just a single packet.

There were 21 pings that took longer than 100ms, and 5 that took longer than 1 second. Worst was 2088ms.

Histogram of ping times

So that’s some preliminary stats; I’m very impressed. We’ll see how it feels after a few days of regular use. I also have a whole ‘nother blog post coming with more detailed information gathered from Dishy’s own diagnostics. Apparently there’s a whole gRPC server there folks have reverse engineered, so you can get the same data the mobile app shows.

Speaking of which, here are some screenshots from the mobile app:

Bottom Line

(Update after most of a day of using Starlink as my ISP)

It’s impressive. It works well. It definitely has some outages right now that make it not suitable today for a 100% reliable Internet connection. I trust these will be fixed in the next few months as they launch more satellites. Web surfing, etc mostly worked fine; occasionally I’d get an error that a page couldn’t be loaded and then when I reloaded a few seconds later it worked fine. Continuous sessions did not work well; I got booted out of World of Warcraft like 4 times in an hour. Unacceptable. I also couldn’t keep an idle ssh session open, probably because of aggressive NAT connection expiration but maybe for other reasons. I haven’t tried Zoom yet but I’m guessing it’ll will have to reconnect.

Update 2: continuous sessions work better than I thought. Idle ssh connections drop after 10 minutes, but put even modest trafficon them and they last hours. So do unadorned netcat client/server connections with traffic. WoW does disconnect when there’s momentary Starlink outages but that may well be WoW’s doing, deciding if it hears nothing after a few seconds the game is down. Zoom worked fine through the outages; I’d get a few second hang but the call would resume immediately with no trouble.

I ran a naive ping monitor to 8.8.8.8, 1 ping a second. Over 5 hours I sent about 18,000 pings and 126 failed; 0.7% rate. That doesn’t sound bad except the failures correspond to outages where the whole network seemed down, it wasn’t just a hiccup.

Bottom line; it works great for streaming media and loading web pages. Real time interactive stuff suffers a bit. Latency is excellent, it really is the 20-50ms advertised. But occasionally the link goes down for 4 seconds and sessions fail.

Why does the link go down? It’s the beta period; Starlink says this is expected behavior. Dishy’s stats says I’ve had 3 minutes downtime from obstructions, 45 seconds because of lack of satellites, and 3 minutes “beta downtime”. Looking closer I think all of that downtime will stop happening once there’s more satellite coverage. At least, I hope so. I’ve been following along on https://satellitemap.space/ and every outage I’ve experienced is correlated with a gap overhead.

I’m a little less clear why sessions go down. TCP is designed to handle packet loss, but his is acting like the TCP sockets are actively terminated when the link is down for just a few seconds. That seems completely unnecessary! I’d love to talk to a Starlink engineer to understand why. Update: after some more experimenting, basic TCP sessions don’t go down. Idle TCP sessions get cancelled after 10 minutes, a common NAT problem. And some applications like World of Warcraft seem to decide the link is dead when Starlink has a 5 second outage. But active ssh sessions and simple netcat servers persist through the short Starlink outages.

I’m super excited about this new service. I’ll keep using it daily for awhile and see how it feels. Also curious now about bonding with another ISP link for more reliability. Speedify looks promising.

My house is just east of the Arbuckle ground station

Updates (March 18)

Since writing this post I’ve been using Starlink more and more and made some changes to make it easier.

My Linux server and my Windows desktop now route through the Speedify VPN. This bonds Starlink with my second ISP link to make a more reliable Internet connection.

I’ve set up isc-dhcp-server on my Ubuntu box to serve DHCP and have it handing out special Starlink gateways to hosts based on MAC address. No more manual configuration of each machine! (Fun fact: Roku devices are incapable of having their network adapters configured without DHCP.) There are more sophisticated ways to do this using the “class” configs, but this works for something simple.

group {
option routers 192.168.3.233;
host ps5 { hardware ethernet 78:c8:81:bb:65:15; }
host roku-office { hardware ethernet cc:a1:2b:93:b6:1f; }
}

Starlink install notes

Thinking seriously where I will install my Starlink. I have an existing antenna mount that was for an old fixed wireless system that’d’ be perfect. But it has some obstructions to the north. From what I’ve read on /r/starlink obstructions are definitely a problem. They translate into short outages where you have no Internet. It’s still OK for bulk downloads, they just resume after the 15s outage. But I’d find that absolutely intolerable myself, particularly for anything interactive. That’s been my experience so far with a temporary ground installation. The roof mount will be better but not a lot; the ground install is experiencing 2 minutes of obstruction outages frequently.

The obstruction cone is going to get smaller over time as they add more satellites. I expect it’s worse down where I am at 39N, which is about as far south as they advertise service right now.

Here’s the worst of the obstructions. These trees will be good and leafy in a few months. And they’re right to the north, the worst place to be. Note the stuff in the dark grey area isn’t a problem, that’s below Dishy’s field of view. But everything above is.

The existing antenna mount. The pipe facing up is between 1 1/2″ and 2″ in diameter (it’s no longer round).

And a fun photo of my old 1 Mbps fixed wireless link (that was on that mount) with Dishy.

The flat platform that the bottom half of that mount is welded to is 5″ x 7″. The bolt holes are inset a small amount, roughly half an inch? I was wondering if I could use Starlink’s Volcano mount to mount to it. Their plate is bigger, 6″ x 9″. But I think I can drill holes to match my 5x7 mount; the plate bulges out to meet the pipe but it looks like there’s enough room. Willing to take the $24 risk at least.

BTW SpaceX is not providing detailed engineering drawings of all this mounting stuff. Dumb! There’s some fairly precise measurements of the pole in this reddit post. Here’s some dimensions on the Volcano mount. Also a popular photo set, someone measuring the stuff with calipers and displaying all the measurements upside down.

Starlink first impressions

I got into the Starlink beta!

First impression on setup is mixed. The unboxing experience is fantastic. Setup is super easy; it’s all pre-plugged in, you just power it all up, wait for Dishy to acquire a connection in a few minutes, and connect to Starlink’s router. That all kinda worked for me. In reality though I had trouble finding satellites the first time, so after 10 minutes I moved it. While I moved it Dishy got unhappy and rehomed the dish. Fair enough, but then it stopped responding entirely. So I power cycled it and let it do its thing and ignored it for awhile. It told me it had an hour of uninterrupted decent connection. Great! First speed test on their suggestion of fast.com was 150/? Mbps, but second speed test on DSL Reports was more like 60/30. Fast again was 75. I looked and now Dishy was telling me there were obstructions. Given the obstruction is a tree with no leaves, I can imagine why it’d be inconsistent. Anyway, it all left me feeling like I can’t quite trust it. Then again I don’t trust anything wireless.

Speaking of wireless, Dishy has one big wire. A heavy shielded ethernet cable coming out of it, 100 feet. And it is hardwired, you cannot remove it. That needs to be plugged into a special PoE injector that has AC power. That injector has an ordinary jack for the second cable, the one that goes to the router. (Although apparently it is also PoE). The crazy thing is Dishy is drawing 100 watts; it’s a heavy thing and it has a motor to tilt. 100 watts is an awful lot for Power-over-Ethernet! The subreddit discussion says it’s a proprietary thing too, not like any other PoE.

Starlink ships a router device which by all accounts is not very good. It’s only minimally configurable. Apparently it also isn’t up to routing traffic as fast as you’d like; folks report their networks are faster without it. The good news is there’s no need to use their router. Dishy works more or less like a cable modem; it has a little DHCP server handing out a 100.78.*.* address (subnet mask 255.192.0.0). Most any router can use this if you plug Dishy into your WAN port on a regular router. Note that Starlink is using carrier grade NAT inside their own network, so most situations are double NAT.

The beta reality today is not great. They just opened up to Northern California (I’m at 39N) and coverage is not perfect, so you have a few minutes downtime a day. Maybe more because of system maintenance. So you can’t really use it as your primary ISP 24/7. I’m currently planning on hacking up some networking config so I can use it as an opt-in basis when I’m willing to put up with the unreliability. All this is promised to improve in just a few months as they launch more satellites.

Obstructions are a real problem for a proper installation. You have to put the dish somewhere with an unobstructed view of the north sky. That’s a 100 degree cone, so even though the tall trees are 20+ feet north of me they’re somewhat in the way. I imagine most rooftops in suburban areas will be OK, but now you’re mounting a dish on the roof. And Starlink has no installation support; you’re on your own. They do have a mobile app with an augmented reality camera display telling you whether your chosen spot is OK. (It’s confusing; wave it around to where it shows you errors like “turn left”, then start looking for the dark grey areas in the AR view. It doesn’t care about those. You want all the non-greyed-out areas in the AR display to be clear of obstructions. You need to move a lot to test everything.) The good news is the device will still work with some obstructions and the obstruction story is getting better as they add more satellites. The bad news is obstructions near the horizon are the worst, which is of course exactly where they are most likely to be.

I think it’s real strange they’re selling this service without any sort of support. They just ship you the dish in the box and say “good luck”. It’s mostly easy enough but mounting that dish with a good clear view is not something most homeowners are going to know how to do. I hope they have some sort of service or reseller program for ordinary folks who don’t know about dish mounts and running cable through their walls. I’m going to hire someone local who has experience installing WISP antennas and/or satellite dishes.

Overall despite a little rockiness at first I’m pretty excited about Starlink. I’m thrilled to finally have an alternative to fixed wireless in Grass Valley. The service plan on paper is good: 100 Mbps or more down, 50 Mbpsish up, 20ms latency, no data cap. $100/mo with a $500 initial cost. Compare to my WISP which is 12/2, 50ms latency, and also $100/mo. Looking forward to the competition!

Ubiquiti failover problems

On the back of my problems with a flaky WAN link I’ve had a different problem with my Ubiquiti router: it would fail over from the WAN link (when it was down) to my LTE backup, but then not return once the WAN link came back up. Not every time, only three or four times in several months. But that’s obviously no good.

More details are documented in this public post and this private support ticket.

Long stort sort, I got escalated to tier 3 support. I’ve made two changes at their suggestion. One was to switch the watchdog ping address from ping.ubnt.com to 1.1.1.1, mostly to skip DNS resolution in the “is the network up?” test. The other was to turn on smart queuing, which apparently might magically fix the routing problems I was seeing.

I changed the ping address Nov 21, and the smart queueing was enabled Dec 9. Meanwhile I haven’t seen my WAN link flake out once since Dec 1. No explanation for that new stability, the router was last rebooted Nov 29 or so and there was flakiness after that. But with the WAN link behaving solidly there’s no chance of the routing failover messing up.

So.. still confused as to what caused the problems I saw. I suspect they’ll come back.

Update: the came back. WAN started flaking out today, Dec 20, at 11:59am local. No hint the failover isn’t working though.

One weird trick to improve network latency

A smokeping from my house to 8.8.8.8

Can you spot the moment PG&E cut the power to our area? The network (and my house) are on backup power, so I’m still online. Looks like a whole lot of other customers aren’t though. Pings dropped roughly from 52ms to 42ms. It’s the fastest I’ve ever seen, even faster than at 3am.

It’s possible that what’s really going on is a different route is being used now that power is down. Here’s the route I have right now:

                                       Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. setup.ubnt.com                    0.0%    21    0.7   0.7   0.4   1.1   0.2
 2. 10.33.1.1                         0.0%    20    0.9   1.0   0.7   1.4   0.2
 3. BR-Switch_tik-a.ppk.sbbnet.net    0.0%    20   25.5  32.3  19.4 105.4  17.6
 4. 172.16.1.149                      0.0%    20   23.8  31.2  21.3  81.4  13.0
 5. 172.16.1.138                      0.0%    20   32.0  35.6  17.5  80.4  12.1
 6. ether4_tik-c1.crx.sbbnet.net      0.0%    20   30.9  29.4  18.4  41.2   6.2
 7. Gi022_rtr-e.crx.sbbnet.net        0.0%    20   24.1  28.5  17.6  36.1   5.4
 8. pr02-ae12.sea09.net.google.com    0.0%    20   37.4  45.2  32.6  51.7   5.2
 9. 74.125.243.193                    0.0%    20   51.5  45.5  34.8  58.1   6.4
10. 209.85.254.237                    0.0%    20   48.7  45.9  33.4  56.0   6.1
11. dns.google                        0.0%    20   69.1  50.3  39.0  75.4  10.4

Edit: one weird trick to increase latency! Note graph is 30 hour time scale.

The long steady part at left is Smarter Broadband, you can barely see the little dip in latency from 50ms to 40ms I reported above. The outage is when both they and AT&T cellular were down. Then I switched to AT&T cellular with 150-400ms ping times to Google DNS overnight. Just about 7am that let up to 500ms ping times. It’s still working, but they must be severely congested or something.

Here’s an mtr:

                                       Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. 192.168.3.1                       0.0%   134    0.7   0.7   0.3   1.1   0.2
 2. 100.127.125.128                   0.0%   134    1.6   1.3   0.8   1.7   0.2
 3. 100.127.173.124                   0.0%   134    2.1   1.8   1.2   5.0   0.4
 4. 107.94.133.11                     1.5%   134  551.2 397.4  89.4 955.8 125.3
 5. 166.185.45.162                    4.5%   134  535.3 393.0  80.5 643.1 112.0
 6. 192.168.192.74                    2.2%   134  517.8 430.0 108.2 1094. 124.8
 7. 192.168.196.8                     3.0%   134  538.8 430.3 108.9 1058. 125.7
 8. 162.244.250.1                     5.2%   134  557.3 432.1 106.9 1017. 120.6
 9. 162.244.250.54                    3.7%   134  506.6 434.2 117.5 966.9 120.9
10. (waiting for reply)
11. 148.66.238.120                    1.5%   134  488.9 450.1 123.0 934.0 130.0
12. 148.66.238.125                    6.0%   134  534.0 448.3 128.7 932.0 126.8
13. 148.66.238.99                     3.8%   134  539.3 456.0 121.8 881.6 130.0
14. 148.66.237.195                    3.0%   134  592.4 452.5 121.6 845.8 129.0
15. 4.59.30.121                      92.5%   134  580.4 511.9 313.3 759.1 122.6
16. 4.69.141.154                     89.5%   134  550.0 451.5 329.1 569.9  85.7
17. 72.14.203.208                     3.8%   134  624.7 468.0 164.4 850.5 117.8
18. 216.239.56.153                    5.3%   134  577.3 493.0 204.1 3320. 287.9
19. 216.239.42.153                    3.0%   134  578.2 459.6 137.2 831.6 118.2
20. 8.8.8.8                           1.5%   133  594.3 458.0 155.7 781.3 118.8

One more latency graph, shorter timescale. Most of this time is on AT&T’s cellular network until the very end (one short period, then the end). There’s jitter and then there’s jitter, you know?

Smokeping notes

I’m trying to improve my Internet uptime monitoring. Right now I have a junky script that sends an ICMP ping every 1 or 5 seconds to a few carefully chosen IP addresses; my router, my upstream link, Google DNS, etc. It logs a text summary when a string of pings fail in a row. It works OK but is janky.

So I asked on the Internet for a better ping monitoring system and was reminded about smokeping. I have it sorta set up on my Ubuntu box now and it’s OK. Before I deep dive on that I also want to give a shout out to vaping, a rewrite of smokeping in Python. It’s not as featureful but then it’s not as old and idiosyncratic, either.

So the setup. I have smokeping sending 3 pings every 5 seconds to a total of 8 hosts. It makes graphs of latency for the ping replies along with highlighting packet loss. Eazy peazy.

Why 3 pings every 5 seconds? Well smokeping is really designed to send a whole lot of pings at once and show the distribution of latencies. The default is 20 pings! Also the default is only to measure every 5 minutes, which is fine for long term monitoring but I’m trying to catch short failures. It turns out 3 pings is the minimum smokeping is willing to send. 5 seconds was a compromise for me not wanting to spam too much. Works out to 3 * 8 / 5 = ~ 5 ping packets a second.

I’m using the default FPing probe. It’s fairly smart about handling timeouts, spacing an interval between pings, rotating through different hosts, etc. There’s also an FPing_Continuous probe option in smokeping whose main difference is it uses the “--loop” option in FPing. Near as I can tell that just moves the control loop from smokeping to fping, not sure that really buys you anything. Maybe it spreads the pings out more evenly?

As near as I can tell there’s no way to get smokeping to ping once a second. I found some years-old discussion about architectural assumptions in smokeping about the minimum interval between pings, and how much time the pings should take, etc that make it sound like that “20 pings every 5 minutes” really is the intended use case. Also I now have a giant RRD file I’m sure, and the code seems to be regenerating all the graphs every 5 seconds whether I need them or not. It’s all a bit silly and overkill but I think harmless for now.

I might also yet replace smokeping with vaping. It’s not nearly as fancy, but then it seems designed precisely for my 1 ping-per-second desired scenario.

Sample to ping.ubnt.com

Ubiquiti Security Gateway failures

Trying to diagnose a problem with my Grass Valley network where the Internet goes down 20-120 seconds every few hours. I think this is an old problem that dates back to my old router (Ubiquiti EdgeMAX) but it may be related to the new USG or the LTE failover device I recently installed, even though it’s now disabled.

The symptom is the whole Internet goes down. My router logs this message:

WAN iface [eth0] transition to state [active] 11:33 am 2020-10-05
WAN iface [eth0] transition to state [inactive] 11:32 am 2020-10-0

I’m able to reproduce that the Internet is really down with a simple looping ping script. But that just tells me the Internet is down, not why. My question is why is the router logging that message?

Related: this webpage has excellent docs on how Ubiquiti’s failure detection and failover works.

Theories

My first theory was that my WISP is just flaky and that’s to be expected. I swear I’ve had problems like this for years. But I had a long chat with them yesterday and they assured me that’s not expected behavior. Also that my device had a clear strong signal for at least a week. But their monitoring is only good to 5 minutes, so wouldn’t catch a 30 second outage.

My second theory is that my WAN device, a Cambium ePMP 1000, is genuinely just failing. That the device loses power or for some other reason reboots. Unfortunately it’s up in a tree and I don’t have the access to read any stats or SNMP data from it, so I don’t know. But that’d surely explain why the router decided eth0 was inactive, if it lost ethernet link.

The third theory is that it’s Ubiquiti’s watchdog itself that’s failing. If you configure a WAN2 failover (say, my LTE device) they run a watchdog process that tries to ping ping.ubnt.com every 10 seconds. If that fails 3 times in a row it decides the WAN1 interface is down, sets it inactive, and fails over to WAN2.

Evidence

But would they still be running this failover algorithm even if WAN2 is disabled and not running? I fear maybe so. Logging in as root on the USG and running show load-balance watchdog I see some evidence that the failover stuff is still happening.

Group wan_failover
eth0
status: Running
pings: 2457
fails: 0
run fails: 0/3
route drops: 7
ping gateway: ping.ubnt.com - REACHABLE
last route drop : Tue Oct 6 02:53:08 2020
last route recover: Tue Oct 6 02:53:59 2020

That timestamp corresponds to my latest failure and suggests the watchdog apparatus is still running. show load-balance status also has some interesting info in it.

There’s more information in /var/log/messages on the router:

Oct 6 02:52:38 ubnt zebra[753]: interface eth0 index 2 changed .
Oct 6 02:52:38 ubnt kernel: eth0: Link down
Oct 6 02:52:39 ubnt zebra[753]: interface eth0 index 2 changed .
Oct 6 02:52:39 ubnt kernel: eth0: 100 Mbps Full duplex, port 0
Oct 6 02:53:08 ubnt wlb: wlb-wan_failover-eth0 wlb-wan_failover-eth0 reachability failed, failover
Oct 6 02:53:08 ubnt wlb: group wan_failover, interface eth0 going Inactive
Oct 6 02:53:08 ubnt wan-event: [WAN Transition] eth0 to state inactive
Oct 6 02:53:59 ubnt wlb: group wan_failover, interface eth0 going Active
Oct 6 02:53:59 ubnt wan-event: [WAN Transition] eth0 to state active

In this log, the ethernet interface goes down first, before the watchdog is involved. That’s consistent with theory #2: the connection to the WISP antenna is flaking out. Looking back in the logs that’s the same pattern for many failures. The ethernet link goes down for about 2 seconds, then comes back. Then about 30 seconds later the failover system kicks in and marks the WAN inactive. Then some period of time later (51 seconds in this instance) the failover marks the link active again.

My local ping to the WISP antenna shows a shorter outage. Clocks are both NTP synchronized, but 7 hours off because of timezones.

Ping 35446 failed Tue Oct 6 09:52:42 2020.
Ping 35447 failed Tue Oct 6 09:52:47 2020
Ping 35448 failed Tue Oct 6 09:52:52 2020
Ping 35449 failed Tue Oct 6 09:52:57 2020
Outage for 21 seconds started Tue Oct 6 09:52:36 2020

I also have a different monitor pinging ping.ubnt.com from my own Linux box

Ping 197355 failed Tue Oct 6 09:52:42 2020
Ping 197356 failed Tue Oct 6 09:53:12 2020
Ping 197357 failed Tue Oct 6 09:53:22 2020
Ping 197358 failed Tue Oct 6 09:53:27 2020
Ping 197359 failed Tue Oct 6 09:53:32 2020
Ping 197360 failed Tue Oct 6 09:53:37 2020
Ping 197361 failed Tue Oct 6 09:53:42 2020
Ping 197362 failed Tue Oct 6 09:53:52 2020
Ping 197363 failed Tue Oct 6 09:53:57 2020
Ping 197364 failed Tue Oct 6 09:54:02 2020
Outage for 90 seconds started Tue Oct 6 09:52:32 2020

Putting that all together, the timeline:

  • 02:52:38 to 02:52:39 router notices WISP ethernet is down
  • 02:52:42 to 02:52:57 (approx) can’t ping the antenna IP address
  • 02:53:08 to 02:53:59 router marks WAN interface inactive
  • 02:52:42 to 02:54:02 (approx) can’t ping an Internet host

Note that even though the ethernet is down for 1 second, the whole Internet is down for 90 seconds. But the WISP antenna is only down for about 20 seconds.

My guess is the ethernet connection to the WISP antenna, including its power, failed. Or else the WISP antenna rebooted itself. The ethernet link comes back very fast on reboot on that device, like 1 second. But it takes 20 seconds to get up and running enough it’ll respond to pings. And in this case, 90 seconds to fully recover and be online again reliably. Not all the outages are this long; most are more like 60 seconds.

Next steps

So that’s all consistent with theory #2: the connection to the WISP antenna is flaking out. I mean it’s right there in the “link down” message. I’m still confused as to how a momentary break in ethernet signal makes for a 60 second outage.

I’ve asked my ISP whether it can give me more information about what’s happening to WISP antenna device. At least, its uptime.

I’ve got a pretty marginal wiring solution for the antenna; the ethernet cable is 350+ feet long and the PoE injector is at far end from the antenna. I’ve also got a simple passive cable joiner about 50 feet from the antenna. I should split it there and put the PoE injector and maybe an ethernet switch nearer the antenna and see if that makes it more reliable.

Update

Well damn, a theory shut down. My ISP got back to me:

I logged into the antenna, and it is showing an up time of 6 days and 7 hours at the time of this email. I also looked at the signal history for the last 3 days and found no breaks or loss of the signal between the antenna and the radio tower. That antenna has a reboot time of about 1 to 2 minutes.

So much for my theory that the antenna was losing power and rebooting.

However I’m still convinced that the ethernet link between the router and the antenna is failing. I mean, the router says so in its logs! That could still be a result of the long ethernet run through a coupler, so there may be still be an advantage to putting a switch in the middle of that long run; it may never have been PoE, but data / link failure. I also wonder if it’s possible the WAN1 port on the USG itself is broken. Seems unlikely but...

I had no outages at all for nearly 36 hours, then today I’ve had 10 outages in 5 hours (mostly overnight). Really confusing.

Update 2

It’s been bugging me that the local antenna seems to go down for 21 seconds, but then the whole WAN goes down for a minute+. I think we’ve got an unfortunate coincidence of timings. The watchdog default is (I think) 3 pings in 10 seconds failing for a failure, and 3 pings in 10 seconds working for a success. With my antenna link outages 3 pings just barely fail in a row. The 4th would work but the router has already decided the link is not working. Then it waits for 3 more pings before re-activating the link. I can sort of verify this behavior; I had the antenna fail a ping once for 6 seconds (don’t know why), and the router didn’t detect that as a real outage.

So for now I’m testing changing the config to need 6 bad pings in a row to detect WAN failover. Once the LTE device is back working it’ll be a longer wait for it to come online, but it might hide these ethernet link outages or at least make them less severe.

$configure
ubnt@ubnt# set load-balance group wan_failover interface eth0 route-test count failure 6
[edit]
ubnt@ubnt# set load-balance group wan_failover interface eth0 route-test count success 3
[edit]
ubnt@ubnt# show load-balance group wan_failover
flush-on-active enable
interface eth0 {
route-test {
count {
failure 6
success 3
}
initial-delay 20
interval 10
}
}
interface tun900 {
failover-only
route-test {
initial-delay 60
interval 600
}
}
sticky {
dest-addr enable
dest-port enable
source-addr enable
}
transition-script /config/scripts/wan-event-report.sh
[edit]
ubnt@ubnt# commit
[edit]
ubnt@ubnt# save
Saving configuration to '/config/config.boot'…
Done
[edit]

These changes aren’t persistent; next time the controller reprovisions the router they’ll be wiped out. The linked docs talk about how to make them persist through that too but I’m told these only work through a USG, not a Dream Machine. Fortunately I have the USG.

Update 3

Those changes may have made things worse; outages seem to be even longer. Honestly I can’t really understand what’s happening. Since making those changes:

Outage for 60 seconds started Mon Oct 12 14:19:03 2020
Outage for 90 seconds started Tue Oct 13 16:13:22 2020
Outage for 75 seconds started Tue Oct 13 16:18:27 2020
Outage for 51 seconds started Tue Oct 13 16:29:32 2020
Outage for 75 seconds started Wed Oct 14 08:37:20 2020
Outage for 16 seconds started Wed Oct 14 08:38:35 2020
Outage for 14 seconds started Wed Oct 14 19:08:41 2020
Outage for 55 seconds started Wed Oct 14 21:09:21 2020
Outage for 121 seconds started Thu Oct 15 01:40:31 2020
Outage for 90 seconds started Thu Oct 15 18:25:41 2020
Outage for 90 seconds started Fri Oct 16 19:50:06 2020

I’ve tried setting the “success” timer from 3 consecutive pings (ie: 30 seconds) to just one. Not ideal if there’s a working failover, but in the absence of one I think this is better than waiting?

UniFi Dream Machine first thoughts

I liked the UniFi Security Gateway experience in Grass Valley so much I decided to replace my EdgeMAX with a UniFi router in San Francisco, too. I also wanted to add another WiFi access point and it’s nice to have a dedicated controller so I bought the home consumer UniFi Dream Machine, aka the UDM.

First impression: it all works out of the box! This is the first Ubiquiti device I’d be comfortable giving a random ordinary person and have them set it up. It was a bit daunting at first; there’s literally no instructions in the box, not even a single page “getting started”. That is dumb. But if you plug the device in and plug your laptop into one of the switch ports and open a browser window, it will grab you and direct you to setup (via a captive portal). The setup is very simple, too, setting up the basic home router folks need.

Too simple though; I really wanted to configure it before turning it on. No such luck. It demands an Internet connection, a remote access login(*), etc to even set up. I gave in and disconnected the old router and just lived with some downtime until I got the new one set up.

Really there wasn’t much to configure. I have my usual few tweaks: a static IP address for one host, a couple of forwarded ports. Fewer and fewer over time though and it was quite easy to get everything shifted over.

Except once again.. Ubiquiti fails to deliver local DNS. The various hacks for adding it to a USG all don’t seem to work either. I dunno, in Grass Valley the local DNS server at least started returning client names it had learned via DHCP after a few hours. I’ll give this time; I’ve seen some evidence it might be working.

More broadly the Dream Machine is lacking a bunch of features. Some of these are pretty fiddly / psecific things but a lot are fairly basic. It’s not clear if the OS can’t do it or if it’s just the UI doesn’t allow you to configure it yet. And the Dream Machine seems to lack a single config.gateway.json for advanced users to edit, the old back door way to enabling some features in UniFi routers. It’s a significant step back in flexibility. So far I’ve only run into one case where I’d want it, but...

(*) I’ve conceded to UniFi’s remote login. The selling point for me was installing the controller software on my mobile phone and being able to remotely look at my network even when not on site. Super handy. What’s weird about this UDM is it doesn’t even seem to support local login; I think it’s cached my cloud login credentials locally for when the network is down but I’m not sure. You can still log in as root too but that doesn’t even use the normal UniFi credentials, instead the login is username root and your cloud login password for the local password. Spooky.

We’ll see how the device is doing after a couple days’ use. I do like UniFi’s platform in general. Also impressed with the WiFi hardware here, a 4x4 antenna setup is nothing to sneeze at. It’s so good I may never bother setting up my old access point as a secondary in San Francisco.

Also I have an advanced project, creating a VPN tunnel between my two houses. Been wanting to do that for years, looks like Ubiquiti has a shortcut method for that. You can also set up a VPN server which would be a big help for me when travelling; I need to look into exactly what that gets you.

Unifi LTE notes

Update (Dec 2021): do not buy this product. It does not work well; there are numerous problems with the failover. And at least in my case, the cell service was terrible. Worse, Ubiquiti’s management of it is terrible. The web UI for cancelling the subscription is broken. And once my Unifi network saw the Unifi LTE once it will not let go of it. I keep finding vestiges of it in the management console (including a popup message every single page load) and cannot figure out how to remove it. (If this happens to you try the classic console. Apparently this is yet another missing feature in the new UI.) UniFi LTE is a bad product.

I finally have a home network cellular backup option; I bought a UniFi LTE. This integrates with the rest of a Ubiquiti home network via their UniFi platform to give seamless failover to an AT&T cell tower when your main ISP is down. Price is $200, $15/mo, $10/GB. Right now there’s a sale where it’s $5/mo and $5/GB until May 2021; kinda hoping they keep it that way, we’ll see.

The bad

I’ll get the bad out of the way first. The LTE device is AT&T only, with a hardcoded SIM. You cannot use any other network provider and you must buy your contract via Ubiquiti on AT&T. Their network is high quality, but if you’re using a lot of LTE data, AT&T is expensive. My intention is to only use this as failover, hopefully never more than a few GB a month, so I’m willing to accept this limit. It’s a dumb limit though. If you want more flexibility there are a variety of LTE modems sold as hotspots. Also a bunch of routers have LTE failover built in, particularly things meant for installation in trucks and RVs.

The other bad is the UniFi LTE is definitely a Ubiquiti proprietary product. It will only work if you have one of their USG or Dream Machine routers. Many routers (including those two) support a more generic WAN failover, where you have a second WAN port and load balancing or failover rules to use it. The UniFi LTE is not that. In fact you don’t plug it into your router at all, it can go anywhere on your LAN and looks like a local ethernet device. (The docs say the router “makes a tunnel” to the LTE when it needs to route that way.)

One final bad: the numbskulls at Ubiquiti failed to include a power adapter. $200 and there was no way to turn the thing on. The docs are cryptic saying “use a UniFi switch to power it”. Digging deeper and I see the UniFi LTE is an 802.3at device; most UniFi switches that supply POE are 802.3af, a lower power standard. What’s weird is the LTE device only needs 8.5W, well within the capabilities of 802.3af, and some reports are that the device works on 802.3af. I didn’t chance it. (It does have the ability to pass another 8.5W through to a second POE port, that’d require more power than 802.3af requires, but it’s optional.)

Anyway this $110 8 port switch is the cheapest thing I could find that Ubiquiti sells that provides 802.3at. I was stubborn and didn’t want to buy a switch, particularly since I’m not sure where I’m going to locate the LTE modem, so I bought a $20 Shenzen special 802.3at injector instead. It seems to work.

The good

The reason I put up with the bad is I wanted a no nonsense device with no confusion, something that would Just Work. And so far so good. I plugged it in and had it up and running within 5 minutes, including buying the contract service. The only fiddling I had to do is I was required to enable “remote management” on my USG; that’s some scary thing where your router state is accessible via the Internet with a password. I don’t love that idea but I relented.

I’m grateful for this simplicity. Doing it myself with an LTE modem would require researching a suitable modem, picking a carrier, picking a data plan for that carrier. Then getting it all working first on a laptop (for testing). And only then, plugging it in to the WAN port on my router and seeing if the failover actually worked. Probably in a way that violated the data contract I signed up for. Yuck. I’m happy I just bought my way out of all that effort.

Another bit of good; judging by the device’s shape and performance it has a pretty serious antenna in it. Ubiquiti got their start making excellent WiFi antennas and I’m hoping that extends to LTE. There’s also a coax connector for an external antenna but I think I’m unlikely to do better unless I put up a mast.

In practice

Like I said, I got it running with no stress at all. It seems to work.

There’s very little configuration on the device. About your only choice is the max data cap (3 GB / month by default) so you don’t get hit with an ugly bill if something goes wrong. I think I saw some reference to being able to set policy so some devices don’t get to use the cellular backup, probably involving a VLAN. Need to look into that.

I simulated a failure by unplugging my normal ISP (the simplest possible failure; detecting a flaky ISP is harder). The failover happened in under 15 seconds. The LTE connection was OK for this area: 14/1 Mbps and somewhat reliable and with lower latency than expected. (My experiments with a phone as hotspot are all over the place but often much worse). It switched back to the ISP when I plugged it back in, but took a minute or two. I did get email alerts about the outage but there was no obvious view on the Controller dashboard about the failover (there is one hidden status message). Anyway, it basically worked.

I’ve also had two unplanned failovers, both lasting less than a minute. I was away from the computer at the time so I didn’t notice. My ISP sometimes has hiccups where all my sessions are terminated and it’s out for a few seconds, I wonder if that triggered the failover? I don’t know that I mind exactly, but it’s something to keep an eye on.

I’ve read some complaints that networks were failing over to LTE, maybe on false pretenses, and then never recovering back to the preferred ISP. I don’t think I’ve seen that behavior yet. I did get a failure where I unplugged the LTE while I’d failed over to it. I then plugged my regular ISP back in expecting the network to go back to it. But it never did. I finally powered the router off and on and after 5 minutes (!) my network came back.

More generally I just wish the LTE failover state were much more prominent in the dashboard. Also that there be a big toggle switch I could hit manually to swap WANs.

Antenna placement

What I really want is a tool to help me better situate the LTE antenna. I can’t find one; I’ve asked here. There are some diagnostics, including enough signal strength readings that I can probably experiment with different placements but there’s no live tool guiding me which direction to point in or anything. I think their long distance WiFi link utilities do have that.

I’m astonished at that “Good signal strength” measurement; we have terrible reception here at my house. Phones get 0 or 1 bars. All I did was put the antenna in a window pointed roughly towards where I think a tower is.

What do all those numbers mean? This article was helpful. The key number there is the RSRQ or “Reference Signal Received Quality”; it’s sort of like SNR but for multi-channel connections. That -11dB qualifies for “good”. The RSRP number is also useful, it’s the raw signal strength for a single channel and -115 is not so good. Band B12 is a 700MHz frequency.

Annoyingly, I can’t find a time series graph of the history of these readings. The Performance graph shows dropped packets, etc so that may be helpful but there’s no simple graph of RSRQ.

As for where the towers are, this article has lots of useful advice. Looking on CellMapper I think I found out which cell tower I’m connected to; there’s a A3E49 on the map north of me and the cell ID (blanked above) I have is 0A3E4911. The 11 stands for the cell to the south so that makes sense too. That tower is further away from me than I’d like but is way up high on a hill. Most of the other AT&T towers are lower, along the highway, which seems dumb. I need to do further experimentation with my phone as a signal tester.

I tried various locations in my house for the antenna. Some not very reliable data:

  • Office window: 0A3E4911, B12 RSRQ -12, RSRP -112 to -115
  • Office closet: 0A3E4911, B12, RSRQ -9 to -13, RSRP -114 to -125
  • Garage pointing north: 0A3E490A, B2, RSRQ -13 to -14, RSRP -119 to -120.
  • Garage point north after use: 0A3E4911, B12, RSRQ -10

Interesting the garage location uses a different cell (same tower) and band. The B12 bands are in the 700MHz spectrum, B2 is in 1900. I think that means the B2 option could be higher bandwidth. However it only stayed connected on B2 until I tried to use it, at which point it switched over to the other cell on B12. I don’t have a clear line of sight (including a metal garage door, among other things) so I suspect 700MHz is the better choice.

Conclusion

I’m pretty happy with the UniFi LTE, particularly at the current $5/GB sale price. It worked right out of the box once I found a power adapter for it. Now I need to run it for a few months and see what happens in practice.

Configuring failover behavior

Some extra notes written after the main piece.

After 48 hours I’m annoyed that the LTE is being failed over to for 5-15 seconds at a time. It’s happened maybe 8 times. These all might be legitimate primary failures, my ISP is flaky, but then it seems disruptive to fully change the routes since that terminates all active TCP connections. I’d rather the thing not respond to failures so quickly.

There’s very little docs on failover and no config options. I did find this discussion thread which says

It tests whether it can ping out via that interface to ping.ubnt.com. So it will detect a failure upstream. It takes a little longer to failover to not be overly-touchy, it’s immediate when you lose link, 3 failed monitoring checks when link is still present (which is, at most, 40 seconds from failure to failover).

Create an upstream failure, and watch “show load-balance watchdog” via SSH to USG. After 10 seconds you should see “run fails” increment to 1/3, then later 2/3, later 3/3 and it’ll fail over at 3/3.

I wonder if that’s still true (this was late 2019). It’s a reasonable heuristic! And that show command shows “run fails: 0/3” which suggests 3 is still the threshold.

Group wan_failover
eth0
status: Running
pings: 3160
fails: 1
run fails: 0/3
route drops: 4
ping gateway: ping.ubnt.com - REACHABLE
last route drop : Sat Sep 19 22:52:34 2020
last route recover: Sat Sep 19 22:53:07 2020

tun900
status: Running
failover-only mode
pings: 120
fails: 1
run fails: 0/3
route drops: 0
ping gateway: ping.ubnt.com - REACHABLE

This gives me a way to monitor and/or simulate their own failover algorithm too, I can at least verify it’s doing what it thinks it’s doing.

I think I found the config JSON on the USG router that controls this too. Following these instructions about config files I ran mca-ctrl -t dump-cfg to inspect the config. Among other things I found this block:

"load-balance": {
  "group": {
    "wan_failover": {
      "flush-on-active": "enable",
      "interface": {
        "eth0": {
          "route-test": {
            "initial-delay": "20",
            "interval": "10"
          }
        },
        "tun900": {
          "failover-only": "''",
          "route-test": {
            "initial-delay": "60",
            "interval": "600"
          }
        }
     },
     "lb-local": "enable",
     "lb-local-metric-change": "enable",
     "sticky": {
        "dest-addr": "enable",
        "dest-port": "enable",
        "source-addr": "enable"
     },
     "transition-script": "/config/scripts/wan-event-report.sh"

Updates and failures

Last night, after a couple of days of installation, we had the failure mode I was afraid of. The network failed over to the LTE at 9:30pm and didn’t switch back. Something else happened at 2:10am and again at 2:30am but it didn’t switch back to the ISP. Usually these last just a few seconds and it switches back to my ISP. This morning we were still on the LTE even though the ISP link was fine. Had to unplug the LTE and then reboot the router to get the thing back.

The main thing I’m seeing are clusters of 4 events; I’m thinking of these as failovers in response to a temporary short ISP outage.

  1. 15:48:06 LTE to state active
  2. 15:48:06 ISP to state inactive
  3. 15:48:40 LTE to state failover
  4. 15:48:40 ISP to state active

That’s what a normal working failover looks like. Not thrilled about having so many of them, but it seems to work. Here’s what happened last night

  1. 21:33:09 ISP to state inactive
  2. 21:33:10 LTE to state active
  3. 21:33:43 LTE to state failover
  4. 21:33:43 ISP to state active
  5. 02:09:39 LTE to state active
  6. 02:09:39 ISP to state inactive
  7. 02:30:21 LTE to state failover

That’s the event report.

First thing to note is that it was the 21:33 failover that actually started the problem. Even though events 3 and 4 make it look like the ISP should be active (not the LTE), I have independent logs of IP addresses that show me my home network was on LTE since 21:33. So that’s weird. The other weird thing about the 21:33 logs is that the events are backwards from normal; ISP to inactive first, then LTE to active. I don’t know how Unifi publishes events though so I’m not sure event ordering is strictly guaranteed. I suspect it is though and that timestamp difference (:09 vs :10) is evocative.

Then there’s the 02:09 events. No idea what those are about, it looks incomplete. I wonder if the router was using LTE but the watchdog infrastructure thought it was on the ISP? Whatever the case it’s a failure.

Ubiquiti is usually more reliable than this. I’m annoyed.

USG notes, GV LAN configuration

Setting up yet another new router, a Unifi USG. I’m finally buying fully into the Unifi platform. I like the concept; one central management process that configures and monitors all your network equipment. Proprietary of course, but I’m willing to bet on Ubiquiti.

Setting up the USG is awkward since it’s the backbone of your network. These docs helped. My catch is my LAN is configured to be 192.168.3.* but the default network is 192.168.1.*. And even though the Unifi Controller could see the USG when I plugged it in (via LAN port) and send it a firmware upgrade, it wasn’t able to actually provision (configure) it. So I had to follow their instructions; plug in a laptop to the WAN port, use the minimal web config to change the subnet, then use the Controller to configure the rest. Annoyingly the Internet access on the laptop worked fine on the 192.168.1.* subnet but not 3.*; I suspect that minimal config on the USG itself doesn’t even set the DHCP router address right when switching. Anyway once I’d switched the USG’s network to 3.* the Controller was able to send the full configuration and everything works.

Yet another router configuration system with its quirks to learn. Most of the defaults seem fine. The only thing I’m missing is static DNS entries for local static IPs, something Ubiquiti has never been great at. Turning on dnsmasq didn’t help. It may not be possible at all, or require editing a config file. Update I waited a day and now /etc/hosts on the router has a bunch of entries from DHCP, which it will also serve via DNS. I do not have dnsmasq enabled. They are FQDNs only, ie hostname.nelson.monkey.org and not the naked hostname. That’s reasonable but it does mean your host doing the query needs to be configured to search that domain.

One annoying thing in the USG: it does not have a switch. It has 3 ports: LAN1, WAN1, and then LAN2/WAN2. That last port can not be switched or bridged to LAN1, it is treated as a third network with its own subnet and routing. You could probably kludge it so it works like LAN1 but the router will be doing extra work. (Hilariously there’s a 4th RJ45 on the thing labelled “console”. It is literally a serial port.)

Another annoying thing in the USG: it’s slow. Not routing, that’s fast. But it takes 45+ seconds for the thing to boot. And re-provisioning takes a long time, although at least it’s conveniently orchestrated.

LAN Configuration

Figured it was time to document my LAN configuration for the next time I have to do this. Not that stuff doesn’t change.

  • 192.168.3.1/24
  • domain name: nelson.monkey.org
  • WAN configured via DHCP, NAT mode
  • Static LAN DHCP entries
    Printer 84:25:19:0e:7b:0b 192.168.3.67
    Axiscam ac:cc:8e:20:47:8f 192.168.3.53
    gvl 94:c6:91:1e:c8:38 192.168.3.75
  • Static DNS entries for gvl and axiscam
  • SNMP enable community string “public” (for Munin on gvl)
  • Port forwarding: none
  • DDNS: none
  • UPnP disabled

The network is pretty closed off; the only way in from outside is via an autossh tunnel I have set up somewhere on a cloud server.

I would like to add a VPN configuration between my two houses though. Every time I’ve looked into that it was complicated, particularly getting it working while only in one place at the time.

Unifi Network Controller on Ubuntu 20

Ubiquiti’s Network Controller comes in an apt installable version for Ubuntu. For the most part their instructions just work. The one wrinkle I ran into with my Ubuntu 20 system is that the service wouldn’t start with systemctl having an error “Cannot locate Java Home”.

The solution for this was to manually install an older Java.
apt install openjdk-8-jre-headless
Their controller seems to require Java 8. The apt page has some confusing instructions about preventing Java 11 from being installed with apt-mark, but at this point we’ve moved on to openjdk-14 in Ubuntu land. Anyway Ubuntu lets you have multiple JREs installed with no drama.

The network controller is running as an HTTP interface on port 8080. Terrible choice of port (this is changeable). Once you do initial setup though it seems to start redirecting you to port 8443 instead.

I needed to migrate the devices from the previous network controller I’d installed. This all seems to be anticipated in the UniFi system, there’s instructions here on “adopting” the device on the new controller. I had to stop the old controller from running for the new controller to see the devices before adoption.

I also set it up to email me alerts for important things on the network. That requires an SMTP server. I grudgingly gave it a Gmail password, but only after creating a specific app password at Google only for this device.

Why am I doing all this? I’m upgrading some parts of my home network (finally installing a cellular backup for the ISP) and am finally fully embracing UniFi, Ubiquiti’s current platform for their networking equipment. I have UniFi access points and ran their controller software once, grudgingly, to install them. But I still have an old EdgeMAX router that predates UniFi. Or rather will for one more day.

The UniFi Network Controller has turned into a pretty good piece of software, btw. I was impressed when it helped me diagnose a WiFi performance problem I had with an old 802.11n device.

Ethernet switch failure?

Around 6:30pm last night my network started getting slow. Some quick diagnostics showed I was getting 25% packet loss in my wired LAN; just pinging the router or other machines on the ethernet. This problem persisted between three pairs of machines: my desktop, my Linux server, and my Ubiquiti router. However it didn’t occur to a fourth computer, Ken’s desktop.

My best guess is the ethernet switch at the center of my house failed. It’s an old Netgear 16 port switch, maybe 10 years old. And it’s been awfully hot lately. The key indicator is if I switched my desktop to using WiFi it could talk to the router with no trouble. The WiFi AP is plugged directly into the router and doesn’t use the suspect switch.

The problem seems gone this morning. I checked on my server and it clearly had a bad night. It has a watchdog rule to reboot if the network is down, a rule that got a lot of use. The churn makes the Munin logs mostly useless but this graph of Munin’s own processing time is indicative. When the network is flaky Munin is very slow as it waits on timeouts.

So problems started around 0 1:00 UTC and persisted until 11:00 UTC, or 6pm to 4am local time. Can’t quite explain why Ken’s computer is fine; maybe only some of the ports failed? 10 hours also seems a long time to recover if it was just overheated temporarily.

I have a backup switch, still new-in-box. Debating replacing it pre-emptively or waiting for this one to fail a second time.

Update: I replaced the switch and power supply.

How big can an ethernet network be?

Switched ethernet is magic. You buy relatively cheap devices, plug everything into them, and packets get where they’re supposed to go without any complication. Well that’s the simple version at least; modern networks with managed switches and VLANs can get complicated. But the basic system is simple. My question is how big does that scale? How many switches and ports can I have on a switched ethernet network?

The classic folklore answer is apparently 7 hops. The network can be no bigger than 7 hops in diameter. That’s pretty big though. Assuming you had 8 port switches in a tree configuration, I think that’s 8^7 = 2,097,152 devices. But IIRC each switch has to maintain a state table of the MAC address of every one of those 2M devices; I imagine in practice there’s not enough RAM for anywhere near that much.

The 7 hops number apparently comes from IEEE 802.1d which formally defines the Spanning Tree Protocol that underlies Ethernet switch routing. Basically magical elves run around your network and divine its topology, then construct a minimal spanning tree so everyone can reach everyone. From what I’ve read it’s not clear that 7 hops is a hard limit so much as it is guidance about practical limits. I suspect it’s mostly governed by latency.

802.1d is very old though and has been superseded. 802.1Q codifies VLANs and the multiple spanning tree protocol. 802.1aq adds Shortest Path Bridging, which I think is a way to let an ethernet use multiple physical routes to increase bandwidth. I’ve never used any of this stuff, but I suspect it changes the assumptions that underlie that 7 hops rule of thumb. OTOH I wonder in practice. With VLANs and managed switches it’s logically reasonable to consider much larger networks working on layer 2, without IP routing involved.

Backup cell ISP notes

My Internet in Grass Valley is flaky enough that I’m looking at getting a permanent mobile service as a whole-house backup. Right now I just use my phone as a hotspot and switch my computer to it when necessary. That works OK but it only gets my own computer, I’m curious about switching the whole house. (Also dreading it; what if one of the devices decides to download a 10 GB update while on mobile?)

Ethernet / router options

The Ubiquiti EdgeMAX EdgeOS router I uses supports having a second WLAN connection as either load balancing or pure failover. Obviously I’d want failover. The trick is that you need to plug the mobile device into an ethernet port on the router. So the usual wireless hotspot doesn’t work.

The one device that looks exactly right is the Netgear 4G LTE Modem. $110 for a SIM card in, ethernet out. Perfect! See review here. Except it explicitly says it does not support Verizon, my carrier of choice. Some of the user comments suggest it does work on Verizon but my guess is only the LTE works and if you have to fall back to 3G it can’t do CDMA. Not ideal. I could use it with AT&T. Also it does not support LTE Advanced.

This review site’s roundup of ethernet-out devices is discouraging. Only Netgear makes the simple ethernet-out product. There’s a couple of things that are also wireless hotspots or routers that have an ethernet port, maybe they could be adopted. Or something really expensive like this new 5G hotspot. One final option would be to get a USB device and use a Raspberry Pi to output ethernet, assuming it’s possible.

Another option that looks slick is the Ubiquiti Redundant WAN over LTE. $200 for some solid-looking LTE hardware that plugs into your ethernet. Also has a setup with AT&T for service already, $15/mo plus $10/GB. The only point of confusion for me is how the failover happens. The device says it’s for UniFi networks, so I imagine it does some Ubiquiti-proprietary coordination with the router (UniFi Security Gateway) to act as a failover. If so then it probably won’t work with my old EdgeOS device.

Back to hotspots

So maybe using a hotspot is the right idea and I should just get a dedicated hotspot device and service. It’s manual failover and won’t cover my whole house, but there’s lots of product choices. The Inseego MiFi 8800L Jetpack (aka Verizon Jetpack) looks terrific. It even supports LTE Advanced! It doesn’t support Verizon 3G which is weird for a product Verizon is explicitly selling. Maybe that’s OK though, 3G is on the way out in the US.

OTOH just using my phone works well enough for the few times I need to do this. Never been sure I really needed a dedicated device. I’m using a Pixel 3 and it supports LTE Advanced.

Mobile data providers

If I get a dedicated device I need a data contract and SIM for it.

I can add a second line to my Verizon account. $10/mo and then $10/GB. I’m unclear but I think this will share my phone’s data balance? I always have way more data than I need, so that seems like a good choice.

I took a quick look at AT&T prepaid MVNOs, as something I could use with that Netgear modem. The best I could find in the US was Red Pocket Mobile. $10/mo for 1GB, and then $10/GB for topups. Or $25/mo for 5GB if you know you’re going to use it a lot. I did not look at getting a proper monthly account with AT&T, or adding a line to existing AT&T service. I suspect the pricing is the same as Verizon.

Conclusion

Three options

  1. Stick with using phone as my backup. A hassle, and manual, but it’s paid for already.
  2. Get a Jetpack mobile hotspot and switch to it manually. More convenient, but still a hassle. Small extra monthly fee.
  3. Get the Netgear LTE Modem and an AT&T MVNO. Give me proper failover, although there’s the risk we then blow through the data thanks to some ignorant device. Have to buy a new contract, so can’t use existing data on the Verizon account.

Option 1 sure is the least demanding up-front.

Updating nameservers in Ubuntu 19, Pi Hole edition

For some reason, every time I reboot my Ubuntu 19 box had /etc/resolv.conf configured to point the name server at 127.0.0.1. There’s no nameserver running there, so it fails. I want it set to 192.168.0.1. Where is this coming from? Is it related to having had Pi Hole installed at one time? systemd? What?

tl;dr: there’s like 5 things in an Ubuntu 19 system that might be modifying your name server, and tracking it down is really terrible.

In the old days you edited /etc/resolv.conf and were done. (libc knows to read this file and use it when resolving names. Crazy, huh?) That works transiently but is undone if you reboot. If you look at the file there’s a dire notice

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.1

OK, so systemd is a DNS resolver too now? Awesome. Don’t let the 127.0.0.53 surprise you; that’s basically another name for 127.0.0.1, localhost. Only they’re being sorta clever. But my system is broken; it’s not set to .53, it’s set to .1.

Then you go down the rabbit hole. That command systemd-resolve --status is giving you systemd’s idea of how to resolv names. That in turn seems to be configured by files in /etc/netplan, something you may have created if you configured static networking. Changing those will (presumably) alter the behavior of systemd’s DNS server.

But my problem is my /etc/resolv.conf was being regenerated at boot time to point to 127.0.0.1, not 127.0.0.53. systemd’s resolver is never involved. How to fix that? Second rabbit hole; there’s a system called resolvconf that might be overwriting it with information in /etc/resolvconf. Only what’s on my system isn’t the real (old) resolvconf, it’s actually systemd’s resolvectl running in a resolvconf-compatibility mode. I fiddled with it for awhile and I still don’t understand how this stuff works, but it seems to not be writing this entry.

I finally did a grep and found even though I’d uninstalled Pi Hole, it left behind a /etc/init.d/pihole-FTL script. Which is running resolvconf at boot time to re-set the nameserver to 127.0.0.1. This script shouldn’t still be on my system, and removing it should stop the clobbering. So I removed and rebooted.

Hah, joke’s on me! Every reboot, the 127.0.0.1 entry gets rewritten. Where is it coming from? I found it in /run/resolvconf/interface/enp3s0.dhcp. I’m not using DHCP, I have a static IP address. But that encouraged me to pay attention to /etc/dhcpcd.conf which, yes, is the actual source of the text overriding resolv.conf. I changed it from “static domain_name_servers=127.0.0.1” to 192.168.0.1 and name service works on reboot! Who knows why this matters.. dhcpcd is still running; it appears to be used to configure interfaces with static addresses even if DHCP isn’t involved.

But systemd still has one joke left on me. Now when I cat /etc/resolv.conf there are two name servers.

nameserver 192.168.0.1
nameserver 127.0.0.53

I have no idea why systemd decided to inject its .53 in there. It didn’t when the DHCP wrote 127.0.0.1 in there, but change that number to 192.168.0.1 and now systemd’s all in a hurry to put itself there. It may be coming from files I’m afraid to edit in /run. Anyway now half the queries go directly to my name server, half are looped through systemd first.

Fortunately the systemd loop seems to be working. I can’t dig @127.0.0.53 but no ordinary query ever hangs in a way consistent with a broken nameserver. systemd-resolve --status suggests that resolver is configured usefully (forwarding all requests to 192.168.0.1). So I’m just gonna leave it alone since it’s working, even if it’s not what I want.

The problem with systemd isn’t just that it’s a giant beast that tries to do everything. It’s that it’s also magic and poorly documented.

Update (DHCP edition)

I went through this ordeal again on another Ubuntu 18.10 box that I’d installed PiHole on. It took me forever to figure out where the bogus entry in /etc/resolv.conf was coming from. I finally found it in /etc/dhcpcd.conf

Ubuntu’s network configuration is a serious dog’s breakfast of competing files overwriting each other. AFAICT, any of these subsystems might be responsible for configuring /etc/resolv.conf:

I have not found this documented clearly anywhere. The way things overwrite config files quietly is really awful.

802.11 bad signal diagnostics (Ubiquiti)

Ken’s computer was having a bad time connecting to our wifi network via 802.11n. I finally figured out it was mostly a problem with signal strength in his room, a second computer displayed the same symptoms with that same 802.11n adapter. We solved the problem by upgrading him to a 802.11ac adapter. Along the way I learned some things about WiFi signal reliability. Usual caveats applied: I’m just learning this stuff myself and am an amateur

802.11 link layer reliability

WiFi’s link layer has its own set of complex reliability stuff built in, sort of analogous to TCP but solving a different problem. That makes WiFi quite different from ethernet, which AFAIK doesn’t have any link layer stuff for handling a lost packet other than the basic collision detection logic (nearly irrelevant in modern switched networks). There’s also some rate negotiation in modern ethernet; if 1000Base-T isn’t working reliably it’ll step down to 100Base-T. But that’s about it. I think ethernet makes the assumption its link layer is basically reliable and figures it’s the upper layers’ problem (ie TCP) to deal with lost packets.

WiFi is an inherently flaky medium though. It’s expected that not all packets will get through the radio æther unmolested by gremlins. So the 802.11 link layer has a couple of mechanisms built into it for reliability.

One tool is forward error correction. The codewords broadcast on 802.11 aren’t just the bits; they’re error correcting codes capable of fixing single bit errors at varying rates. I believe in practice wifi sends anywhere from 2 bits for every 1 bit of user data to 6 bits for every 5.

A second tool is link layer retries, something a little like TCP’s retry and ACK protocol. This is called “ARQ (Automatic Repeat Request)” in what I’ve read, and basically amounts to tracking sequence numbers and resending packets when not acknowledged. I don’t know how many retries are attempted or whether retries stall the link, this article has details that suggest it’s 4 or 7 retries. But note all this retry is happening on one local wireless link, in under a millisecond. Very different from TCP’s waiting a full round trip for a retransmit.

A final important tool is speed negotiation. Much like TCP uses lost packets and ACK clocking to figure out the maximum speed, WiFi gear monitors error rates and if it sees too many, steps down to a less aggressive data rate. There’s a bunch of choices here summed up by “MCS index”; you might up the error coding from 3 in 4 to 1 in 2, or use 16-QAM instead of 64-QAM, or whatever. I don’t know much about how this works in WiFi but I imagine it’s quite subtle and different from TCP’s algorithms. This paper (I haven’t read) has a description of some of them in practice.

I enjoyed reading this paper about 802.11 reliability. A couple of tidbits I picked up.. Up to half the theoretical bandwidth on an 802.11 connection is consumed by reliability mechanisms, particularly ACKs. Also there’s a paradox that faster links seem to be more reliable. There’s a lot of potential reasons for that, from the tautology that the link is faster because it is more reliable to odd things like faster data transmits mean less time spent flying through the æther and exposed to gremlins.

So that’s the theory. WiFi is designed with a lot of tools to deal with inherently unreliable radio communication. Error correction, retries, rate negotiation, it’s doing a lot.

802.11 diagnostic tools

Despite all that magic Ken was seeing speeds of like 500 kbps on his wireless link, truly awful. The most useful tool I found for measuring this on Ken’s client was simply DSL Reports speed test. That’s testing throughput all the way to an Internet site so is not really a very good test of a local wifi link. But I verified once or twice he was seeing the same slow speed internally, and he was getting a link much slower than our Internet connection. The nice thing about the consumer speed test tool is it shows you momentary bandwidth so you can get a feel for jitter, packet loss, etc. There are many better specialist tools for testing link throughput on your local WLAN; I took the one easiest to put my hands on.

On the server side, I have a fancy UniFi network with a complex bunch of network control software I never use. Turns out it has useful reports though! See Identifying Wi-Fi Issues with Debugging Metrics.

Well that’s your problem right there. According to my UniFi access point, Ken’s computer is receiving at a rate of 1 Mbps. That’d explain the 528 Kbps throughput. Yuck! I never could figure out why it was that low though. Or why it never seemed to increase again, the adapter went to lowest common denominator and got stuck there.

Another useful set of graphs buried in UniFi’s tool are time series charts of the AP’s performance. Graphs like this:

Note that’s a graph from when things are mostly going OK, I don’t have a picture of the problem. But at the time it was not working well the 2Ghz band was showing 80% channel utilization; all for Ken’s crappy 1 Mbps stream. And also lots of dropped and retried packets. Bad news.

I did very the same 802.11n adapter on a second computer also sucked in the same room; so it seemed to be the adapter, not the computer. But 802.11ac was fine. So the solution was simple, spend $25 on a decent wifi adapter and be done with it.

802.11ac, 802.11ax, and friends

A few years back I wrote up a blog post about 802.11n. The learning that went into that served me well. 802.11n is a fairly complex technology and also a very good one; the improvement over 802.11g was enormous. Well now it’s been a few years and 802.11n is old news, 802.11ac is standard and 802.11ax is the new hotness. What are they? (Same caveats as always apply; this is a gentleman amateur’s understanding, mostly based on reading Wikipedia articles.)

One observation; everyone talks about max throughput as the big performance number. But what people really hate about WiFi is when it’s unreliable. I’d much rather have a reliable 100 Mbps connection than a flaky 1 Gbps connection. Related are the number of retransmits that the wireless medium has to do and how that percolates up to dropped packets and unreasonable jitter at the IP level. Right now wireless connections are way, way worse for latency-sensitive applications like videoconferencing or gaming. Fixing that is not the focus of the stuff I’ve read about wifi improvements, but it may still be a happy side effect.

802.11ac

802.11ac is the evolution of 802.11n, a roughly 2013 technology. Sometimes it’s marketed as “WiFi 5”, and also it comes in two major flavors; Wave 1 and Wave 2. To a first approximation 802.11ac is technically just like 802.11n but simply faster. More bits per codeword, wider bandwidth channels, etc. These add up to faster networks with more robust fallbacks, but no major new concepts.

The big change in practice is a lot of 802.11ac connections run at 5GHz (2.4GHz is also supported). 802.11n in theory can run at 5GHz but a lot of the systems only supported it at 2.4GHz. The higher frequency means the signals don’t work as well indoors, but also mean more bandwidth. Even better the 5GHz band has a very generous allotment of channels and a bunch of smart stuff so that it can avoid interference with neighbors, so it works better in dense urban areas.

Nominally an 802.11ac channel is 20MHz wide, but 802.11ac can use up to 160MHz effectively combining 8 channels for 8x the bandwidth. (802.11n was limited to 40MHz). The other big improvements are more MIMO streams (8 vs 4 in 802.11n) and up to 256 symbols per codeword (vs 64 at 802.11n). All those combine for yet higher effective thoughput. In reality most equipment doesn’t support the very highest throughput modes. That’s where the Wave 1 and Wave 2 marketing language comes in; Wave 1 tops out at 1.3 Gbps, Wave 2 at 2.34 Gbps. In reality you’re going to get more like 200-800 Mbps if you’re doing well.

Which brings us to more marketing language. WiFi adapters are sold with language like “AC 1300”. That doesn’t mean 1300 MBps. That means it’ll run up to 400 Mbps at 2.4GHz and 867 Mbps at 5.0 GHz. Even though you only get one or the other, the marketing people add the two numbers to come up with the product description. They also apparently round up, so 400+867=1300. Dumb, but at least it’s clear enough what it means. Your AC 1300 device will never go faster than 867 Mbps. And bigger numbers are better.

Most of 802.11ac’s changes over 802.11n are “go faster”, but there’s a few new concepts too. One is Multi-User MIMO, which somehow lets a router support more bandwidth for a cloud of devices than the maximum throughput just for one device. I think this is spatially based, so that bandwidth to, say, the north of the device is independent to bandwidth to the south.

The other change is beamforming. This lets the equipment do something like a directional antenna, directing signal in the direction it’s trying to communicate. Only you don’t have to move the antenna, instead the electrical elves inside the antenna form the beam by holding up little mirrors. (I may have some of the details wrong but I’m sure my explanation is more comprehensible than the correct one.) I have no idea how well it works in practice.

So that’s 802.11ac. “Faster 802.11n that prefers 5GHz” is a reasonable summary. At this point any new hardware you buy should support 802.11ac. And it may be worth upgrading any old 802.11n gear you have; switching to 5GHz is a nice thing.

802.11ax

802.11ax is the 2019 hotness, also branded WiFi 6. I don’t really know much about it, but to a first approximation it’s yet another improvement beyond 802.11ac. A lot of the changes seem to be about avoiding congestion in denser areas. Smarter dynamic power management, better MIMO options, and the ability to use a wider range of frequencies between 1 and 7 GHz.

The addition of Orthogonal frequency-division multiple access (OFDMA) sounds like a big deal. This is a new way to share spectrum among multiple users which should help contention. I think it’s all coordinated by a single access point so I guess it works for one WLAN, not resolving contention between neighboring WLANs.

Another change is changing guard intervals to a longer period. That sounds like it’d lower bandwidth but benefit longer distance operation. There’s also changes in subcarrier spacing and symbol durations I don’t understand.

It’s not clear what the maximum throughput of 802.11ax will be. People are throwing around the number 10 Gbps, which is phenomenal. According to the wikipedia chart a single stream tops out at about 1200 Mbps, but you can have multiple streams. Be interesting to see what people get in practice.

802.11ad and 802.11ay

I’ve never encountered these but given the cutesy naming (one letter above ac/ax) I include it here. These are 60Ghz protocols, also called WiGig, and I’m curious if they are an evolution of WiMAX. Maybe not; the drawback of 60GHz is not only does it not penetrate walls, but you can only throw it about 1km through the air. So it’s not great for a fixed wireless network. But so much bandwidth! 802.11ad can do 7Gbps, 802.11ay is talking about 176Gbps. Wikipedia talks about this being interesting for use for wireless displays.

Pi-Hole problem with dnsmasqd, LXD

This is for the search engines. Installing Pi-Hole on an Ubuntu 18.10 system it wouldn’t start the DNS server. Looking at “service pi-hole status” I see this error:

May 31 15:00:05 gvl pihole-FTL[30005]: dnsmasq: cannot access /etc/dnsmasq.d/lxd: No such file or directory

For once Googling the error didn’t get me anywhere useful. I finally looked and found this symlink:

# ll /etc/dnsmasq.d/lxd
lrwxrwxrwx 1 root root 28 Apr 26 2018 lxd -> /etc/dnsmasq.d-available/lxd

However the entire directory /etc/dnsmasq.d-available/ doesn’t exist. So it’s a dangling symlink. Apparently dnsmasq.d refuses to start if it finds one of those, doesn’t just skip it. Removing that dangling symlink fixed the problem and now Pi-Hole starts.

No idea where the file came in. I tinkered with LXD on this machine in the past, maybe that’s a remnant of something I installed and then removed.

Ubuntu, DNS, and sudo

I’m confused about something in Ubuntu 18.10. Why does sudo require DNS to be working? And is that appropriate in the face of Ubuntu’s default network configuration?

First, the fun part. If DNS is broken on an Ubuntu host then you can’t sudo.

$ sudo bash
sudo: unable to resolve host gvl: Resource temporarily unavailable
[sudo] password for nelson:
hostname: Temporary failure in name resolution

I’ve seen discussions of this problem going back to 2006 and vaguely recall it being even older than that. It’s not clear if it’s even a bug; /etc/sudoers does have network-based restrictions. But it sure makes it hard to fix a system with a broken network if you can’t become room in the first place.

The usual advice / workaround for this problem is to add your system’s hostname to /etc/hosts. That way you can always resolve the name via the file even if networking / DNS is down. The dumb advice suggests adding it as an alias for 127.0.0.1, the smarter ones have you using the real IP address. However Ubuntu 18.10 doesn’t seem to have any way of adding that hostname for you, neither at install time nor at boot time via netplan. I’ve added this manually, is it a bad idea? I do worry it could get out of sync if I renumber my network some day.

Confounding this problem is DNS is kind of complicated on Ubuntu 18.10. My 18.10 system has an /etc/resolv.conf that lists “nameserver 127.0.0.53”. (Which is sort of equivalent to localhost, 127.0.0.1, but a different number.) systemd has grabbed this port and is providing DNS service via systemd-resolved. That’s a name service daemon that mostly just forwards requests to an upstream name server. The configuration for that is confusing because a lot of files in /etc get rewritten at boot time by Netplan, but in my case it boils down to “we get our DNS servers from DHCP”. All well and good and I think systemd-resolved may even be answering the host’s own name internally, not forwarding it to the DNS server.

The problem is I stopped systemd-resolved via systemctl (while I was experimenting with Pi-Hole DNS). Then I had no way to sudo to start it again. Oops.


DNS ad blocking, Pi-Hole

I’m fooling around with Pi-Hole, the DNS server that also blocks ads by refusing to answer DNS requests for ad servers on various black lists. It was originally designed to run on a standalone Raspberry Pi server but it runs fine on any Ubuntu box. (Beware, the install script is a bit aggressive and will reconfigure your network if you let it.) Unforunately running Pi-Hole on a hacker-friendly router is not easy.

Anyway, Pi-Hole seems to work OK for me. I’m using it as the DNS server for my Windows desktop and for the Linux box itself. The funny thing is I have enough ad blockers installed in clients on Windows (uBlock Origin, Privacy Badger) that very few ad DNS requests get through to Pi-Hole.

The real reason I’m interested in using this is for various devices that can’t easily block ads. Like my iPad; Apple added some support for ad blockers but it’s not very good. Or my Roku, or my PS4, or... I like the idea my whole home network is a black hole for advertising.

The huge drawback here is that DNS is really the wrong place to be injecting policy like this in a network. DNS should be a simple caching service that does its one thing very directly. I’ve never been a fan of policy DNS systems like OpenDNS because they add so much complication. I’m looking with dread at the first thing in my house that doesn’t work in a confusing way because it can’t connect to something that Pi-Hole thinks is an ad server. I’ll never figure it out.

The other drawback is redundancy; what happens if my Pi-Hole server goes down? You can configure secondary DNS for most operating systems as a backup (including via DHCP) but it turns out most systems treat that second server as an alternative server, not just a backup, so it’ll get half the requests. I guess I could run two Pi-Hole servers? Lol, no.

Pi-Hole as a software package also feels a bit like overkill. At it’s core is pihole-FTL, a daemon based on dnsmasq plus extra code. dnsmasq is fine but that extra code implements a bunch of weird stuff. Maintaining the blocklists, OK. Logging every DNS query to a world readable file? Not a great idea (albeit configurable). There’s also a fancy web interface implemented in PHP which is nice, but more surface area. It also listens on localhost:4711 for its own API. It’s just doing a lot of things on top of being a DNS server. I think it’s reasonable, but it is a lot.

(To be fair, Pi-Hole is very well documented. Also the default install seems to be smart, like running as its own user, etc. Whoever built this distribution made an effort to do a good job. It also seems to autoupdate its own binaries, which sure offers an exciting new attack vector to my Linux box.)

One limitation of Pi-Hole is it only works if you can configure the DNS servers of your device. A lot of Internet-of-Crap devices apparently just hardcode a DNS server; see Paul Vixie’s recent rant against Google Chromecast. One solution is to capture and redirect DNS requests back inside. Yes, you can act like your own hostile wifi network! I’m anxious about the complexity this introduces.

I imagine this is only going to get worse with DNS-over-TLS or DNS-over-HTTPS. The Pi-Hole can make its own upstream DNS requests via Cloudflare’s DNS-over-HTTPS, but I’m not sure there’s a way to have the Pi-Hole work as a secured DNS server itself. Not an issue now, there are precious few secure DNS clients, but maybe in a year or so.

Another drawback of Pi-Hole is there’s no good way to temporarily disable it. I mean you can via the admin interface, but it disables ad blocking for everyone. Also it requires a separate web page. I like the way uBlock has a simple UI in the browser for me to temporarily turn it off.

Bad ethernet cable

Just had a real life experience of a bad ethernet cable hurting my network. My Linux server (or rather, the 4 port switch it is connected to) sometimes gets gigabit ethernet, sometimes 100 MBit. I couldn’t figure out why, but today I was frustrated it was stuck at 100 MBit so I found the actual cable in the patch panel and replaced it. Boom, gigabit ethernet.

I’ve got fairly elaborate-but-janky ethernet wiring in my house. Some 20 cables in the walls punched down into a cheap Leviton patch panel. Then short patch cables from the panel to the switch. In retrospect the patch panel is probably overkill; I’m never gonna repatch it. And it adds two more connectors, some circuit board traces, and a patch cable to every cable run. Still it mostly seems to do gigabit ethernet fine, just wish we hadn’t used cheap patch cables. They don’t have any rating printed on the jacket at all, just some numbers that boil down to basic Underwriter Lab type building codes. They’re flat, and in my experience flat cables tend to be crap.

Time to replace all the patch cables. Happily I found some gay pride Cat6

Update: success!

Monitoring EdgeOS bandwidth with Munin

Ubquiti’s routers are reliable and flexible, but they lack a certain.. consumer polish. One thing missing from the graph is any sort of historical bandwidth tracking or graphs. There’s no way to see what bandwidth you used in the last 5 minutes, much less the last year.

But EdgeOS does support SNMP. So you can collect the SNMP data on a Munin node running on another computer and graph it.

Step 1: turn on SNMP following something like these instructions. I did this via the router GUI instead using the Config Tree wizard. The two settings that are important are

snmp {
     community public {
         authorization ro
     }
     listen-address 192.168.0.1 {
         port 161
     }
}

Note there’s no real security in this kind of SNMP, anyone with access to that listen-address will be able to read a bunch of state off your router.

I was able to test SNMP was working with snmpwalk but I forget exactly what command worked. SNMP is a mystery to me.

Step 2: configure your Munin node to read the SNMP data. I used this guide. It basically has you use munin-node-configure to detect what SNMP data is available and then symlink a bunch of plugins. Then you add a “virtual node” for the router to your munin.conf.

The resulting config is overkill; I’m not sure I need to measure my router’s disk usage, thank you. Also there’s like 8 graphs for the network and I haven’t quite figured out which opaquely numbered interface is the WAN I care about monitoring. I figure after a day’s data is collected it’ll be clear what’s useful to keep.

Update: here’s what I kept

snmp_192.168.0.1_cpuload
snmp_192.168.0.1_if_2
snmp_192.168.0.1_load
snmp_192.168.0.1_netstat
snmp_192.168.0.1_uptime

The graph shows a big upload I did out of my network maxing out at ~10Mbps. Incoming bandwidth maxes out at 250Mbps so if I ever saturate that the scale on this graph is going to go to hell.

SF Internet upgrade to 250/10

I’ve been using Wave (formerly Astound) as my ISP in San Francisco since June 2014. When I first got their 100 Mbps / 5Mbps cable modem it seemed so fast I could see through time. But network tech keeps improving, at least in urban areas. Sonic now offers $50/mo gigabit fiber and both Astound and Comcast have tried to match with upgraded cable modem speeds.

I’d prefer to switch back to Sonic but it requires running a new wire, which is a bit complicated for me. OTOH I could simply fill out a form with Wave, agree to pay an extra $10, and poof: I get 250 / 10 speeds. Which I did today, and it seems to work fine.

The real surprise here is I’m getting 250 all the way to my desktop. I’d been putting this upgrade off because I thought my home network wiring limited me to 100 Base T, so anything over 100 Mbps wasn’t so exciting. I guess the wiring in the house (particularly the patch panel) is better than I feared. (I’d planned ahead with the cable modem, an Arris 6141 which maxes out about 343 Mbps.

250/10 is hugely asymmetric, I wish they wouldn’t do that. I read somewhere that 19:1 was the maximum reasonable asymmetry, more than that and there wasn’t enough upstream bandwidth for ACKs to to clock the download. No idea if that’s really true and I bet that varies depending on window sizes, etc.

As always when I first got the speed boost it didn’t seem to work because I forgot I’d configured my router to do traffic shaping. I’m using an EdgeRouter X and their “smart queue”. It does an excellent job managing bufferbloat, but you do have to configure your max bandwidth correctly! Once I’d done that I was still only getting 190 Mbps down. Turns out that’s a limitation of the EdgeRouter X; once you enable QoS the CPU has to touch every packet and unfortunately it’s just not fast enough to keep up. One solution would be to upgrade the router, maybe an ER-4. What I’m doing now is only doing smart queueing on the 10 Mbps upload. Realistically that’s probably enough; saturating 250Mbps is hard.

I did get a nice practical demo with this game update. 30 MBytes/second, I remember when that was as fast as a hard drive could go! Unfortunately this nirvana only lasted about a minute until EA’s horrible servers crapped out and/or throttled me, real throughput over the whole download is more like 2MB/sec. Speed tests show I’m still getting 250 from my ISP.

mosh behind NAT

I wanted to give mosh a try to see if the fancier remote shell program would work around this crazy Berlin Internet that terminates idle connections in < 5 minutes.

Turns out mosh doesn’t work if the server you are connected to is behind NAT. It relies not only on connecting to TCP:22 for the ssh, but also a second server running on UDP:60001 or nearby to do its magic. Worse, the mosh server doesn’t seem to have any support for NAT traversal. The advice of the docs is “set up static port forwards for these 1000 ports”. I appreciate the optimism about a pure 1990s Internet, but in the modern environment that’s ridiculous.

The solution I found is to use this 2012 shell script. It’s a wrapper for mosh-server that uses miniupnpc first to request the port be forwarded. Seems to work for me with my Ubiquiti router. You arrange for it to be invoked by putting the server wrapper script in your PATH on the server, then doing “mosh -server=mosh-server-upnp” on the client you’re connecting from to cause it to be invoked.

There’s also this recent Ruby script which might be a better choice, but I couldn’t be bothered to look up how to install Ruby scripts.


Using a modem in 2018

I’m wanting to program my Door King gate controller. It’s hooked into our phone line and can be programmed via touchtones or with a modem. So why not? I bought a modem. $16 for a USB 56kbps modem. I even made an unboxing video.

I plugged it in to my Windows 10 box and it was just recognized, no driver futzing at all. It even seems available for use for faxing and dialup. But that’s far too new-fangled, so I looked around and found that Tera Term still exists and can be used as serial port console software. Also found at least one dialup BBS online. A few half-remembered Hayes AT commands later and we have connection! Not sure why it only connects at 26400kbps, but I’ll take it.

Screenshot_1.png

 

Having a bit of trouble finding the modem to connect to it. Tera Term seems to think my modem is COM3 and worked first time I tried it. Windows Fax & Scan sometimes identifies a fax device, sometimes doesn’t. And the Door King software is not identifying any modems although I can manually tell it to use COM3.

Worse, the Door King software seems to require an account that I pay for in order to use the programming software. I got as far as registering for the software and getting my password mailed back to me in plaintext before I saw it was $6/month. Forget that. The manual talks about a “DoorKing Auto-Programming Software for Windows” which is different from the “DKS Access Plus” software I can find online. I’ll dig a bit more tomorrow, but this whole ridiculous escapade into modems may be coming to an abrupt end.

One long wire

Three years ago I kludged up my Internet access in Grass Valley using a Ubiquiti wireless ethernet bridge. Today I was able to remove that and replace it with a simple long wire. Yay! We finally got some electricians out to run cable through existing conduit. The conduit was crushed, but fortunately not under the driveway like we’d been told by the last electrician. The break was right at the edge of the driveway, probably where a heavy truck fell off once and crushed the conduit. Dug that up, fixed it, ran three new Cat 6 wires and now I’m wired from my house to the antenna up in a tree.

Shout out to the Ubiquiti Nano M5 and Nano Loco M5 though. Those things worked like a champ, rock solid for 3 years. It wasn’t too demanding a problem; 12 Mbps wirelessly over a couple hundred feet. But it worked great for three years with zero problems. I don’t think I ever even had to reboot them. And when the power went out, they rebooted themselves just fine. Very nice hardware and software.

I’m gonna do some tinkering with my new wired setup. I have about 450′ of cable run total from my router to the tree antenna. That’s broken up into three pieces. A 100′ segment from router to an ethernet switch in my garage, a 300′ segment from the ethernet switch to a PoE module at the tree, and then a 50′ segment from the PoE module to the antenna up in the tree. I’m gonna see if I can get away with a passive RJ45 coupler between the ethernet switch in the garage and the cable that goes up the tree to the antenna, move the PoE module down into the garage. That’d let me not rely on outdoor power up by the tree any further. Update: turns out this works fine.

Ethernet has a well known a 100 meter / 328 feet limit on cable runs. But is that a real hard limit? The folklore is it has to do with timing and collision detection, but apparently that might have only been true for very old 10BaseT and/or with non-switched networks. In modern times it may be more a soft standard for signal strength and attenuation in which case there’s some wiggle room. I’ve heard from friends with 500′ or longer runs who say it works.

Fixing bufferbloat in Ubiquiti EdgeOS

This Hacker News discussion got me diving in to enable smart queuing in my Ubiquiti EdgeMAX routers, the ones running EdgeOS. There’s a quick-and-dirty explanation of how to set it up in these release notes, search for “smart queue”.

Long story short, under the QOS tab I created a new policy for eth0 and set bandwidth numbers a little higher than the 100/5Mbps my ISP says it sells me. Then tested with DSLReports speed test

  • No smart queue: I get about 105/5.5 with an F for bufferbloat. 300ms+
  • Smart queue at 100/5: I get 90/4.5 with an A+ for bufferbloat.
  • Smart queue at 110/6: I get about 100/5.3 with an A for bufferbloat.

Update: several folks have pointed out to me that smart queuing causes problems if you have a gigabit Internet connection. The CPU in a Ubiquiti router can only shape 80-400MBps of traffic depending on how new/expensive a router you bought. If you enable smart queueing on a gigabit Internet connection you will probably lose a lot of bandwidth.

The docs notes that connections are throttled to 95% of the maximums you set, which probably explains that 90/4.5 reading. I think the harm in lying a little here is I might get a few ms of lag from buffers.

The Hacker News discussion has a bunch of other stuff in it too. Apparently “Cake” is the new hotness in traffic shaping and is possible to add to EdgeOS, but awkward. Also it’s apparently hard to buy a consumer router that can really do Gigabit speeds, particularly if you want traffic shaping. Huh.

Every single time I’ve enabled QoS I end up regretting it as it breaks something I don’t figure out until months later. I wonder what it will be this time? I hate I have to statically configure the bandwidth throttles.

 

Screenshot_1.png

UDP spam from DirecTV boxes

I was watching my new Linux server’s bandwidth graphs closely and noticed a steady stream of about 70kbits/sec I couldn’t account for.

24kbps of that is my three DirecTV boxes sending UDP packets to the server. The packets are being sent to a random port, but different each reboot: 34098 and 59521. There’s never a single response from the server. It’s the only traffic I see from the DirecTV boxes to my Linux server. Each UDP packet has text in it like this:

HTTP/1.1 200 OK
Cache-Control: max-age=1800
EXT:
Location: http://192.168.3.63:49152/2/description.xml
Server: Linux/2.6.18.5, UPnP/1.0 DIRECTV JHUPnP/1.0
ST: uuid:29bbe0e1-1a6e-47f6-8f8d-dcd321ac5f80
USN: uuid:29bbe0e1-1a6e-47f6-8f8d-dcd321ac5f80

So it looks to be UPnP junk. Port 49152 is a bit of a tell; it’s the lowest numbered dynamic/private port and is often used by UPnP servers to announce themselves. Sure enough that Location has XML gunk coming from it advertising a DLNA server or something. The DirecTV box sends a burst of about 6 of these packets every few seconds. All three of them.

I wonder why my Linux box is so lucky as to get these? My Windows box doesn’t seem to get them. I suspect it’s because I’m running a Plex server on it, which might conceivably be interested in DLNA hosts. I turned off DLNA in Plex and rebooted and it’s still getting them.

Oh well, it’s not much bandwidth. Not sure where the rest of the 70kbps is going. There’s a lot of broadcast chatter on port 1900, more UPnP stuff. Nothing else focused like this.

Ubiquiti EdgeMAX / EdgeOS local DNS

Ubiquiti makes nice routers with good firmware. But one missing feature; it doesn’t generate local hostnames in DNS for clients on DHCP. Ie, my Linux server registers itself with the name “gvl”. But I can’t then “ssh gvl” on my network because gvl isn’t a valid DNS name, not even in the Ubiquiti.

The right solution for this is to enable dnsmasq to be your DHCP server. dnsmasq is already running as a DNS server in the router; all this does is let it also be the DHCP server. As a side effect you now have nice DNS service. The downside here is it requires some slight tomfoolery to enable and then you end up with a less-than-standard router. See the discussion here.

Another possible solution is to enable the “hostfile-update” option. This tells the stock DHCP server to write entries in /etc/hosts. There’s some possible bugs with this.

The hacky solution for this is to leave DHCP alone and just create a static IP address and DNS name for your host. I’m too lazy to post screenshots, but basically...

  1. Boot your DHCP client that you want to give a DNS name to. Let it take an automatic address.
  2. In the web GUI for the router, go to Services / DHCP Server. Click the little “Actions” dropdown button and select “View Leases”.
  3. Find your DHCP client and click “Map Static IP”. This computer (well, MAC address) will now get a static IP every time it boots.
  4. Go to Config Tree. Open system / static-host-mapping / host-name.
  5. Click “Add”. Type a hostname. Click update list.
  6. In the config tree look under host-name for your new name. Click it, then under “inet” add a field which is the IP address you set up in step 3.
  7. Click “Preview” to verify the config is right. It should be something like this. If it looks right, Apply it.
    set system static-host-mapping host-name gvl inet 192.168.3.75
  8. Test DNS on another system. dig @192.168.0.1 gvl any

Steps 4-8 can also be done via the command line configurator, which is probably less clumsy than the config-tree GUI.

Now that I’ve typed all this out I think perhaps switching to dnsmasq for DHCP is the better solution. But this works as a one-off.

Ubiquiti EdgeMAX EdgeOS router notes

I’m setting up a new Ubiquiti router, an EdgeRouter X SFP using firmware v1.9.7+hotfix.4. Some notes on doing this:

Out of the box the router only works on ethernet port 0 (eth0). It does not run DHCP. You have to manually configure a computer to talk to it on 192.168.1.1.

The router will redirect you to HTTPS when you connect. However they of course don’t have an SSL certificate for 192.168.1.1 so your browser will refuse to connect. You can override this in Chrome and Firefox by looking for “Advanced” mode on the error screen.

The first thing to do with a new Ubiquiti router is upgrade the firmware. The stock firmware is old and missing important features. (My memory is upgrading UniFi access points is also necessary, the shipping version had a crippling bug.)

Once you flash it the first thing to do is run the “Basic Setup” Wizard. (Note, this is not available in the shipping firmware.) This will set the router up to do What You Expect from a consumer router; NAT routing for eth0 (the WAN port) and DHCP for the rest. For a simple home network that is probably all you need to do.

1.9.7 and other versions have a bug where if you manually configure some static IP addresses along with DHCP, then dhcpd won’t start when you reboot the router. The fix for this is to remove all static entries. I was able to add one static entry later via the DHCP control panel and rebooting still works. Not sure if I can manually add an entry or not. This is all probably a bug in vyatta, their GUI config system.

DNS is not enabled for DHCP entries or static hosts. That’s a thing the dnsmasq used by many routers does for you. I can’t figure out how hard this would be to enable. The obvious wizard reportedly only adds your entries to /etc/hosts on the router itself which is not propagated by its DNS server. I didn’t try very hard.

UPnP is not enabled by default. You can add it via a feature wizard; internal is “switch0” and external is “eth0” (or whatever your WAN port is).

For my own notes, a network setup idiosyncratic to me, I added a static interface route to 192.168.1.0/24 going out eth0. Hoping to reach my invisible wireless ethernet bridge boxes on 192.168.1.110 and .111. No luck, but I think that may be because they’re configured to think the network is 192.168.0.0/23 and so can’t talk to my 192.168.3.* addresses. Oops.

 

Berlin home Internet link

More details on my Berlin Internet sitch. My apartment has a Technicolor router that comes from PrimaCom’s cable modem service. It was down entirely for several days (and not just for me) when we got here, which is not so awesome. Mobile hotspots are a poor alternative.

The downtime revealed PrimaCom manages the router WiFi. When the Internet was down the WiFi was also turned off. You couldn’t even turn it on in the admin pages (default login: username blank, password admin). Once Internet service was working again and I rebooted the router, I had WiFi. Weird.

The bummer about the router, or the larger network, is that it just forgets about idle TCP sockets after about 5.5 minutes. Idle ssh sessions and other quiet TCP links just stop working. Not even a reset, just a timeout, and it’s consistently timed so it’s not a FIFO queue filling up. There’s nothing in the router config that’s obviously causing the problem.

Of course web browsers never even notice, so most of their customers have no idea. I wonder if it breaks notifications via WebSocket though. For ssh I work around it with ServerAliveInterval=50. I suppose TCP keepalives would fix it in general but that’s a half-abandoned tech and the default interval in Windows is 2 hours (!) so you have to fiddle the registry. Ken has some weird TN3270 sessions he uses, I think SSL and telnet. We fixed his timeouts by just using Tunnelbear VPN which papers over the problem. I really should run my own VPN server.

We never could connect to an old school PPTP VPN. The TCP control channel for setup seems to have worked (according to Wireshark) but no GRE packets ever arrived.

The fun thing is I have an honest-to-goodness IPv6 address and all of it works. Sometimes I seem to be connecting to Google via IPv6. I’m not quite sure what to do with this capability, but it’s novel for me. I wonder if the router is still doing NAT for IPv6? The IP address a test site shows me is the same one my Windows box tells me I have, so I guess not. The router does have an “IPv6 firewall” enabled though, perhaps that provides basic protection from outside attacks? I should set up a remote IPv6 box to play around with this.

Update: Primacom seems woefully underprovisioned. In the morning I get about 5000kbps, bursting to 10Mbps. In the evening I’m doing good to get 500kbps, 1/10th the speed. I assume that’s contention with my other cable modem users. 500kbps isn’t really enough to even stream video.

 

Here’s a traceroute on IPv4

|------------------------------------------------------------------------------------------|
|                                      WinMTR statistics                                   |
|                       Host              -   %  | Sent | Recv | Best | Avrg | Wrst | Last |
|------------------------------------------------|------|------|------|------|------|------|
|                             192.168.0.1 -    0 |    3 |    3 |    2 |    5 |   10 |    5 |
|                              10.195.0.1 -    0 |    3 |    3 |   10 |   20 |   41 |   41 |
|                            172.16.0.201 -    0 |    3 |    3 |   15 |   24 |   42 |   42 |
|                            172.16.0.109 -    0 |    3 |    3 |   15 |   24 |   42 |   42 |
|                             172.18.0.53 -    0 |    3 |    3 |   16 |   25 |   43 |   43 |
|        ae63.edge7.Frankfurt1.Level3.net -    0 |    3 |    3 |   24 |   30 |   43 |   43 |
|   ae-2-3210.edge4.Frankfurt1.Level3.net -    0 |    3 |    3 |   30 |   34 |   44 |   44 |
|             10ge10-15.core1.fra1.he.net -    0 |    3 |    3 |   27 |   35 |   50 |   50 |
|              100ge5-2.core1.par2.he.net -    0 |    3 |    3 |   74 |   81 |   93 |   93 |
|             100ge14-1.core1.nyc4.he.net -    0 |    3 |    3 |  114 |  124 |  143 |  143 |
|              100ge9-1.core2.chi1.he.net -    0 |    3 |    3 |  143 |  156 |  163 |  143 |
|             100ge12-1.core1.mci3.he.net -    0 |    3 |    3 |  141 |  154 |  162 |  141 |
|               10ge4-1.core1.mci2.he.net -    0 |    3 |    3 |  142 |  155 |  163 |  142 |
|wholesale-internet-inc.10gigabitethernet1-3.core1.mci2.he.net -    0 |    3 |    3 |  142 |  155 |  163 |  142 |
|lag-to-oak.edge-a.clay1.mci.us.as32097.net -   34 |    3 |    2 |  160 |  161 |  163 |  160 |
|lag-core-b.dist-1-3.clay1.mci.us.as32097.net -    0 |    3 |    3 |  146 |  156 |  163 |  146 |
|                         wk.somebits.com -    0 |    3 |    3 |  145 |  157 |  163 |  145 |
|________________________________________________|______|______|______|______|______|______|

Powerline ethernet

I’m spending a few weeks in an apartment in Berlin that’s a large sprawling place. The single wifi router at one end has no hope of reaching the other end and there’s no ethernet in the house. So I took a $50 gamble on a powerline ethernet kit and it seems to work, at least up to 30Mbps. We’ll see if it lasts; my friend says in his experience these things fail after a month or two.

The plug-n-play experience out of the box is pretty great. Plug both devices in, press the pair button, and you’re done. It acts more or less like a bridged ethernet. Plug one end into your router, another end into a computer, and you’re done.

One wrinkle here is security. Your network is being carried out on power lines and who knows how far they’ll go. So the products all have a shared key encryption mechanism (pairing is key exchange) to keep your network private. They probably leak all sorts of RF out the modulated wires, oops.

TP-Link makes a huge variety of these devices. My box says “AV600 TL-PA4020P Kit”, a variant I can’t even find anywhere, but it seems about the same as the AV500 versions only 100Mbps faster. The choices seem to be power passthrough or not, 1-3 ethernet ports per device, and then more expensive for higher bandwidth (up to 1.2Gbps). Different versions for different countries too, both the electrical plug shape and radio frequency interference concerns. Some versions also have a WiFi access point built in, I kind of wish I’d bought one but I wanted to keep it simple and cheap.

The relevant network standard is HomePlug, some vendor consortium for powerline networking. (They just dissolved last year and put all the specs in the public domain.) In theory there’s vendor interoperability. I don’t quite know what’s going on, the Wikipedia article talks about 1000+ channels from 2 to 86MHz.

The really interesting play here is if all your Internet of Things devices supported this kind of networking. Just plug them into the power; no wifi or ethernet required. I wonder why that’s not more popular, I suspect it’s because of the rumored flakiness of powerline ethernet.

 

DDNS clients

I set up a new router and so once again am trying to figure out the hack I need for Dynamic DNS updating. I use afraid.org for DDNS and I need something on my home network so that if my IP address changes I notify afraid to update my record. And boy it’s complicated. In the past my router firmware (Tomato or OpenWRT) seemed to handle it for me, but my new router (Ubiquiti EdgeMAX) isn’t working. It has a DDNS client, but it’s fail.

Why so complicated? Because of history. In the bad old days there were all these complicated protocols for DDNS. Software like ddclient has support for a zillion different proprietary protocols. But DDNS has mostly now stabilized on “fetch this URL with a secret token to refresh your IP address”, taking the IP address implicitly from the source of the HTTP request. And that’s all we need. afraid acknowledges this, with a sample cron job which fetches every 5 minutes. Done.

Well not quite. Ideally you’d only post an update if your IP address actually changed. And ideally you’d update immediately, not every 5 minutes. This is possible (and implemented in the Tomato router) but it’s too much work to figure out how to do it. So the cron job it is.

One last wrinkle; afraid has two versions of the dynamic update. v1 and v2. Conceptually they’re the same, but v2 has improvements. The one I like is v2 doesn’t say “ERROR” if you post an update without a change, it just acknowledges that nothing changed. You have to opt names into the v2 interface in the web UI first.

I like how afraid’s example cron job is randomized so it runs at a random second, not exactly at 00:00:00 and 00:05:00, ... Thundering herds are bad.

RF scan in San Francisco

My fancy Ubiquiti access point has an RF scan tool. Here’s what it found in my house in San Francisco, Noe Valley.

Capture.PNG

Capture2.PNG

 

Not a great visualization; the yellow bar fills up the trapezoid. Mouseover tells me the 2.4GHz channels are about 20-30% “utilized” with “interference” of -95 dBm (noise floor?). 5.0GHz channels are mostly 0% utilized except for 112 and 136, which are about 20%. Interference there is -91 dBm for most, -96 for a couple.

My iPhone sitting nearby can see about 4 neighbor’s WiFi networks. Also probably a lot of 2.4GHz cordless phones, including mine. In practice 2.4GHz barely works through the house and 5.0GHz is terribly unreliable, probably because the walls are lath and plaster faraday cages.

 

routes at my WISP

I continue to be baffled by my WISP’s networking. Last few days I’ve had frustrating small outages, like 1-2 minutes at a time. But only during working hours. Support told me they were doing “some maintenance that might cause that” one of the days. I fear they think even an occasional 2 minute outage while they reboot equipment is OK, but happening 5+ times a day is getting really old. I do have some sympathy for them though. It’s a fixed wireless network, my house is connected via at least 2 radio relays at other customers’ houses before reaching a wired network. That’s gotta be hard to manage.

Anyway, I realize part of my confusion now is that traceroute is lying to me. Here’s an mtr report after running about 25 minutes.

                                       Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. OpenWrt.lan                       0.0%  1606    0.4   0.3   0.3   0.5   0.0
 2. sbbgateway.lan                    2.6%  1606    2.2   2.3   1.6  24.6   2.0
 3. 173.195.183.1                     0.0%  1605   35.7  39.6  16.0 136.5  15.0
 4. 173.195.188.45                    0.0%  1605   33.3  37.5  14.4 139.4  14.9
 5. 173.195.188.21                    0.0%  1605   46.1  39.7  17.2 142.3  15.5
 6. 173.195.177.1                     0.0%  1605   29.0  36.9  18.0 128.5  15.1
 7. 173.195.177.254                   0.0%  1605   37.8  39.0  17.5 145.9  15.3
 8. v122.core1.fmt2.he.net            0.0%  1605   39.1  51.3  28.0 176.6  14.3
 9. 10ge7-1.core1.sjc2.he.net         0.0%  1605   57.3  51.2  27.4 128.1  15.7
10. 72.14.219.161                     0.0%  1605  104.7  47.6  28.2 155.5  16.3
11. 108.170.242.81                    0.0%  1605   57.0  49.5  27.5 142.6  15.9
12. 216.239.49.103                    0.0%  1605   55.2  50.6  28.3 146.1  15.8
13. google-public-dns-a.google.com    0.0%  1605   49.0  47.2  27.4 158.4  14.3  

Hop 1 is my router. Hop 2 is the wireless antenna on my property. Hop 8 is Hurricane Electric, a network provider in California, and beyond that is the public Internet.

But what’s going on between hops 3 and 7? I used to think this was the wireless nodes in my WISP, that hop 3 was the first radio and hop 4 was the second and so on. But looking at that average ping time I realize there’s no latency between 3 and 7. So now I think that hop 3 must be the first bit of wired infrastructure at my ISP, and that hops 2-3 are the sum total of all fixed wireless links. Perhaps they are acting as bridges, transparent at the IP layer. That’s how my own Ubiquiti nodes operate, I actually have 2 Ubiquity M2s running between hops 1 and 2 that are invisible to mtr.

FWIW the boxes at hops 3-5 look to be running MikroTik RouterOS. That’s also consistent with wired infrastructure; my wireless antenna at hop 2 is a Cambium device. No idea what 6 and 7 are. I don’t want to freak out my ISP by probing too hard.

One reason I’m looking at this so closely is I’m trying to understand the 2.3% packet loss shown at hop 2. That looks like it’s to my own equipment and I should be able to fix that. But every test I’ve done directly shows 0 packet loss to that device, the Cambium antenna up in my tree. Now my theory is the packet loss is actually in the wireless network between hops 2 and 3, the WISP’s wireless infrastructure. MTR can’t report it directly because those devices aren’t visible at the IP layer, so it just credits the packet loss to the last IP hop in the route, hop 2.

I think I see a similar thing when I mtr backwards back into my router at the WISP from a public Internet host; there’s no latency in my ISP’s network on the way in until a high latency gap at the last hop. The route back is different from the route out, which makes direct comparison a bit trickier.

Latency

I did a ping test to 173.195.177.254, the edge of my ISP’s network.

51 packets transmitted, 51 received, 0% packet loss, time 50076ms
rtt min/avg/max/mdev = 17.645/38.194/84.315/14.119 ms

I also asked my neighbor to do one.

52 packets transmitted, 52 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 17.737/29.401/53.861/8.731 ms

So his latency is 9ms better than mine. Significantly less jitter and worst case, too. I believe the difference between us is one radio hop. He has a radio link directly to Twin Cities Church. I think I have two hops, one north to a house and then from there south to the church.

I’d thought the church was where the wired internet began, it’s a major hub for the WISP. But those latency numbers suggest there’s possibly more wireless. The WISP’s office is down in Alta Sierra. The distances involved are so short I don’t think signal propagation time matters; it’s at most 20km, or 0.07ms at the speed of light. Not relevant. Processing time on the antenna relays though, not to mention congestion, those matter. Perhaps it’s 9ms per wireless hop, based on my measurement of my own link. We have ~20ms of latency unaccounted for, that suggests there are two more wireless hops from the church to the wired infrastructure.

Exede satellite Internet

A Metafilter discussion introduced me to a type of Internet access I didn’t know about before; Exede satellite Internet, part of ViaSat (and WildBlue). It seems better than the Hughesnet satellite Internet which is so slow, metered, and high latency as to be nearly useless. Although I took a brief look at Hughes and they seem to have improved their offering somewhat, not sure if Exede is significantly better.

If you’re in the right regions Exede offers Liberty Internet, 12/3 Mbps, or even 25/3, for $70-$150 a month. The problem is after you go through 12-30GB that month they drop you down to a lower service which is only 1-5Mbps, or maybe worse. If you’re in the wrong area all you get is Classic service, 5/1 Mbps, for $50-$130/month. That comes with a 10-25GB monthly cap and I can’t tell if it’s a hard cap or another slowdown.

It’s still high latency though. Their FAQ is full of mealy-mouth bullshit about “web accelerators” and how latency is better, but the what to expect page confesses 700ms latency and that gaming won’t work. That’s the incontrovertible problem with geosync satellite systems; it’s 240ms just getting to the satellite and back, not to mention all the other work that has to be done.

The other part of Exede that got my attention is it’s bidirectional; you’re sending signals back to the satellite via the antenna. Old Hughes installs relied on a phone line for uploads. Hughes now advertises up to 1Mbps upload speeds though, so maybe they have a satellite option now.

I was baffled why the 12/25 Mbps service was available in San Francisco, but only 5 Mbps in Grass Valley. It’s satellite, why does it matter where I am? Well it turns out they’ve broken up the US into cells with different “beams”. I found a good map and technical detail. It looks like most of the western US isn’t served by ViaSat-1 at all, but instead by Anik-F2.

beams.JPG

 

beams 2.JPG

 

Lightweight NTP clients for Unix

NTP is important, it sets your system clock. A proper Unix machine with an ordinary network connection should be within 10ms of true time. The problem is the traditional software we use to do this, ntpd, is old and complicated and has had a lot of security problems. It also does way more than your typical server needs, supporting obscure protocols and funky hardware you’ll never access.

I think a modern Unix machine just needs a simple network only time setter. Poll the time from ~4 NTP servers, discipline the clock to ~10ms, implement leap seconds correctly. That’s about it. I’m on the fence about client-only; if it’s not a big deal to be a simple server, that’d be better. I’m also ignorant about security, the historical crypto stuff in ntpd is pretty woolly.

A lot of other people think there should be a simpler time settings, there’s a bunch of alternatives now.

  • chrony is the best alternative I know of. It seems to do time correctly, and it has some clever accommodations for running in difficult environments like a VM or on a machine like a laptop that’s asleep a lot of time.
  • NTPSec, a big effort to first simplify the old ntpd code, then port it to a safe language like Rust or Go. The project has some problems but they are getting ambitious work done. Keep an eye on it.
  • systemd-timesyncd is everywhere now thanks to systemd. It’s too simple though, really just an SNTP client, and can’t discipline the clock nearly accurately enough to be useful for good time.
  • ntimed, see the blog. This project was looking promising but seems to have stalled out.
  • openntpd, the OpenBSD rewrite of an NTP daemon. It has a lot of problems including good clock discipline and leap seconds and is not really suitable.
  • ntpd! The venerable classic. Despite the problems the bugs are being fixed and it’s still the daemon I suspect powers most of the world’s Unix machines.

Chrony has a very useful comparison of chrony, ntp, and openntpd. The Performance numbers at the bottom are what’s most interesting to me (those numbers are microseconds).

End of the day, I think ntpd is still a decent choice. Chrony looks like the best alternative. I don’t have experience with it to comment on. I have no way of knowing if it’s more secure than ntpd. It’s also in C and has had some security problems.

Internet in the mud

This is what happens when my Ubiquiti wi-fi antenna outside falls off its mast into the mud

The network was surprisingly useful in the bad period. I didn’t really notice for basic web stuff, although I did notice video streaming was unreliable. The main thing I could measure was my ping time to the antenna (as measured by mtr) had a standard deviation of 28ms. 5% packet loss too. So something was wrong, but the hardware handled it robustly. What’s with the delayed pings, btw, is there some retransmit logic involved somewhere? In the wireless devices?

“In the mud”, btw, mostly meant on the ground. Fortunately it fell facing my house. But with little or no line of sight to the house. Mind you the other antenna in the house is literally behind a wall; it works well enough I’ve never bothered to mount it in the window.

Ubuntu 16 NTP notes

I love NTP. What’s it look like in Ubuntu 16? ntpd is pretty much the same, but some change or things I’ve never noticed before.

Debug mode 7 queries are now entirely disabled. The ntpdc program basically doesn’t work; you use ntpq instead. Given the number of times this protocol has been used in a UDP amplification DDOS, it’s a necessary change.

ntpd is started with the -g flag. This flag allows NTP to set the system clock once no matter how far out of sync it is. The default behavior is to never move the clock more than 1000s as a sort of sanity check. In practice it’s usually the client that’s insane, not the server.

servers are now configured like this

pool 0.ubuntu.pool.ntp.org iburst

“iburst” means the ntpd will try 8 times in 16 seconds to reach an unreachable server. The “pool” directive is not in the man pages, but these docs explain it. It tells ntpd to use DNS differently, to look up random new IP addresses every time. I’m not positive but I think ntpd still isn’t smart enough to look up a new pool IP address every few days or when a server goes offline. But at least it’ll get different IP addresses for the same hostname.

In addition to ntpdate/ntpd, Ubuntu also now provides timedatectl and systemd-timesyncd, part of the systemd hydra. It’s not very well documented; see Arch’s docs and this announcement. It’s a lightweight client-only time synchronizer. That seems like a good idea for security / client footprint. But it may be a bit too lightweight. It sounds like it only gets time from one server, for instance, and I wonder if they’re doing the PLL clock syncing that makes ntpd so good. systemd’s stuff gets out of the way if you are running ntpd.

Verizon tethering experiment

I need a backup for Internet in Grass Valley for when my WISP goes down. (Which is frequently, every Sunday morning lately.) Verizon now enables tethering on iPhones at no extra charge, just data used, part of the new simpler service plans. So I tried it briefly.

Quick result is it’s not bad. I have two dots of signal on my iPhone. I get 4Mbps down, 130kbps up on a DSLReports speed test. Latency to somebits.com was 130ms average, compare 90ms on my WISP link. But the jitter was terrible, some 400ms+ pings. At $5-$10/GB I’m not going to want to use this regularly, but it’s fine as a backup.

One oddity. My tethered network connection is genuinely IPv6, and my Mac automatically uses it. Yay! The downside is the first time I tried this I could only connect to IPv6 sites; v4 only sites like my own blog wouldn’t work. I originally tested this by configuring my ethernet to “off” in the Mac network preferences, and maybe somehow it retained the IPv4 route through the wire? Explicitly unplugging the wire worked fine.

I’ve been considering getting a mobile hotspot; Wirecutter recommends Verizon’s Jetpack AC791L for $200 (or $50 with a two year contract). It looks pretty reasonable if I want a dedicated device and not just use my phone. Main reason I see to do that is for travel, so I can keep my US SIM card in the phone. Verizon’s plan seems to allow extra devices on my account for $10 / device and I can turn it off and on. Or just buy the Verizon device with the contract.

                                                        Packets               Pings
 Host                                                  Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. 172.20.10.1                                         0.0%   158    2.7  18.9   1.8 303.4  43.4
 2. 69.sub-66-174-31.myvzw.com                          0.0%   157   37.5  77.4  28.2 319.4  70.9
 3. 20.sub-69-83-164.myvzw.com                          0.6%   157   41.1  81.8  26.2 400.8  75.2
 4. 170.sub-69-83-164.myvzw.com                         4.5%   157   36.7  81.5  25.2 323.5  78.8
 5. 2.sub-69-83-164.myvzw.com                           5.7%   157   35.1  77.9  30.4 382.5  71.4
 6. 12.sub-69-83-163.myvzw.com                          8.3%   157   41.4  72.9  30.1 455.9  69.5
 7. 33.sub-66-174-29.myvzw.com                          2.5%   157   42.1  83.5  29.6 380.4  81.1
 8. et-2-0-0.GW11.SAC1.ALTER.NET                        8.9%   157   28.1  71.8  28.1 349.4  65.8
 9. ???
10. 0.ae1.BR3.SJC7.ALTER.NET                            3.8%   157   46.5  94.3  35.6 394.6  71.2
11. 204.255.168.26                                      8.3%   157   56.1  80.3  32.7 289.6  61.7
12. 100ge12-2.core1.den1.he.net                        10.8%   157   76.8 120.1  76.8 509.8  60.7
13. 100ge14-1.core1.mci3.he.net                        21.7%   157   99.9 124.2  86.2 310.3  45.4
14. 10ge4-1.core1.mci2.he.net                          49.7%   157   93.1 120.8  84.0 454.4  58.9
15. wholesale-internet-inc.10gigabitethernet1-3.core1. 38.9%   157  105.2 125.4  79.4 336.2  61.4
16. lag-to-oak.edge-b.clay1.mci.us.as32097.net         39.7%   157   94.2 130.1  77.5 377.2  64.2
    lag-to-oak.edge-a.clay1.mci.us.as32097.net
17. lag-core-a.dist-1-3.clay1.mci.us.as32097.net       34.4%   157  101.9 122.1  82.0 333.8  54.4
    lag-core-b.dist-1-3.clay1.mci.us.as32097.net
18. wk.somebits.com                                     0.6%   157   97.5 135.5  77.6 436.9  72.9

127 packets transmitted, 127 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 79.470/131.121/471.344/69.791 ms

Weird cable modem routing

Here’s a strange mtr report:

                                       Packets               Pings
 Host                                Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. router.nelson.monkey.org          0.0%   234    0.3   0.3   0.2   0.6   0.0
 2. 10.21.156.1                       0.4%   234   21.9  15.9   9.6  42.3   4.1
    104.220.254.153
 3. 10.21.156.1                       0.9%   234   24.4  16.5   9.6  71.3   5.6
    104.220.254.153
 4. 104.220.254.153                   0.0%   234   14.7  16.1  10.2  33.0   4.1
    cr1-200p-a-be-100.bb.spectrumnet.us
 5. cr1-200p-a-be-100.bb.spectrumnet  0.0%   234   23.3  17.2   9.8  42.5   4.6
    cr1-9greatoaks-te-0-5-0-13.bb.spectrumnet.us
 6. cr1-9greatoaks-te-0-5-0-13.bb.sp  0.0%   234   23.5  17.7  10.7  57.0   5.7
    72.14.204.109
 7. 72.14.204.109                     0.0%   234   13.9  17.6  10.5  37.9   4.4
    108.170.242.241
 8. 108.170.242.241                   0.0%   234   17.1  17.6   7.8  44.2   4.3
    216.239.49.83
 9. 216.239.49.83                     0.0%   234   15.0  17.2  11.4  36.6   4.5
    google-public-dns-a.google.com
10. google-public-dns-a.google.com    0.0%   233   12.5  17.3  11.1  47.6   4.8

It’s hard to read that at first, but what’s going on is the path is changing at hop 2. Sometimes my packets go directly to 104.220.254.153, sometimes they go through 10.21.156.1 first. And the packets take 4 or 5 hops before they get out of the local ISP and in to spectrumnet.us, suggesting sometimes they visit those other two addresses more than once. (I wish traceroute would break this out for me, show which fraction of packets take which route.)

That’s a capture from home in San Francisco, my ISP is Wave Broadband (aka Astound). They provide good clean 100Mbps without any of Comcast’s bullshit and have mostly been reliable. I had some problems yesterday (massive packet loss, lag) which got me looking. The problems went away when I rebooted my cable modem (which itself is WTF), but this weird routing remains.

I can’t tell if that reported 0.9% packet loss is real, or an artifact of mtr’s TTL trickery or reporting. A straight up ping to 8.8.8.8 showed 0 loss in 1500 packets, so it may not be real.

I have some vague theory that what’s going on is there’s local congestion and if stuff gets buffered, 10.21.156.1 becomes visible. But I have very little evidence for that.

Ubuntu name lookup: DNS vs NSS

Usually when I want to look up a domain name, I use the “dig” or “host” command. This issues a live DNS request to the configured DNS servers and you get a response from DNS. Sometimes I use “whois” on the domain first to find the domain authority, then do a “dig @server name” to find the actual live authoritative response, bypassing whatever cache my usual resolver (Google DNS) has.

But client programs on Ubuntu don’t issue DNS queries directly. They use NSS, the Name Service Switch, as configured in /etc/nsswitch.com. (In the long long ago a similar system was named YP, for Yellow Page). NSS often ends up using DNS to resolve a hostname. But it also uses local files like /etc/hosts. I’ve always had some fear it did its own caching too, although I don’t think my system does. There’s a daemon called nscd that would do caching, but I don’t have it installed.

Anyway, ordinary programs like “ssh” or “ping” don’t use DNS directly, they use NSS to look up IP addresses. So how do you query what NSS would do? The getent program.

$ getent ahosts google.com
216.58.194.142 STREAM google.com
216.58.194.142 DGRAM
216.58.194.142 RAW
2607:f8b0:4000:80d::200e STREAM
2607:f8b0:4000:80d::200e DGRAM
2607:f8b0:4000:80d::200e RAW

That’s returning a lot of data! “getent hosts google.com” returns a single address, which is generally what you mean. But for Google that gives you an IPv6 address. The “ahosts” command prints all possible matches, which is useful for debugging.

I’m digging into all this because of a frustrating problem with a freedns dynamic DNS name I use for my home machine. Every six months they decide I’m inactive and change the address to some domain parking page. In theory they email me a warning but it never gets through. So it breaks scripts I have that use the name to access to my home network. And I dutifully log in an re-enable my account, but it takes awhile for the changes to propagate.

After I re-enabled my account, “host” and “dig” would show the right address but “ping” or “ssh” would use the wrong address. Turns out if a domain is disabled freedns sets its A records to both 127.0.0.1 and 87.98.255.18, their parking web server. So that’s confusing. On top of that they set a TTL for one hour, which is kind of awful for something you’re trying to update. But I think my real problem was that one Google name server had cached the old bad address but another had cached the good new address, so queries were giving me random ones.

I’m going to just add a manual entry to /etc/hosts for now until that hour period is up.

DNS ANY requests are deprecated?

Saw something new in DNS recently

$ dig reddit.com any
reddit.com.    		3788   	IN     	HINFO  	"Please stop asking for ANY" "See draft-ietf-dnsop-refuse-any"

Huh. Turns out there’s an effort afoot to refuse ANY requests. CloudFlare’s post on their reasoning is instructive. Long story short ANY was mostly only used for debugging, not in real applications. But it’s also expensive to serve and easy to abuse, particularly in DNS amplification attacks. So out it goes.

Too bad, but I see the dismal logic of it. Chalk it up along with AXFR DNS queries and NTP’s monlist command for “why we can’t have nice things that use UDP”.

Ubiquiti cranky customer

Very happy with my Ubiquiti network hardware. Unimpressed with the software experience. Just sent this cranky email to their support, where I’m sure I will get a canned “thanks for the note” reply and nothing will improve.

Your products have three problems that harm the perception of security. Y’all make excellent network hardware, but your software should be as excellent. I’ve already worked around these problems, just registering a complaint.

The Unifi Controller Mac application is not signed. MacOS refuses to launch it until I disable Gatekeeper security.

The Unifi Controller does not come with a valid SSL certificate. I realize this is complicated, but it’s a bad experience to require users to disable Chrome SSL checks to use the product.

Your reset password links from ZenDesk are being flagged as spam by Gmail. They say “Why is this message in Spam? It has a from address in ubnt.com but has failed ubnt.com’s required tests for authentication. Learn more”.

Thanks for listening,
Nelson

Ubiquiti Unifi access points

Boy, bad first impression of a product. I got a Ubiquiti wireless access point. Figured I could set it up in 10 minutes and go; what could be easier? Lol, joke’s on me. They now require a 200 megabyte “Unifi Controller” running on some machine on your network to configure the devices; no more simple web interface. Instead the controller talks some magic protocol to the devices and then runs its own web server on port 8843 with a fancy web UI. Did I mention the Mac binary is not signed, so it won’t even run without working around Mac’s security system? And the SSL certificate doesn’t work? Awesome.

The software itself seems useful but complex. The manual is 154 pages. It provides group management of all Ubiquiti devices on my network. This seems like it would be great if I had a complicated network with a bunch of Ubiquiti devices. Maybe that’s their market. I just have one device, though, and it better play nice with the rest of my network. Fortunately this is just an AP, and stumbling through I got it working without much effort.

I think it was as simple as going through the basic config of the controller software (username, password, wifi settings), then choosing the Devices tab and clicking “adopt” on the access point.

Sitting 6 feet from the AP I’m getting a full 100Mbps according to DSLReports’ speed test. (Link layer claims 216Mbps). Putting the AP where my old one was gives more like 20Mbps, but I think it’s still better WiFi than the Asus RT-AC66U that I use. But the whole point of this is I want a second AP for upstairs, so I’ll end up running both.

Not a fan of the Power-over-Ethernet brick they provide. I’m confused about POE, there seems to be multiple standards for voltages and which pins are hot. I have no idea if it’s feasible for me to run POE for my whole house, particularly since this punchdown board everything goes through is some Levitron piece of crap that can’t even reliably do gigabit.

freedns annoyance

I’ve been using freedns.afraid.org for years for dynamic DNS, to access my home machines on dynamic IP addresses. Nice little service, valuable but not quite valuable enough to be paying money for.

Or so I thought. They have a thing where my domain name gets marked “dormant” and they change the DNS records to point to a static advertising site. I have to log in again to say “no I’m really using this still”, then wait for the one hour TTL expiration for things to work again. Ugh. Shades of DynDNS, the slow decline from being a useful free service to being crap.

I get it, they want to make money on me, OK. But their business goals are so modest it seems odd to inconvenience 2,500,000 free users in hopes of signing up 1000. Verification is useful; maybe they need to somehow clear out old unused names. Just wish there were some better way than “we broke your name good luck!”. Like a reminder email or something. The news page from 4 years ago says he’s working on a graceful notification. Guess that didn’t work out. (They seem to have been sending emails at one time but I’ve never seen one.)

The other DNS host I use is Hover, as part of their domain registry. They still don’t support any dynamic IP option.

NTP surveys

Way back in 1999 I did a survey of NTP. I spidered the whole Internet’s collection of NTP servers and published some statistics. From a desktop Linux box in my office at MIT, without permission, which raised a few eyebrows. But it was the 90s Internet and it was awesome.

These days NTP is much more widely deployed. It’s also been the cause of some security exploits and DDOS traffic, so I fear my kind of survey is much harder to do now. But I get requests about it occasionally, I think mostly from students. Here’s an email of answers I just sent today. Shodan’s view of NTP servers looks like an interesting place to start.

First of all,you use ntpq or ntpdc to do the query,is there any other method to do that now?

I mostly used ntpdc for access to the “monlist” command, which shows clients who are asking for the time (ie: downstream links). Both ntpq and ntpdc support “peers” to show where this particular server is asking for time (ie: upstream links). I also have used ntpdate to just query the time.

Secondly considering the Internet security,most of hosts are behind the firewalls,can the final result actually reflect to the true conditions?

Yes, you are right. It was a concern in 1999 when I did my survey and it’s only gotten much worse. I wonder now whether a survey like I did is even possible. There have been several high-profile security problems with NTP in the past few years, including an exploit in ntpd using monlist. Also NTP queries can be used for DDOS queries. The net result is that most servers are much more secure now and may not answer anything other than a basic “what time is it” query. Also I suspect a survey like mine would set off many alarms.

Finally,can I conduct the survey on a computer running Windows operating system?Can you give me some suggestions?

It should be possible on Windows, but I’m not sure how to do it. You want some way to make ~100 NTP requests simultaneously. It’s pretty easy since it’s just a UDP protocol, but I don’t know the best way to do that on Windows.
Two other things you should look into:
The NTP Pool is where most Internet clients get their time today. There’s about 4000 servers total and I’m sure there are plenty of opportunities to survey and research just those servers. The NTP pool developer community is friendly, you should talk to them before doing any significant survey work.
These days it is relatively easy to query every single IPv4 address in the world, all 4 billion of them. One site that does this regularly is Shodan. For example, here is their search result showing 835,000 NTP servers: https://www.shodan.io/search?query=ntp

DNS glue records

Had a bit of DNS I didn’t understand today. The whois records for google.com say the name server is ns1.google.com. So how do you look up the address for ns1.google.com? That’s a circular dependency!

Turns out the answer is glue records; there’s a good explanation in the first two answers on Stack Exchange, or enjoy this comic strip. Long story short, the same TLD server that tells you that the name server for google.com is ns1.google.com also provides an “additional” non-authoritative A record for ns1.google.com. That short-circuits the circular dependency. You can see this reply yourself with dig +additional. Here’s a (heavily shortened) transcript where I only show the lines along the actual resolution chain:

$ dig +trace +additional google.com SOA

.			13529	IN	NS	g.root-servers.net.
;; Received 397 bytes from 192.168.0.1#53(192.168.0.1) in 31 ms

com.			172800	IN	NS	k.gtld-servers.net.
h.gtld-servers.net.	172800	IN	A	192.54.112.30
;; Received 734 bytes from 192.112.36.4#53(g.root-servers.net) in 279 ms

google.com.		172800	IN	NS	ns4.google.com.
ns4.google.com.		172800	IN	A	216.239.38.10
;; Received 660 bytes from 192.54.112.30#53(h.gtld-servers.net) in 361 ms

google.com.		60	IN	SOA	ns3.google.com. dns-admin.google.com. 117627770 900 900 1800 60
;; Received 210 bytes from 216.239.38.10#53(ns4.google.com) in 36 ms

The key thing there is the third segment. My computer asked h.gtld-servers.net who the name server for google.com was, and it gave me an NS record naming ns4.google.com. But then it also volunteered a non-authoritative A record for that name, 216.239.38.10. That’s the “additional” response that serves the glue record.

The other question is how glue records are administered; who told gtld-servers.net the address for ns4.google.com? How do we keep that IP address updated? I’m not sure. My registrar Hover just lets you fill in a glue record but doesn’t explain how that gets sent to the TLD servers. Gandi’s docs have a good explanation too. My guess is it’s part of the protocol that registrars use to communicate with the companies that maintain the TLDs. You don’t just give them NS records for each domain, but you can give them an A record too. I wonder if they auto-update? I’m guessing not.

Glue records are old: they are explained in RFC 1033, complete with an example at SRI.com. This DNS book notes that glue records can also be an optimization; it’s basically providing the answer to the next question the resolver is about to ask. At the cost of being non-authoritative.

(Reading this whole chain I realize I’m still a bit confused about how DNS works. My computer asks my name server 192.168.0.1 who the name server is for “.”, the root, and is told g.root-servers.net. Note it gets no additional A record. But then my computer already knows that g.root-servers.net is 192.112.36.4, how did it know that? Maybe a cache? Then it asks that root server for the name server for .com and is told k.gtld-servers.net, along with an additional A record. From there it can ask about Google.)

Hat Tip to Andy Fowler for giving me the magic keyword “glue records”.

CNAMEs at a DNS root

It’s common wisdom that you can’t use a CNAME at the root of your domain. http://www.example.com can be a CNAME pointing to something, but example.com can’t. That makes hosting websites on naked domains awkward. Only confusingly you actually can do this, it’s just a bad idea. And some DNS services make it look like you’re doing it in a good way, but really they’re faking it. It’s all pretty confusing but I think I understand what’s going on in detail. This post was motivated by this Hacker News thread.

A reading from the holy text, RFC 1034

A CNAME RR identifies its owner name as an alias, and specifies the corresponding canonical name in the RDATA section of the RR. If a CNAME RR is present at a node, no other data should be present; this ensures that the data for a canonical name and its aliases cannot be different. This rule also insures that a cached CNAME can be used without checking with an authoritative server for other RR types.

So if you make example.com a CNAME, you can’t put any other DNS records on it. AFAIK you can actually do this and it will work as well as a CNAME will. The problem is you often want other DNS entries at the apex domain. You want an MX entry so you can redirect mail at example.com. You want a TXT entry to verify you own the domain name to various services. You might want special funky records for DNSSEC or other stuff. It really doesn’t work to make your apex domain an alias for some other domain.

Confusingly, a lot of the big DNS providers do let you set up a CNAME at the apex domain. But behind the scenes they aren’t really serving it as a CNAME; it’s more of a synthetic alias implemented by their DNS server. Typically it looks up the destination host address and quickly substitutes that IP in with an A record for your apex domain. That breaks the end-to-end principle of the DNS lookups, which causes problems for geographic load balancing, fast cache expiry, and probably DNSSEC. But it’s not a terrible solution.

Here’s a list of some of the DNS vendors’ aliasing technology

Long story short, if you want to serve a website from an apex domain it requires compromises and/or protocol fiddling.

Looking at all this I wonder if the world would be well served with a special DNS entry just for web servers. It’s weird to put something application specific in DNS, but there’s a strong precedent in MX entries, for mail delivery. Probably a bad idea to extend that to the web, but maybe it’d all some useful tricks?

 

DNSSEC examination

I was curious what was up with DNSSEC these days. A little bit of a dive on deployment and the way it all works in practice.

Bottom line: use a DNSSEC-aware nameserver like Google Public DNS and you will be protected from DNS records that were signed but tampered with. However very few DNS names are signed.

You can see quick DNSSEC tests in a browser. This page displays a DNSSEC Secured!” if you are secure. This site should fail to load entirely (name won’t resolve) in a secured system.

Deployment

My main question is how widely DNSSEC is deployed. This little name-and-shame site gives a pretty depressing answer, the top 25 sites according to Alexa all don’t support it. Particularly curious why Google doesn’t publish DNSSEC records. They’re not dumb or lazy, they take security very seriously, I imagine they think it isn’t important or useful for some good reason.

Verisign’s DNS Scoreboard says some 625,000 domains are DNSSEC secured. That’s like 0.4%, although it is growing.

percent-trace.png

 

Example DNSSEC records

The Verisign Labs DNSSEC debugger is the best web tool I’ve seen for examining DNSSEC records. Note the little “more/less” buttons in the display, if you click “more” enough you get to see the full response like dig gives you. You can also use dig to check things with “dig +dnssec”, then look for the extra records and the “AD” flag in the response.

Here are some test domains and their properties. Note I wrote this in Dec 2015, things may change afterwards.

  • google.com: no DNSSEC on the domain.
  • ietf.org: working DNSSEC, a simple signed domain.
  • www.ietf.org: working DNSSEC that’s a CNAME to CloudFlare, which also has DNSSEC (since last month).
  • www.paypal.com: working DNSSEC at PayPal, but www is a CNAME to Akamai, which does not have DNSSEC enabled.
  • dnssec-failed.org: a deliberately broken DNSSEC record. Most tools and nameservers I use won’t even give you any data from this record, presumably because it’s broken. I had to view the web page via archive.org, which apparently isn’t verifying DNSSEC. Neither is Googlebot unless they special-cased it.
  • rhybar.cz: another deliberately broken DNSSEC record.

Screen Shot 2015-12-20 at 10.13.32 AM.png

DNS server behavior

How do various public DNS servers handle DNSSEC records?

  • Google: supports DNSSEC, doesn’t return records for broken DNSSEC.
    dig @8.8.8.8 dnssec-failed.org +dnssec
  • UltraDNS: supports DNSSEC, doesn’t return records for broken DNSSEC.
    dig @156.154.70.1 dnssec-failed.org +dnssec
  • OpenDNS: does not support DNSSEC at all. Will return records even if DNSSEC is bad.
    dig @208.67.222.222 dnssec-failed.org +dnssec
  • Verizon / Level3: does not support DNSSEC at all, returns bad records. (The list I’m working with says this service is “DNSSEC aware”, but that’s not the same as “validating” apparently.)
    dig @4.2.2.1 dnssec-failed.org +dnssec

Bottom line it looks like there’s two types of servers. Those that do support DNSSEC and won’t return any data if a declared DNSSEC record is broken, and those that are ignorant of DNSSEC entirely. That’s to be expected.

I’ve long been a skeptic of OpenDNS, and their lack of DNSSEC support is another reason to not like them. Back in 2010 they proudly announced they were going to back DNSCurve instead. No one else has supported it since then, so I assume it’s basically a dead end. Their arguments for DNSCurve was that no one was using DNSSEC and that DNSSEC’s choice of crypto algorithms was weak. Adoption is still a problem for DNSSEC, but it supports many different crypto algorithms now so I assume that’s less of a problem.

I’d like to note that my OpenWRT DNS server seems to not pass on the AD flags. I’ve got it configured to use Google DNS upstream, so I get the benefit of the protection since Google simply won’t return records for broken domains, but clients won’t get to see if the records are properly signed or not. I think this is fixable, either by changing to a different DNS resolver in OpenWRT or maybe just telling dnsmasq to add DNSSEC.

Client support

The whole point of DNSSEC is to authenticate the DNS record all the way to the client. But I don’t think many (any?) consumer clients are validating DNSSEC themselves. Instead they are trusting their DNS server to validate for them. That violates the end-to-end principle.

On testing, I believe MacOS 10.9 does nothing with DNSSEC. If I manually set my DNS server to 4.2.2.1 (a Verizon server that does not do DNSSEC), Chrome can load the test pages with broken DNSSEC signatures. I suspect MacOS is just assuming you should trust your DNS server.

I didn’t test it, but I think stock Ubuntu does not do DNSSEC either. The glibc resolver doesn’t seem to have it. I did run across some libraries that do DNSSEC; libval, ldns, and knot. And if you’re running bind or dnsmasq you can enable DNSSEC on those.

I found one Chrome extension that verifies DNSSEC itself. Neat! But it requires a native binary plugin and that was more than I felt like dealing with.

Final thoughts

DNSSEC seems to mostly work, just adoption is slow. On the server side, the root DNS servers didn’t support it until July 2010; before then it would have been very awkward to use. For clients, Google DNS started doing DNSSEC in May 2013, so that’s been a good long while now. But end user clients aren’t doing anything themselves.

One question I didn’t explore is overhead. All those extra DNS records take memory and bandwidth to serve. And verifying signatures takes CPU time. I don’t think that’s prohibitive at the edges given all the room for caching, but the big DNS server operators may be worried.

 

LoL lag on Wifi

When I play LoL with a wired connection to my router in Grass Valley it looks like this. But when I play via WiFi it looks like this. Periodic ping spikes, from the usual 85ms to 170ms or so. Note the packet loss number is the same, about 10 packets/s. This ping pattern is not particularly noticeable while playing, but sometimes on WiFi I’ve had serious lag, disconnects, etc. Not so much when wired.

The WiFi link is as good as it could be. I’m 10 feet from the router, clear line of site, 30dB SNA. 802.11n, 5GHz, relatively quiet network. Either there’s something broken with the hardware or else WiFi really is just this unreliable. Need to experiment more. I sure wish I knew what algorithm LoL used to report ping. Last time I did the packet dissection work it looked like it was the RTT time on special ping/pong packets. Maybe they get lost and are retransmitted?

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.

OpenWRT: persistent DNS entries

One wrinkle with OpenWRT: if the router reboots, it loses the DNS entries it was giving based on DHCP leases. Even the ones you’ve configured as static DHCP leases, they don’t show up until the client host renews its DHCP lease. Forum discussion suggests this is because dnsmasq is reading from the dhcp.leases file which is stored on tmpfs, not permanent storage.

The simple workaround is just to manually add the host in /etc/hosts and restart dnsmasq. It will serve those entries to DNS clients. That means the client’s IP address is now stored in two different places, which is not ideal, but I can live with it. There’s some discussion of other solutions for this like moving the DHCP lease file to permanent storage or changing the configuration tool to manage parallel entries in both DHCP and dnsmasq. As of 15.05, none of that seems to be happening.

I’m liking OpenWRT now. It’s comforting working with a router that’s a full and proper Linux distribution. It’s also sort of overkill, but on the balance I like it.

Networking complication

I’m in over my head with this wireless ethernet bridge thing. Story isn’t complete, but collecting my notes. There are further writeups of this question in forum posts I’ve made: on OpenWRT forums and on Ubiquiti forums.

The real problem is I don’t understand Linux networking any more. Ethernet address aliases are new to me, and I’m confusing routing and bridging, and my knowledge feels too outdated to diagnose this properly. Honestly if it hadn’t all Just Worked on my old Tomato box I’d never have believed this was possible.

I have three subnets:

  1. My home LAN, managed by my OpenWRT box, running 192.168.0.1/24.
  2. My ISP’s network, managed by their gear, running at 10.33.1.1/24.
  3. My management IP addresses for the Ubiquiti wireless bridge, mostly invisible, but running at 192.168.1.110/24 and 192.168.1.111/24.

The challenge is getting my OpenWRT router to be able to talk to the boxes at 192.168.1.*. With Tomato I just added a static route and all was done. I tried that with OpenWRT and no luck.

A lightbulb went off thanks to an answer on the Ubiquiti forums. The WAN port on my OpenWRT boxes now has two addresses: 10.33.1.50/24, assigned by the ISP via DHCP. And also 192.168.1.1/24, assigned manually by me to talk to the Ubiquiti gear. I managed to make that actually work by manually running “ip addr add 192.168.1.1/24 dev eth0”. And now I can talk to the Ubiquiti boxes!

BTW, this whole “ip addr” thing is new to me. In my day we used ifconfig and every interface had one address, thankyouverymuch. Kids these days with their multihoming and aliases and VLAN tagging and stuff. Just don’t understand it.

Update: I added this IP address alias permanently to the routers config by following these docs, which led me to add this block at the end of /etc/config/network

config interface 'ubiqnet'
    option 'ifname' 'eth0'
    option 'proto' 'static'
    option 'ipaddr' '192.168.1.1'
    option 'netmask' '255.255.255.0'

Those same docs have a worrying warning “On openwrt 12.09, a lan interface that is first defined as dhcp interface and then has aliases with static ip address could cause problems in routing the lan traffic through the wan zone”. I think that’s exactly what I’m doing but I’m running 15.05; maybe it’s no longer a problem?

Remote Wireshark capture

It’s easier than I thought to capture network traffic from a remote machine and display it in WireShark running on your local computer.

# one liner with named pipe
$ wireshark -k -i <(ssh root@192.168.0.1 "tcpdump -s 0 -U -w - not port 22")

# more explicit version of named pipe
$ mkfifo p
$ ssh root@192.168.0.1 "tcpdump -s 0 -U -w - not port 22" > p &
$ wireshark -k -i /tmp/p

# one liner with a normal pipe
$ ssh root@192.168.0.1 "tcpdump -s 0 -U -w - not port 22" | wireshark -k -i -

All three variants are doing the same thing; they ssh into the remote host you want to monitor and fire up tcpdump to get the packet stream via SSH. Then wireshark is launched to read from the stream.

The official docs for this talk about using named pipes, which is what the first two versions do. The <(command) thing is a special bash syntax for creating a named pipe for you, it’s just a more concise version of explicitly using mkfifo. The last version using stdin also seems to work for me but the docs say “it is not clear whether it always works”. The only mysterious thing I can think of is buffering questions, but I don’t know why a named pipe would be better than a normal pipe for that.

The tcpdump command is a tiny bit subtle. It’s important to not capture ssh traffic, since we’re using ssh as the transport and that’d create a feedback loop. The other options are basically “capture everything and don’t buffer”.

OpenWRT first impressions

I decided to get yet another new router, a TP-Link Archer C7 on the WireCutter recommendation. Mostly for 5GHz radio, but also as an excuse to play with new firmware. I’d really like some sort of reboot watchdog. My impression is both Tomato and DD-WRT are a bit long in the tooth and it’s time to try something new. OpenWRT has a lot of mindshare right now, I first noticed it because it’s the home of the fq_codel work for better QOS. Worth a try.

My first impression of OpenWRT is it’s definitely not for civilian use. Really it feels more like a nice custom stripped down Linux distribution you use from the command line, not a network appliance. If you just install it and run it you do get a basic working router. But some fundamental features like detailed bandwidth monitoring, Dynamic DNS, or UPnP/NAT-PMP aren’t enabled by default. And the Luci web GUI, while nice, is very technically oriented. For instance the default configuration screens are yammering at you about bridging and WLAN1 and a bunch of confusing stuff that I understand but your basic user won’t. I get the impression that really I shouldn’t be using the Web GUI at all, just log in via ssh and editing text files.

One specific reason I installed OpenWRT is that it has a lot of third party packages. In theory a lot of this is manageable via the web GUI but I couldn’t even find the “update package list” button so ended up running “opkg update” on the command line instead. It is awesome that OpenWRT has a sane package management system!

I like that OpenWRT is clearly designed to support IPv6 well.

Some interesting packages:

  • tcpdump: for network diagnostics
  • luci-app-sqm: fq_codel QOS. traffic shaper.
  • wget curl netcat: some basic things on hand. these have to install SSL, so it’s a significant download / disk space.
  • nano, less: unix file utilities
  • luci-app-statistics and collectd-mod-*: historical stats for router
  • luci-app-vnstat: more historical traffic stats
  • luci-app-upnp miniupnpd: UPnP and NAT-PMP port forwarding
  • watchcat: reboot if ping fails for a long time
  • luci-app-*: applications that have a Web UI for them. Many useful things here.

All in all OpenWRT seems great for someone lwho wants to build and maintain a custom router software installation. If you just want a basic router that works I think stock firmware may be a reasonable choice these days. Or else Tomato/Shibby, but that’s pretty wonky.

Now I’m trying to figure out my weird network setup to talk to the usually-transparent Ubiquiti boxes.

Hotel internet woes

Travelling in France, various problems with hotel Internet:

  • The one whose captive portal logs you out every 15 minutes
  • The one that resets HTTP requests for various Javascript libraries, including some basic things likes like JQuery and Dojo. On further inspection my guess is it has a whitelist of allowed Javascript URLs and blocks all others.
  • The one that requires an email address and gives you 10 minutes to verify a code sent to it. After entering the code your 10 minutes is not extended, but logging in again with the same credentials does work.
  • The one that doesn’t allow SSH connections.
  • The one whose captive portal aggressively intercepts connections sometimes breaking web page reloads.
  • The one that is just crushingly slow.
  • The one that is sort of fast on download but 400kbps on upload. Trying to Tweet a 2MB photo times out.
  • The one that works reasonably well, if slowly, but 1 of the 12 wifi access points is broken. The one closest to my room, and me with no idea how to tell my computer to ignore that single access point. They brought a new access point for me, some ZyXEL consumer hardware. It works better but the antenna is broken off so the WiFi is weaker than the rogue bad AP. Fortunately the ethernet switch on it worked so I was able to use my own wifi router.
  • The one whose captive portal can’t capture Google, so the obvious way of triggering the login capture process does not work.

France has a particular problem in that the law requires all Internet users have to identify themselves. A requirement which is not always reliably enforced, but it seems to be enough that few places are willing to just let you connect to a WiFi node; you have to type in some form of identification. Hotels love getting your email address, of course.

The real problem is all this captive portal hackery; it may be an even worse networking abomination than NAT. Wasn’t there some effort to at least standardize a captive portal response so your browser understands that “www.google.com” isn’t actually a page for a shitty Novotel?

Ubiquiti success, sort of

Running a wire at my house isn’t working out, so I’m stuck needing a wireless link to get the 200′ outdoors to the base of a tree. Fortunately there’s power there! Today I replaced the hacky leftover router wireless link with a more permanent setup involving Ubiquiti hardware. So far so good, some things to improve.

The Ubiquiti equipment is interesting. In a lot of ways it’s just like a WiFi router with flexible firmware like DD-WRT on it. It has a wifi network interface and a wired network interface and various routing and bridging capabilities. But it’s more prosumer. Ubiqiuti has pretty solid firmware (airOS) and I’m impressed with details like the web-based discovery tool and the way it reconfigures itself quickly without rebooting. Also the wireless implementation seems much more solid than consumer gear. And the hardware is designed for outdoor use with directional antennas, and supports distances of 5 miles out of the box. Pretty impressive.

One massive caveat: the wireless link startup time is slow. Like 30+ seconds, maybe 5 minutes the first time. It appears to be scanning the spectrum for the right channel to use. Not sure why that takes so long, or why you can’t just rely on normal 802.11 frequency hopping for the 5GHz links.

I set up a Nano M5 and a Nano Loco M5 paired together as a transparent ethernet bridge. That configuration means those devices are invisible to the rest of my network. My router sits at the other end and gets DHCP from my ISP’s equipment. The wireless network SSID for the nanos isn’t even visible (and anyway it’s not standard 802.11). I think this is the right configuration for my purposes.

The configuration is like this:

  • A WISP POP a mile away with IP 173.195.173.1
  •    ... via a wireless link to ...
  • ISP hardware in my tree, acts as a DHCP server and NAT router.
    The WAN side is at 173.195.173.xxx
    The LAN side is at 10.33.1.1 and provides DHCP and NAT to my house
  •   ... via an ethernet cable to ...
  • Nano M5 in Access Point mode. WDS is enabled for bridging. This device has an IP address of 192.168.0.111 but that’s mostly invisible.
  •   ... via a 5GHz airMax link to ...
  • Nano Local M5 in Station mode. WDS is enabled for bridging. This device has an IP address if 192.168.0.110 but that’s mostly invisible
  •    ... via an ethernet cable to ...
  • My home router, an ASUS RT-N16 running as full AP + Router.
    The WAN side gets its IP address via DHCP from the ISP (via the Nanos). It happens to be 10.33.1.23 at the moment.
    The LAN side is 192.168.0.1 with subnet 255.255.255.0. Also provides DHCP and all the other home network services you’d expect
  •    ... via an ethernet cable or 2.4GHz 802.11 link to ...
  • Desktop computers, mobile devices, etc in 192.168.0.*

The good news is I’m not doing triple-NAT anymore. My router is doing all the real NAT work for my house. The ISP’s hardware is also NAT but I’ve taken pains to only have the one device connecting to it.

The main problem with this configuration is from my house network I can’t access the Nano status pages at 192.168.0.110/111. My router and the rest of my house’s devices think all of 192.168.0.* is on the LAN interface so won’t send packets out the WAN interface where they are. I could hack around this with static routes but that’s dumb. I should reconfigure the Nanos to a different subnet like 192.168.25.*. Then I add a single static route for that subnet in my router and I think I’m done. (I could set them to 10.33.1.* but that’s a bit funky, I definitely don’t want to risk those devices being visible to the wider Internet.)

The other small problem I have is the secondary PoE port on the Nano M5 isn’t working. In theory this should provide power to the ISP equipment in the tree. Power passthrough isn’t enabled by default but I fixed that, still not working. More tinkering required, for now I just use a second PoE injector.

This Ubiquiti firmware is pretty powerful and I feel like there’s some simpler configuration where I get rid of my house router entirely, use one of the two Nanos to be the router too. I’m not sure that really simplifies anything though, I’d probably still want the third box acting as an access point inside the house.

Update

I renumbered the Ubiquiti bridge devices to 192.168.1.110 / 192.168.1.111 and added a static route for them in my router. Works great. Next project; some sort of monitoring for them. They have SNMP and I find references to Munin plugins.

I also figured out the secondary PoE problem. I thought maybe it was total power; the Ubiquiti device wants 8W, the Cambium radio in the tree wants as much as 7W. So 15W total and the PoE injector only puts out 12W. But then I read more closely and discovered that the Cambium PoE implementation is reversed from the usual passive setup. Cambium puts positive voltage on pins 7 & 8, not 4 & 5 like everyone else. How stupid! Really dangerous, I’m lucky the magic smoke stayed inside the Cambium gear when I plugged it in. Maybe they engineered in some safety to overcome the perversity of using reverse polarity from what is common. (I hesitate to say standard, because there is no standard for passive PoE, although the 802.3af standard has a mode B that looks an awful lot like the passive PoE everyone but Cambium does.)

I’ve also discovered the radio in my house works in a closet, behind a relatively thick wall. Signal strength is degraded; airMAX quality is 78% compared to 95% with a clear view through the window, and max speed is about 200Mbps instead of 300Mbps. Still well above what I need for the 12Mbps Internet link though. Going to test it out, would be nice to not have to mount that thing outdoors or in the window.

Outdoor wiring

(Some very boring notes so someone else can wire this up)

Conceptually, we’re connecting a wire from the antenna in the tree to the Ubiquiti NSM5, one long straight wire. But it’s complicated because we need separate PoE injectors to provide power to both devices.

The black wire from the tree goes to the Phihong PoE module. It goes to the port on the left, labelled “Data + Power”. Very important to use the right module; the Cambium tree antenna uses non-standard PoE and this Phihong PoE module is special. The word “PHIHONG” is in the upper left of the label, beneath a spiral P logo. It’s the longer module, that does not say “Ubiquiti” in the upper right. The top one in this photo.

An ordinary short ethernet patch cable goes from the “Data” port on the right side of the Phihong PoE module to the “LAN” port on the right side of the Ubiquiti PoE module. This cable is currently a 3′ coil of white wire (would be nice to replace with a 1′ cable). This cable is not powered, not PoE, it just carries data between the devices.

Another ordinary ethernet cable goes from the “PoE” port on the left side of the Ubiquiti module to the Ubiquiti NSM5 antenna. It goes to the port on the right labelled “Main”. The port labelled “Secondary” is not used.

Finally, plug both PoE modules into AC power. There’s an LED on the back of the Ubiquiti radio to confirm it’s powered, but it’s pretty hard to see in bright sunlight. Once the devices have power they both take about ~60 seconds to establish wireless links.

WiFi protocol notes

I’ve been doing Wikipedia reading associated with my wireless experiments on how 802.11n works. Here’s some brutal summaries, note I’m totally ignorant of signals processing and believe taming the electromagnetic field is basically witchcraft. I’m sure I made a mistake somewhere.

802.11n notes

  • 802.11b and 802.11g are basically a single wireless signal on a single 20MHz wide channel. 802.11g uses orthogonal frequency division multiplexing to split that 20MHz up into 52 separate subcarriers. There’s 8 different modulation and coding rates possible in 802.11g, resulting in data rates of 6, 9, 12, 18, 24, 36, 48, or 54 Mbps.
  • 802.11n is based on 802.11g.
  • 802.11n’s main innovation is multiple antennas and MIMO.
  • 802.11n can optionally use a 40MHz channel. That’s a bit naughty at 2.4GHz; it means you overlap with pretty much every other 2.4GHz user around you. My iMac doesn’t appear to support 40MHz at 2.4GHz.
  • 802.11n can also run at 5GHz. (My router doesn’t.) I don’t think it runs any faster at that frequency, although the channel separation is nicer.
  • Max 802.11n datarate at 20Mhz channels is 288.8Mbps. At 40MHz it’s 600Mbps.
  • Multiple antennas also allow for MIMO, multiple-input and multiple-output. I don’t understand this at all but the Wikipedia page says this is about exploiting multipath effects to effectively get more useful signals out of the same bandwidth. This seems like complete magic to me.
  • A specific thing MIMO does is spatial division multiplexing. I think this is effectively a directional thing, ie: “I can talk to radios north of me and radios south of me independently”. Only I’m guessing this has more to do with orientation of the antenna, and may explain part of why simply rotating my antennas so they were not all parallel resulted in a better connection. (If the access point’s antennae are parallel then they are not spatially disjoint.) My iMac is currently enjoying two spatial channels to the router, which makes more sense if you think of rotational spatial division.
  • You get 1 spatial stream per antenna+radio (sort of), and 802.11n supports up to 4 antennas. My Asus RT-N16 is a 2x2 configuration so that’s effectively 2 transmit and 2 receive antennae. (There’s only 3 physical antennae, no idea how that works). That’s why it maxes at 300Mbps; only 2 spatial streams. With 20MHz bandwidth it maxes out at 144.4Mbps. My iMac gets 1 spatial stream sometimes and 2 most of the time.
  • 802.11n optionally supports a 400ns guard interval, half the space between separate data frames as the old 800ns. That seems to boost throughput about 10%. The Wi-Fi signal app on my iMac reports speeds that suggest I am using this, sometimes. (Ie right now: MCS index 7, but 73 Mbps).
  • 802.11n supports a bunch of different coding rates. The coding rate describes how much of the signal is reserved for redundant error correcting bits. My iMac is typically seeing a coding rate of 3/4 or 5/6.
  • 802.11n supports several different modulation schemes. That’s the digital to analog part of the radio, the way bits are turned into waves. My iMac is mostly using 16-QAM or 64-QAM, which corresponds to 4 or 6 bits per symbol. Neat visualization here
  • The coding rate, modulation, number of spatial streams, and maybe even the guard interval are varying frequently, at least once a second. Presumably the access point is picking which variant to use depending on the current error rate.
  • 802.11ac is the new hotness. It’s 5GHz, supports 80Mhz and 160MHz channels, 8 spatial streams, 256-QAM (with non-standard 1024), etc. If my arithmetic is right the spec could in theory go up to 8Gbps (compare 600Mbps for 802.11n). I think in reality you can actually get gigabit wireless speeds. But only if the spectrum is uncongested and the signal path is clear. My fancy ASUS RT-AC68U claims up to 1300Mbps at 5GHz. That seems to correspond to 2 streams at MCS index 7, which is 64-QAM 5/6 rate.

MCS Index

Most of the 802.11n options are summarized in a single number called the MCS Index. See also this table. MCS Index specifies the number of spatial streams, the modulation type, and the coding rate. Those together define how much data can be stuffed in a single subchannel. Combine that with your bandwidth (20Mhz or 40MHz) and your guard interval and you get a max data rate.

In practice my iMac mostly hangs out at MCS 7 or MCS 12. MCS 7 is a very dense modulation and coding, but only one spatial stream, and it’s reporting 73Mbps. MCS 12 is a less dense modulation but 2 spatial streams, and reports 78Mbps.

Misc other observations

The upstream bandwidth from my link is 12Mbps, so I don’t really care about any of these higher speeds. I’m much more interested in reliability.

I had my RT-N16 configured to use 40MHz but my Mac wasn’t using that. (From a quick search, Apple doesn’t support 40MHz at 2.4GHz.) So I knocked it down to 20MHz in the router and now I think I’m getting a stronger signal. -60dBm instead of -65dBm. I suppose that’s possible? I didn’t measure carefully.

I’ve got two wireless devices connected to the router; my iMac and an old WRT54GL running 802.11g. I tried making both of those wireless links busy, about 5Mbps each, and didn’t see any obvious contention. My iMac didn’t even drop down to 1 spatial stream which I was sort of naively expecting. That’s all as it should be: 802.11g promises 54Mbps bandwidth and I wasn’t getting near that. Nice that it really works.

Google’s new OnHub router does 802.11ac and 802.11n in a 3x3 configuration.

My 2013 iMac’s wifi antenna is behind the Apple logo in the case. Why? Because it’s the only part of the back that’s not made of aluminum.

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.

Video bitrates

Interesting post from Riot explaining why they don’t broadcast 1080@60fps. Long story short, they say it’s too much bandwidth. I was curious how much bandwidth it really is so I used youtube-dl to look at the streams for the DotA 2 final this year.

For MP4 streams the bitrates for video only are:

Resolution   FPS     KBPS
       144    15      120
       240    30      255
       360    30      610
       480    30     1148

       720    30     2243
       720    60     3362

      1080    30     4191
      1080    60     5592

Bottom line: 1080@60 is 2.5x the size of 720@30. And 720@60 is less bandwidth than 1080@30. IMHO the faster framerate offers more of an upgrade than the extra scanlines.

Edit: the LCS live broadcast on Aug 22 is 720@60. 3800kbps total at the router. Format 298, which is h264.

For completeness: YouTube also offers VP9 streams. They’re mostly smaller except 1080@60, but the scaling is about the same. Here’s all the streams on offer.

160          mp4        256x144    DASH video  120k , avc1.4d400c, 15fps, video only, 34.59MiB
278          webm       256x144    DASH video  131k , webm container, VP9, 15fps, video only, 35.95MiB
133          mp4        426x240    DASH video  255k , avc1.4d4015, 30fps, video only, 77.52MiB
242          webm       426x240    DASH video  281k , vp9, 30fps, video only, 75.53MiB
243          webm       640x360    DASH video  525k , vp9, 30fps, video only, 141.57MiB
134          mp4        640x360    DASH video  610k , avc1.4d401e, 30fps, video only, 147.37MiB
244          webm       854x480    DASH video  957k , vp9, 30fps, video only, 254.94MiB
135          mp4        854x480    DASH video 1148k , avc1.4d401f, 30fps, video only, 293.53MiB
247          webm       1280x720   DASH video 1945k , vp9, 30fps, video only, 510.17MiB
136          mp4        1280x720   DASH video 2243k , avc1.4d401f, 30fps, video only, 561.60MiB
298          mp4        1280x720   DASH video 3362k , h264, 60fps, video only, 917.39MiB
302          webm       1280x720   DASH video 3372k , VP9, 60fps, video only, 815.76MiB
248          webm       1920x1080  DASH video 3580k , vp9, 30fps, video only, 896.15MiB
137          mp4        1920x1080  DASH video 4191k , avc1.640028, 30fps, video only, 1018.78MiB
299          mp4        1920x1080  DASH video 5592k , h264, 60fps, video only, 1.55GiB
303          webm       1920x1080  DASH video 5833k , VP9, 60fps, video only, 1.38GiB

WiFi transmit power readings

I’ve got a router outside about 200 feet from my iMac with a clear line of sight through a window. I’m running 802.11 at 2.4GHz over the distance. It works surprisingly well. I’m in a quiet rural area. The signal strength isn’t great and the speed isn’t what I’d like. The Tomato firmware I use lets me override the transmit power in the router, numbers from 0-250. Default is 17 or 42, folk wisdom is that up to 70 is “safe” although other folks say any setting is safe. Those settings may be throttled too, depending on what country you’ve configured the router to be in. Also apparently too high and you start getting distortion. Or not. Wireless is spooky.

Here’s some readings on signal courtesy of the WiFi Signal Mac program. Routers are running Tomato and/or Shibby and are using stock antennae. Readings taken under light to no load. All readings are approximate / variable and sloppy enough to not be very good. It’s not clear what these settings really mean; people call them “milliwatts” but it’s not clear that’s true.

All this stuff is using channel 11. 20MHz wide, AFAICT, even though I configured for 40. Measured noise is -79 to -82 dBM. I wish I understood how noise worked better. I’ve been able to use this link even when reported noise was higher than signal. Is that a thing WiFi can do?!

iMac 2011 tests:

Linksys WRT54GL 802.11g, 200 feet away

  • 12: -72 dBm
  • 42 (default): -75 dBm
  • 70: -72 dBm
  • 200: -67 dBm

ASUS RT-N16 802.11n, 200 feet away

  • 80: -68dBm
  • 200?: -68dBm. (May be limited by US country setting.)

a different ASUS RT-N16 802.11n, 10 feet away

  • 17 (default): -50 dBm

Macbook Air 2011 tests

ASUS RT-N16 802.11n, 2 feet away

  • 80: -32 dBm

ASUS RT-N16 802.11n, 200 feet away.

  • 80: -69 dBm

No real conclusions from all this. Boosting power might or might not make a significant difference; measurably it does with the WRT54GL, not so much with the RT-N16. The RT-N16’s signal strength also seems a little better, which is sort of expected since it’s 5+ years newer hardware with fancier antennas, etc.

One thing I didn’t record systematically is the improvement 802.11n brings. With the 802.11g links my actual link speed seemed to be 2Mbit/s as measured by Ookla Speed Test. I can get the full 12Mbit/s with the 802.11n. The reported theoretical Mbps of the wireless link is also significantly faster, as expected. The way I understand this is that 802.11n makes better use of available signal than 802.11g.

See also this discussion which shows improvements from -73 RSSI to -60 RSSI as power went from 1 to 55. Another graph shows improvements from -80 to -72 RSSI as power goes from 0 to 80. This article is interesting as well.

Update: antenna arrangement

Woah! I rearranged my antennas and picked up 5-6 dBm, which when I only had 6 dBm over noise basically doubles the SNR.

All the tests above are with the 2 or 3 antennas on the router all pointing straight up. Turns out that’s dumb, you want them perpendicular. I arranged the 3 antennas on the RT-N16 into a W shape (45 degree angles) instead of all 3 straight up. Went approximately form -68dBm to -63dBm. Who knew?

Update 2: hot rod antennas

I tried some third party antennas, advertised as 9dBm gain (compared to 3dBm stock). Not impressed. Measured signal strength at my iMac was the same, about -63dBM with both sets of antennae. The new antennae are over 2x as long, which I guess is probably good? But the connector isn’t stiff enough and it doesn’t hold its own weight at the 45° angle I figured out was better. I think I won’t be using these.

Update 3: symmetric readings

I forgot that my RT-N16 wifi router 200 feet away has a report of RSSI too, so I can see the signal from the other side. These readings are all +/- 3dBm fluctuations.

  • iMac hears -65. N16 hears -58
  • WRT54GL hears -61. N16 hears -52
  • MacBook Air hears -73. N16 hears -71

These devices all report noise measurements too but its’ radically different, like -75 dBm on the iMac and -92dbM on the WRT54GL. No idea what that means.

Update 4: San Francisco tinkering

I tried to apply what I learned about improving wifi strength in San Francisco. Different environment: I’ve got 10+ networks in view of me (mostly 2.4GHz?) and the walls of the house generate a lot more interference, I think because of metal lath in the plaster. Anyway, what I learned:

  • Changing xmit power from 42mW to 100mW didn’t help at all
  • Repositioning the antennas to a spread out W made things a little worse, if it had any change at all.
  • 2.4GHz and 5GHz work equally well downstairs, about 32dB SNR. Upstairs (away from router), 2.4GHz has a significantly stronger signal. like 10-20dB SNR vs 5-10dB.
  • Fancy ASUS routers have an “interference mitigation” setting that seems designed for dense urban areas. Turning it on didn’t help signal strength at all, may even have harmed SNR by 2dB or so. Nevertheless I’ve left it on with some theory it will help.

I wish there were some easy way to measure reliability. I don’t care about max throughtput nearly as much as I do reliable packet delivery at whatever speed.

LoL protocol: channels

I sliced my ~20 minute ARAM game packet capture a different way, looking at channel numbers. Enet is a multichannel protocol, it can contain up to 0xff different channels. No idea what guidance there is for using this feature, but here’s what I found. Note that my parser still breaks on some packets, so I discarded things that look malformed or very rare. Ie: report is not 100% complete.

Channel 0xff: control. 2%
Starts the game off with a CONN/VCON pair.
For the whole game, client sends PING roughly twice a second. It gets an ACK about 35-40ms later (my client’s RTT.) A new ping is sent almost exactly 500ms after the last ACK is received.
For the first three minutes, server sends PING roughly twice a second which then client immediately ACKs. Server pings mostly stop after 180 seconds, although I did see a single server PING at 519, 848, 964, 1666, and 1928 seconds.
The PING packets are generally just 12 bytes big, but occasionally are bigger: 30 or 31 bytes is next most common.

Channel 0x03: server to client. 42%
Entirely reliable packets. A whole lot. 54% are small (14 bytes is most common), but some get to 100s of bytes. I imagine this is the important game state.

Channel 0x01: client to server. 35%
This contains all of the traffic the client sends the server. A healthy mix of Enet packet types (reliable, unreliable, and unsequenced). 72% of these packets are very small (14, 24, or 25 bytes). Some are a little bigger.
I ran a second game which was a custom solo game for just 4 minutes with me doing nearly nothing, almost no input. There were almost no reliable packets sent by my client at all; that is consistent with the reliable packets being used for user input. I wonder if all the unsequenced/unreliable traffic is used for bot detection, tracking the user’s mouse position or other signals from the client?

Channel 0x04: server to client. 19%
A bunch of SUNR packets first; those are unreliable but sequenced. Then a stream of SUNS packets; those are unsequenced. No one packet length dominates, the most common is a 40 byte packet at 9%. But almost all the traffic is in the 40-60 byte length.

Channel 0x02: server to client. 1%
Entirely unreliable packets. Not many. 71% are 25 bytes.

Channel 0x05: server to client. 0.03%
This is a mystery. It’s very low traffic, 25 or so over the whole trace. But they’re there and they are sequenced.

Conclusions

I think channel 3 is most interesting as a source of lag; that’s the server sending reliable packets to the client. Channel 1 is also interesting since it contains the clients’ reliable packets to the server.

I just noticed that SUNS packets (unsequenced) still contain sequence numbers. That’s handy for monitoring out of order and loss even if the protocol doesn’t treat those as errors.

I also did a quick spot check of this data vs. a custom solo game I recorded for ~4 minutes where I did almost nothing. The traffic distribution was roughly similar other than the difference in  channel 1 I noted above.

Here’s a table of popularity of packet types and channel number.

    1469 .4164 PING   :ff
    1459 .4135   ACKK :ff
     299 .0848 ACKK   :ff
     298 .0845   PING :ff
       1 .0003 CONN   :ff
       1 .0003   VCON :ff

   38364 .2362 SUNS   :01
    8541 .0526 SREL   :01
    8540 .0526   ACKK :01
     967 .0060 SUNR   :01

   34606 .2131   SREL :03
   34217 .2107 ACKK   :03

   29401 .1810   SUNS :04
    1689 .0104   SUNR :04

    1510 .0093   SUNR :02

      23 .0001 ACKK   :05
      23 .0001   SREL :05

libenet / league of legends protocol success!

Last year I looked into the League of Legends real time protocol, the format of the UDP messages between the game server and clients. My recent lag problems motivated me to look again and I’ve gotten somewhere this time.

The protocol is said to be based on libenet 1.2 with some modifications. The body of the protocol itself is encrypted, presumably to make it harder for third party hacks to sniff data from the game. (It doesn’t make it impossible though, so once again DRM frustrates legit use without dissuading cheaters.) But I don’t care about the body, I just want the enet headers, the sequence numbers and retransmits and stuff. And that’s in the clear!

The best guide I’ve found is this Wireshark dissector, or rather an updated version Boreeas kindly gave me that isn’t checked in anywhere. The key thing is inside the UDP packet, the first 8 bytes are a not-very-interesting header. Then the 9th byte is an Enet command, the 10th byte is a channel number, and the 11th and 12th bytes are the sequence number. (To complicate things sometimes only the first 6 bytes are the header, so the command is the 7th byte, etc.) ACK packets have some bogus sequence number, but the first 2 bytes after that are the sequence number of the packet being acknowledged.

So I put all that together and wrote some Python Impacket code and now I have something printing a summary of UDP captures I made. Below is a few lines from my outputter. This shows the server sending a reliable packet on channel 3 numbered 01a9, then another numbered 01aa, then another number 01ac. My client acknowledges all three. But what happened to 01ab? The server sends that along 200ms later, either because it arrived out of order or else because the server knew to try to send it again. Note that in the meantime 01ad also went missing; that never showed up, so I’m confused. Still, it’s a start. I assume the LoL client shows lag if a reliable packet doesn’t arrive properly.

SREL   03 01a9 00167.521401   00000000: 0D 89 78 BC A7 80 96 CE  86 03 01 A9 00 38 D6 23  ..x..........8.#
  ACKK 03 01a9 00167.521538   00000000: F3 CC 6D 92 A7 03 01 03  00 00 01 A9 96 CE        ..m...........
  SUNS 01 0000 00167.542210   00000000: F3 CC 6D 92 A7 03 49 01  00 00 03 8C 00 0A 87 99  ..m...I.........
SREL   03 01aa 00167.562514   00000000: 0D 89 78 BC A7 80 96 E5  86 03 01 AA 00 07 6F 00  ..x...........o.
  ACKK 03 01aa 00167.562663   00000000: F3 CC 6D 92 A7 03 01 03  00 00 01 AA 96 E5        ..m...........
  SREL 01 0065 00167.583485   00000000: F3 CC 6D 92 A7 83 8E B4  86 01 00 65 00 1F 6B 4F  ..m........e..kO
SREL   03 01ac 00167.629336   00000000: 0D 89 78 BC A7 80 97 28  86 03 01 AC 00 18 D8 AB  ..x....(........
ACKK   01 0065 00167.629393   00000000: 0D 89 78 BC A7 00 01 01  01 AC 00 65 8E B4        ..x........e..
  ACKK 03 01ac 00167.629477   00000000: F3 CC 6D 92 A7 03 01 03  00 65 01 AC 97 28        ..m......e...(
SUNS   04 0000 00167.688278   00000000: 0D 89 78 BC A7 00 49 04  00 00 03 DD 00 3B BA D6  ..x...I......;..
SREL   03 01ae 00167.688330   00000000: 0D 89 78 BC A7 80 97 64  86 03 01 AE 00 10 F5 54  ..x....d.......T
  ACKK 03 01ae 00167.688425   00000000: F3 CC 6D 92 A7 03 01 03  00 65 01 AE 97 64        ..m......e...d
  SREL 01 0066 00167.709221   00000000: F3 CC 6D 92 A7 83 8F 31  86 01 00 66 00 1F 6B 4F  ..m....1...f..kO
SREL   03 01af 00167.736732   00000000: 0D 89 78 BC A7 80 97 A5  86 03 01 AF 00 44 2B 25  ..x..........D+%
  ACKK 03 01af 00167.736863   00000000: F3 CC 6D 92 A7 03 01 03  00 66 01 AF 97 A5        ..m......f....
ACKK   01 0066 00167.739947   00000000: 0D 89 78 BC A7 00 01 01  01 93 00 66 8F 31        ..x........f.1
  SUNS 01 0000 00167.740008   00000000: F3 CC 6D 92 A7 03 49 01  00 00 03 8F 00 0A 23 68  ..m...I.......#h
SREL   03 01ab 00167.765224   00000000: 0D 89 78 BC A7 80 97 C2  86 03 01 AB 00 1B BC 8D  ..x.............
  ACKK 03 01ab 00167.765389   00000000: F3 CC 6D 92 A7 03 01 03  00 00 01 AB 97 C2 01 03  ..m.............
SUNS   04 0000 00167.770715   00000000: 0D 89 78 BC A7 00 49 04  00 00 03 DF 00 23 31 79  ..x...I......#1y

Here’s a breakdown of packet types from an ARAM game I recorded. 23.77% of packets are from my client to the server, “send unsequenced”. Huh, what does my client have to say to the server that’s so volumnious and yet unimportant? About 41% of traffic is the server sending reliable packets and the client acknowledging them and another 11% is the client sending reliable packets and the server acknowledging them. 21% of the traffic is unsequenced packets from the server, or about the same number of packets as reliable ones. I’d expected more of a bias to unreliable packets from the server than that.

   20086 .2377   SUNS
   17498 .2070   ACKK
   17475 .2068 SREL
   15406 .1823 SUNS
    5670 .0671   SREL
    5101 .0604 ACKK
    1528 .0181 SUNR
    1311 .0155   PING
     203 .0024   SUNR
     197 .0023 PING
      40 .0005 SFRG
       1 .0000 VCON
       1 .0000   CONN

iperf to measure UDP loss

Sometimes I want to test link quality by seeing if UDP packets are getting lost. iPerf is a nice tool for that. It’s a client + server command line app that generates floods of packets and verifies they arrived on the other end. A bandwidth intensive ping.

To confuse things, there’s an iperf2 and an iperf3. They sort of do similar things but I think iperf3 is mostly better. In particular the server is now mostly a dumb packet reflector and the client can give the server instructions like “try UDP now” etc, more suited for running a server somewhere stable and headless and testing with the client. See in particular the -R option to ask the server to send packets to the client.

server$ iperf3 -s

client$ iperf3 -u -c somebits.com
Connecting to host somebits.com, port 5201
[  5] local 192.168.0.23 port 63531 connected to 107.150.51.74 port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  5]   0.00-1.00   sec   120 KBytes   983 Kbits/sec  15
[  5]   1.00-2.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   2.00-3.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   3.00-4.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   4.00-5.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   5.00-6.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   6.00-7.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   7.00-8.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   8.00-9.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   9.00-10.00  sec   128 KBytes  1.05 Mbits/sec  16
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  5]   0.00-10.00  sec  1.24 MBytes  1.04 Mbits/sec  1.545 ms  1/159 (0.63%)
[  5] Sent 159 datagrams

iperf Done.

If I understand correctly the default UDP settings try to send 1 megabit a second worth of packets. That works out to 128 KBytes each second in 16 datagrams, or 8192 byte UDP datagrams. With the usual 1500 byte MTU that works out to 6 actual packets. You can set options for bandwidth, maximum datagram size, etc. Here’s a nice long test sending 1400 byte packets.

iperf3 -R -l 1400 -l 1000 -t 100 -u -c somebits.com

There’s a few public iperf servers to test against. The one run by @scottlinux in California was working well when I just tried it.

Fixed wireless Internet: Cambium, Ubiquiti

I don’t believe in wireless communications. Too spooky. Also too unreliable, and slow. And 2.4GHz wifi is particularly bad in San Francisco, between the crowding, the lack of distinct channels in 802.11a/b/g, and the faraday cages surrounding all our lathe-and-plaster rooms.

But in Grass Valley wireless is the only option. AT&T and Comcast refuse to provide wired service to rural homes and PUC and the FCC are not regulating their monopolies effectively. My ISP is SmarterBroadband, a wireless ISP that works by establishing fixed wireless links from house to house to regional distribution point to central office and then down to fast fiber backhaul. It works surprisingly well and reliably, the main limiting factor has been speeds and the challenges of getting clear line-of-sight in a hilly area covered with trees.

My link for the last couple of years has been a 900 MHz link through oak trees to a house 1.4 miles north of me. The key thing about 900 MHz is it works OK through tree cover, something higher frequencies has a harder time with. Cambium Networks hardware running Canopy, which I think dates back to the old Motorola Canopy days. It’s been pretty reliable; the only time my point to point link has failed has been in heavy snow, and then only because snow accumulated on the antenna. Also low latency (20ms?) and low jitter. The problem has been speed. The max link speed is 2600kbits/s, and the product they sell me only bursts that fast before throttling me down to 1000kbit/s. That’s 300 megabytes / hour, and it sucks.

Yesterday they upgraded me. Sent a guy 70 feet up a tree with a Cambium ePMP 1000, a 5Ghz antenna. Pointed at the same house but that far up we’re above the trees, clear line of sight. I’m told the link is good to 25 Mbit/s but I’m being sold 12/2 Mbps. Which is still pretty great and I’m grateful for the upgrade. I’m surprised how cheap the antennas are. They offered me an upgrade for a very low cost, and it looks like you can buy your own antenna for about $140. Of course you need the service!

In addition to 900MHz and 5GHz my ISP sells two other types of wireless links. There’s a 2.4GHz product they mostly don’t sell any more. It also requires clear line of sight, but is slower than 5GHz. And they have a new 3.4GHz product they label “4G”, I think because it’s based on cellular technology. It’s pretty fast too (their product offers 70% the bandwidth of 5GHz) and is able to handle a little multipath, so works with a small amount of tree cover. Didn’t work at my house though, and once we were committed to going up a tree we might as well use the 5GHz gear.

The other half of the problem I have now is getting the Internet connection from the tree 200′ from my house inside. I’m intending to run cable, but that may get complicated depending on the status of existing conduits and the challenge of trenching. Right now I have a shitty old Linksys WRT54GL sitting outside and it works surprisingly well. That’s making me think I should try a wireless link instead, even though I don’t believe in wireless.

I asked on Metafilter and got a clear consensus answer on the product I need: a Ubiquiti Nanostation M. These are consumer grade point to point wireless links. There’s a variety of frequencies and antenna sizes. They’re rated for 5+ miles so are way overkill for my 200 ft needs. But then I can probably use the tiny 9″ x 3″ antennas and be done with it. It looks like I can get a pair for about $150. Need mounting hardware and a bit of wiring work at both ends to install it right, but still that’s got to be cheaper than digging a trench.

The big question is how reliable this kind of link is. Reports are promising! I’m also curious to know what’s going on at a protocol level. They call their protocol “airMAX” which is apparently not 802.11, it’s some TDMA thing. OK, I’m fine with proprietary. But then does the link work as an ethernet bridge? Or is it working at an IP level and messing with my packets? More to learn.

Wireless; maybe not as scary as I have believed! Still nothing beats a clean run of Cat5e. Except a pickup truck full of hard drives, of course.

Update: Ubiquiti answered a tweet I made asking for advice, with a suggestion to use the Nanostation locoM5 and a suggested wireless bridge configuration. That sure makes it easy!

Home Internet device proliferation

I have 31 devices with IP addresses in my house right now. 4 computers, a printer, a game console, a router. These I expect. But also 6 Sonos music players, 3 Roku video players, 3 DirecTV boxes, 3 TV displays, and a couple of iPhones and an iPad and a Kindle. And several other devices on my network I can’t readily identify. I’m a geek who collects gadgets, sure, but I don’t think I am particularly extraordinary in that. This proliferation of devices presents several problems.

The first problem is basic network management. The only reason I know this count is I’m enough of a geek that I know how to find my router status page. Some routers I’ve seen only assign 32 IP addresses in total, I wonder how many households hit that limit and have no way of knowing? How does anyone even know what is on their network?

The second problem is tracking down problem devices. For me this usually shows up as “something’s using all the fucking bandwidth” on my slow 1MBps connection. So I look at the router IP traffic display to find the problem IP address. Then the question is, what is the device? If I’m lucky the device asked for a name when registering via DHCP; the name “DIRECTV-H25-9B3FDEB9” is a pretty good clue, and I’ve learned “NP-1GH314015312” actually means “Roku”. Sometimes the MAC address is a clue; you can look up the first 3 bytes to find the vendor. But knowing an ethernet interface was built by “Hon Hai Precision Ind. Co.” isn’t that helpful. Google tells me that’s Foxconn, still not helpful, it took something else that made me realize that was really my Playstation 4. My Kindle shows up with a prefix E0:CB:1D which is “private”, completely useless for identification.

So then I have to get clever to find the device. nmap’s TCP fingerprinting is helpful for figuring out what OS that IP address is running. For the Playstation that showed that it was FreeBSD, and I vaguely remembered that Sony bizarrely used FreeBSD for its OS and that helped me track it down. nmap can’t detect the Kindle OS via TCP fingerprints. For that device I was left with wireless signal strength in my router display. I guessed maybe it was the Kindle by the time it registered for DHCP then physically carried the Kindle nearer to the router to determine the mystery IP address’ signal strength got stronger. Ridiculous.

The third problem is some devices can’t be trusted with Internet access. My Samsung TV displays are in that category, their SmartHub SmartTV crap. Actually in theory I like the idea of it and the Netflix client etc aren’t bad. But there’s lots of reason to be worried about the security exposure of TV firmware. Also the UI is terrible. Samsung thinks the best time to pop up a “do you want to update?” dialog is right when you turn the TV on after dinner and are about to watch a movie. Consumers can’t even meaningfully answer that question; why ask it of them in the most intrusive possible way? Anyway, I decided the TVs didn’t need Internet access anymore. Not easy to disable. For the wired TVs it was enough to unplug the ethernet, but for the wireless ones the OS lacks any way to forget a network. Fortunately I could tell it to use a new bogus SSID and it was literal enough to accept the broken network even though it knew about a working one.

Roku Twitch: variable bandwidth usage

The Roku got a new official Twitch client recently. It has a remarkably neat trick: variable adjustment of bandwidth usage while playing a stream without interruption. I’ll be watching the stream in what looks to be 480p quality. Then it drops to lower quality: 360p, or 240p, or even the impressionistic smeary stream for mobile devices. Then it pops back up to 480p when it can. All the while playback is uninterrupted. Crucially the audio never cuts out or skips, so the overall viewing experience is remarkably smooth.

Here’s a bandwidth graph of 10 minutes of me watching RiotGames’ official LCS channel yesterday.

Roku Twitch bandwidth graph

My network is capable of 2600 kbits/sec but only for a burst of ~30 seconds. Then I’m throttled back to 1024 kbps for awhile. Here you can see the stream is mostly consuming about 1000 kbps but occasionally enjoys the burst up to 1500 and once even dropped down to 660 or so. All the time that was happening my playback was quite smooth and solid, the only indication anything was going on was that the graphics got a bit fuzzy sometimes.

Most video streaming apps online seem to have one HTTP stream for each quality of video, and once you start streaming it you’re committed to that bitrate. The Twitch app must be doing something smarter about grabbing a few seconds of stream at a time and dynamically altering the bitrate depending on measured bandwidth. That may explain the 3s buffering time before the stream plays, too. I’ll gladly take that tradeoff.

In the long long ago of the early 00s Internet, video streaming was dominated by RealMedia’s proprietary protocol. That was UDP, so packet loss could be handled by the app. And it was a progressive codec. I think Twitch is doing TCP and not a progressive codec, so it’s more like it’s just dynamically altering which stream it asks for on the fly. Seems to work pretty well.

(BTW, Twitch is still coy about publishing details on video quality and bitrates. Their’ partners page has some samples though, which claims

  • 240p: 384kbps
  • 360p: 512kbps
  • 480p: 768kbps
  • 720p: 1161kbps
  • 1080p: 1500kbps

I’m suspicious of the correctness of these numbers. They’re too low, also too much like round numbers except 720p. Maybe the numbers are video only and they’re doing transcoding to exactly hit a video bitrate? Seems unlikely.)

Complex QOS rules considered harmful

tl;dr: some router firmware has a catch-all rule that throttles all unidentified UDP traffic to 5% of bandwidth (labelled “Crawl”). This is a stupid rule, disable it.

I just fixed a bug in my router’s configuration that explained why Google QUIC was not working well for me. It may also explain bugs I’ve been seeing in League of Legends, OpenVPN, and other UDP protocols. I’m not entirely certain.

I’ve been running the Tomato v1.28 (Toastman) firmware for a year+ now. It’s an old build. It has 40+ default QoS rules identifying all sorts of protocols from important ones (DNS) to silly ones (RealAudio streaming), and then classifies traffic service level. Unfortunately some of the rules are harmful.

The problem rule in this case was the very last one. “UDP Dst Port: 1-65535, classify Crawl”. And Crawl by default is limited to maximum 5% of total bandwidth! There are a few higher priority rules that classify specific kinds of UDP traffic: DNS, for instance. But any new or unanticipated use of UDP is severely throttled. Such as QUIC, Google’s fancy new web protocol. And Cisco VPN. And maybe OpenVPN.

And maybe League of Legends; it’s a UDP protocol too, and hasn’t performed as well on my slow network as I expected. Just playing a game feels about the same, maybe a little less laggy, but there’s still the same unexpectedly high packet loss. But I think one reproducible bug is gone now. Jayce gates cause a brief surge of UDP packets; it used to be that caused significant lag even when playing alone. Now they don’t cause lag.

The simple fix is to adjust the Crawl class to also get up to 100% of bandwidth (both inbound and outbound). That may still have lower queue priority though. You can also try adding more rules for UDP protocols you care about; QUIC is on ports 80 and 443, for instance. But trying to label all known UDP protocols is a Sisyphean task.

I can’t imagine why anyone ever thought a 5% cap for default traffic was a good idea. Particularly for a UDP protocol which may not even be able to interpret those dropped packets as a signal to rate limit itself. Judging by the comment they were trying to catch unidentified BitTorrent traffic, which must have its own rate limiting. But still, what a dumb rule.

After several years of using QoS on home routers I’m of the opinion that QoS rules cause as much trouble as they fix. It’s certainly caused me a lot of problems. In a home network there’s no meaningful way to shape incoming traffic at all. You can shape the outgoing traffic a bit, and I think prioritizing ACK is probably a good idea. (Although weirdly this behavior is not the default). But in general the QoS implementations out there complicate things a lot and don’t provide a lot of value.

It’s time to go back and look at what the Bufferbloat guys have accomplished recently, and whether fq_codel or something similar has gotten traction. Their approach seems much simpler. Last I checked no Tomato variant supported it.

QUIC problem

Update 2: this was a bug in my router, not QUIC. See below, I also posted to the QUIC protocol group about it.

The Google is broken on my computer. This happened once before. Web sessions to every site on the Internet work fine except Google properties. Those hang for ~15 seconds for every web request in Chrome. Safari requests work fine.

Both times this has happened to me have been up in Grass Valley, the place with the shitty fixed wireless Internet. And both times when I’ve looked in Wireshark there’s some QUIC protocol stuff happening, I don’t know what. But my guess is that Chrome is deferring all requests to QUIC and they have a bug / bad interaction with my ISP where it doesn’t work right.

I could swear I once saw some QUIC diagnostic info inside Chrome. Or at least a way to disable QUIC entirely. Can’t find it now. Of course it’s hard to find things when Google doesn’t work. Edit: found the disable, it’s in chrome://flags. The statistics are in chrome://net-internals/#quic. The moment I disabled QUIC Google searches worked better. Interestingly, simply restarting Chrome didn’t help, at least not completely. I lack the patience to test this carefully, no point if no one’s going to pay attention to the result.

In desperation I’ve tried using Bing. It’s not as good as I remember. In the past I didn’t like the UI but the relevance was mostly good. But now the relevance is bad. They were returning URLs for RSS feeds on Metafilter for searches. WTF?

Update: I have a theory! It may be my router QoS settings. Tomato / Toastman 1.28 doesn’t have a rule for QUIC, but does have a default rule that all UDP traffic otherwise not classified is assigned the category “crawl”, which is limited to just 5% (40kbps) on my network. D’oh! I wonder if this also is responsible for my worse-than-expected League of Legends performance here. I added a rule for QUIC (UDP ports 80/443, classify WWW). Also raised the bandwidth cap on “Crawl” to 100% traffic, that was a dumb default rule. Now to try it out for a few hours...

Bandwidth caps

My fast cable modem service comes with a data cap. I get an honest 100 Mbit/s, with a 300 Gbyte/month cap. Beyond that it costs $0.20 per gigabyte. I hate the idea of data caps although I sort of understand where the ISP is coming from. If I hit this cap every month I’d be angry, but so far I’ve usually come in far under. Not this month though; between the new PS4 and downloading a bunch of video I’m well over. 360GB and there’s 10 days to go.

Being over the cap has really changed how I think about the Internet. I’m now pricing stuff in my head. Watching a single LoL game broadcast will cost me $0.20. Watching a high quality movie on a stream will cost me $1.00. Do I really need to download a whole season of that TV show I might or might not watch? Maybe I can wait a few days, until April? Maybe I should put off some software updates too. I mean truthfully it’s not a lot of money, and I can certainly afford it, but knowing that I’m paying by the GB changes the way I think about it. (Related: this is why micropayments are a bad idea.)

I’m a bit confused about how my ISP calculates my usage. I also track usage via my router, and the GB usage numbers are wildly divergent.

Month    ISP    Router   Percentage
Jan      167    199       84%
Feb      160    148      108%
Mar      360    235      153%

I certainly understand why the numbers wouldn’t be exactly the same, but it’s been ±15% for the last two months. This month it’s +50%. I may ask about that when the month is over, although I’m pessimistic that customer service will give me a useful answer.

If I maxed my connection I could download about 30,000 GB a month; so my cap is 1% of max. My slow rural ISP has 1/100th the speed but the cap is 1/10th the size, so their cap is 0.1% of max.

NTP kibbitzing

This Metafilter discussion about the ntpd developer needing funding got me thinking more about NTP. I wrote a few comments on MeFi that have good content.

But the big revelation for me is NTimed, PHK’s project to write an ntpd replacement. His notes are very encouraging. The big excitement is that he’s explicitly building a client-only version of the code for 99.99% of users, and he thinks he can keep it to < 10,000 lines of code. That would be fantastic, both for security and for performance. I hope it’s a success. So far it looks very promising.

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.

HooToo travel router

This router from HooToo is amazing: $18 for the HooToo Tripmate Nano. Ethernet in, 802.11 b/g/n out, and it acts like a router, bridge, can even serve SMB with a USB disk. And the thing is about 2x2 inches, less than half the size of a pack of cards. $18!

No idea how it works as a bulletproof serious router. I bought it for travel, in particular for hostile hotels that either have no WiFi, bad WiFi, or want to charge you per device. If they have an ethernet cable you’re usually better off than trying their wireless.

$18! How is that possible? Particularly the 802.11n chip. It’s an American company too, or at least they list an address in San Jose. (English is awfully bad on the site.) Hardware design is cheap, obviously, but seems solid enough.

The firmware is clearly some Linux derivative. The Nano just offers a binary, which I unpacked as far as to see it was an initrd image. Another product of theirs includes a “GPL Source download” so they’ve at least heard of open source license requirements.

OpenVPN: UDP vs TCP

One thing I can’t decide with OpenVPN is whether to use UDP or TCP for the tunnel. The online guides for this are nonsense, babbling about how “TCP is more reliable so use it if you don’t want corrupted file transfers”. That’s not how it works.

My own impression is UDP is clearly a better choice for low level IP tunneling, in the abstract. The OpenVPN community seems to prefer UDP as well. OTOH it may not always work. Some networks don’t really route UDP correctly and I have a suspicion random UDP ports are more likely to be blocked than random TCP ports. (Best idea; run your VPN endpoint on TCP port 80. Ugh.)

In practice, from my Grass Valley client with the weirdo fixed wireless network, UDP isn’t working. Well it sort of works but the link is limited to 60kbps instead of the burst max of 2000kbps, and it’s flaky. Online docs suggest this is an MTU problem, in particular if you don’t have MTU path negotiation working. I could well believe I don’t. This FAQ suggests setting “mssfix 1200” as a workaround but it didn’t help. I tried the “tun-mtu 1500 fragment 1300 mssfix” config the docs suggest as a workaround but that broke the connection entirely. No idea why, but the log had some warning about “FRAG_TEST not implemented”. Maybe it’s because I only set it on one side of the tunnel (see this FAQ). Whatever, TCP is working, I’ll stick with that.

My Mac has another problem where the network doesn’t work for the first ~30 seconds after the VPN link establishes. It feels like some sort of timeout problem, maybe it’s using the wrong route or DNS is messed up or something. It may be specifically a Chrome problem.

Update: months later I realize this was a router QoS problem.

Weird network crash; VPN related? router bug?

Just had a weird crash on my network in Grass Valley. I was trying out my new VPN setup on my iMac, tunneling all my Mac’s traffic through an OpenVPN connection to my router in San Francisco. Worked great! Then I got clever and tried to open http://192.168.0.1/, my router status page, curious what the VPN route would do. That page looked like it loaded but I think Chrome was loading a stale page; once I clicked on any other page on the router status panel it failed.

But not just the web page failed. My network failed. In my whole house, every device dead. The router wasn’t responding to DHCP requests. Even worse, the router didn’t come back after power cycling it. Three times. The power light came on but there was no DHCP service on the Ethernet, no WiFi. It was like the router had failed to boot. I finally got the router to come up on the fourth try. That time I’d disconnected my ethernet switch (and the rest of the home network) from the router first.

I have no theory for what went wrong. It seems implausible that client traffic on a VPN would kill the router, but not impossible. But I have zero idea why the router wouldn’t boot successfully until I disconnected the rest of the LAN. Sadly, I have no logfiles from the router to help.

Now I’m scare to try using the VPN again. But, well, what’s the worst that could happen?

.. And we’re back, on the VPN again, and I can’t trigger that crash again. Maybe a fluke? I think the page I was loading when the network died last time was Tomato’s Device List. It seems very unlikely, but maybe that somehow does some funky ethernet tickling that got my switch in a bad state? Weird.

I did work to understand tunnelblick a little more. It creates a new network interface utun0 that’s a point to point link between two addresses in the VPN block. Then it adds a network route with destination “0/1” with the remote end of the VPN as the gateway. I guess that is a catch-up IPv4 route, which sits above “default” in priorities but below any more specific routing table entry like 192.168.0 going over my LAN. The result seems to work correctly, Wireshark confirms most of my traffic is going over the VPN tunnel but I can still connect to hosts on my LAN.

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.

netstat only shows some stuff as tcp6?

Weird, Apache doesn’t show up as tcp when running netstat -l on my Ubuntu 14.04 box.

tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 localhost:postgresql *:* LISTEN
tcp 0 0 localhost:smtp *:* LISTEN
tcp6 0 0 [::]:http [::]:* LISTEN
tcp6 0 0 [::]:munin [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:postgresql [::]:* LISTEN
tcp6 0 0 localhost:smtp [::]:* LISTEN
udp 0 0 107.150.51.74:ntp *:*
udp 0 0 localhost:ntp *:*
udp 0 0 *:ntp *:*
udp6 0 0 fe80::52e5:49ff:fea:ntp [::]:*
udp6 0 0 localhost:ntp [::]:*
udp6 0 0 [::]:ntp [::]:*

Apache is definitely running on port 80 and serving live traffic. It does show up with the tcp6 entry, and I believe [::] means “all addresses” so that must account for it. Odd not to see it bound to the old IPv4 name. (Same with munin, but not ssh.) I wonder if this change was in netstat, the kernel, or how Apache binds ports? Anyway you can’t just ignore the tcp6 part of netstat even if your box doesn’t have a public IPv6 address, IPv4 stuff may be hiding there.

Life at 100Mbit

I can report that having 100 Mbit at home is a good thing. I know, who would have guessed? The raw speed makes an enormous difference. For instance a couple of days ago I installed Skyrim. 10 GB of download. On my old DSL that would have been 4 hours, something to schedule overnight. Now it’s less than 20 minutes. Also means I can stream an HD movie without worrying whether something else using the link will ruin the playback.

But the best thing is having so much capacity greatly simplifies the router. I used to go to great lengths to have QoS routing. Right now I’m experimenting with not bothering at all, it’s completely disabled. I don’t notice any problems even when running a full speed BitTorrent both up and down.

Part of the advantage is my Internet is now faster than a lot of the backbone, so “full speed” for the average site won’t saturate my link. I also think it matters that the packets are relatively smaller. On my shitty 1Mbit link a 1500 byte packet is 12ms wide. Even with perfect packet scheduling there’s going to be uninterruptible 12ms delays sometimes. With this good link that time goes down to 0.12ms, making it much easier to share the link between multiple applications.

Companies selling “make your network better” products

Some interesting companies I ran across, all selling products to make home internet better. I can’t tell if any of these really work or not, just an interesting market category.

Netduma is going to sell a router optimized for gamers. Very little info on the website but so far it seems like better firmware, along the lines of what you get if you know how to make Tomato or DD-WRT work. Ie, “Anti-Flood” sounds like QoS scheduling. This product seems smart, in that it’s very hard right now to buy a good consumer router with good firmware. And they could get deeper into tweaking TCP/IP (like messing with windows, Nagling, etc), but even just doing decent QoS and buffering is a big help.

Speedify is a service that offers channel bonding for higher throughput by using multiple links. It sounds a little like a VPN, their client sends your traffic through to their “speed servers”. I’m skeptical this will really work in practice, but it’s interesting.

WTFast promises faster gaming, “cut your latency in half or better!”. The site is very marketing heavy and sounds like snakeoil to me, but maybe it could work. They have a “Gamer Private Network” which they claim is faster than the public Internet. There’s a $250k Kickstarter for router hardware, selling a 300MBps wireless router for the very good price of $50. They have a working software client and these Redditors report it helps them. I suppose a VPN service optimized for gamers makes some sense.

Testing DNS without cacheing

Helping a friend figure out a DNS problem, passing on some ancient wisdom about how to test if your DNS is right. The key thing is to avoid all the caches, make direct queries to the servers of authority.

$ whois somebits.com

Ask the Internet name authority about the domain somebits.com. Lots of crap is returned there, what you care about is the name servers.

$ whois somebits.com | grep 'Name Server'

Name Server: NS1.HOVER.COM
Name Server: NS2.HOVER.COM
Name Server: NS3.HOVER.COM

So now we know that there are three authoritative DNS servers for the domain. Let’s ask one of them for information (and strip out comments, lines starting with semicolon)

$ dig @NS1.HOVER.COM somebits.com any | grep -v '^;'

somebits.com. 900 IN NS ns1.hover.com.
somebits.com. 900 IN A 107.150.51.74
somebits.com. 900 IN SOA ns1.hover.com. dnsmaster.hover.com. 1394118405 10800 3600 604800 900
somebits.com. 900 IN NS ns2.hover.com.

ns1.hover.com. 900 IN A 216.40.47.26
ns2.hover.com. 900 IN A 64.98.148.13

The important thing here is learning the A record for somebits.com, pointing to 107.150.51.74. That’s the DNS record for my server.

If you’re debugging a DNS problem, start with this type of query. Go straight to the Name Server of authority. If those records are wrong then it’s hopeless. If they look right then something else can still have gone wrong. Particularly cached data, whether cached in DNS or else cached by client software. Google Chrome seems overaggressive about caching DNS info, for instance. Java used to be awful.

running tcpcrypt on Ubuntu

Excited by the new TCPINC effort, I went to build and install tcpcrypt, a sample implementation of a proposal. The GitHub project has recent activity and the code mostly builds.

I had to install these packages to get it to build:
autoconf libssl-dev libcap-dev libnetfilter-queue-dev.

It runs, too, and installs OK. Funky way it works using iptables to redirect traffic. The tcpcryptd self tests to check.tcpcrypto.org worked, but using curl to load the check page at http://tcpcrypt.org/test.php didn’t. Turns out the problem was curl doesn’t follow redirects and that’s the only way you know the test works, “curl -L” or “wget” works. I ended up setting up an SSH tunnel to test from my Mac and was able to get http://tcpcrypt.org/fame.php to work correctly and register as #809 on the Hall of Fame.

I’m curious if anyone plans to use this code as the basis for a real implementation. If so would be worth my time to make the build process easier. Also maybe remove some of the swear words from the code :-P

tcpinc

This is exciting: IETF has a working group on adding encryption to TCP. TCPINC.

They’re explicitly punting on authentication and certificate verification. That’s smart. The result won’t protect against MITM attacks, but it will still provide significant improved protection against passive traffic collection. Also authentication is really hard whereas basic wire encryption is not.

They also explicitly mandate NAT compatibility, which is a practical choice but means users are mostly not protected from traffic analysis. I can live with that.

The failure of IPSEC is one of the greatest mistakes the Internet architecture has suffered so far. SSL is a total hack and botch compared to properly encrypting data traffic. I’d argue doing it at layer 3, the IP layer, is better than doing it in TCP. But encryption is sort of a session-oriented thing so I can see why they want to start with TCP.

Is my host secure in IPv6?

I want to verify that my Ubuntu 14.04 box is secure in IPv6 space. netstat shows various things are listening on IPv6 ports. Do I have a publically reachable IPv6 address? I think not. ifconfig shows this IPv6 address:

inet6 addr: fe80::52e5:49ff:feae:3a13/64 Scope:Link

ServerFault has a useful explanation. The Scope:Link means Link-local address, something explicitly not routed and only reachable on the local Ethernet segment. This means that these servers are reachable by anything else on that same Ethernet segment, which might mean other servers in the rack in my colo. I believe all IPv6 address that start with fe80:: are link scope.

There’s a bunch of online services that will test ports or do nmap for you for IPv6.

sshuttle

I took a quick look at sshuttle, a poor man’s VPN. It creates an ssh tunnel to any Linux host you can ssh too, then munges your OS to route most, but not all, traffic through the tunnel.

I’m confused about how it works. On my Mac I couldn’t find any evidence of it in ifconfig or the routing tables. It does set some ipfw rules, and more if I enable DNS as well. Can ipfw manipulate traffic in this way? There’s some more commentary on this 4 year old Hacker News discussion.

The big drawback is it only handles TCP, with an option to also handle DNS traffic. But not arbitrary UDP or all IP. I think for many practical things that doesn’t matter, but it is a drawback.

The nice thing is it’s super easy to set up and doesn’t require any server infrastructure. It’s a clever hack. Clients work on MacOS and Linux, at least.

SF bandwidth usage before and after

in mid-July I switched ISPs, from sonic.net DSL with 6/1 Mbps speeds to astound.net cable with 100/5 Mbps. Best thing ever, 100 Mbps is like seeing through time. It is sometimes faster for me to download something over the Internet than to get it off my LAN, which is just ridiculous.

Getting a higher speed doesn’t seem to have changed my usage. I average about 150GB a month both before and after. Here’s a table of usage for the past few months

Date Download Upload Total
2014-09 133.03 GB 7.13 GB 140.17 GB
2014-08 102.84 GB 5.22 GB 108.06 GB
2014-07 102.81 GB 8.29 GB 111.11 GB
2014-06 144.46 GB 11.42 GB 155.88 GB
2014-05 136.55 GB 11.61 GB 148.15 GB

Compare to bandwidth usage in Grass Valley, with a 1/0.1 Mbps link, where I average 15 GB a month. The big difference between the two houses is totally behavioral. I deliberately only download video, stream video, update Steam and iOS and stuff in San Francisco with the fast link.

VPN server notes

I need a VPN server for when I’m travelling. I used to use sonic.net’s great service, but now that I switched ISPs I need my own mostly to get IP tunnelling to circumvent stupid hotel networks. Options:

  • Cloak. Their service works well, particularly the iOS client. It’s cheap ($10/mo for unlimited bandwidth). The drawback is that a lot of their VPN server endpoints are on IP blacklists for websites, which is just terrible.
  • Tomato firmware. Run this at home and use my cable modem service as a VPN. Not ideal, but Tomato has a built-in service that looks easy to configure.
  • PPTPD, as documented here. Apparently pretty easy but a bit kludgey, not clear how secure it is.
  • OpenVPN, maybe as automated here. I think this is the more serious option but I’m warned it’s hard to get working right.

The VPN server and client world is terribly confusing and usability is awful. I’m hoping I can just skate through with Cloak for my light usage.

IP address is not identity

I’m using Cloak as a VPN provider while travelling. Great product, excellent MacOS VPN client. Unfortunately they terminate your VPN links at random servers in VPS clouds like Linode. And those IP addresses are blocked by sites like Yelp and Pinterest. Pinterest goes so far to say as “there’s a bot in your network”, which really means “we blocked that block of IP addresses because someone once ran a bot there”.

Stupid.

1Mbps is inadequate

So there I am, playing along in League of Legends, a tense game but we might win yet if I just position Annie right and time her stuns (an exercise in counting to 4). It’s exciting and fun. Suddenly the game lags out; characters freeze, skills don’t respond, things start sliding around and teleporting. Basically unplayable, 10 seconds later suddenly I get the packet that says “you died”.

Curse and swear. Switch to the bandwidth monitor, some random IP address is taking all my bandwidth. All 1 megabit. Go to the router status page, do the OUI identification of the Mac address, see it as an iPhone. That narrows it down to 3 iPhones. During death timers I find all three and put them in airplane mode, but by then it’s too late.

1 Megabit internet is just not adequate anymore. Seems crazy to say it, but there it is. The direct cause this time is some random iPhone deciding that right then was a good time to download a software update. At full speed, of course, because throttling is not a concept that’s well implemented in TCP/IP. In San Francisco I have a 100 Mbit link that’s either faster than the server or else the download completes so quickly I don’t notice. In Grass Valley, with the 1Mbps fixed wireless (the best I can buy), nope.

The underlying problem here is the US broadband infrastructure and the FCC’s collusion with the cable/telco duopoly ensuring no investment in the captive market. Fuck them.

 

ToS/DSCP byte in IP packets

Update: be sure to read comment #3 below from Dave Täht. Apparently the Bufferbloat project has made a lot of progress on good router queuing and there’s a lot for me to learn about, including fq_codel and CeroWRT.

Interesting thing in Transmission’s Bittorrent client’s docs

peer-socket-tos: String (default = “default”) Set the ​Type-Of-Service (TOS) parameter for outgoing TCP packets. Possible values are “default”, “lowcost”, “throughput”, “lowdelay” and “reliability”. The value “lowcost” is recommended if you’re using a smart router, and shouldn’t harm in any case.

The Type-of-Service byte is the second byte in an IP header. It is not widely implemented, and has a tangled history. Is it useful?

The bottom six bits are for DSCP, Differentiated Services (aka DiffServ). This allows an IP packet (or the program controlling it) to request a certain level of routing service quality. There’s various things to request; low jitter, best effort delivery, and a couple of means of defining priority classes. I don’t know how well supported these bits are, the Wikipedia entry makes it sound like it’s not entirely unknown. Linux IPTables has rules for setting DSCP classes. The Bufferbloat wiki has some discouraging notes on implementation. Windows 7 claims to support it, but looks wonky. Someone found a Comcast bug in their DSCP data that was harming download speeds.

The top two bits are used for ECN, a way for the router to signal to a TCP stack that it should slow down without actually dropping packets. I think ECN is not practically useful in today’s Internet, too many clients don’t implement it and too many routers don’t use it (or any form of queue management). But I could be wrong. /proc/sys/net/ipv4/tcp_ecn is 0 (not enabled) in my Tomato/Shibby router even though I’ve turned QoS on.

My conclusion on a quick read is these bits are not usefully deployed, too much stuff doesn’t support them. Too bad; it’s exactly what a home network router needs to cooperatively share a network. So much of TCP/IP QoS work was abandoned because it doesn’t work with hostile peering relationships. But I really do trust and control my home router and I wish it could do more to manage bandwidth.

San Francisco ISP woes

I love my ISP, sonic.net. They have solid no bullshit service, great customer support, and are generally super consumer friendly. Unfortunately they are DSL over AT&T’s copper, so they are pretty hamstrung with what they can do. And I’m stuck at 7Mbps on a single line.

I tried calling them to upgrade to bonded service and it gets very expensive very quickly. Their business service is the bonded option but it’s $90/mo for what will probably be 15Mbps for me (30 if I’m lucky with line quality). And then it comes with two phone lines I don’t want for which I have to pay another $40/mo in taxes, no choice. I assume that bundling is because Sonic is making some money just for providing phone service, but who knows.

In SF we have other technology options. MonkeyBrains offers high speed wireless, which I don’t want. Comcast and Astound offer cable Internet and are promising 50Mbps or even 110Mbps for less than sonic.net wants to charge me. But Comcast is the devil. Maybe Astound is an option. Reports from friends are both have been reliable ISPs.

I called Astound. It’s $90/mo, no taxes, for 100/5 cable Internet. (That’s the price after the first year discount.) They provide service over their own coax, not sharing cable with Comcast.

 

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.

Bandwidth usage in a house

From my place up in Grass Valley, the one with the slow 768kbps link. Recently upgraded to a screamin’ 1024kbps, which makes a bigger difference than you’d think. (800kbps is apparently a sweet spot for online video.)

I’m averaging about 11GB download a month. That’s 33 hours of fully saturated link a month, or about 5% of total capacity. I’m surprised there’s an average of about 2GB upload too. The asymmetric upstream speed is terribly slow, so I work really hard to never rely on it. Then again a TCP ACK packet is about 3% of the size of the data packet it’s acknowledging, so that accounts for 0.3GB of upload just to match the downloads. (Roughly, details vary.)

 

Date Download Upload Total
2014-04 10.47 GB 1.17 GB 11.63 GB
2014-03 17.38 GB 1.55 GB 18.94 GB
2014-02 10.10 GB 1.32 GB 11.42 GB
2014-01 7.57 GB 1.11 GB 8.68 GB
2013-12 10.35 GB 1.71 GB 12.07 GB
2013-11 11.17 GB 1.55 GB 12.72 GB
2013-10 4.15 GB 0.59 GB 4.73 GB
2013-09 10.04 GB 1.41 GB 11.45 GB
2013-08 11.66 GB 1.39 GB 13.05 GB
2013-07 13.97 GB 2.15 GB 16.12 GB
2013-06 14.92 GB 2.49 GB 17.41 GB
2013-05 13.06 GB 1.96 GB 15.02 GB
2013-04 12.97 GB 1.50 GB 14.46 GB
2013-03 10.81 GB 1.21 GB 12.02 GB
2013-02 10.79 GB 1.35 GB 12.14 GB
2013-01 10.93 GB 1.71 GB 12.64 GB
2012-12 15.97 GB 2.01 GB 17.97 GB
2012-11 4.57 GB 0.58 GB 5.15 GB

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.

Automatic software updates considered harmful

Another day, another bandwidth management problem. Being on a slow 1Mbit link really makes you aware of how much crap Apple products downloads, with no user control.

Today’s scenario: trying to watch LoL tournament games on Twitch. That’s an 800kbps stream, so anything else running on my 1000kbps link is instantly notable. Like, say, my laptop. The one I’d like to use for very light web browsing while watching. Only the moment I open it up a bunch of Apple shit decides now’s the time it has to download updates. All invisibly, with no user feedback or control. Right now it’s softwareupdated downloading who knows what or how much, I’m guessing it’s the 120mb command line developer tools. Yesterday storeagent decided it had to download something, I still don’t know what, but that one started downloading with the lid closed and the machine nominally asleep.

Background downloads that happen quietly so your machine is ready to go are great. Background downloads that run in the middle of the day and consume all bandwidth are bad. If only they had some network saturation detection, or if there were a way to specify low priority network usage, or something. But this is TCP/IP and there’s not, so Apple’s a bit stuck. Still it’s awful and annoying.

Oh yeah, you can’t even kill storeagent. Ignores SIGINT. I finally did a SIGKILL. It seems to have recovered intelligently from that.

 

Traffic shaping vs. burst speeds

I’m a fan of the QoS controls built into Tomato firmware and other fancy routers. Unfortunately it doesn’t work on my slow Grass Valley link. The problem is the QoS algorithm they use needs to know the max link speed as a parameter; basically it throttles traffic that approaches 90% of that link speed when things get congested.

Except, I don’t have a single link speed. My link is 2500kbps for about 60 seconds, then is 1000kbps. If I set the QoS limit to 1000kbps then the router never allows any single stream to use more than that, basically wasting my burst. So I set it to 2500kbps, but then that screws up the traffic shaping when things get busy.

There’s other QoS algorithms out there that should be possible. I dimly recall back in 1999 when I studied this last that RED didn’t require knowing the link speed, just auto-detected congestion. That may be harder to pull off on a house router since it’s sitting behind the congested link, you really want to shape the link upstream of the bottleneck.

 

what’s using my bandwidth, take 20

Perpetual problem; network is slow, some process is using all the bandwidth, what is it?

On a Mac, the new short answer may be “use Mavericks”. The Activity Monitor includes a Network view and while it’s not perfect, it helps.

On an older Mac or other Unix machine, here’s one way:

Run iftop. It’s a top-like program that shows individual network sockets. Press “p” to turn on port number display. Press “t” to simplify to one line per host. The three columns of numbers on the left are download rates in kilobits/second, averages over 2/10/40 seconds.

Note the port number of the top flow. Then run lsof (as root) and search through the output for that port number. It contains the program name and process ID.

Using this I managed to find it was ocspd taking all my CPU. That program downloads fresh certificate revocation lists. Amazing how much data it had to grab.

iftop and lsof use existing kernel services, doesn’t require installing a kernel module or anything. Should be possible to write a patch to iftop that does the lsof-side of things to show the process ID and name. Or else a separate tool.

Rubbernet is a fine graphical tool to manage and shape Mac bandwidth in this fashion. But it’s €30. Also it requires a kernel module, which feels like dangerous overkill.

 

whois protocol notes

Whois is one of the magical old Internet protocols, going way back to 1982 in the time before TCP was even the standard. It still mostly works. I was curious how it’s scaled, in particular where the database state is held. The Wikipedia article is useful.

Long story short, each top level domain like .com has a whois server. Some of those servers maintain “thick” databases where they have a full copy of the database. Ie, the .ORG whois server has the full .ORG whois database itself. Others are “thin” and delegate queries to the domain registrar of record; for somebits.com, say, the .COM whois server looks up the name and sees TUCOWS is the registrar so sends the request for somebits info off to TUCOWS. It’s all basically a pretty centralized system and seems to work. RWhois is the proposal to replace the centralized system with a hierarchical one.

There’s about 100 million .com domains. Assuming a generous 4 kilobytes of data per record, that’s 400 GB of data. That’s a fair amount of data but not a whole lot, although there sure must be a lot of queries. Whois updates propagate fast, often in seconds, although TUCOWS has a 15 minute delay.

You can see this delegation when making a whois query (testing with the Mac command line client). Asking for somebits.com, the first query goes to a Verisign server who gives back a partial response, including a Whois Server at TUCOWS, the registrar for the domain. Then the whois client makes a second request to TUCOWS. Asking for somebits.org gives you the reply straight from a server at afilias.info, who I guess is running the whois for .org, a thick implementation.

How do you find the whois server for a particular TLD? There’s no standard, but IANA runs a database you can query via whois. Ie: whois -h whois.iana.org com. I don’t know if the whois tools use that online. My Mac client seems to know directly where to send whois queries for weird domains like .museum, .xxx, and .io. (Although it has a bunch of hilarious options to manually choose whois servers, like Russian and Caribbean authorities.)

The most important thing a whois server tells you is the DNS authority for the domain, where to go to look up IP addresses. In retrospect it’s odd that query is not part of the DNS system itself, is instead delegated to this other protocol. Then again the typical DNS client never does the whois requests themselves, they just ask a DNS resolver somewhere. And DNS has a huge amount of caching.

I have a lot of respect for the core old Internet protocols. Many have been in service for 30 years and still work great, despite a zillion-fold increase in Internet size.

ASUS RT-AC66U bug

My fancy new ASUS RT-AC66U has pretty good firmware; it seems based on the Tomato core, even the QoS. And unfortunately the built in DNS server, the one it advertises in DHCP. It has some bug that occasionally causes it to fail to respond to any requests for awhile, I think blocking on some other connection. I just had a failure where I couldn’t resolve names for about 45 seconds and it went away the moment an active HTTP download of a 60 megabyte file completed. The network was up the whole time (downloading the file), as was the router web interface, but DNS requests failed.

I should probably stop using the router DNS. Or else install Merlin’s patches.

YouTube video bandwidth

I’ve been watching some League of Legends gamecasts, live video. They offer several streams including Twitch.tv and Youtube. Here’s the bandwidth for a 720p stream; from Twitch first (a steady 2500kbps) and then YouTube (variable, averages 1600kbps). My network caps out about 6000kbps.

 

Image

 

 

It’s great that YouTube uses so much less bandwidth, but I’ve had real problems with reliability. In San Francisco it’s nearly unwatchable on WiFi. And in Grass Valley with the 2500kbps burst to 800kbps sustain network, YouTube’s stupid bandwidth estimator gets all confused by the burst and fails to deliver a reliable stream (at any quality). In general I think YouTube is trying to be too clever. That sawtooth pattern is sure weird.

IP address 0.0.0.0

The IP address 0.0.0.0 is often used to mean “all a machine’s IP addresses” or “all network interfaces”. If you configure a server to listen to 0.0.0.0 it listens on everything. If you specify 0.0.0.0 as some sort of IP restricting filter it usually applies to all addresses.

But what does 0.0.0.0 mean to a client? Surprisingly, connecting to http://0.0.0.0/ seems to work on both my Macs and Linux. On my Mac “route get 0.0.0.0” shows me it’s going to use my Ethernet interface, with a real IP address. On my Linux box “ip route get 0.0.0.0” shows it using the loopback on 127.0.0.1.

Looking at this because I need a shell script that prints out an IP address that is likely to work even if I’m remotely shelled in to something. Here’s a script I use to launch test web servers for webapp development:

function pws {
  PORT="$1"
  [ -z "$PORT" ] && PORT=$[RANDOM%1000 + 9000]
  IP=`ifconfig | awk '/inet / { if ($2 != "127.0.0.1") { print $2; exit 0; } }'`
  python -m CGIHTTPServer "$PORT" >> /tmp/pws-"$PORT".log 2>&1 &
  echo "http://$IP:$PORT/"
}

Not getting gigabit ethernet

I’m not getting gigabit ethernet at home between my Linux box and my iMac. Some previous notes suggested I got 30MB/s, at least once, so maybe this is a new problem?

I tested by running dd if=/dev/zero bs=16k count=10000 | nc -l 9999 on the Linux server and running time nc 192.168.0.65 9999 > /dev/null on the Mac. That took 13.9 seconds for the 164 megabytes, for a throughput of 11.7 megabytes = 93.6 megabits/second of useful data transfer. (MenuMeters measured 11.7MB/s as well; dd claimed 9.8MB/s, but there was a delay in starting the client). Figuring TCP overhead that’s clearly running at 100Mbps, not gigabit.

The server is my Linux box with the onboard Realtek chip (which has some issues). ethtool reports it’s running at 1000Mb/s, full duplex.

The client is my 2011 iMac with some Broadcom chip. WiFi totally turned off. MenuMeters and Network Utility both report Gigabit.

The switch is a Netgear GS116 gigabit switch. It’s unmanaged, so I don’t have much insight into what’s going on. Only one set of blinking lights on the switch indicates gigabit speed, so that’s my problem; either the Mac or the Linux box didn’t negotiate gigabit but is lying about it in the ethernet driver.

Come to think of it, this Mac has been flaky on the ethernet for awhile now, it sometimes takes minutes to come up after resume from sleep. I bet something’s gone wrong with the port or the cable and I’m only capable of 100 megabit now. Wish I had some way to diagnose it.

(the difference between 100mbps and 1000mbps is noticeable when transferring large files. The disk is capable of about 250mbps.)

Update looking at the blinking lights I figured out my Mac really has gigabit at the switch, but the Linux box didn’t. Then I looked closer and realized my Linux box had gigabit too, but only to the small gigabit switch sitting in the closet with it. The upstream link from that small switch to the main big switch was 100 megabit. Weird. Rebooting the small switch fixed it. Confounding issue: I have a 100mbps printer plugged in to the small switch. It doesn’t seem to be disrupting my gigabit right now.

Ubuntu resolv.conf

In the old days setting up DNS was easy. You edited /etc/resolv.conf, put your nameservers in there, and you were done. Sadly it’s gotten more complicated as time goes on; DHCP provides nameservers, computers have multiple network interfaces, you want different DNS servers on a laptop depending on where you are.

But the resolvconf(8) system in Ubuntu is impenetrably complex to configure. I’ve found a bunch of random places where name servers are stored or written. I thought that /etc/network/interfaces is canonical. But there’s stuff in /etc/resolvconf/ too, and things cached in /run/resolvconf/, and I have no idea how to just add a name server. Various “obvious” things fail with old configs coming from some cache.

AskUbuntu has a decent answer that while it may not be correct, works. Edit /etc/resolvconf/resolv.conf.d/head (ignoring the warning about autogeneration), add your entry, then run resolvconf -u. I just tried it and it worked, even put my entries first in the list.

My real goal was to replace my ISP’s flaky DNS server with Google’s 8.8.8.8. It’s stupid in the modern era that DNS is still a sequential operation with a 5 second timeout. This Ask Ubuntu answer suggests installing a fancy caching DNS server like pdns.

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.

nmap scan options

I’m trying to learn something about the quality of a wireless Internet link in a house in Nevada County. Unfortunately the last couple of hops are invisible; my guess is the ISP is blocking all ICMP and other stuff at the boundary between their wired network and wireless network. Fair enough, but I really want to see inside that wireless link.

Sadly everything I’ve tried has failed, they’ve really got the link buttoned down. An ICMP traceroute does show me some promising looking networks before my destination but the latency seems too low to be wireless and there’s not much I can learn. Anyway, here’s some notes on using nmap’s more exotic options for probing a network.

nmap has a rich variety of host discovery options. Here’s some notes on various probe options. You have to be root to do a lot of this. In most cases nmap’s strategy is to send a packet hoping to get any sort of reply, it doesn’t care what the reply is, just something that verifies the host exists and is running an IP stack. It seems to send the probe twice, at least in some cases

  • -Pn: no discovery, just assume the host is up.
  • -PS: TCP SYN. Tries to open a TCP port; getting back an ACK or RST will both confirm the host is online, so it works whether the port is open or not. Default is port 80, do “-PS99” or whatever to change the port number.
  • -PA: TCP ACK. Sends a bogus ACK, expecting a RST back.
  • -PU: UDP. Should get an ICMP port unreachable response.
  • -PY: SCTP INIT. Similar to -PS, but tries to open an SCTP connection.
  • -PE: ICMP echo. Good ol ping
  • -PP: ICMP timestamp. One of those tech dead ends that should be removed or disabled (indeed, it’s not present in IPv6). My Linux server seems to respond with the correct time!
  • -PM: ICMP address mask. A way to query the subnet mask. Kind of a useful thing really, but Linux doesn’t seem to answer it. Maybe disabled for security?
  • -PO: IP protocol ping. Sends unusual IP protocol requests; ICMP, IGMP, and IP-in-IP by default. My Linux datacenter box doesn’t respond to IGMP or IP-in-IP probes.
  • -PR: ARP ping. For local ethernets only, bypasses the kernel’s ARP handling and handles ARP itself.  Any ARP reply implies the host exists. Note this is on by default for local networks and short-circuits other types of requests.

The default is -PE -PS443 -PA80 -PP: ping, TCP probes of HTTPS and HTTP, then ICMP timestamp. The default is also to do -PR when scanning ethernet local addresses.

Some other useful flags:

  • -sn: don’t scan ports, just probe to see if the host exists
  • -n: skip DNS and reverse DNS
  • -v: verbose output
  • --send-ip: send IP packets (rather than raw ethernet). Has the side effect of bypassing ARP ping. There’s supposed to be a “--disable-arp-ping” option but it’s not in nmap 6.0.1.
  • --traceroute: uses an existing probe method to do a full traceroute. Very clever way to map a network even when most stuff is shut down; if you can get a response from, say, ICMP timestamps you can use that to do the traceroute.

Here’s a screenshot of Wireshark after a bunch of probes to my remote Linux box.

quickie VPN notes

I looked quickly into setting up a VPN server on my Ubuntu box in a datacenter, for use with MacOS and iOS clients. Unimpressed with what I learned. Here’s some options. They all suck.

  • PPTP, the venerable Microsoft protocol. Relatively easy to set up on both server and client, but has a reputation for being insecure. Plus it’s PPP and old and has a bad smell to it.
  • L2TP over IPSec. Apparently the server is doable on Ubuntu, but a bit wonky. MacOS and iOS both have clients. I probably should try this, I just don’t like the description of how it works. Update: Josh J. suggested this guide for setup (site down; Google cache).
  • Cisco IPSec. Proprietary? End of life from Cisco? Seems like a road not worth looking down.
  • OpenVPN. This is Ubuntu’s recommended server. Naturally, MacOS has no client for it; people like Tunnelblick. There’s no iOS client either other than GuizmOVPN which requires a jailbreak. I briefly tried following Ubuntu’s guide for installing OpenVPN which starts with “copy these config files and then edit some stuff”. Only the list of things to configure is incomplete, the template config files have errors in them, and after setting it all up I’m told “No /etc/openvpn/easy-rsa/openssl.cnf file could be found. Further invocations will fail”. I imagine I could power through all this stuff but it’s clear OpenVPN is not ready for casual users.

Why is this so damned hard?

Shape Blizzard’s bittorrent client

Blizzard uses BitTorrent for distribution of their game clients and patches. Great idea, but their BitTorrent client lacks any user controlled bandwidth settings so it totally saturates your home network. And thanks to the combination of bufferbloat and 100+ active streams, TCP congestion control doesn’t much help.

What does help is router QoS. I use Tomato firmware and it has a very nice little QoS setting. The key classifier for Blizzard traffic is Source or Destination Port: 6881. That catches most of the TCP streams starting on your PC downloading the game client. I set it to Low priority, which gives my ssh, HTTP and DNS traffic at the router a fighting chance.

While I’m here, the most valuable router QoS setting is “prioritize ACK packets”. That helps stop large uploads from an ADSL line prevent simultaneous fast downloads.

Here’s a graph of my router outbound traffic while I’m busily downloading Diablo III to my laptop (class = Low) while simultaneously uploading a big file via ssh (class = Medium). The graph shows a lot of Highest priority traffic; I’m not sure, but I assume that’s ACK packets. I’m a little sad that low priority gets 50% of the bandwidth whereas medium only gets 25%: I don’t know if that’s how the QoS works or if it’s an artifact of Bittorrent using so many simultaneous streams.

Here’s my router QoS settings:

Match Rule Class Description
UDP
Port: 123
Highest ntp
TCP/UDP
Dst Port: 53
Transferred: 0 - 2KB
Highest DNS
TCP
Port: 22
Transferred: 0 - 1024KB
High ssh
TCP
Dst Port: 80,443
Transferred: 0 - 512KB
High WWW
TCP
Dst Port: 80,443
Transferred: 512KB+
Low WWW (512K+)
TCP/UDP
Dst Port: 53
Transferred: 2KB+
Lowest DNS (2K+)
TCP/UDP
Port: 119
Low NNTP
TCP/UDP
Port: 563
Low NNTP (SSL)
TCP/UDP
Port: 6881
Low Blizzard BitTorrent

And for lolz, I’ve discovered my iMac + router + modem  has 2 megs of upload buffer. Boy that’s a lot. I should look into tweaking Tomato to lower the buffers. Or maybe find whatever the new hacker hipster router firmware is.

Update: the graph above was when I only identified source port 6881 as Blizzard traffic. Catching destination 6881 as well seems to help things a little.