iptables
also: netfilter, firewall
A command-line utility for configuring Linux kernel firewall rules that filter and route network packets based on protocols, ports, IP addresses, and other criteria.
iptables is the userspace tool for managing netfilter, the Linux kernel's packet filtering framework. It allows administrators to define rules that accept, drop, or modify incoming and outgoing network traffic.
Rules are organized into tables (filter, nat, mangle) and chains (INPUT, OUTPUT, FORWARD) that packets traverse. For example, to block SSH access from a specific IP: iptables -A INPUT -p tcp --dport 22 -s 192.168.1.100 -j DROP
Common uses include blocking ports, implementing port forwarding, rate limiting, and masquerading (NAT). Rules are applied immediately but lost on reboot unless saved with iptables-save or persisted through tools like iptables-persistent.
Note: On modern systems with IPv6 support, ip6tables handles IPv6 rules separately. Many distributions now prefer nftables as a modern replacement.