Lion Cipher Lab

Build a host firewall with nftables

Why it matters

A firewall is the most basic control that decides which network traffic a machine will even talk to, and on Linux the modern tool for the job is nftables, the in-kernel framework that replaces the older iptables. The idea that pays off everywhere is default-deny: instead of trying to block every bad thing one rule at a time, you drop everything by default and then allow only the handful of things you actually need. That flips the burden of proof — an exposed service you forgot about is closed until you explicitly open it, which is exactly the mistake attackers hunt for. Learning to write a…

What you'll learn

Steps in this lab

  1. What a host firewall is, and why default-deny
  2. Install and enable nftables
  3. Safety first: don't lock yourself out
  4. Write the base ruleset
  5. Look at the live ruleset
  6. Test that allowed passes and blocked drops
  7. Make it persistent
  8. What you built, and the habit underneath it

Open the full interactive lab →