1. View / List All iptables Rules
When you want to check what rules are in iptables, use –list option as shown below.
# iptables --list
Example 1: Iptables list output showing no rules
# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
The above output shows chain headers. As you see, there are no rules in it.
Example 2: Iptables list output showing some rules
When there is a rule to disable ping reply, you have the iptables list output as like the following. You can see the rule in the OUTPUT chain.
# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DROP icmp -- anywhere anywhere icmp echo-request
2. Delete iptables Rules using flush option
When you want to delete all the rules, use the flush option as shown below.
# iptables --flush
After doing this, your iptables will become empty, and the “iptables –list” output will look like what is shown in the example 1.
You can also delete (flush) a particular iptable chain by giving the chain name as an argument as shown below.
# iptables --flush OUTPUT
No comments:
Post a Comment