iptables is a traditional tool for packet filtering on Linux. It uses tables of rules applied to network traffic and is known for its flexibility.


sudo apt install iptables
sudo iptables -L
    

Configuration: To make rules persistent across reboots, save your current ruleset and load it at startup.


sudo iptables-save > /etc/iptables/rules.v4
# On Debian/Ubuntu, install "iptables-persistent" to auto-load
sudo apt install iptables-persistent