Setting Up a Basic Firewall
Posted on June 1, 2024 (Last modified on June 26, 2024) • 1 min read • 95 wordsLearn how to set up a basic firewall to protect your network from unauthorized access and attacks.
Set up a firewall using iptables to control incoming and outgoing traffic. Iptables is a powerful tool for managing network traffic rules.
# Example: Basic iptables rules
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -j DROP
Ensure iptables rules persist across reboots by saving them to a file and restoring them at boot.
# Example: Saving iptables rules
sudo iptables-save > /etc/iptables/rules.v4