logoalt Hacker News

My home network observes bedtime with OpenBSD and pf

80 pointsby ibobevlast Monday at 1:56 PM23 commentsview on HN

Comments

toast0today at 4:20 PM

> However, I ran into trouble with the RealTek ethernet hardware support in OpenBSD, which had been running fine with Linux for years.

I've run into problems with realtek gigE nics on Linux, FreeBSD, and Windows. I'm convinced their hardware/firmware has a timing issue where if the wrong things happen, the descriptor indexes get unsyncronized. This can lead to network stalls, but also wild writes. IIRC, reset behavior is weird too; vague because it's been a while since I looked, but I think if you get a network stall and do a reset, the card may receive and DMA a packet into RAM in the process ... something like that anyway.

I have systems where the FreeBSD base driver consistently stalls, but the realtek provided driver works mostly ok; but the realtek driver is full of undocumented flag setting, so who knows what it's doing... it also sets the NIC to emit pause frames when it runs out of RX buffers which I never want; things will be much better if packets are dropped when RX buffers are full.

I would love to have the equipment and time to figure out what's going on, but a) realtek probably should be the ones to do it, b) switching drivers usually works at no cost, and swapping to intel almost always works but you need slots and cards (ebay gets you multiport 1g for $10, 10g for $20-$30 though). I've heard realtek is good at 2.5g and intel isn't; but I haven't run enough realtek 2.5g to know.

pak9rabidtoday at 3:07 PM

Cool post, I love a good firewall story.

One suggestion though: rather than doing this all on a single LAN network and having to deal with adding exceptions for devices that still need access to the Internet during 'bedtime' periods, I suggest creating a separate VLAN for devices that need 'bedtime' enforcement and put those devices there, while leaving your 'always online' devices in your main VLAN where access to the Internet is always available. This way all you have to do is simply change your firewall rules for that VLAN to enforce bedtime, which removes the extra rules needed for exceptions.

show 2 replies
deanputneytoday at 3:11 PM

Love your watercolors! What a fun addition to a technical article :)

show 2 replies
foobariantoday at 4:29 PM

Only allowing TCP will break a lot of stuff. I was wondering why even bother with the transport layer, instead of just focusing on IP directly

panavinsinghtoday at 3:28 PM

The anchor-based approach for time-dependent rules is elegant. Most people would reach for a cron job that rewrites firewall rules on a schedule, but using pf anchors keeps the state management inside the packet filter where it belongs. The key advantage of pf over iptables for this kind of use case is that rule evaluation is deterministic and the syntax stays readable enough to audit six months later without documentation archaeology. Nice to see OpenBSD used for practical home network management instead of just theoretical security posturing.

show 2 replies
OGWhalestoday at 4:47 PM

Fun article! I like your watercolors too, especially the one of them going into the pufferfish's mouth :D

drnick1today at 5:00 PM

That little PC should be able to run a lot of additional stuff in addition to the packet filter. My setup is similar, but I use an old gaming PC instead, and run dozens of services including email, nginx and various game servers on it. It does not break a sweat.

nesarkvechneptoday at 6:52 PM

Waiting for the “pf is garbage, use Linux” comments.

show 1 reply
protealtoday at 4:52 PM

Thank you for sharing! What are your thoughts on intentionally degrading service over the course of an hour instead of a hard cutoff? Like implementing an increasingly restrictive cap on download speeds/intentionally dropping a % of packets over the hour. Might be a little less jarring than a hard stop.

show 1 reply
bluGilltoday at 5:31 PM

I tried something like this. my kids just turned off wifi and I can't control the cell signals. Phone parent controls are not powerful enough for what I need

show 4 replies
devnotes77today at 7:04 PM

[dead]

hofiflotoday at 5:24 PM

[dead]

netiktoday at 6:19 PM

Yet another “I cant’t parent so I’ll show my kids what a surveillance state looks like” post.