linux中如果要屏蔽除80端口外其他所有端口要如何修改/etc/sysconfig/iptables,本人系统是centos6.5
发布网友
发布时间:2022-05-03 01:48
我来回答
共1个回答
热心网友
时间:2023-10-03 05:55
如下修改。。建议要把22 加上。。。否则后面连接不方便,如果不想要就删除这条。只留80
# Generated by iptables-save v1.4.7 on Fri Mar 14 15:19:57 2014
*raw
:PREROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [1:140]
COMMIT
# Completed on Fri Mar 14 15:19:57 2014
# Generated by iptables-save v1.4.7 on Fri Mar 14 15:19:57 2014
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1:140]
:POSTROUTING ACCEPT [1:140]
COMMIT
# Completed on Fri Mar 14 15:19:57 2014
# Generated by iptables-save v1.4.7 on Fri Mar 14 15:19:57 2014
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
# Completed on Fri Mar 14 15:19:57 2014
# Generated by iptables-save v1.4.7 on Fri Mar 14 15:19:57 2014
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1:140]
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
COMMIT
# Completed on Fri Mar 14 15:19:57 2014