Part 1: Understanding Network Packets: IP Header, UDP Header
Part 2: How To Use IPTables to Block a Specific DNS Request?
iptables, nftables, and ipvs, which are firewalls/load balancers on Linux, are being built on top of Netfilter.
Can we develop our own firewall?
It is not that easy, but yes.
I have seven distinct modules created. The modules will assist you in creating a basic Linux firewall.
The Git repository will teach you how to use the Netfilter framework to filter network packages, extract valuable information, and allow or block them.
I added the kernel modules to my GitHub account: Firewall as a Linux-Kernel Module
The modules' complexity is progressively raised. It is highly recommended that you proceed through the modules in order of number.
This is the video where you can learn how to build and deploy a module.
Part 1 & Part 2
It is strongly advised that you read the first and second articles before proceeding to the modules.
Firewall-as-a-Linux-Kernel-Module
Enjoy!