

To install the required package use the following command: sudo apt-get install iptables-persistent

In case you are using Ubuntu VPS you need to install additional package for that purpose. Now that you deleted the iptables firewall rule you need to save the changes to make them persistent. mo GET YOUR VPS sudo iptables -D INPUT -s 111.111.111.111 -p tcp -dport 22 -j DROP

For that purpose you need to use the following syntax: iptables -D chain rulenumįor example, if you have a firewall rule to block all connections from 111.111.111.111 to your server on port 22 and you want to delete that rule, you can use the following command: How to Delete iptables Firewall Rules?Īt some point, you may need to delete a specific iptables firewall rule on your server. If this is the case we recommend you to check our tutorial on How to Set Up a Firewall with iptables on Ubuntu and CentOS to make your server more secure. The output will be similar to the one below if there are no rules added: Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)Ĭhain POSTROUTING (policy ACCEPT 0 packets, 0 bytes) Since NAT (Network Address Translation) can also be configured via iptables, you can use iptables to list the NAT rules: sudo iptables -t nat -n -L -v Pkts bytes target prot opt in out source destinationĬhain FORWARD (policy ACCEPT 0 packets, 0 bytes)Ĭhain OUTPUT (policy ACCEPT 0 packets, 0 bytes) If there are no rules added to the packet filtering ruleset the output should be similar to the one below: Chain INPUT (policy ACCEPT 0 packets, 0 bytes) Otherwise, you need to add sudo user on your Linux VPS or use the root user.

To run the command above your user need to have sudo privileges. Connect to your Linux VPS via SSH and run the following command: sudo iptables -nvL In order to be able to check this you need to have SSH access to the server. Iptables allows you to list all the rules which are already added to the packet filtering rule set. Iptables is a command line utility that allows system administrators to configure the packet filtering rule set on Linux. iptables requires elevated privileges to operate and must be executed by user root, otherwise it fails to function. We’ll show you, how to list and delete iptables firewall rules.
