Firewall Rule Generator
Generate firewall rules for iptables, UFW, and FirewallD with ease.
Generated Command
iptables -A INPUT -j ACCEPTCommon iptables Examples
| Description | Command |
|---|---|
| Allow established/related | iptables -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 HTTPS | iptables -A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT |
| Default DROP policy | iptables -P INPUT DROP |
| Allow loopback | iptables -A INPUT -i lo -j ACCEPT |
| Block specific IP | iptables -A INPUT -s 192.168.1.100 -j DROP |
| Log invalid packets | iptables -A INPUT -m state --state INVALID -j LOG --log-prefix "INVALID: " --log-level 4 |
| NAT masquerade | iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE |
| Port forward 8080 → 80 | iptables -t nat -A PREROUTING -p tcp --dport 8080 -j DNAT --to-destination :80 |
| Allow ICMP ping | iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT |
| Delete rule by matching | iptables -D INPUT -p tcp --dport 22 -j ACCEPT |
| Delete rule by number | iptables -D INPUT 3 |
| List rules with numbers | iptables -L INPUT --line-numbers -n |