写一个防火墙配置脚本,只允许远程主机访问本机的80端口
#!/bin/bash
#this is a server firewall
#updated by yehaifeng
#qq:769358362
#define var
IPT=/sbin/iptables
#Remove any existing rules
$IPT -F
$IPT -X
$IPT -Z
#setting default firewallpolicy
$IPT --policy OUTPUT ACCEPT
$IPT --policy FORWARD DROP
$IPT -P INPUT DROP
#setting for loopback interface
$IPT -A INPUT -i lo -j ACCEPT
$IPT -A OUTPUT -o lo -j ACCEPT
#accept 80 port only
$IPT -A INPUT -p tcp --dport 80 -j ACCEPT
#save iptables
/etc/init.d/iptables save