magnopeem_rj
(usa Ubuntu)
Enviado em 17/09/2012 - 10:42h
Caro colaborador bom dia..
pelo o que entendi no seu caso o problema e rota faz o seguinte.
cria um script que vai fazer essa ou efetuar outra transicao, como e debian faz assim.
touch /etc/init.d/roteamento
chmod +x /etc/init.d/roteamento
vi /etc/init.d/roteamento
e cola isso la dentro.
#!/bin/bash
iniciar(){
#Modulos
modprobe ip_tables
modprobe iptable_nat
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
echo "Modulos carregados!"
# Limpando as tabelas
iptables -F
iptables -X
iptables -F -t nat
iptables -X -t nat
iptables -A FORWARD -j LOG
echo "Tabelas Limpas"
# Politica de Acesso
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
echo "Politicas Aplicadas"
##### regras da vpn######
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -P FORWARD ACCEPT
iptables -A INPUT -i tun+ -j ACCEPT
iptables -A FORWARD -i tun+ -j ACCEPT
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -i tun0 -o tun0 -j ACCEPT
iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT
iptables -A INPUT -p tcp --dport 1194 -j ACCEPT
iptables -A INPUT -p udp --dport 1194 -j ACCEPT
iptables -I INPUT -i tun+ -j ACCEPT
iptables -I OUTPUT -o tun+ -j ACCEPT
iptables -I FORWARD -i tun+ -j ACCEPT
iptables -I FORWARD -o tun+ -j ACCEPT
echo "Rede VPN ativada"
###########################
}
parar(){
iptables -F
iptables -t nat -F
echo "Regras de firewall e compartilhamento desativados"
}
case "$1" in
"start") iniciar ;;
"stop") parar ;;
"restart") parar; iniciar ;;
*) echo "Use os parâtros start ou stop"
esac
########################### fim do arquivo ############################
e depois
update-rc.d roteamento defaults
/etc/init.d/roteamento start