怎样在Linux下封ping(icmp包)

在这个过分自由的internet上

到处都充斥着病毒、蠕虫什么的

而入侵往往是先通过ping来扫描定位“活着的”机器的

如果把机器的ICMP echo requests关掉

不敢说机器会安全很多

但起码会少很多苍蝇骚扰:)

闲话少说

Linux下关掉ping其实很简单

在文件/etc/sysctl.conf中添加两句:

 

net.ipv4.icmp_echo_ignore_broadcasts = 1

net.ipv4.icmp_echo_ignore_all = 1

 

再运行命令

sysctl -p即可生效

或者是重起也能生效

这种方式实现的还不算完美

在windows下ping不会有问题

但如果在linux下ping做了这个操作的机器的话

命令就会挂在那里

直到Ctrl+C结束

但如果是在linux下ping一台不通的机器的话

是会输出"Destination Host Unreachable"之类的什么的

 

Discussion Area - Leave a Comment




*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word