Linux Journal: Roll Your Own Firewall with Netfilter

Written By
Web Webster
Web Webster
Oct 14, 2003

Every self-respecting Linux guru should be familiar
with firewalls and how to install and configure them. With this in
mind, Linux gurus also should be curious about how firewalls
function and how to build a firewall of his or her own. Explaining
exactly these two things is the goal of this article. Here, we
attempt to write a firewall in less than 60 lines of C code. As
impossible as this may sound, it actually is quite simple to do
using the power of Linux kernel modules and Netfilter.

“Netfilter is a packet filtering subsystem in the Linux kernel
stack and has been there since kernel 2.4.x. Netfilter’s core
consists of five hook functions declared in linux/netfilter_ipv4.h.
Although these functions are for IPv4, they aren’t much different
from those used in the IPv6 counterpart. The hooks are used to
analyze packets in various locations on the network stack…”

Complete
Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.