Basic IPTables Configuration

Learn basic IPTables configuration for Linux firewalls.

  1. List current rules:
sudo iptables -L -v -n
  1. Allow SSH:
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  1. Block IP:
sudo iptables -A INPUT -s 192.168.1.100 -j DROP
  1. Save rules:
sudo iptables-save > /etc/iptables/rules.v4

Read more: IPTables Documentation