Here's a method to easily delete a rule under the Netfilter firewall with the iptables command.
root@host:~# iptables --line-numbers -L -n -v -t filter
root@host:~# iptables --line-numbers -L -n Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 4 ACCEPT udp -- 0.0.0.0/0 224.0.0.251 state NEW udp dpt:5353 5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited 6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
Here we delete the rule n°6 of the INPUT chain :
root@host:~# iptables -t filter -D INPUT 6
We can also delete the same rule using this command :
root@host:~# iptables -D INPUT -m tcp -p tcp --dport 22 -j ACCEPT
Contact :