Linux Commands Helper

💬 Your AI-powered Linux assistant

iptables Command - Firewall Management

The iptables command is used to set up, maintain, and inspect the tables of IP packet filter rules in the Linux kernel. It is commonly used to configure firewall rules for network traffic control and security.

Syntax

iptables [options] [chain] [rule-specifications]

Examples

iptables -L

List all current firewall rules.

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

Allow incoming SSH connections on port 22.

iptables -A INPUT -p tcp --dport 80 -j DROP

Block incoming HTTP traffic on port 80.

iptables -D INPUT -p tcp --dport 22 -j ACCEPT

Delete the rule that allows SSH on port 22.

Notes

  • Root privileges are required to modify firewall rules with iptables.
  • Changes made with iptables are not persistent after reboot unless saved.
  • On modern systems, nftables is recommended as a replacement for iptables.

© 2025 Linux Commands Helper. All rights reserved.

This project is under construction. Feedback and contributions are welcome.

Fazier badgeFeatured on Startup Fame