Skip to main content

Iptables Rule Generator

Generate iptables commands for common firewall scenarios.

Select Scenario
IP Address
Generated Command
Note: Most iptables commands require root privileges (sudo).

Common Usage

  • Block IP: Deny access from a specific IP address.
  • Allow Port: Open a specific port (e.g., 80 for HTTP, 443 for HTTPS).
  • Port Forwarding: Redirect traffic from one port to another IP/port (requires NAT).
  • Save Rules: Save current rules to a file (persistence depends on OS).

Note: Always verify the generated rules before applying them to your server. Incorrect firewall rules can lock you out of your system.