iptables禁止别人,允许自己

这里举个例子,以ping为案例:禁止别人ping自己,但允许自己ping别人。

[root@localhost ~]# iptables -A INPUT -p icmp --icmp-type 8 -d 192.168.0.130 -j DROP
[root@localhost ~]# iptables -A OUTPUT -p icmp --icmp-type 0 -s localip -j ACCEPT

基本上设置第一条就ok了,主要是-d  ,目标ip。

猜你喜欢

转载自www.cnblogs.com/xingyunfashi/p/9187387.html