歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux系統禁ping

Linux系統禁ping

日期:2017/2/28 14:37:08   编辑:Linux教程

1.修改配置文件對系統臨時生效,系統重啟後設置不起作用。
[root@208 ~]# echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all

2.永久生效,修改系統的配置文件
[root@208 ~]# vim /etc/sysctl.conf
net.ipv4.icmp_echo_ignore_all = 1 --添加這一行
[root@208 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
net.ipv4.icmp_echo_ignore_all = 1
net.ipv4.conf.all.arp_notify = 1

3.如果生效時有錯誤,錯誤處理
[root@208 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key --錯誤信息
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
net.ipv4.icmp_echo_ignore_all = 1
net.ipv4.conf.all.arp_notify = 1

解決方法:
[root@208 ~]# modprobe bridge
[root@208 ~]# lsmod | grep bridge
bridge 83177 0
stp 2218 1 bridge
llc 5546 2 bridge,stp

推薦閱讀

Fedora 18 下arping 的安裝 http://www.linuxidc.com/Linux/2013-06/85300.htm

CentOS 6.2 下安裝 smokeping 測試網絡狀況 http://www.linuxidc.com/Linux/2012-12/75843.htm

CentOS中Iptables關於ping的配置問題 http://www.linuxidc.com/Linux/2012-11/74660.htm

VMware下Linux如何ping通Windows http://www.linuxidc.com/Linux/2012-11/73749.htm

Linux下長時間ping網絡加時間戳並記錄到文本 http://www.linuxidc.com/Linux/2012-09/70440.htm

Copyright © Linux教程網 All Rights Reserved