All Products
Search
Document Center

:How to delete existing rules in Iptables from a Linux instance

Last Updated:Dec 31, 2020

Overview

This article describes how to in existing in Iptables delete rules a Linux instance.

Detail

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.

Perform the following steps.

Note: the internal configurations of the instance may be required to be modified. To ensure data security, create a snapshot of the instance first.

  1. Run the following command to view the num of the rule to be deleted:
    iptables -t nat -L -n --line-numbers
  2. Confirm the num corresponding to the rule to be deleted, and then run the command delete.
    iptables -t nat -D PREROUTING [$Num]
    Note:[$Num] indicates the num to be deleted. After you delete a rule, the other rules fill the table and the num parameter changes.

Application scope

  • Elastic Compute Service