Firewall Rule Generator

Generate firewall rules for iptables, UFW, and FirewallD with ease.

Generated Command
iptables -A INPUT -j ACCEPT

Common iptables Examples

DescriptionCommand
Allow established/relatediptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
Allow SSH (port 22)iptables -A INPUT -p tcp --dport 22 -j ACCEPT
Allow HTTP and HTTPSiptables -A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT
Default DROP policyiptables -P INPUT DROP
Allow loopbackiptables -A INPUT -i lo -j ACCEPT
Block specific IPiptables -A INPUT -s 192.168.1.100 -j DROP
Log invalid packetsiptables -A INPUT -m state --state INVALID -j LOG --log-prefix "INVALID: " --log-level 4
NAT masqueradeiptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Port forward 8080 → 80iptables -t nat -A PREROUTING -p tcp --dport 8080 -j DNAT --to-destination :80
Allow ICMP pingiptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
Delete rule by matchingiptables -D INPUT -p tcp --dport 22 -j ACCEPT
Delete rule by numberiptables -D INPUT 3
List rules with numbersiptables -L INPUT --line-numbers -n