Moving from OpenBSD to FreeBSD for firewalls

(utcc.utoronto.ca)

153 points | by zdw 6 days ago ago

78 comments

  • popknobinfanny 3 hours ago

    Root on ZFS is an easy sell for me. OpenBSD's ancient filesystem is notoriously flaky, and they have no interest in replacing it anytime soon.

    I can't be worried that critical parts of my network won't come back up because the box spontaneously rebooted or the UPS battery ran out (yes it happens — do you load test your batteries — probably not) and their bubblegum-and-string filesystem has corruption and / and /usr won't mount and I gotta visit the console like Sam Jackson in Jurassic Park to fsck the damn thing.

    Firewalls are critical infra — by definition they can't be the least reliable device in the network.

    • hnav 2 hours ago

      conversely, running a firewall on something like ZFS also sounds like too much. Ideally I'd want a read-only root FS with maybe an /etc and /var managed by an overlay.

      • lmm 2 hours ago

        Sounds like overcomplicating in the name of simplification. ZFS is a good, reliable, general-purpose system; often the right answer is to just put everything on ZFS and get on with your life.

        • SoftTalker 2 hours ago

          I’ve had more problems with zfs than all other filesystems combined including FAT. It’s IMO overkill for a root partition.

    • p_ing an hour ago

      > Firewalls are critical infra — by definition they can't be the least reliable device in the network.

      This is why you have failover for firewalls. The loss of any single device isn't that important.

      • MBCook an hour ago

        Sure but you still want them as stable as possible. Needing (emphasis there) to fail over should be for emergencies, not standard operating procedure.

  • dylan604 9 hours ago

    I once wrote a similar post to an DVD industry centric mailing list (remember those?) regarding switching to FCP7 from Adobe Premiere with a huge difference in how FCP7 would allow capturing of discrete audio channels vs Premiere forcing an interleaved audio stream. Eventually, a rep from Adobe contacted me through my company's PR team (a first for me) to go over the list of complaints. At the end, he agreed these were all valid complaints, and then asked "if Premiere added these changes would I be willing to switch back"? At that point, I said probably not as we'd now be fully switched to FCP7 in all departments. So I understand that sentiment as well. Honestly, I was shocked that someone actually read my missive and actually paid any mind to it. So maybe someone at OpenBSD will be as receptive if not equally unable to do anything about it.

  • SoftTalker 9 hours ago

    As noted, recent changes to OpenBSD TCP handling[1] may improve performance.

    On a 4 core machine I see between 12% to 22% improvement with 10 parallel TCP streams. When testing only with a single TCP stream, throughput increases between 38% to 100%.

    I'm not sure that directly translates to better pf performance, and four cores is hardly remarkable these days but might be typical on a small low-power router?

    Would be interesting if someone had a recent benchmark comparison of OpenBSD 7.8 PF vs. FreeBSD's latest.

    [1] https://undeadly.org/cgi?action=article;sid=20250508122430

    • wahern 8 hours ago

      That particular change improves throughput received locally. Though over the past few years there's been a ton of work on unlocking the network layer generally to support more parallelism.

      For a firewall I guess the critical question is the degree of parallelism supported by OpenBSD's PF stack, especially as it relates to common features like connection statefulness, NAT, etc.

      • SoftTalker 7 hours ago

        Thanks. Yes after I posted that I started wondering if it was really relevant to pf.

    • throwaway270925 5 hours ago

      Can confirm. Lots of performance improvements lately in OpenBSD. Our Load Balancers basically doubled throughput after updating from 7.6 to 7.7

  • kuon an hour ago

    I was using OpenBSD for my firewalls for a long time, but with the arrival of 10Gbit/s ethernet, I realized that I had to move back to ASIC based firewalls.

    Yes, you can forward 10Gbit/s with linux using VPP, but you cannot forward at that rate with small packets and stateful firewall. And it requires a lot of tuning and a large machine.

    A used SRX4200 from juniper runs at around 3k USD and you can even buy support for it and you can forward at like 40Gb/s IMIX with it.

    I still prefer PF syntax over everything else though.

  • somat 4 hours ago

    I am not very familiar with FreeBSD's pf but my understanding is that fbsd integrated it from OpenBSD and then proceeded to put a fair amount of work in making it more performant(multi core) while OpenBSD put most of it's work into improving pf's features, At this point the two pf's are different enough that they are not really compatible. OpenBSD can't really use much of fbsds multi core work and FreeBSD is A. Is a lot more hesitant about breaking backwards compatibility and B. would need get the queuing structures to work with their kernel. In short FreeBSD pf is like using an old fast version of OpenBSD pf

    In fact if you asked me to explain the difference between obsd and fbsd it is exactly this. fbsd focuses on performance and obsd focuses on ergonomics.

    • markjdb an hour ago

      The pf maintainer in FreeBSD has been doing a ton of work to bring more recent improvements over from OpenBSD, trying to bring them in sync as much as possible without breaking compatibility: https://cgit.freebsd.org/src/log/sys/netpfil/pf

      The state of affairs you described is much less the case now than in the past.

  • yuvadam 9 hours ago

    What's wrong with Linux for firewalls? Either openwrt, or any distro really.

    Why would any BSD perform better?

    (edit: genuinely curious why BSDs are such popular firewalls)

    • linsomniac 35 minutes ago

      I'm pretty die-hard Linux, but I had a client who needed to do traffic shaping on hundreds or thousands of this ISPs users. I've tried multiple times to get anything more than the most simple traffic shaping working under Linux, with pretty bad luck at it. I set them up with a FreeBSD box and the shaping config, IIRC, was a one-liner and just worked, I never heard any complaints about it.

      I've run a lot of Linux firewalls over the decades, but FreeBSDs shaping is <chefs kiss>

    • mrpippy 6 hours ago

      One thing I like about using OpenBSD for my home router is almost all the necessary daemons being developed and included with the OS. DHCPv4 server/client, DHCPv6 client, IPv6 RA server, NTP, and of course SSH are all impeccably documented, use consistent config file formats/command-line arg styles, and are privilege-separated with pledge.

    • wasting_time 7 hours ago

        Compared to working with iptables, PF is like this haiku:
      
        A breath of fresh air,
        floating on white rose petals,
        eating strawberries.
      
        Now I'm getting carried away:
      
        Hartmeier codes now,
        Henning knows not why it fails,
        fails only for n00b.
      
        Tables load my lists,
        tarpit for the asshole spammer,
        death to his mail store.
      
        CARP due to Cisco,
        redundant blessed packets,
        licensed free for me.
      
      (From https://marc.info/?l=openbsd-pf&m=108507584013046&w=2 )

      Nftables has improved the situation on Linux somewhat, but PF is incredibly intuitive and powerful. A league of its own when it comes to firewalling.

      • NewJazz 6 hours ago

        Nftables is alright IME

      • justaboutanyone 7 hours ago

        Has there ever been an effort to port PF over to linux, or to create an adaption layer that makes things compatible?

        • thesuitonym 6 hours ago

          pf has been ported to Debian/kFreeBSD, but afaik no effort has been made to port it to the Linux kernel. A lot of networking gear already runs a BSD kernel, so my guess is the really high-level network devs don't bother because they already know BSD so well.

      • waynesonfire 18 minutes ago

        Uhh... no idea but yea. Its that much better that it deserves a poem.

    • 2trill2spill 9 hours ago

      I assume in this case they already had a bunch of firewall rules for PF and switching from OpenBSD -> FreeBSD is a much easier lift then going to linux because both the BSDs are using PF, although IIRC there are some differences between both implementations.

    • lmm 2 hours ago

      Too many random changes, too fiddly to maintain, too much general flakiness. Especially for simple single-purpose devices that you want to set up once and leave alone for years, BSD is generally much nicer than Linux. I'd actually flip your question: why would you ever use Linux rather than FreeBSD?

    • jrmg 3 hours ago

      One thing unexpected I found when setting up an OpenBSD based router recently: the web isn’t riddled with low-quality and often wrong SEO and AI slop about OpenBSD like it is for Linux. I guess there just isn’t enough money to be made producing it for it for such a niche audience.

      If you search up a problem, you get real documentation, real technical blog posts, and real forum posts with actual useful conversations happening.

    • nesarkvechnep 8 hours ago

      What's wrong with using any BSD? Can't people use whatever suits their needs?

      • yuvadam 8 hours ago

        Of course, I'm genuinely curious why BSDs are more popular as firewalls.

        • nesarkvechnep 7 hours ago

          Because of pf[1]. It's just a very capable firewall with a pleasurable configuration language.

          [1] https://www.openbsd.org/faq/pf/

          • Twirrim 6 hours ago

            Agreed, `pf` is a delight to use.

            Borrowing a demonstration from https://srobb.net/pf.html

                tcp_pass = "{ 22 25 80 110 123 }"
                udp_pass = "{ 110 631 }"
                block all
                pass out on fxp0 proto tcp to any port $tcp_pass keep state
                pass out on fxp0 proto udp to any port $udp_pass keep state
            
            
            Note last rule matching wins, so you put your catch-all at the top, "block all". Then in this case fxp0 is the network interface. So they're defining where traffic can go to from the machine in question, in this case any source as long as it's to port 22, 25, 80, 110, or 123 for TCP, and either 110 or 631, for UDP.

            <action> <direction> on <interface> proto <protocol> to <destination> port <port> <state instructions>

        • petee 4 hours ago

          The documentation on BSDs, and in particular OpenBSD, are generally high quality

    • electric_mayhem 9 hours ago

      PF is really nice. (Source: me. Cissp and a couple decades of professional experience with open source and proprietary firewalls).

      And if they are already using it on openbsd, it’s almost certainly an easier lift to move from one BSD PF implementation to another versus migrating everything to Linux and iptables.

      • theideaofcoffee 8 hours ago

        Agreed. Once you've gone pf you'll pine for it when working with anything else.

        • kstrauser 8 hours ago

          I've gotta me-too this. I've written any number of firewall rulesets on various OSes and appliances over the years, and pf is delightful. It was the first and only time I've seen a configuration file that was clearly The Way It Should Be.

        • bigfatkitten 7 hours ago

          The only configuration language I like more is Juniper. I picked that up and became fluent in it within about a day.

    • mikey_p 8 hours ago

      Because of PF or Packet Filter (the PF in pfSense FWIW): https://en.wikipedia.org/wiki/PF_(firewall)

    • rfmoz 8 hours ago

      Let me extend the question to what’s wrong with NFTables on Linux? It’s a different way to manage Netfilter, out of IPTables

    • guerby 8 hours ago

      We migrated to a linux nftables based firewall.

      I never liked iptables, but nftables is pretty nice to write and use.

      And with one "flowtable" line added to your nftables.conf you can even in theory have faster routing when conntrack is active

      https://thermalcircle.de/doku.php?id=blog:linux:flowtables_1...

    • INTPenis 4 hours ago

      I've used both and the main advantage is PF/ipfw syntax.

      But now with nftables I actually am going back to RHEL on Firewalls. I want something ultra-stable and long lived.

      • wahern 4 hours ago

        I've been using OpenBSD and PF for nearly 25 years (PF debuted December 2001). Over those years there have been syntax changes to pf.conf, but the most disruptive were early on, and I can't remember the last syntax change that effected my configs (mostly NAT, spamd, and connection rate limiting).

        During that time the firewall tool du jour on Linux was ipchains, then iptables, and now nftables, and there have been at least some incompatible changes within the lifespan of each tool.

        OpenBSD has an additional leg up in that incompatible changes between releases are concisely, clearly, and consistently documented, e.g. https://www.openbsd.org/faq/upgrade78.html The last incompatible pf.conf syntax change I could find was for 6.9, nearly 5 years ago, https://www.openbsd.org/faq/upgrade69.html

  • ThinkBeat 7 hours ago

    I find it a bit odd that they seem to have gone from having OpenBSD as the standard and are not moving to FreeBSD and Ubuntu.

    I an not sure what role these computers that may transition to Ubuntu do, there are probably good reasons, I wish he had expanded on it.

    • thatcks 6 hours ago

      The computers that moved from OpenBSD to Ubuntu were our local resolving DNS servers. These don't use PF and we also wanted to switch from our previous OpenBSD setup to Bind, where we were already running Bind on Ubuntu for our DNS master servers. The gory details were written up here: https://utcc.utoronto.ca/~cks/space/blog/sysadmin/UsingBindN...

      We may at some point switch our remaining OpenBSD DHCP server to Ubuntu (instead of to FreeBSD); like our DNS resolvers, it doesn't use PF, and we already operate a couple of Ubuntu DHCP servers. In general Ubuntu is our default choice for a Unix OS because we already run a lot of Ubuntu servers. But we have lots of PF firewall rules and no interest in trying to convert them to Linux firewall rules, so anything significant involving them is a natural environment for FreeBSD.

      (I'm the author of the linked-to article.)

      • cyberpunk 6 hours ago

        Why do you say OpenBSD stopped "supporting bind"? You mean they don't include it in the base system anymore since the switch to unbound?

        I mean.. It's one pkg_add away. It's a weird constraint to give yourself if that was the problem, considering you absolutely had to install it on your replacement ubuntu servers.

  • awesome_dude 9 hours ago

    > There are some things about FreeBSD that we're not entirely enthused about.

    Damn I wish that they had expanded on this a bit (not to start a flame war, but to give readers a fuller picture, or even to prod the FreeBSD community into "fixing" those things)

    edit: typo fix

    • lloydatkinson 9 hours ago

      It does seem like a weird omission doesn’t it?

  • Y_Y 8 hours ago

    So you don't like OpenBSD, but you do like Ubuntu?

    This person seems like they know wht they are talking about and given it serious thought, but I cannot fathom how you could make such a conclusion today.

    • toast0 7 hours ago

      If they're concerned about performance, yeah. OpenBSD doesn't do the basics that you need to get the most out of your SMP hardware; there's no way to set cpu affinity at least from userland, and it's clear that this sort of work is not a priority for OpenBSD; it's not easy work, but FreeBSD has done it. Beyond CPU affinity, you also need your network structures setup to reduce lock contention, things like fine grained locks, hashed subtables and/or "lockless" tables, configuring the NICs as close as possible to one queue per core and keeping flows on the same queue which is pinned to a single core so that the per flow locks never contend and don't bounce between cores.

      Ubuntu/Linux do have reasonable performance, but I think they prefer PF firewalls, so that makes Linux a non-option for firewalls.

      Personally, I don't really care for PF, but it offers pfsync, which I do care for, so I use it and ipfw... but I need to check in, I think FreeBSD PF may have added the hooks I use ipfw for (bandwidth limits/shaping/queue discipline).

      • seanw444 6 hours ago

        It's not necessarily that OpenBSD can't implement the basics, it's that they don't want to. A lot of the high-performance features introduce potential security vulnerabilities. Their main focus is security and correctness. Not speed.

      • csmpltn 7 hours ago

        > "there's no way to set cpu affinity at least from userland"

        How is that even possible. What's the excuse?

        On Windows, setting process affinity has been around since the Windows NT days.

        • thesuitonym 7 hours ago

          The gp already answered you, "this sort of work is not a priority for OpenBSD."

          OpenBSD is a small, niche operating system, and it really only gets support for something if it solves a problem for someone who writes OpenBSD code. In a way, this is nice, because you never get half-assed features that kinda-sorta work sometimes, maybe. Everything either works exactly as you'd expect, or it's just not there.

          I love OpenBSD, but there are some tasks it's just not suited for, and that's fine, too.

        • toast0 7 hours ago

          I was pretty sure I had seen a mailing list post from Theo about it, but I can't find it now. The only relevant thread I can find is this one [1], which pretty much just says "we don't do it for userland"; but does say it is available inside the kernel, and I have seen some mentions in recent release notes for OpenBSD of binding PF things by toeplitz hash, which indicates the right progression for that ... but it's still hard to get max performance from a simple network daemon without binding the userland threads to same core that the kernel processes the flow with. Once your daemon starts doing substantial work, binding cpus isn't as important, but if it's something like an authoritative DNS server or HAProxy with plain sockets, the performance benefit from eliminating cross-core communication can be tremendous.

          [1] https://marc.info/?l=openbsd-misc&m=152507006602422&w=2

        • doubled112 7 hours ago

          It's the OS's job to manage resources.

          • Twirrim 6 hours ago

            The OS doesn't always know everything about workloads to be able to make the right decisions.

    • EliteGadget 5 hours ago

      It appears they have different requirements for those machines. They state the Ubuntu machines are for non-firewall applications. Ubuntu and Debian can configured relatively easily for a number of workstation and server roles.

      Also many IT professionals that have used Linux will be familiar with a Debian or a Debian derivative such as Ubuntu. That simply isn't the case with OpenBSD.

      I recently installed OpenBSD on my old laptop to try it out and I found it difficult even though I used to use it at University back in the late 2000s.

      • raddan 2 hours ago

        Amusingly, I started using OpenBSD in 2000 because after repeatedly trying to get Debian running on my PowerPC G4 and failing (for months), I discovered that OpenBSD had a PowerPC port that immediately worked. Honestly the hardest part about OpenBSD is the installer, which has a few small improvements over the one back in 2000, but is essentially the same. I'm sure that kids these days will turn to ChatGPT for help, but I learned most of what I knew about hacking on a UNIX machine from OpenBSD's amazingly good man pages; they are still great.

        I went through the process again just this weekend, because the disk in my firewall died. It's obvious that they continue to put a lot of effort into the OS. It's too bad that I can't use it as my daily driver, because I gladly would.

        • EliteGadget 2 hours ago

          Their ports to older non-x86 stuff does work well but I can't justify using it as a desktop OS. Too many compromises you have to make without a lot of benefit IME.

          I find with the BSDs is that it is difficult to look up how to do something quick via a web search. Yes that is a man page that will tell you how to use whatever, but knowing where you are supposed to look to solve "why doesn't two button scroll work" isn't immediately obvious.

          I was mucking around with FreeBSD on my old laptop and it works well and it isn't too bad to get stuff going if you are following the handbook, there is still that "how do I get <thing> working". I think the OS is good underneath, but I kinda want two finger scrolling to kinda work when I install cinnamon and X.

          Debian is at the stage now of install, you have desktop and most stuff just works at least on a x86-64 system. If I want to install anything, it is download deb / flatpak and I am done.

    • stackghost 3 hours ago

      It's actually pretty shocking how poorly and sluggish OpenBSD performs, and it's not meaningfully more secure than a properly-configured Linux or freebsd box.

      I'm honestly not sure what its use case is in 2025, beyond as a research OS.

      • popknobinfanny 3 hours ago

        Theo has gone on record stating that it IS a research OS, which allows them to prototype new ideas like pledge().

        It's also the development and reference platform for OpenSSH, before the Linux distros add all sorts of digital AIDS to it. Remind me again how the xz backdoor happened and why OpenBSD wasn't affected.

        If their license was more like Mozilla's, the Linux distros wouldn't legally be allowed to call it OpenSSH because they make so many unnecessary patches and modifications.

        • stackghost 3 hours ago

          >Theo has gone on record stating that it IS a research OS, which allows them to prototype new ideas like pledge().

          Makes sense

          >before the Linux distros add all sorts of digital AIDS to it. Remind me again how the xz backdoor happened and why OpenBSD wasn't affected.

          Why are OpenBSD people always so rude and defensive? Sheesh

        • jamiek88 2 hours ago

          Digital AIDS?

          Jesus.

  • jmclnx 9 hours ago

    For me, the only drawback for corporations is the 6 month upgrade. There is no LTS on OpenBSD.

    I use OpenBSD as a workstation and it works great, but in a production environment I doubt I would use OpenBSD for critical items, mainly because no LTS.

    It is a sad state of affairs because Companies do not want nor will want a system you need to upgrade so often even if its security very good.

    • rootnod3 9 hours ago

      On the other hand though, updates on OpenBSD are the most painless updates I have ever done. I am more concerned about it's usage of UFS instead of something more robust for drives.

      • kstrauser 8 hours ago

        I'm grossly generalizing here, but it seems like OpenBSD boxes seem to be commonly used for the sorts of things that don't write a lot of data to local drives, except maybe logfiles. You can obviously use it for fileservers and such but I don't recall ever seeing that in the wild. So in that situation, UFS is fine.

        (IMO it's fine for heavier-write cases, too. It's just especially alright for the common deployment case where it's practically read-only anyway.)

        • SoftTalker 8 hours ago

          I've used it as a mail server, a web server, and a database (postgres) server. It's also my main desktop OS. Did/does fine, but I never really stressed it. I would certainly welcome a more capable filesystem option, as well as something like logical volumes, but I can't say that ufs has ever failed me.

          You'll definitely want to have it on a UPS to avoid some potentially long and sometimes manual intervention on fscks after a power failure. And of course, backups for anything important.

    • rbc 3 hours ago

      I think it depends on your needs. Working corporate environments with 1000+ hosts, LTS operating systems are big help. On the other hand, for smaller cases, call it a work group or smaller, I think OpenBSD provides a base system that doesn't typically make drastic changes, along with a ports collection that does a pretty good job of keeping up with the third party applications. It's a good balance. I've recently seen some "Immutable" Linux distributions that are basically spins of upstream distributions. They leave the inherited distribution mostly alone and load the extras using Flatpak or the like. Sounds similar to BSD ports in a way.

    • SoftTalker 9 hours ago

      Yet companies insist on enabling unattended upgrades at least for "security" patches, which have introduced breakage or even their own vulnerabilities in the past (Crowdstrike was a recent dramatic example).

      OpenBSD will just tell you that maintaining an LTS release is not one of their goals and if that's what you need you'll be better served by running another OS.

  • 0xWTF 9 hours ago

    I don't understand why this has 29 points and no comments. What's so amazing about this?

    • wslh 9 hours ago

      Discussion threads about performance?

  • j45 8 hours ago

    I just like the reference to 10G ethernet. It can't become normal soon enough.

  • wslh 9 hours ago

    I imagine a near future where TCP/IP stacks, and device drivers are interchangeable between operating systems. In Linux, NDISWrapper [1] enables to use Windows drivers in Linux but it's a wrapper (with all due respect to this project).

    [1] https://en.wikipedia.org/wiki/NDISwrapper

  • theideaofcoffee 9 hours ago

    Just more navel-gazing from UTCC. I still don't understand why all of these submissions get upvoted so often. 10G performance just really isn't that interesting anymore, maybe around 2005 when it was the new kid on the block. If they were talking about squeezing firewall performance out of a box with a couple of 200g or 400g adapters and on run-of-the-mill CPUs and no offloading or something like Netflix publishes with their BSD work, I'd be more interested.

    • cyberpunk 6 hours ago

      It reads a bit like someone LARP'ing a sysadmin. Perhaps they're students or something.

      • yepguy an hour ago

        Nah, Chris is definitely a real sysadmin and his blog has been pretty popular in this space for a long time.