Skip to main content

Firewall Rule Generator

v1.0.2

Generate firewall rules for iptables, UFW, and nftables.

Generates firewall rules for iptables, UFW (ufw allow/deny), and nftables based on configured allow/deny rules for ports, protocols, and source IP ranges.

How to use
  • Select your firewall tool (iptables, UFW, or nftables).
  • Add rules: direction (INPUT/OUTPUT), protocol, port or range, and source/destination.
  • Copy and review the generated commands before applying them on your server.
Review generated rules carefully before applying them to a production system.
Rules
Rule #1
iptables
# iptables rules
# Flush existing rules
iptables -F
iptables -X

# Default policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

# Allow loopback
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -p tcp --dport 443 -m comment --comment "HTTPS" -j ACCEPT