Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of disabling and opening ping by Linux

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the method of prohibiting and opening ping in Linux". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the method of prohibiting and opening ping in Linux".

I. Kernel parameter setting

1. Allow ping settings

Temporary

Echo 0 > / proc/sys/net/ipv4/icmp_echo_ignore_all

Permanent

Echo net.ipv4.icmp_echo_ignore_all=0 > > / etc/sysctl.confsysctl-p # execute this command to make the changed / etc/sysctl.conf configuration file effective

Note: if there is already a net.ipv4.icmp_echo_ignore_all field in the / etc/sysctl.conf configuration file, just use vim to change the corresponding value.

2. Disable ping setting

Temporary

Echo 1 > / proc/sys/net/ipv4/icmp_echo_ignore_all

Permanent

Echo net.ipv4.icmp_echo_ignore_all=1 > > / etc/sysctl.confsysctl-p # execute this command to make the changed / etc/sysctl.conf configuration file effective

Note: if there is already a net.ipv4.icmp_echo_ignore_all field in the / etc/sysctl.conf configuration file, just use vim to change the corresponding value.

II. Firewall settings

Note: the premise of using the following method is that the kernel configuration is the default, that is, the kernel does not disable ping

1. Allow PING settings

Iptables-An INPUT-p icmp--icmp-type echo-request-j ACCEPT iptables-An OUTPUT-p icmp--icmp-type echo-reply-j ACCEPT

2. Disable PING setting

Iptables-An INPUT-p icmp--icmp-type 8-s 0Linux 0-j DROP-- icmp-type 8 echo request indicates echo request (ping request) 0 ping 0 means all IP thanks for your reading. The above is the content of "the method of Linux banning and opening ping". After the study of this article, I believe you have a deeper understanding of the problem of Linux banning and opening ping. The specific use situation still needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report