## 防火墙设置脚本
>[success]在web服务器中,只需要开启 web服务 和ssh服务还有 ping 其它的一率禁止
### 脚本如下:
>[warning] 在配置防火墙的时,一定要注意,不要把自己关在外面,最简单的方式,是使用脚来处理。
~~~
#!/bin/bash
#配置服务器防火墙
#author yifeng (E-mail:576617109@qq.com)
iptables -F #先清空规则
iptables -P INPUT DROP #禁止所有访问
iptables -P OUTPUT DROP #禁止所有响应
iptables -P FORWARD DROP #禁止所有转发
iptables -A INPUT -p tcp --dport 80 -j ACCEPT #允许web访问
iptables -A INPUT -p tcp --dport 22 -j ACCEPT #允许ssh访问
iptables -A INPUT -p icmp -j ACCEPT #开启ping
iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT #响应web访问
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT #响应ssh访问
iptables -A OUTPUT -p icmp -j ACCEPT #响应ping 访问
service iptables save #永久保存配置信息
~~~
>[danger]通常情况,都是通过远程管理服务器的,所以在设置防火墙时,