sudo vi /etc/iptables.up.rules 后没有这个文件,怎么办
来源:1-6 安装 Node.js v8.0 生产环境
bibilv
2018-08-11
sudo vi /etc/iptables.up.rules 后没有iptables.up.rules文件,及里面的内容,能发一份吗
写回答
1回答
-
Scott
2018-08-12
如果你是用阿里云服务器,可以用阿里云的安全组来配置进出方向的端口,在服务器内部就不需要架设二道防火墙了,如果是不含安全组的其他厂商,可以参考这个:
*filter # allow all connections -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # allow out traffic -A OUTPUT -j ACCEPT # allow http https -A INPUT -p tcp --dport 443 -j ACCEPT -A INPUT -p tcp --dport 80 -j ACCEPT -A INPUT -p tcp --dport 8081 -j ACCEPT # allow ssh port login -A INPUT -p tcp -m state --state NEW --dport 39999 -j ACCEPT # ping -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT # mongodb connect -A INPUT -s 127.0.0.1 -p tcp --destination-port 19999 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 19999 -m state --state ESTABLISHED -j ACCEPT # website -A INPUT -s 127.0.0.1 -p tcp --destination-port 3000 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 3000 -m state --state ESTABLISHED -j ACCEPT # movie -A INPUT -s 127.0.0.1 -p tcp --destination-port 3001 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 3001 -m state --state ESTABLISHED -j ACCEPT # gougou app -A INPUT -s 127.0.0.1 -p tcp --destination-port 3002 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 3002 -m state --state ESTABLISHED -j ACCEPT # indust app -A INPUT -s 127.0.0.1 -p tcp --destination-port 3003 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 3003 -m state --state ESTABLISHED -j ACCEPT # wechat -A INPUT -s 127.0.0.1 -p tcp --destination-port 3004 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 3004 -m state --state ESTABLISHED -j ACCEPT # ice and fire -A INPUT -s 127.0.0.1 -p tcp --destination-port 3005 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 3005 -m state --state ESTABLISHED -j ACCEPT # imooc ice demo -A INPUT -s 127.0.0.1 -p tcp --destination-port 3006 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 3006 -m state --state ESTABLISHED -j ACCEPT # imooc ice demo -A INPUT -s 127.0.0.1 -p tcp --destination-port 3007 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 3007 -m state --state ESTABLISHED -j ACCEPT # imooc ice demo -A INPUT -s 127.0.0.1 -p tcp --destination-port 3008 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 3008 -m state --state ESTABLISHED -j ACCEPT # log denied calls # -A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied:" --log-level 7 # drop incoming sensitive connections #-A INPUT -p tcp --dport 80 -i eth0 -m state --state NEW -m recent --set #-A INPUT -p tcp --dport 80 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 150 -j DROP # reject all other inbound -A INPUT -j REJECT -A FORWARD -j REJECT COMMIT
00
相似问题