[CentOS]iptables设置,刚弄死一台服务器,请各位帮我看看怎么修改

是是非非 是是非非 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
对外开放的服务有 http (80) / https (443) / ssh(1433) / ftp (1434 : 2000~2099) / 某服务 (12921/10086)

脚本如下:


#!/bin/bash
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X

ServicePorts="80 443 1433 1434 2000:2099 10086 12921"
AccessPorts="20 21 22 53 80 443 1433 1434 2000:2099 3306 10086 12921"
#Default
iptables -P INPUT DROP
#Access
for aPort in $AccessPorts ; do
iptables -A INPUT -i eth1 -p tcp --sport $aPort -j ACCEPT
iptables -A INPUT -i eth1 -p udp --sport $aPort -j ACCEPT
done

#Service
for sPort in $ServicePorts ; do
iptables -A INPUT -i eth1 -p tcp --dport $sPort -j ACCEPT
iptables -A INPUT -i eth1 -p udp --dport $sPort -j ACCEPT
done
...全文
评论 27
收藏 已收藏
分享
返回顶部