Basic iptables Usage & Commands

Basic iptables Usage & Commands


Iptables is a program that allows you to configure Linux's built-in firewall. By default, no rules are set, meaning the firewall will accept all connections. This guide covers the basics of working with iptables. To execute any of the below commands, you will need to be logged in to your VPS via SSH.

To list all current iptables rules:

# iptables -L

To flush/clear all current firewall rules:

# iptables -F


To stop/disable iptables temporarily:

# service iptables save

# service iptables stop


To restart the iptables service:

# service iptables restart


# /etc/rc.d/init.d/iptables restart

(Usage: /etc/rc.d/init.d/iptables start|stop|restart|condrestart|status|panic|save)

Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 146