#!/bin/bash
IF_INTERNA="eth0"
IF_EXTERNA="eth1"
REDE_INTERNA="172.0.0.0/24"
echo "1"> /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -Z
iptables -X
iptables -F -t nat
iptables -X -t nat
iptables -F -t mangle
iptables -X -t mangle
iptables -P INPUT ACCEPT
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A OUTPUT -m state --state RELATED,ESTABLISHED,NEW -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED,NEW -j ACCEPT
#iptables -t filter -A INPUT -i lo -j ACCEPT
#iptables -t filter -A INPUT -i $IF_INTERNA -j ACCEPT
iptables -t nat -A POSTROUTING -s $REDE_INTERNA -j MASQUERADE