平时在搭建环境的时候,经常会有防火墙(iptables)的配置, 现整理成脚本,方便执行
#! /bin/bash #---- settings rules ----------- iptables -F iptables -X iptables -t nat -F iptables -t nat -X iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -p icmp --icmp-type any -j ACCEPT iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -m state --state NEW -m multiport -p tcp --dport 80,21,3306 -j ACCEPT iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited /etc/rc.d/init.d/iptables save service iptables restart
原文链接: http://www.tojsp.com/linux/linux-centos-fedora-iptables-configure.html
时间: 2024-10-11 13:21:42