码迷,mamicode.com
首页 > 其他好文 > 详细

【CentOS】ping sysctl.conf

时间:2015-08-01 19:13:27      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:centos ping sysctl.conf

// 查看设置

[root@wode012 etc]# cat /proc/sys/net/ipv4/icmp_echo_ignore_all 

0


// 测试

HuangChao-MacBookPro:~ hchao$ ping a.b.c.d

PING a.b.c.d (a.b.c.d): 56 data bytes

64 bytes from a.b.c.d: icmp_seq=0 ttl=55 time=6.690 ms

64 bytes from a.b.c.d: icmp_seq=1 ttl=55 time=5.536 ms

64 bytes from a.b.c.d: icmp_seq=2 ttl=55 time=23.421 ms

64 bytes from a.b.c.d: icmp_seq=3 ttl=55 time=8.740 ms

^C

--- a.b.c.d ping statistics ---

4 packets transmitted, 4 packets received, 0.0% packet loss

round-trip min/avg/max/stddev = 5.536/11.097/23.421/7.207 ms

HuangChao-MacBookPro:~ hchao$ 


// 修改配置

[root@wode012 etc]# vi /etc/sysctl.conf 

[root@wode012 etc]# 

# System default settings live in /usr/lib/sysctl.d/00-system.conf.

# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file


# disable ping

net.ipv4.icmp_echo_ignore_all=1


# For more information, see sysctl.conf(5) and sysctl.d(5).


// 生效

[root@wode012 etc]# sysctl -p

net.ipv4.icmp_echo_ignore_all = 1

[root@wode012 etc]# 


// 测试

HuangChao-MacBookPro:~ hchao$ ping a.b.c.d

PING a.b.c.d (a.b.c.d): 56 data bytes

Request timeout for icmp_seq 0

Request timeout for icmp_seq 1

Request timeout for icmp_seq 2

Request timeout for icmp_seq 3

Request timeout for icmp_seq 4

Request timeout for icmp_seq 5

Request timeout for icmp_seq 6

Request timeout for icmp_seq 7

Request timeout for icmp_seq 8

^C

--- a.b.c.d ping statistics ---

10 packets transmitted, 0 packets received, 100.0% packet loss

HuangChao-MacBookPro:~ hchao$


本文出自 “黄超的IT笔记” 博客,请务必保留此出处http://huangchao.blog.51cto.com/10446378/1680794

【CentOS】ping sysctl.conf

标签:centos ping sysctl.conf

原文地址:http://huangchao.blog.51cto.com/10446378/1680794

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!