日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

How to allow/block PING on Linux server – IPTables rules for icmp---reference

發(fā)布時間:2025/4/5 linux 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 How to allow/block PING on Linux server – IPTables rules for icmp---reference 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

BY?ADMIN?-?APRIL, 9TH 2014

The ‘PING’, it’s a command-line tool to check a host is reachable or not. We can manage it by the help of ‘iptables’. The ‘ping’ is using ICMP to communicate. We can simply manage the ‘icmp : Internet Controlled Message Protocol’ from iptables.

Required iptables switches
The below pasted switches are required for creating a rule for managing icmp.

-A : Add a rule -D : Delete rule from table -p : To specify protocol (here 'icmp') --icmp-type : For specifying type -J : Jump to target

Normally using icmp types and its Codes Click here for ICMP Types and Codes

echo-request : 8 echo-reply : 0

Here I am explaining some examples.

How to block PING to your server with an error message ?
In this way you can partially block the PING with an error message ‘Destination Port Unreachable’. Add the following iptables rules to block the PING with an error message. (Use REJECT as Jump to target)

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

Example:

[root@support ~]# ping 109.200.11.67 PING 109.200.11.67 (109.200.11.67) 56(84) bytes of data. From 109.200.11.67 icmp_seq=1 Destination Port Unreachable From 109.200.11.67 icmp_seq=2 Destination Port Unreachable From 109.200.11.67 icmp_seq=3 Destination Port Unreachable

To block without any messages use DROP as Jump to target.

iptables -A INPUT -p icmp --icmp-type echo-request -j DROP iptables -A OUTPUT -p icmp --icmp-type echo-reply -j DROP

Allow Ping from Outside to Inside

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

How to block PING from your server to world ?
In this way you can block PING option from your server to outside. Add these rules to your iptables to do the same.
Block PING operation with message ‘Operation not permitted’

iptables -A OUTPUT -p icmp --icmp-type echo-request -j DROP

Example:

root@test [~]# ping google.com PING google.com (173.194.34.136) 56(84) bytes of data. ping: sendmsg: Operation not permitted ping: sendmsg: Operation not permitted ping: sendmsg: Operation not permitted ping: sendmsg: Operation not permitted

To block with out any error messages.
For this, DROP the echo-reply to the INPUT chain of you iptables.

iptables -A OUTPUT -p icmp --icmp-type echo-request -j DROP iptables -A INPUT -p icmp --icmp-type echo-reply -j DROP

Allow Ping from Inside to Outside

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

You can use the icmp code instead of icmp-type name for adding rule to iptables.
That’s it. Try this and let me know your feedback.

reference:http://crybit.com/iptables-rules-for-icmp/

轉(zhuǎn)載于:https://www.cnblogs.com/davidwang456/p/3657898.html

總結(jié)

以上是生活随笔為你收集整理的How to allow/block PING on Linux server – IPTables rules for icmp---reference的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 丁香婷婷在线观看 | 视频在线日韩 | 日韩激情在线播放 | 国产精品乱码久久久久 | 在线观看免费黄色 | 亚洲呦呦| 91精品国产闺蜜国产在线闺蜜 | 欧美区一区 | 美女天天干| 久久久久久国产免费a片 | 国产乱来视频 | 亚洲男人皇宫 | 奇米在线777 | 99视频网 | 亚洲欧美精品午睡沙发 | 成人午夜视频在线观看 | 亚洲精品乱码久久久久久 | 插插影视| 轻点好疼好大好爽视频 | 久久免费播放视频 | 免费萌白酱国产一区二区三区 | xxx色| 最新日本中文字幕 | 情侣av | 色哟哟一区二区三区四区 | 国产精品一区二区在线看 | 亚洲美女屁股眼交8 | 亚洲国产精品影院 | 五十路息子| 日韩性猛交ⅹxxx乱大交 | 欧美色图狠狠干 | 999超碰 | 葵司在线视频 | 被黑人猛躁10次高潮视频 | 免费在线网站 | 91成人在线观看国产 | 精品无码国产污污污在线观看 | 99精品视频网站 | 欧美日韩在线视频一区二区 | 午夜精品一区二区三 | 国产一级大片在线观看 | 女人夜夜春 | www.香蕉视频在线观看 | 俄罗斯破处 | 日韩精品一区二区三区国语自制 | 国产欧美一区二区精品久久久 | 亚洲精品视频在线播放 | 日韩大片在线观看 | 国产国语亲子伦亲子 | 四虎影院www| 国产aaaaaa| 双乳被四个男人吃奶h文 | 三级男人添奶爽爽爽视频 | 日韩欧美爱爱 | 欧美美女性生活 | 亚洲熟妇一区二区 | 国产在线精品播放 | 黄色视屏在线免费观看 | 欧美日韩中文在线 | 天天爽夜夜爽夜夜爽精品视频 | 99久久夜色精品国产亚洲 | 亚洲女人初尝黑人巨大 | 91天堂素人 | 超91在线 | 日韩av不卡在线 | 亚洲一区你懂的 | 男生裸体视频网站 | 欧美日日骚 | 色91精品久久久久久久久 | 欧美韩日 | 欧美日韩视频一区二区 | 性chinese天美传媒麻 | 欧美精品欧美极品欧美激情 | 在线观看视频99 | 8x8x最新网址 | 亚洲热热 | 一区二区三区不卡在线观看 | 3o一40一50一6o女人毛片 | www.浪潮av.com | 美女又爽又黄 | 色综合久久久久综合体桃花网 | 日本午夜精品理论片a级app发布 | 欧美黑人猛交 | 一区二区不卡在线 | 91成人观看 | 精品欧美一区二区久久久 | 女女同性女同一区二区三区按摩 | 亚洲最黄网站 | 欧美性狂猛xxxxxbbbbb | 银杏av| 一级爱爱免费视频 | 91蝌蚪91密月 | 福利视频一区 | 在线免费看a | 东北少妇高潮抽搐 | 久久久99久久| 人妻丰满熟妇岳av无码区hd | 夜色一区二区三区 | 少妇黄色片 |