I have Comcast Internet service at home. I’ve used it for many years now, and one of the constant things over this period of time has been that the service is quite often very unreliable. I’ve gone for months with no problems, and then for some weeks or months the service gets to be terribly unreliable.
What do I mean by unreliable? That is best described in terms of what the service is like when it is reliable.
- I can leave an ssh session to a remote machine up and running for days (say, an EC2 instance) – if I have keep-alive and things like that setup
- VPN sessions stay up for days without a problem
- The network is responsive, DNS lookups are quick, ICMP response is good, surfing the web is effortless, things like Netflix and Amazon movies work well
- Both IPv4 and IPv6 are working well
You get the idea. With that in mind, here’s what I see from time to time:
- Keeping an ssh session up for more than an hour is virtually impossible
- VPN sessions terminate frequently, sometimes it is so bad that I can’t VPN successfully
- DNS lookups fail (using the Comcast default DNS servers, 184.108.40.206, 220.127.116.11, 2001:558:feed::1, and 2001:558:feed::2). It isn’t any better with Google’s DNS because the issue is basic network connectivity
- There is very high packet loss even pinging my default gateway!
- Surfing the web is a pain, click a link and it hangs … Forget about streaming content
During these incidents, I’ve found that the cable modem itself remains fine, I can ping the internal interface, signal strengths look good, and there’s nothing obviously wrong with the hardware.
What I’ve found is that rebooting my cable modem generally fixes the problem immediately. Now, this isn’t always the case – Comcast does have outages from time to time where you just have to wait a few hours. But for the most part, resetting the cable modem just fixes things.
So I was wondering how I could make this all a bit better for myself.
An option is something like this. An “Internet Enabled IP Remote Power Switch with Reboot“. Or this, this, or this. The last one of those, Web Power Switch Pro Model, even sports a little web server, can be configured, and supports SNMP, and a REST API! Some of these gadgets are even Alexa compatible!
But, no – I had to solve this with a Raspberry Pi! Continued in Part 2.
In Part 1 of this blog post, I described a problem I’ve been facing with my internet service, and the desired solution – a gizmo that would reboot my cable modem when the internet connection was down.
The first thing I got was a PiRelay from SB Components. This nifty HAT has four relays that will happily turn on and off a 110v or 250v load. The site claims 7A @ 240V, more than enough for all of my network gear. See image below, left.
Next I needed some way to put this in a power source. Initially I thought I’d get a simple power strip with individual switches on the outlets. I thought I could just connect the relays up in place of the switches and I’d be all set! So I bought one of these (above right).
Finally I just made a little junction box with four power outlets, and wired them up to the relays.
The software to control this is very straightforward.
- It turns out that the way Microsoft checks for internet connectivity is to do a get on “http://www.msftncsi.com/ncsi.txt”, and that returns the text “Microsoft NCSI”. OK, so I do that.
- I also made a list of a dozen or so web sites that I visit often, and I make a conn.request() to them to fetch the HEAD.
If internet connectivity appear to be not working, power cycle “relay 0”, which is where my cable modem is running. And this is a simple cron job, runs every 10 minutes.
Works like a champ. Another simple Raspberry Pi project!
If you are interested, ping me and I’ll post more details. I intend to share the code for the project soon – once I shake out any remaining little gremlins!
This is a wonderful, well written, and comprehensive write-up on taking night photographs (in general) and the Milky Way in particular.
Well worth the 10 minutes to read it through.
This is just freaking awesome. 50,000 images produced this masterpiece in 81 megapixel resolution.
Debugging things on the Raspberry Pi by flashing the power LED.
I’ve often found that the most useful debugging technique is to be able to provide a visual cue that something is going on. And for that, blinking the power light on the Raspberry Pi is the easiest thing to do.
The power light (often called LED1) is always on, and bright red. So turning it off, and back on is a great little debugging technique.
A short note about the LEDs on Raspberry Pi. There are two, one is the green one [led0] for network activity, and the other is the red one [led1] for power.
They are exposed through
To turn off the red LED
echo 0 > /sys/class/leds/led1/brightness
To turn on the red LED
echo 0 > /sys/class/leds/led1/brightness
Doing this requires that you are privileged. So to make things easy I wrote it in C, put the binary in /bin, and turned on the setuid bit on it. I’ve also used a library that blinks the power LED in simple morse code to get a short message across. I can’t do more than about 10 wpm in my head now so while it is slow, it is very very useful.
4 Ways To Make Better Street Portraits While Traveling
A nice article, particularly tip 4.
How to Improve Low-Light Performance by Increasing Your ISO
I have got to try this out.