کد:
iptables -t filter -P INPUT DROP
iptables -t filter -P OUTPUT ACCEPT
iptables -t filter -P FORWARD ACCEPT
##
iptables -t filter -A INPUT -i lo -j ACCEPT
iptables -t filter -A INPUT -p icmp --icmp-type any -j ACCEPT
iptables -t filter -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 20:25 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m udp -p udp --dport 53 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m udp -p udp --dport 161 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 1024 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 1723 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 3128 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 1863 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 11999 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m tcp -p tcp --dport 5000:5500 -j ACCEPT
iptables -t filter -A INPUT -m state --state NEW -m udp -p udp --dport 5000:5500 -j ACCEPT
iptables -t filter -A INPUT -j REJECT --reject-with icmp-host-prohibited