Example code sharing of how to disable ping in Linux

黄舟
Release: 2017-06-01 11:00:24
Original
1771 people have browsed it

This article mainly introduces the relevant information on the implementation examples of linux prohibiting ping. Friends who need it can refer to the

Linux implementation examples of prohibiting ping

1. The command to temporarily disable PING operation is : #echo 1>/proc/sys/net/ipv4/icmp_echo_ignore_all

2. Permanently prohibit PING configuration method

  /etc/sysctl.conf 中增加一行

   net.ipv4.icmp_echo_ignore_all=1

   执行sysctl -p生效
Copy after login

Firewall method:

1. Allow PING settings

     iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT

    iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
Copy after login

or you can temporarily stop the firewall operation.

  service iptables stop
Copy after login

2. Disable PING settings

  iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -j DROP
Copy after login

The above is the detailed content of Example code sharing of how to disable ping in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!