Disable Ping on Debian 10 using iptables

You can Stop anyone from pinging your Server using iptables .Disabling ping is useful in instances when u don’t want to be discovered on a network

Run the following command in the bash terminal to Append(-A) :-

iptables -A INPUT -p icmp -j DROP 

If you have many ip tables rules that might interfere then its a good idea to Insert(-I) this rule to the top of the chain instead of appending it to the end of the chain, you can check all your rules using :-

iptables -L --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
2    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3561


The number at the beginning of each rule line indicates the position in the chain. To insert a new rule above a specific existing rule, simply use the index number of that existing rule. For example to insert a new rule to the top of the chain, use the following command with index number 1.

iptables -I INPUT 1 -p icmp -j DROP

If you have any questions feel free to comment down below

Referals:

Leave a Comment

Your email address will not be published. Required fields are marked *