0

I am trying to block ICMP to an incoming subnet, lets say this is 1.0.0.0/24

I am currently using Linux (Ubuntu 20.04) with a basic ufw setup. Right now people can ping an address like 1.0.0.0, how can I make the firewall block incoming ICMP requests to that subnet?

Thanks

4
  • Or what would be better, is to restrict ICMP to a specific IP Address. Eg: Only 3.3.3.3 can ping 1.0.0.0 – Zane Oct 10 '20 at 0:13
  • Is this Ubuntu box the router for your network? Please share your network topology. – Tero Kilkanen Oct 10 '20 at 9:02
  • I basically just have a normal Ubuntu box, nothing major running on it. I have a /24 routed on it, and I would like to block ICMP only to the /24, as I have other IP addresses which should allow ICMP, or at least to ban it except when coming from a specific IP. – Zane Oct 11 '20 at 9:53
  • Can you show a diagram of the setup? It is still hard to see from your description what the network structure actually is. – Tero Kilkanen Oct 11 '20 at 10:01
0
$ sudo iptables -A INPUT -d 1.0.0.0/24 -p icmp --icmp-type echo-request -j REJECT

Any ICMP echo requests destined to 1.0.0.0/24 network will be discarded by the firewall

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.