How to list and delete IPtables
How to list and delete iptables
- To delete Input rules:
- iptables -L -n -v --line-number
- For example, if we want to delete the input rule that drops invalid packets, we can see that it's rule 3 of the INPUT chain. So we should run this command:
- iptables -D INPUT 3
- To delete POSTROUTING:
- iptables -t nat -L -n -v --line-number
- iptables -t nat -D POSTROUTING 2
- --------------- snip -----------
- Chain POSTROUTING (policy ACCEPT 57 packets, 4044 bytes)
- num pkts bytes target prot opt in out source destination
- 1 670 42596 SNAT all -- * br2 0.0.0.0/0 0.0.0.0/0 to:172.30.13.90
- 2 0 0 SNAT tcp -- * * 0.0.0.0/0 192.168.1.254 tcp dpt:80 to:192.168.1.99
- ---------------snip ----------------
- The above place line 2 is deleted.
Command to list the IPtables:
- iptables -L -v
- iptables -L
- iptables -L -n => For INPUT, FORWARD and OUTPUT-chains
- iptables -L -t nat
- iptables -t nat -L -n -v -> to View nat rules
No comments:
Post a Comment