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

How to disable and enable ping in Linux system

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you "how to disable and open ping in the Linux system", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn how to disable and open ping in the Linux system "this article.

Ping is a program used to test the number of network connections. Ping sends an ICMP; echo request message to the destination and reports whether it has received the desired ICMP echo (ICMP echo reply). It is a command used to check whether the network is open or the speed of the network connection.

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 0 DROP 0-- icmp-type 8 echo request indicates echo request (ping request) 0 ping 0 represents all IP

The above is all the contents of the article "how to disable and turn on ping in Linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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: 221

*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

Development

Wechat

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

12
Report